Fix Furnace Fix

This commit is contained in:
TheBrokenRail 2024-12-18 21:08:06 -05:00
parent 3771666a14
commit dcafeb5c44
3 changed files with 14 additions and 7 deletions

View File

@ -83,24 +83,24 @@ static RakNet_StartupResult RakNetInstance_host_RakNet_RakPeer_Startup_injection
} }
// Fix Furnace Not Checking Item Auxiliary When Inserting New Item // 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 // Get Existing Item
FurnaceTileEntity *tile_entity = furnace_screen->tile_entity; FurnaceTileEntity *tile_entity = furnace_screen->tile_entity;
const ItemInstance *existing_item = tile_entity->getItem(slot); const ItemInstance *existing_item = tile_entity->getItem(slot);
// Check Item // Check Item
int valid; bool valid;
if (item->id == existing_item->id && item->auxiliary == existing_item->auxiliary) { if (item->id == existing_item->id && item->auxiliary == existing_item->auxiliary) {
// Item Matches, Is Valid // Item Matches, Is Valid
valid = 1; valid = true;
} else { } else {
// Item Doesn't Match, Check If Existing Item Is Empty // Item Doesn't Match, Check If Existing Item Is Empty
if ((existing_item->id | existing_item->count | existing_item->auxiliary) == 0) { if ((existing_item->id | existing_item->count | existing_item->auxiliary) == 0) {
// Existing Item Is Empty, Is Valid // Existing Item Is Empty, Is Valid
valid = 1; valid = true;
} else { } else {
// Existing Item Isn't Empty, Isn't Valid // 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); return original(furnace_screen, slot, item);
} else { } else {
// Invalid // 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 // Get Real Selected Slot
int32_t misc_get_real_selected_slot(const Player *player) { 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 // Fix Furnace Not Checking Item Auxiliary When Inserting New Item
if (feature_has("Fix Furnace Not Checking Item Auxiliary", server_disabled)) { if (feature_has("Fix Furnace Not Checking Item Auxiliary", server_disabled)) {
overwrite_calls(FurnaceScreen_handleAddItem, FurnaceScreen_handleAddItem_injection); overwrite_calls(FurnaceScreen_handleAddItem, FurnaceScreen_handleAddItem_injection);
overwrite_call((void *) 0x32580, FillingContainer_removeResource_two, FurnaceScreen_moveOver_FillingContainer_removeResource_two_injection);
} }
// Disable Speed Bridging // Disable Speed Bridging

View File

@ -1,5 +1,5 @@
extends Screen; 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; property FurnaceTileEntity *tile_entity = 0x1d0;

View File

@ -11,6 +11,9 @@ method bool linkEmptySlot(int slot) = 0x92590;
method int getFreeSlot() = 0x91ffc; method int getFreeSlot() = 0x91ffc;
method int getSlot(int id) = 0x91ce0; method int getSlot(int id) = 0x91ce0;
method int linkSlot(int linked_slot, int unlinked_slot, bool push_aside) = 0x92188; 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; virtual-method bool add(ItemInstance *item_instance) = 0x30;