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 FullSmelter v1.0.2
FullSmelter.dll
Decompiled 2 days agousing System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace FundidorCheio; [BepInPlugin("yuri.FullSmelter", "Full Smelter", "1.0.0")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(Smelter), "OnAddOre")] private static class AoPorMinerio { private static void Prefix(Smelter __instance) { if (!((Object)(object)Inst == (Object)null) && Inst.Ligado.Value) { Inst.AbrirVaga(__instance); } } } public static Plugin Inst; private ConfigEntry<bool> Ligado; private ConfigEntry<int> Vagas; private float proximo; private FieldInfo campoVisao; private MethodInfo metodoCombustivel; private void Awake() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown Inst = this; Ligado = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "The smelter and the blast furnace use no coal and hold up to 100 ore. Only your own game needs this mod."); Vagas = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Slots", 100, "How much ore fits. From 10 to 100."); campoVisao = typeof(Smelter).GetField("m_nview", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); metodoCombustivel = typeof(Smelter).GetMethod("GetFuel", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); Harmony val = new Harmony("yuri.FullSmelter"); val.PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Full Smelter 1.0.2"); } public int Capacidade() { int num = Vagas.Value; if (num < 10) { num = 10; } if (num > 100) { num = 100; } return num; } private void Update() { if (!Ligado.Value || (Object)(object)Player.m_localPlayer == (Object)null || Time.time < proximo) { return; } proximo = Time.time + 1f; Smelter[] array = Object.FindObjectsOfType<Smelter>(); if (array != null) { for (int i = 0; i < array.Length; i++) { Manter(array[i]); } } } public void AbrirVaga(Smelter forno) { if (!((Object)(object)forno == (Object)null) && EhMetal(forno)) { int num = Capacidade(); if (forno.m_maxOre < num) { forno.m_maxOre = num; } } } private void Manter(Smelter forno) { AbrirVaga(forno); if ((Object)(object)forno == (Object)null || !EhMetal(forno) || campoVisao == null || metodoCombustivel == null) { return; } object? value = campoVisao.GetValue(forno); ZNetView val = (ZNetView)((value is ZNetView) ? value : null); if ((Object)(object)val == (Object)null || !val.IsValid()) { return; } object obj = metodoCombustivel.Invoke(forno, null); float num = 0f; if (obj is float) { num = (float)obj; } int num2 = 40 - (int)num; if (num2 >= 1) { if (num2 > 8) { num2 = 8; } for (int i = 0; i < num2; i++) { val.InvokeRPC("RPC_AddFuel", new object[0]); } } } private static bool EhMetal(Smelter forno) { if ((Object)(object)forno == (Object)null || forno.m_conversion == null) { return false; } for (int i = 0; i < forno.m_conversion.Count; i++) { ItemConversion val = forno.m_conversion[i]; if (val != null && !((Object)(object)val.m_to == (Object)null) && !((Object)(object)((Component)val.m_to).gameObject == (Object)null) && EhBarra(((Object)((Component)val.m_to).gameObject).name)) { return true; } } return false; } private static bool EhBarra(string nome) { int result; switch (nome) { default: result = ((nome == "Flametal") ? 1 : 0); break; case "Copper": case "Tin": case "Bronze": case "Iron": case "Silver": case "BlackMetal": result = 1; break; } return (byte)result != 0; } }