From bdb6fc4a5410d68cf517dbe90fa49cec45bbda5a Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Mon, 3 Oct 2016 18:08:43 +1000 Subject: % Gotta Re-merge these Changes with those made on my laptop. --- .../core/inventories/InventoryWorkbenchChest.java | 7 +++- .../inventories/InventoryWorkbenchCrafting.java | 37 ++++++++++++++++------ .../core/inventories/InventoryWorkbenchTools.java | 7 ++-- 3 files changed, 39 insertions(+), 12 deletions(-) (limited to 'src/Java/gtPlusPlus/core/inventories') diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java index 569f99b078..8d147ad21c 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java @@ -146,7 +146,12 @@ public class InventoryWorkbenchChest implements IInventory{ { for (int i = 0; i < getSizeInventory(); ++i) { - if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) { + ItemStack temp = getStackInSlot(i); + if (temp != null){ + //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); + } + + if (temp != null && temp.stackSize == 0) { inventory[i] = null; } } diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java index 72454d75ed..333bb5c847 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java @@ -1,7 +1,9 @@ package gtPlusPlus.core.inventories; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -15,13 +17,30 @@ public class InventoryWorkbenchCrafting implements IInventory{ /** Inventory's size must be same as number of slots you add to the Container class */ private ItemStack[] inventory = new ItemStack[INV_SIZE]; + public final InventoryCrafting craftMatrix; + public final Container parentContainer; + + public InventoryCrafting getCrafting(){ + return craftMatrix; + } /** * @param itemstack - the ItemStack to which this inventory belongs */ - public InventoryWorkbenchCrafting() + public InventoryWorkbenchCrafting(Container containerR) { - + this.parentContainer = containerR; + this.craftMatrix = new InventoryCrafting(parentContainer, 3, 3); + } + + private ItemStack[] getArrayOfCraftingItems(){ + ItemStack[] array = new ItemStack[9]; + for (int i=0; i= 0 && slot < INV_SIZE) { - inventory[slot] = ItemStack.loadItemStackFromNBT(data); + getInventory()[slot] = ItemStack.loadItemStackFromNBT(data); } } } @@ -44,7 +63,7 @@ public class InventoryWorkbenchCrafting implements IInventory{ NBTTagList list = new NBTTagList(); for(int i = 0;i getInventoryStackLimit()) { @@ -147,7 +166,7 @@ public class InventoryWorkbenchCrafting implements IInventory{ for (int i = 0; i < getSizeInventory(); ++i) { if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) { - inventory[i] = null; + getInventory()[i] = null; } } } diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java index 00ecd94574..7e3e7c3aef 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java @@ -1,6 +1,6 @@ package gtPlusPlus.core.inventories; -import gregtech.api.interfaces.IToolStats; +import gregtech.api.items.GT_MetaGenerated_Tool; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -178,7 +178,10 @@ public class InventoryWorkbenchTools implements IInventory{ // Don't want to be able to store the inventory item within itself // Bad things will happen, like losing your inventory // Actually, this needs a custom Slot to work - return (itemstack.getItem() instanceof IToolStats); + if (itemstack.getItem() instanceof GT_MetaGenerated_Tool){ + return true; + } + return false; } } \ No newline at end of file -- cgit