From 654a2ba912b80f6473601f843f34f65269728ddc Mon Sep 17 00:00:00 2001 From: Shibesan Date: Thu, 23 May 2024 19:42:17 +0200 Subject: [PATCH 1/2] bugfix: CraftFromContainers AddOre and AddFuel --- CraftFromContainers/BepInExPlugin.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CraftFromContainers/BepInExPlugin.cs b/CraftFromContainers/BepInExPlugin.cs index 9c75165..6ca4184 100644 --- a/CraftFromContainers/BepInExPlugin.cs +++ b/CraftFromContainers/BepInExPlugin.cs @@ -272,7 +272,7 @@ static bool Prefix(Fireplace __instance, Humanoid user, bool hold, ref bool __re inventory.RemoveItem(__instance.m_fuelItem.m_itemData.m_shared.m_name, amount); typeof(Inventory).GetMethod("Changed", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(inventory, new object[] { }); for (int i = 0; i < amount; i++) - ___m_nview.InvokeRPC("AddFuel", new object[] { }); + ___m_nview.InvokeRPC("RPC_AddFuel", new object[] { }); user.Message(MessageHud.MessageType.Center, Localization.instance.Localize("$msg_fireadding", new string[]{__instance.m_fuelItem.m_itemData.m_shared.m_name}), 0, null); @@ -308,7 +308,7 @@ static bool Prefix(Fireplace __instance, Humanoid user, bool hold, ref bool __re user.Message(MessageHud.MessageType.Center, Localization.instance.Localize("$msg_fireadding", new string[]{__instance.m_fuelItem.m_itemData.m_shared.m_name}), 0, null); for(int i = 0; i < amount; i++) - ___m_nview.InvokeRPC("AddFuel", new object[] { }); + ___m_nview.InvokeRPC("RPC_AddFuel", new object[] { }); __result = false; @@ -353,7 +353,7 @@ static bool Prefix(CookingStation __instance, ref bool __result, Humanoid user, typeof(Container).GetMethod("Save", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(c, new object[] { }); //typeof(Inventory).GetMethod("Changed", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(c.GetInventory(), new object[] { }); user.Message(MessageHud.MessageType.Center, "$msg_added " + __instance.m_fuelItem.m_itemData.m_shared.m_name, 0, null); - ___m_nview.InvokeRPC("AddFuel", Array.Empty()); + ___m_nview.InvokeRPC("RPC_AddFuel", Array.Empty()); __result = true; return false; } @@ -481,7 +481,7 @@ static bool Prefix(Smelter __instance, Humanoid user, ItemDrop.ItemData item, ZN //typeof(Inventory).GetMethod("Changed", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(inventory, new object[] { }); for (int i = 0; i < amount; i++) - ___m_nview.InvokeRPC("AddOre", new object[] { newItem.m_dropPrefab.name }); + ___m_nview.InvokeRPC("RPC_AddOre", new object[] { newItem.m_dropPrefab.name }); user.Message(MessageHud.MessageType.TopLeft, $"$msg_added {amount} {name}", 0, null); if (Traverse.Create(__instance).Method("GetQueueSize").GetValue() >= __instance.m_maxOre) @@ -513,7 +513,7 @@ static bool Prefix(Smelter __instance, Humanoid user, ItemDrop.ItemData item, ZN //typeof(Inventory).GetMethod("Changed", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(c.GetInventory(), new object[] { }); for (int i = 0; i < amount; i++) - ___m_nview.InvokeRPC("AddOre", new object[] { newItem.m_dropPrefab.name }); + ___m_nview.InvokeRPC("RPC_AddOre", new object[] { newItem.m_dropPrefab.name }); user.Message(MessageHud.MessageType.TopLeft, $"$msg_added {amount} {name}", 0, null); @@ -568,7 +568,7 @@ static bool Prefix(Smelter __instance, ref bool __result, ZNetView ___m_nview, H inventory.RemoveItem(__instance.m_fuelItem.m_itemData.m_shared.m_name, amount); //typeof(Inventory).GetMethod("Changed", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(inventory, new object[] { }); for (int i = 0; i < amount; i++) - ___m_nview.InvokeRPC("AddFuel", new object[] { }); + ___m_nview.InvokeRPC("RPC_AddFuel", new object[] { }); added += amount; From d5f3780814daa825f194ba1674994dd7c40bd123 Mon Sep 17 00:00:00 2001 From: Shibesan Date: Tue, 11 Jun 2024 19:55:32 +0200 Subject: [PATCH 2/2] missing one AddFuel --- CraftFromContainers/BepInExPlugin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CraftFromContainers/BepInExPlugin.cs b/CraftFromContainers/BepInExPlugin.cs index 6ca4184..47df390 100644 --- a/CraftFromContainers/BepInExPlugin.cs +++ b/CraftFromContainers/BepInExPlugin.cs @@ -600,7 +600,7 @@ static bool Prefix(Smelter __instance, ref bool __result, ZNetView ___m_nview, H //typeof(Inventory).GetMethod("Changed", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(c.GetInventory(), new object[] { }); for (int i = 0; i < amount; i++) - ___m_nview.InvokeRPC("AddFuel", new object[] { }); + ___m_nview.InvokeRPC("RPC_AddFuel", new object[] { }); added += amount;