diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2013-12-17 01:10:07 +0200 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2013-12-17 01:10:07 +0200 |
| commit | e66f86a8624a5504fb1b389982883be9ebe6a092 (patch) | |
| tree | 4dcc23f3589f2b2f48116fbe8ac8410020c7deef /common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java | |
| parent | 766dafe80bdf9d2fe338346971fde1b87d0b7ad8 (diff) | |
Final commit, couldn't make the bench work, so I will send it as it is
Diffstat (limited to 'common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java')
| -rw-r--r-- | common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java b/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java index 5cce837..7d24c21 100644 --- a/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java +++ b/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java @@ -9,15 +9,19 @@ import net.minecraft.tileentity.TileEntity; public class TileEntityJewelrsCraftingTable extends TileEntity { - public boolean hasJewel, hasModifier; - public ItemStack jewel, modifier; + public boolean hasJewel, hasModifier, hasEndItem; + public ItemStack jewel, modifier, endItem; + public int timer; public TileEntityJewelrsCraftingTable() { this.jewel = new ItemStack(0, 0, 0); this.modifier = new ItemStack(0, 0, 0); + this.endItem = new ItemStack(0, 0, 0); this.hasJewel = false; this.hasModifier = false; + this.hasEndItem = false; + this.timer = 0; } @Override @@ -26,12 +30,17 @@ public class TileEntityJewelrsCraftingTable extends TileEntity super.writeToNBT(nbt); nbt.setBoolean("hasJewel", hasJewel); nbt.setBoolean("hasModifier", hasModifier); + nbt.setBoolean("hasEndItem", hasEndItem); + nbt.setInteger("timer", timer); NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound tag1 = new NBTTagCompound(); + NBTTagCompound tag2 = new NBTTagCompound(); this.jewel.writeToNBT(tag); nbt.setCompoundTag("jewel", tag); this.modifier.writeToNBT(tag1); nbt.setCompoundTag("modifier", tag1); + this.endItem.writeToNBT(tag2); + nbt.setCompoundTag("endItem", tag2); } @Override @@ -40,15 +49,33 @@ public class TileEntityJewelrsCraftingTable extends TileEntity super.readFromNBT(nbt); this.hasJewel = nbt.getBoolean("hasJewel"); this.hasModifier = nbt.getBoolean("hasModifier"); + this.hasEndItem = nbt.getBoolean("hasEndItem"); + this.timer = nbt.getInteger("timer"); this.jewel = new ItemStack(0, 0, 0); this.jewel.readFromNBT(nbt.getCompoundTag("jewel")); this.modifier = new ItemStack(0, 0, 0); this.modifier.readFromNBT(nbt.getCompoundTag("modifier")); + this.endItem = new ItemStack(0, 0, 0); + this.endItem.readFromNBT(nbt.getCompoundTag("endItem")); } public void updateEntity() { super.updateEntity(); + if(this.hasJewel && this.hasEndItem) + { + if(timer > 0) timer--; + System.out.println(timer); + if(timer == 0) + { + this.hasEndItem = true; + this.endItem = jewel; + this.hasJewel = false; + this.jewel = new ItemStack(0, 0, 0); + this.hasModifier = false; + this.modifier = new ItemStack(0, 0, 0); + } + } } public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) |
