From f0e045061af9da4d3bed6bdedf9477b9e4f02e22 Mon Sep 17 00:00:00 2001 From: koolkrafter5 Date: Sat, 29 Nov 2025 15:20:49 -0500 Subject: [PATCH] Bind unbound blood orbs that are placed into the calcinator by players Only allow reagents in the top slot and blood orbs in the bottom slot Take the full reagent stack from the player's hand instead of only one item --- .../common/block/BlockAlchemicCalcinator.java | 19 +++++++++---------- .../tileEntity/TEAlchemicCalcinator.java | 4 +++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockAlchemicCalcinator.java b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockAlchemicCalcinator.java index 94409f49..da5927f9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockAlchemicCalcinator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/block/BlockAlchemicCalcinator.java @@ -16,6 +16,8 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import WayofTime.alchemicalWizardry.AlchemicalWizardry; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator; import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator; @@ -87,12 +89,10 @@ public class BlockAlchemicCalcinator extends BlockContainer { Random rand = new Random(); TileEntity tileEntity = world.getTileEntity(x, y, z); - if (!(tileEntity instanceof IInventory)) { + if (!(tileEntity instanceof IInventory inventory)) { return; } - IInventory inventory = (IInventory) tileEntity; - for (int i = 0; i < inventory.getSizeInventory(); i++) { ItemStack item = inventory.getStackInSlot(i); @@ -139,18 +139,17 @@ public class BlockAlchemicCalcinator extends BlockContainer { if (playerItem.getItem() instanceof IBloodOrb) { if (tileEntity.getStackInSlot(0) == null) { + IBindable.checkAndSetItemOwner(playerItem, player); ItemStack newItem = playerItem.copy(); newItem.stackSize = 1; --playerItem.stackSize; tileEntity.setInventorySlotContents(0, newItem); } - } else if (tileEntity.getStackInSlot(1) == null) { - ItemStack newItem = playerItem.copy(); - newItem.stackSize = 1; - --playerItem.stackSize; - tileEntity.setInventorySlotContents(1, newItem); - } - + } else if (tileEntity.getStackInSlot(1) == null + && ReagentRegistry.getReagentStackForItem(playerItem) != null) { + tileEntity.setInventorySlotContents(1, playerItem); + player.inventory.setInventorySlotContents(player.inventory.currentItem, null); + } } else { if (tileEntity.getStackInSlot(1) != null) { player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(1)); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAlchemicCalcinator.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAlchemicCalcinator.java index 31261b6c..477d1f6c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAlchemicCalcinator.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAlchemicCalcinator.java @@ -318,7 +318,9 @@ public class TEAlchemicCalcinator extends TEReagentConduit implements IInventory @Override public boolean isItemValidForSlot(int slot, ItemStack itemStack) { - return true; + if (itemStack == null) return false; + return (slot == 0 && itemStack.getItem() instanceof IBloodOrb) + || (slot == 1 && ReagentRegistry.getReagentStackForItem(itemStack) != null); } @Override