diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-09-12 17:04:35 +1000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2017-09-12 17:04:35 +1000 |
commit | cdc728c5b606d6d3d49dce77c18f875a1f8379c6 (patch) | |
tree | 8e48d0e8fe2aa88547b9a00b56bce51a3022ea3f /src/Java/gtPlusPlus/core/tileentities | |
parent | 72905a7d18b0c5fca8a8edf3ed38b17d7f11f415 (diff) | |
download | GT5-Unofficial-cdc728c5b606d6d3d49dce77c18f875a1f8379c6.tar.gz GT5-Unofficial-cdc728c5b606d6d3d49dce77c18f875a1f8379c6.tar.bz2 GT5-Unofficial-cdc728c5b606d6d3d49dce77c18f875a1f8379c6.zip |
+ Auto Crafter now consumes items when found for a recipe.
+ Auto Crafter now outputs item when all 9 inputs are valid.
+ Added Read & Write to NBT functions to NBTUtils class.
% Project Table now stores inputs and output to a Data Stick.
Diffstat (limited to 'src/Java/gtPlusPlus/core/tileentities')
-rw-r--r-- | src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java index 9a1f52b0be..31277a763e 100644 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java @@ -3,6 +3,7 @@ package gtPlusPlus.core.tileentities.machines; import java.util.List; import java.util.Vector; +import gtPlusPlus.core.container.Container_ProjectTable; import gtPlusPlus.core.inventories.*; import gtPlusPlus.core.inventories.projecttable.InventoryProjectMain; import gtPlusPlus.core.inventories.projecttable.InventoryProjectOutput; @@ -13,8 +14,10 @@ import ic2.api.network.INetworkUpdateListener; import ic2.api.tile.IWrenchable; import ic2.core.IC2; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; +import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -24,12 +27,21 @@ public class TileEntityProjectTable extends TileEntity implements INetworkDataPr public InventoryProjectMain inventoryGrid; public InventoryProjectOutput inventoryOutputs; + + /** The crafting matrix inventory (3x3). */ + public InventoryCrafting craftMatrix; + public IInventory craftResult; + private Container_ProjectTable container; public TileEntityProjectTable(){ this.inventoryGrid = new InventoryProjectMain();//number of slots - without product slot this.inventoryOutputs = new InventoryProjectOutput();//number of slots - without product slot this.canUpdate(); } + + public void setContainer(Container_ProjectTable container){ + this.container = container; + } @SuppressWarnings("static-method") public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag){ @@ -114,9 +126,16 @@ public class TileEntityProjectTable extends TileEntity implements INetworkDataPr //Data stick ItemStack dataStick = this.inventoryOutputs.getStackInSlot(0); - if (dataStick != null){ - Utils.LOG_INFO("Found Data Stick."); - ItemStack newStick = NBTUtils.writeItemsToNBT(dataStick, this.inventoryGrid.getInventory()); + if (dataStick != null && this.container != null){ + Utils.LOG_INFO("Found Data Stick and valid container."); + + + ItemStack outputComponent = container.getOutputContent(); + ItemStack[] craftInputComponent = container.getInputComponents(); + + + ItemStack newStick = NBTUtils.writeItemsToNBT(dataStick, new ItemStack[]{outputComponent}, "Output"); + newStick = NBTUtils.writeItemsToNBT(newStick, craftInputComponent); NBTUtils.setBookTitle(newStick, "Encrypted Project Data"); int slotm=0; Utils.LOG_INFO("Uploading to Data Stick."); |