mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-21 12:32:19 +00:00
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
This commit is contained in:
1 parent
49b1d051e8
commit
f0e045061a
2 files changed
+12
-11
No files matched your search
+9
-10
@@ -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));
|
||||
|
||||
+3
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user