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