using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Script")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Minecraft")]
[assembly: AssemblyTitle("Minecraft")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
public class LavaCull : MonoBehaviour
{
[Range(0f, 5f)]
public float rangeMultiplier = 1f;
internal Renderer lavaRenderer;
internal bool isCulled;
private void Awake()
{
lavaRenderer = ((Component)this).GetComponentInChildren<Renderer>();
LavaCullingManager.Register(this);
}
private void OnDestroy()
{
LavaCullingManager.Unregister(this);
}
internal void SetVisible(bool visible)
{
if (!((Object)(object)lavaRenderer == (Object)null) && lavaRenderer.enabled != visible)
{
lavaRenderer.enabled = visible;
isCulled = !visible;
}
}
}
public class LavaCullingManager : MonoBehaviour
{
private static LavaCullingManager instance;
private static readonly List<LavaCull> surfaces = new List<LavaCull>();
private Transform target;
private Vector3 lastCheckPos;
private float lastYRotation;
private float logicTimer;
private const float LOGIC_INTERVAL = 0.5f;
private const float MOVE_THRESHOLD = 5f;
private const float ROT_THRESHOLD = 20f;
public static void Register(LavaCull s)
{
EnsureInstance();
if (!surfaces.Contains(s))
{
surfaces.Add(s);
}
}
public static void Unregister(LavaCull s)
{
surfaces.Remove(s);
}
private static void EnsureInstance()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
if (!((Object)(object)instance != (Object)null))
{
GameObject val = new GameObject("LavaCullingManager_Internal");
((Object)val).hideFlags = (HideFlags)61;
instance = val.AddComponent<LavaCullingManager>();
Object.DontDestroyOnLoad((Object)(object)val);
}
}
private void Update()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if ((int)GameDirector.instance.currentState == 2 && Object.op_Implicit((Object)(object)PlayerAvatar.instance) && LevelGenerator.Instance.Generated)
{
if (!Object.op_Implicit((Object)(object)target))
{
target = ((Component)PlayerAvatar.instance).transform;
lastCheckPos = target.position;
lastYRotation = target.eulerAngles.y;
ForceUpdate();
}
LogicUpdate();
}
}
private void LogicUpdate()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
logicTimer -= Time.deltaTime;
bool flag = Vector3.Distance(lastCheckPos, target.position) >= 5f;
bool flag2 = Mathf.Abs(target.eulerAngles.y - lastYRotation) >= 20f;
if (logicTimer <= 0f || flag || flag2)
{
logicTimer = 0.5f;
lastCheckPos = target.position;
lastYRotation = target.eulerAngles.y;
UpdateSurfaces();
}
}
private void ForceUpdate()
{
UpdateSurfaces();
}
private void UpdateSurfaces()
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
float lightDistance = GraphicsManager.instance.lightDistance;
for (int num = surfaces.Count - 1; num >= 0; num--)
{
LavaCull lavaCull = surfaces[num];
if (!Object.op_Implicit((Object)(object)lavaCull))
{
surfaces.RemoveAt(num);
}
else
{
float num2 = lightDistance * lavaCull.rangeMultiplier;
float num3 = num2 * num2;
Vector3 val = ((Component)lavaCull).transform.position - target.position;
bool visible = ((Vector3)(ref val)).sqrMagnitude < num3;
lavaCull.SetVisible(visible);
}
}
}
}
public class MCColliderView : MonoBehaviour
{
public enum GizmoColor
{
Red,
Green,
Blue,
Yellow,
Magenta,
Cyan,
Orange,
White,
Black
}
[SerializeField]
private GizmoColor gizmoColor = GizmoColor.Blue;
private void OnDrawGizmos()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
BoxCollider component = ((Component)this).GetComponent<BoxCollider>();
if (Object.op_Implicit((Object)(object)component))
{
GetColors(out var wire, out var fill);
Gizmos.matrix = ((Component)this).transform.localToWorldMatrix;
Gizmos.color = wire;
Gizmos.DrawWireCube(component.center, component.size);
Gizmos.color = fill;
Gizmos.DrawCube(component.center, component.size);
}
}
private void GetColors(out Color wire, out Color fill)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_0242: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
switch (gizmoColor)
{
case GizmoColor.Red:
wire = new Color(1f, 0f, 0f, 1f);
fill = new Color(1f, 0f, 0f, 0.2f);
break;
case GizmoColor.Green:
wire = new Color(0f, 1f, 0f, 1f);
fill = new Color(0f, 1f, 0f, 0.2f);
break;
case GizmoColor.Blue:
wire = new Color(0f, 0.4f, 1f, 1f);
fill = new Color(0f, 0.4f, 1f, 0.2f);
break;
case GizmoColor.Yellow:
wire = new Color(1f, 1f, 0f, 1f);
fill = new Color(1f, 1f, 0f, 0.2f);
break;
case GizmoColor.Magenta:
wire = new Color(1f, 0f, 1f, 1f);
fill = new Color(1f, 0f, 1f, 0.2f);
break;
case GizmoColor.Cyan:
wire = new Color(0f, 1f, 1f, 1f);
fill = new Color(0f, 1f, 1f, 0.2f);
break;
case GizmoColor.Orange:
wire = new Color(1f, 0.5f, 0f, 1f);
fill = new Color(1f, 0.5f, 0f, 0.2f);
break;
case GizmoColor.White:
wire = new Color(1f, 1f, 1f, 1f);
fill = new Color(1f, 1f, 1f, 0.15f);
break;
case GizmoColor.Black:
wire = new Color(0f, 0f, 0f, 1f);
fill = new Color(0f, 0f, 0f, 0.15f);
break;
default:
wire = Color.blue;
fill = new Color(0f, 0f, 1f, 0.2f);
break;
}
}
}
public class MCLevelPointVisualizer : MonoBehaviour
{
private LevelPoint[] levelPoints;
private BoxCollider levelPointTrigger;
private Vector3 offset = new Vector3(0.1f, 0f, 0.1f);
private void OnDrawGizmos()
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
levelPoints = ((Component)this).GetComponentsInChildren<LevelPoint>();
if (levelPoints == null || levelPoints.Length == 0)
{
return;
}
LevelPoint[] array = levelPoints;
LevelPoint[] array2 = array;
foreach (LevelPoint val in array2)
{
levelPointTrigger = ((Component)val).gameObject.GetComponent<BoxCollider>();
if (val.ModuleConnect)
{
Gizmos.color = Color.yellow;
}
else
{
Gizmos.color = Color.green;
}
Gizmos.DrawCube(((Component)val).transform.position + levelPointTrigger.center, levelPointTrigger.size);
if (val.ConnectedPoints == null || levelPoints.Length == 0)
{
continue;
}
foreach (LevelPoint connectedPoint in val.ConnectedPoints)
{
List<LevelPoint> connectedPoints = connectedPoint.ConnectedPoints;
if (connectedPoints.Contains(val))
{
Gizmos.color = Color.green;
Gizmos.DrawLine(((Component)connectedPoint).transform.position + offset, ((Component)val).transform.position + offset);
Gizmos.DrawLine(((Component)val).transform.position - offset, ((Component)connectedPoint).transform.position - offset);
}
else
{
Gizmos.color = Color.red;
Gizmos.DrawLine(((Component)connectedPoint).transform.position, ((Component)val).transform.position);
}
}
}
}
}
[BepInPlugin("com.Minecraft.cave", "Minecraft Cave", "1.0.0")]
public class MCModuleSize : BaseUnityPlugin
{
private bool MinecraftActive = false;
private float previousModuleWidth = 0f;
private bool previousSaved = false;
private void Awake()
{
SceneManager.sceneLoaded += OnSceneLoaded;
SceneManager.sceneUnloaded += OnSceneUnloaded;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Minecraft Cave mod loaded.");
}
private void OnDestroy()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
SceneManager.sceneUnloaded -= OnSceneUnloaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (((Scene)(ref scene)).name != "Main")
{
return;
}
try
{
Level val = RunManager.instance?.levelCurrent;
if ((Object)(object)val == (Object)null)
{
return;
}
string name = ((Object)val).name;
if (name == "Level - Minecraft Cave")
{
if (!previousSaved)
{
previousModuleWidth = LevelGenerator.ModuleWidth;
previousSaved = true;
}
LevelGenerator.ModuleWidth = 5f;
MinecraftActive = true;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Minecraft Cave detected — ModuleWidth set to 5.");
}
}
catch (Exception arg)
{
((BaseUnityPlugin)this).Logger.LogError((object)$"Module size error (OnSceneLoaded): {arg}");
}
}
private void OnSceneUnloaded(Scene unloadedScene)
{
if (!MinecraftActive || ((Scene)(ref unloadedScene)).name != "Main")
{
return;
}
try
{
if (previousSaved)
{
LevelGenerator.ModuleWidth = previousModuleWidth;
previousSaved = false;
((BaseUnityPlugin)this).Logger.LogInfo((object)$"Left Minecraft Cave — ModuleWidth restored to {previousModuleWidth}.");
}
MinecraftActive = false;
}
catch (Exception arg)
{
((BaseUnityPlugin)this).Logger.LogError((object)$"Module size error (OnSceneUnloaded): {arg}");
}
}
}
public class MCValuableVisualizer : MonoBehaviour
{
private void OnDrawGizmos()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
BoxCollider component = ((Component)this).GetComponent<BoxCollider>();
Gizmos.color = new Color(1f, 1.18f, 0f, 6f);
Gizmos.matrix = ((Component)this).transform.localToWorldMatrix;
Gizmos.DrawWireCube(component.center, component.size);
Gizmos.color = new Color(1f, 1.18f, 0f, 0.2f);
Gizmos.DrawCube(component.center, component.size);
Gizmos.color = Color.white;
Gizmos.matrix = Matrix4x4.identity;
Bounds bounds = ((Collider)component).bounds;
Vector3 center = ((Bounds)(ref bounds)).center;
Vector3 val = center + ((Component)this).transform.forward * 0.5f;
Gizmos.DrawLine(center, val);
Gizmos.DrawLine(val, val + Vector3.LerpUnclamped(-((Component)this).transform.forward, -((Component)this).transform.right, 0.5f) * 0.25f);
Gizmos.DrawLine(val, val + Vector3.LerpUnclamped(-((Component)this).transform.forward, ((Component)this).transform.right, 0.5f) * 0.25f);
}
}
namespace Minecraft
{
[BepInPlugin("Script.Minecraft.Cave", "Minecraft Cave", "1.0")]
public class Minecraft : BaseUnityPlugin
{
internal static Minecraft Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
}