Decompiled source of BadnorthModBiome v2.0.0

Biome.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using Voxels.TowerDefense;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Biome")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Biome")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a06b26de-2bb6-43ea-ae1b-7f1218f8d1ea")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RandomBiomeMod;

[BepInPlugin("com.yourname.randombiomes", "Random Biome Mod", "1.0.0")]
public class RandomBiomePlugin : BaseUnityPlugin
{
	private void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Random Biome Mod is loading...");
		Harmony.CreateAndPatchAll(typeof(IslandStyle2Patch), (string)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Random Biome Mod has been patched!");
	}
}
[HarmonyPatch(typeof(IslandStyle2), "ApplyShaderConstants")]
public static class IslandStyle2Patch
{
	[HarmonyPrefix]
	public static bool RunOurRandomCode(IslandStyle2 __instance, float year)
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Expected O, but got Unknown
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: 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)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Expected O, but got Unknown
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			FieldInfo fieldInfo = AccessTools.Field(typeof(IslandStyle2), "tex");
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(IslandStyle2), "texId");
			FieldInfo fieldInfo3 = AccessTools.Field(typeof(IslandStyle2), "colorId");
			Texture2D val = (Texture2D)fieldInfo.GetValue(__instance);
			string text = (string)fieldInfo2.GetValue(__instance);
			string text2 = (string)fieldInfo3.GetValue(__instance);
			Color val2 = RandomColor();
			Color val3 = RandomColor();
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = new Texture2D(64, 2, (TextureFormat)5, false);
				fieldInfo.SetValue(__instance, val);
			}
			for (int i = 0; i < ((Texture)val).width; i++)
			{
				float num = (float)i / (float)(((Texture)val).width - 1);
				Color val4 = Color.Lerp(val2, val3, num);
				val.SetPixel(i, 0, val4);
				val.SetPixel(i, 1, val4);
			}
			val.Apply();
			Shader.SetGlobalVector(text2, Color.op_Implicit(val2));
			Shader.SetGlobalTexture(text, (Texture)(object)val);
		}
		catch (Exception ex)
		{
			Debug.LogError((object)("RandomBiomeMod Error: " + ex));
		}
		return false;
	}

	private static Color RandomColor()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: 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_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		Color val = default(Color);
		do
		{
			((Color)(ref val))..ctor(Random.value, Random.value, Random.value);
		}
		while (val.r < 0.05f && val.g < 0.05f && val.b < 0.05f);
		return val;
	}
}