From 05c78126859231a68e199dc34613689bd0978e2f Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Mon, 11 Apr 2016 19:44:54 +0300 Subject: Initial commit --- ihl/processing/metallurgy/CrucibleInventory.java | 155 +++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 ihl/processing/metallurgy/CrucibleInventory.java (limited to 'ihl/processing/metallurgy/CrucibleInventory.java') diff --git a/ihl/processing/metallurgy/CrucibleInventory.java b/ihl/processing/metallurgy/CrucibleInventory.java new file mode 100644 index 0000000..57d9c17 --- /dev/null +++ b/ihl/processing/metallurgy/CrucibleInventory.java @@ -0,0 +1,155 @@ +package ihl.processing.metallurgy; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraftforge.oredict.OreDictionary; +import ic2.core.ContainerBase; +import ic2.core.IC2; +import ic2.core.item.tool.HandHeldInventory; +import ic2.core.util.StackUtil; + +public class CrucibleInventory extends HandHeldInventory{ + + ItemStack thisItemStack; + IInventory inventoryContainer; + public CrucibleInventory(EntityPlayer player, ItemStack stack) { + super(player, stack, 1); + thisItemStack=stack; + inventoryContainer=player.inventory; + } + + public CrucibleInventory(IInventory inventoryContainer1, ItemStack stack) + { + super(null, stack, 1); + thisItemStack=stack; + inventoryContainer=inventoryContainer1; + } + + @Override + @SideOnly(Side.CLIENT) + public GuiScreen getGui(EntityPlayer player, boolean arg1) { + return new CrucibleGui(new CrucibleContainer(player, this)); + } + + @Override + public ContainerBase getGuiContainer(EntityPlayer player) { + return new CrucibleContainer(player, this); + } + + @Override + public String getInventoryName() { + return "crucible"; + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public boolean isItemValidForSlot(int arg0, ItemStack stack) { + if(((Crucible)thisItemStack.getItem()).isEmpty(thisItemStack)) + { + int[] arrayIDs = OreDictionary.getOreIDs(stack); + for(int i=0; i= 0) + { + var9 = inventoryContainer.getStackInSlot(var8); + } + + if (var9 != null) + { + NBTTagCompound nbtTagCompoundSlot = var9.getTagCompound(); + + if (nbtTagCompoundSlot != null && nbtTagCompound.getInteger("uid") == nbtTagCompoundSlot.getInteger("uid")) + { + this.thisItemStack.stackSize = 1; + + if (var8 == -1 && inventoryContainer instanceof InventoryPlayer) + { + ((InventoryPlayer) inventoryContainer).setItemStack(this.thisItemStack); + } + else + { + inventoryContainer.setInventorySlotContents(var8, this.thisItemStack); + } + + break; + } + } + } + + } + } + +} -- cgit v1.2.3