Decompiled source of BiomeVariantDisplay v1.0.1

Valheim Biome Variant Display.dll

Decompiled 2 weeks ago
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Valheim Biome Variant Display")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Valheim Biome Variant Display")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("35d31677-65f6-4ec5-b3d6-b6992c847b60")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MyBepInExPlugin;

[BepInPlugin("strangers.BiomeVariantDisplay", "Biome Variant Display", "1.0.0")]
public class Main : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Minimap), "UpdateBiome")]
	public static class Patch_Minimap_Biome_Variant
	{
		[HarmonyPostfix]
		private static void Postfix(Minimap __instance, Player player)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_00ea: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null)
			{
				return;
			}
			if ((int)__instance.m_mode == 1)
			{
				BiomeSector currentBiomeData = player.GetCurrentBiomeData();
				if (currentBiomeData != BiomeSector.Empty && currentBiomeData.AltBiomes.Any())
				{
					string text = string.Join(", ", currentBiomeData.AltBiomes);
					text = currentBiomeData.GetName(false) + "\n" + text.Replace(" ( - )", "").Replace("Modifier: ", "").Replace(" " + currentBiomeData.GetName(false), "");
					__instance.m_biomeNameSmall.text = text;
					__instance.m_biomeNameSmall.verticalAlignment = (VerticalAlignmentOptions)256;
				}
				return;
			}
			Vector3 value = Traverse.Create((object)__instance).Method("ScreenToWorldPoint", new object[1] { Input.mousePosition }).GetValue<Vector3>();
			if (Traverse.Create((object)__instance).Method("IsExplored", new object[1] { value }).GetValue<bool>())
			{
				BiomeSector biomeSector = WorldGenerator.instance.GetBiomeSector(value, false);
				string text2 = string.Join(", ", biomeSector.AltBiomes);
				text2 = biomeSector.GetName(false) + "\n" + text2.Replace(" ( - )", "").Replace("Modifier: ", "").Replace(" " + biomeSector.GetName(false), "");
				__instance.m_biomeNameLarge.text = text2;
				__instance.m_biomeNameLarge.verticalAlignment = (VerticalAlignmentOptions)256;
			}
			else
			{
				__instance.m_biomeNameLarge.text = "";
			}
		}
	}

	private const string pluginGUID = "strangers.BiomeVariantDisplay";

	private const string pluginName = "Biome Variant Display";

	private const string pluginVersion = "1.0.0";

	private readonly Harmony HarmonyInstance = new Harmony("strangers.BiomeVariantDisplay");

	public static ManualLogSource logger = Logger.CreateLogSource("Biome Variant Display");

	public void Awake()
	{
		logger.LogInfo((object)"Biome Variant Display loaded");
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		HarmonyInstance.PatchAll(executingAssembly);
	}
}