From c6f5802f58aa58ae134752ff7ae04afae0143bf5 Mon Sep 17 00:00:00 2001 From: Alexdoru <57050655+Alexdoru@users.noreply.github.com> Date: Wed, 3 Dec 2025 02:52:03 +0100 Subject: [PATCH] delete furnace ASM --- .../common/transform/EnderCoreMethods.java | 140 ------------------ .../transform/EnderCoreTransformer.java | 33 ----- 2 files changed, 173 deletions(-) diff --git a/src/main/java/com/enderio/core/common/transform/EnderCoreMethods.java b/src/main/java/com/enderio/core/common/transform/EnderCoreMethods.java index 801a466..5f6bbb1 100644 --- a/src/main/java/com/enderio/core/common/transform/EnderCoreMethods.java +++ b/src/main/java/com/enderio/core/common/transform/EnderCoreMethods.java @@ -1,13 +1,5 @@ package com.enderio.core.common.transform; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ContainerFurnace; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraft.tileentity.TileEntityFurnace; - import com.enderio.core.common.config.ConfigHandler; public class EnderCoreMethods { @@ -15,136 +7,4 @@ public class EnderCoreMethods { public static int getMaxAnvilCost() { return ConfigHandler.anvilMaxLevel; } - - // mostly copied from ContainerFurnace - public static ItemStack transferStackInSlot(ContainerFurnace inv, EntityPlayer p_82846_1_, int p_82846_2_) { - ItemStack itemstack = null; - Slot slot = (Slot) inv.inventorySlots.get(p_82846_2_); - - if (slot != null && slot.getHasStack()) { - ItemStack itemstack1 = slot.getStack(); - itemstack = itemstack1.copy(); - - if (p_82846_2_ == 2) { - if (!mergeItemStack(inv, itemstack1, 3, 39, true)) { - return null; - } - - slot.onSlotChange(itemstack1, itemstack); - } else if (p_82846_2_ != 1 && p_82846_2_ != 0) { - // I have moved this check to the beginning - if (TileEntityFurnace.isItemFuel(itemstack1)) { - if (!mergeItemStack(inv, itemstack1, 1, 2, false)) { - // Nest this inside so that if the above fails it will - // attempt to do the input slot - if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) { - if (!mergeItemStack(inv, itemstack1, 0, 1, false)) { - return null; - } - } - } - } else if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) { - if (!mergeItemStack(inv, itemstack1, 0, 1, false)) { - return null; - } - } else if (p_82846_2_ >= 3 && p_82846_2_ < 30) { - if (!mergeItemStack(inv, itemstack1, 30, 39, false)) { - return null; - } - } else if (p_82846_2_ >= 30 && p_82846_2_ < 39 && !mergeItemStack(inv, itemstack1, 3, 30, false)) { - return null; - } - } else if (!mergeItemStack(inv, itemstack1, 3, 39, false)) { - return null; - } - - if (itemstack1.stackSize == 0) { - slot.putStack((ItemStack) null); - } else { - slot.onSlotChanged(); - } - - if (itemstack1.stackSize == itemstack.stackSize) { - return null; - } - - slot.onPickupFromSlot(p_82846_1_, itemstack1); - } - - return itemstack; - } - - // copied from Container - private static boolean mergeItemStack(Container inv, ItemStack p_75135_1_, int p_75135_2_, int p_75135_3_, - boolean p_75135_4_) { - boolean flag1 = false; - int k = p_75135_2_; - - if (p_75135_4_) { - k = p_75135_3_ - 1; - } - - Slot slot; - ItemStack itemstack1; - - if (p_75135_1_.isStackable()) { - while (p_75135_1_.stackSize > 0 && (!p_75135_4_ && k < p_75135_3_ || p_75135_4_ && k >= p_75135_2_)) { - slot = (Slot) inv.inventorySlots.get(k); - itemstack1 = slot.getStack(); - - if (itemstack1 != null && itemstack1.getItem() == p_75135_1_.getItem() - && (!p_75135_1_.getHasSubtypes() || p_75135_1_.getItemDamage() == itemstack1.getItemDamage()) - && ItemStack.areItemStackTagsEqual(p_75135_1_, itemstack1)) { - int l = itemstack1.stackSize + p_75135_1_.stackSize; - - if (l <= p_75135_1_.getMaxStackSize()) { - p_75135_1_.stackSize = 0; - itemstack1.stackSize = l; - slot.onSlotChanged(); - flag1 = true; - } else if (itemstack1.stackSize < p_75135_1_.getMaxStackSize()) { - p_75135_1_.stackSize -= p_75135_1_.getMaxStackSize() - itemstack1.stackSize; - itemstack1.stackSize = p_75135_1_.getMaxStackSize(); - slot.onSlotChanged(); - flag1 = true; - } - } - - if (p_75135_4_) { - --k; - } else { - ++k; - } - } - } - - if (p_75135_1_.stackSize > 0) { - if (p_75135_4_) { - k = p_75135_3_ - 1; - } else { - k = p_75135_2_; - } - - while (!p_75135_4_ && k < p_75135_3_ || p_75135_4_ && k >= p_75135_2_) { - slot = (Slot) inv.inventorySlots.get(k); - itemstack1 = slot.getStack(); - - if (itemstack1 == null) { - slot.putStack(p_75135_1_.copy()); - slot.onSlotChanged(); - p_75135_1_.stackSize = 0; - flag1 = true; - break; - } - - if (p_75135_4_) { - --k; - } else { - ++k; - } - } - } - - return flag1; - } } diff --git a/src/main/java/com/enderio/core/common/transform/EnderCoreTransformer.java b/src/main/java/com/enderio/core/common/transform/EnderCoreTransformer.java index 2526fda..6431e8a 100644 --- a/src/main/java/com/enderio/core/common/transform/EnderCoreTransformer.java +++ b/src/main/java/com/enderio/core/common/transform/EnderCoreTransformer.java @@ -60,10 +60,6 @@ public class EnderCoreTransformer implements IClassTransformer { "drawGuiContainerForegroundLayer", "func_146979_b"); - private static final String containerFurnaceClass = "net.minecraft.inventory.ContainerFurnace"; - private static final ObfSafeName containerFurnaceMethod = new ObfSafeName("transferStackInSlot", "func_82846_b"); - private static final String containerFurnaceMethodSig = "(Lnet/minecraft/inventory/ContainerFurnace;Lnet/minecraft/entity/player/EntityPlayer;I)Lnet/minecraft/item/ItemStack;"; - @Override public byte[] transform(String name, String transformedName, byte[] basicClass) { // Anvil max level @@ -95,35 +91,6 @@ public class EnderCoreTransformer implements IClassTransformer { } }); } - // Furnace Shift Click Fix - else if (transformedName.equals(containerFurnaceClass)) { - basicClass = transform(basicClass, containerFurnaceClass, containerFurnaceMethod, new Transform() { - - @Override - void transform(Iterator methods) { - while (methods.hasNext()) { - MethodNode m = methods.next(); - if (containerFurnaceMethod.equals(m.name)) { - m.instructions.clear(); - - m.instructions.add(new VarInsnNode(ALOAD, 0)); - m.instructions.add(new VarInsnNode(ALOAD, 1)); - m.instructions.add(new VarInsnNode(ILOAD, 2)); - m.instructions.add( - new MethodInsnNode( - INVOKESTATIC, - "com/enderio/core/common/transform/EnderCoreMethods", - "transferStackInSlot", - containerFurnaceMethodSig, - false)); - m.instructions.add(new InsnNode(ARETURN)); - - break; - } - } - } - }); - } return basicClass; }