From dcafeb5c449440af22f9d73639edd8fee6f20acb Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Wed, 18 Dec 2024 21:08:06 -0500 Subject: [PATCH] Fix Furnace Fix --- mods/src/misc/misc.cpp | 16 ++++++++++------ symbols/src/gui/screens/FurnaceScreen.def | 2 +- symbols/src/level/container/FillingContainer.def | 3 +++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index f20a3706b6..0c41069abd 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -83,24 +83,24 @@ static RakNet_StartupResult RakNetInstance_host_RakNet_RakPeer_Startup_injection } // Fix Furnace Not Checking Item Auxiliary When Inserting New Item -static int32_t FurnaceScreen_handleAddItem_injection(FurnaceScreen_handleAddItem_t original, FurnaceScreen *furnace_screen, int32_t slot, const ItemInstance *item) { +static bool FurnaceScreen_handleAddItem_injection(FurnaceScreen_handleAddItem_t original, FurnaceScreen *furnace_screen, int32_t slot, const ItemInstance *item) { // Get Existing Item FurnaceTileEntity *tile_entity = furnace_screen->tile_entity; const ItemInstance *existing_item = tile_entity->getItem(slot); // Check Item - int valid; + bool valid; if (item->id == existing_item->id && item->auxiliary == existing_item->auxiliary) { // Item Matches, Is Valid - valid = 1; + valid = true; } else { // Item Doesn't Match, Check If Existing Item Is Empty if ((existing_item->id | existing_item->count | existing_item->auxiliary) == 0) { // Existing Item Is Empty, Is Valid - valid = 1; + valid = true; } else { // Existing Item Isn't Empty, Isn't Valid - valid = 0; + valid = false; } } @@ -110,9 +110,12 @@ static int32_t FurnaceScreen_handleAddItem_injection(FurnaceScreen_handleAddItem return original(furnace_screen, slot, item); } else { // Invalid - return 0; + return false; } } +static bool FurnaceScreen_moveOver_FillingContainer_removeResource_two_injection(FillingContainer *self, const ItemInstance &item) { + return self->removeResource_one(item, true) == 0; +} // Get Real Selected Slot int32_t misc_get_real_selected_slot(const Player *player) { @@ -513,6 +516,7 @@ void init_misc() { // Fix Furnace Not Checking Item Auxiliary When Inserting New Item if (feature_has("Fix Furnace Not Checking Item Auxiliary", server_disabled)) { overwrite_calls(FurnaceScreen_handleAddItem, FurnaceScreen_handleAddItem_injection); + overwrite_call((void *) 0x32580, FillingContainer_removeResource_two, FurnaceScreen_moveOver_FillingContainer_removeResource_two_injection); } // Disable Speed Bridging diff --git a/symbols/src/gui/screens/FurnaceScreen.def b/symbols/src/gui/screens/FurnaceScreen.def index 94aa9d14d9..b4cd15a957 100644 --- a/symbols/src/gui/screens/FurnaceScreen.def +++ b/symbols/src/gui/screens/FurnaceScreen.def @@ -1,5 +1,5 @@ extends Screen; -method int handleAddItem(int slot, const ItemInstance *item) = 0x327a0; +method bool handleAddItem(int slot, const ItemInstance *item) = 0x327a0; property FurnaceTileEntity *tile_entity = 0x1d0; diff --git a/symbols/src/level/container/FillingContainer.def b/symbols/src/level/container/FillingContainer.def index 84c785b1d1..8c02e625e3 100644 --- a/symbols/src/level/container/FillingContainer.def +++ b/symbols/src/level/container/FillingContainer.def @@ -11,6 +11,9 @@ method bool linkEmptySlot(int slot) = 0x92590; method int getFreeSlot() = 0x91ffc; method int getSlot(int id) = 0x91ce0; method int linkSlot(int linked_slot, int unlinked_slot, bool push_aside) = 0x92188; +method int removeResource_one(const ItemInstance &item, bool check_aux) = 0x923ac; +method bool removeResource_two(const ItemInstance &item) = 0x9247c; +method bool removeResource_three(int param_1) = 0x92088; virtual-method bool add(ItemInstance *item_instance) = 0x30;