Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of AncientBarkCoal v1.0.0
BepInEx/plugins/AncientBarkCoal/AncientBarkCoal.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AncientBarkCoal")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+e6c3d2db5663b1ef9d9172fa9a51cdff5905fc59")] [assembly: AssemblyProduct("AncientBarkCoal")] [assembly: AssemblyTitle("AncientBarkCoal")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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; } } } namespace AncientBarkCoal { [BepInPlugin("local.valheim.ancientbarkcoal", "Ancient Bark Coal", "1.0.0")] public sealed class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(Smelter), "Awake")] private static class KilnAwakePatch { [HarmonyPostfix] [HarmonyPriority(0)] private static void Postfix(Smelter __instance) { try { AddConversion(__instance); } catch (Exception ex) { WarnOnce("Kiln recipe was not added: " + ex.GetType().Name + ": " + ex.Message); } } } public const string PluginGuid = "local.valheim.ancientbarkcoal"; private static ManualLogSource Log; private static readonly HashSet<string> Warnings = new HashSet<string>(); private Harmony harmony; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; try { harmony = new Harmony("local.valheim.ancientbarkcoal"); harmony.PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Ancient Bark Coal loaded; kiln initialization patch installed."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Could not install kiln patch; check game/BepInEx compatibility. " + ex)); } } private static void WarnOnce(string message) { if (Warnings.Add(message) && Log != null) { Log.LogWarning((object)message); } } private static void AddConversion(Smelter kiln) { //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) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown if ((Object)(object)kiln == (Object)null) { return; } string name = ((Object)((Component)kiln).gameObject).name; if (name != "charcoal_kiln" && name != "charcoal_kiln(Clone)") { return; } List<ItemConversion> conversion = kiln.m_conversion; if (conversion == null) { WarnOnce("Kiln conversion list is missing; leaving it unchanged."); return; } foreach (ItemConversion item in conversion) { if (item != null && (Object)(object)item.m_from != (Object)null && ((Object)((Component)item.m_from).gameObject).name == "ElderBark") { return; } } ObjectDB instance = ObjectDB.instance; GameObject val = (((Object)(object)instance == (Object)null) ? null : instance.GetItemPrefab("ElderBark")); GameObject val2 = (((Object)(object)instance == (Object)null) ? null : instance.GetItemPrefab("Coal")); ItemDrop val3 = (((Object)(object)val == (Object)null) ? null : val.GetComponent<ItemDrop>()); ItemDrop val4 = (((Object)(object)val2 == (Object)null) ? null : val2.GetComponent<ItemDrop>()); if ((Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null) { WarnOnce("ElderBark or Coal is unavailable at kiln Awake; this kiln is unchanged. Reload the world after fixing the item/loading conflict."); return; } List<ItemConversion> list = new List<ItemConversion>(conversion); list.Add(new ItemConversion { m_from = val3, m_to = val4 }); kiln.m_conversion = list; } } }