summaryrefslogtreecommitdiff
path: root/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2013-12-23 22:03:06 +0200
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2013-12-23 22:03:06 +0200
commit198677e5b01009a65d243da1d25a14f879df659c (patch)
tree512da4c4fbccc40fdcfc79a6f6cbf0f4eb0efd50 /common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
parentb01cf1aa1d3480ad52ee7940f213596bfe6a2090 (diff)
Changed lots of stuff, added new features. Ender Rings!!!
Diffstat (limited to 'common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java')
-rw-r--r--common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java54
1 files changed, 39 insertions, 15 deletions
diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java b/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
index 6eb2212..a0e71ef 100644
--- a/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
+++ b/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
@@ -1,5 +1,7 @@
package darkknight.jewelrycraft.tileentity;
+import darkknight.jewelrycraft.config.ConfigHandler;
+import darkknight.jewelrycraft.util.JewelryNBT;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
@@ -9,20 +11,24 @@ import net.minecraft.tileentity.TileEntity;
public class TileEntityJewelrsCraftingTable extends TileEntity
{
- public boolean hasJewel, hasModifier, hasEndItem, isDirty;
- public ItemStack jewel, modifier, endItem;
+ public boolean hasJewelry, hasModifier, hasEndItem, isDirty, hasJewel;
+ public ItemStack jewelry, modifier, endItem, jewel;
public int timer, effect;
+ public float angle;
public TileEntityJewelrsCraftingTable()
{
- this.jewel = new ItemStack(0, 0, 0);
+ this.jewelry = new ItemStack(0, 0, 0);
this.modifier = new ItemStack(0, 0, 0);
this.endItem = new ItemStack(0, 0, 0);
- this.hasJewel = false;
+ this.jewel = new ItemStack(0, 0, 0);
+ this.hasJewelry = false;
this.hasModifier = false;
this.hasEndItem = false;
+ this.hasJewel = false;
this.timer = 0;
this.effect = 0;
+ this.angle = 0;
this.isDirty = false;
}
@@ -30,37 +36,49 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
- nbt.setBoolean("hasJewel", hasJewel);
+ nbt.setBoolean("hasJewelry", hasJewelry);
nbt.setBoolean("hasModifier", hasModifier);
nbt.setBoolean("hasEndItem", hasEndItem);
+ nbt.setBoolean("hasJewel", hasJewel);
nbt.setInteger("timer", timer);
nbt.setInteger("effect", effect);
+ nbt.setFloat("angle", angle);
+
NBTTagCompound tag = new NBTTagCompound();
NBTTagCompound tag1 = new NBTTagCompound();
NBTTagCompound tag2 = new NBTTagCompound();
- this.jewel.writeToNBT(tag);
- nbt.setCompoundTag("jewel", tag);
+ NBTTagCompound tag3 = new NBTTagCompound();
+
+ this.jewelry.writeToNBT(tag);
+ nbt.setCompoundTag("jewelry", tag);
this.modifier.writeToNBT(tag1);
nbt.setCompoundTag("modifier", tag1);
this.endItem.writeToNBT(tag2);
nbt.setCompoundTag("endItem", tag2);
+ this.jewel.writeToNBT(tag3);
+ nbt.setCompoundTag("jewel", tag3);
}
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
- this.hasJewel = nbt.getBoolean("hasJewel");
+ this.hasJewelry = nbt.getBoolean("hasJewelry");
this.hasModifier = nbt.getBoolean("hasModifier");
this.hasEndItem = nbt.getBoolean("hasEndItem");
+ this.hasJewel = nbt.getBoolean("hasJewel");
+
this.timer = nbt.getInteger("timer");
this.effect = nbt.getInteger("effect");
- this.jewel = new ItemStack(0, 0, 0);
- this.jewel.readFromNBT(nbt.getCompoundTag("jewel"));
+ this.angle = nbt.getFloat("angle");
+ this.jewelry = new ItemStack(0, 0, 0);
+ this.jewelry.readFromNBT(nbt.getCompoundTag("jewelry"));
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"));
+ this.jewel = new ItemStack(0, 0, 0);
+ this.jewel.readFromNBT(nbt.getCompoundTag("jewel"));
}
@Override
@@ -71,12 +89,14 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = true;
}
- if (this.hasJewel && this.hasModifier && !this.hasEndItem)
+ if(angle<360F)angle+=3F;
+ else angle=0F;
+ if (this.hasJewelry && (this.hasModifier || this.hasJewel) && !this.hasEndItem)
{
if (timer > 0)
{
timer--;
- for (int l = 0; l < 2000/(timer + 2); ++l)
+ for (int l = 0; l < ConfigHandler.jewelryCraftingTime/(timer + 2); ++l)
{
if(this.getBlockMetadata() == 0) this.worldObj.spawnParticle("witchMagic", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.2F, 0.0D, 0.0D, 0.0D);
if(this.getBlockMetadata() == 1) this.worldObj.spawnParticle("witchMagic", xCoord + 0.8F, (double) yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
@@ -87,11 +107,15 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
if (timer == 0)
{
this.hasEndItem = true;
- this.endItem = jewel.copy();
- this.hasJewel = false;
- this.jewel = new ItemStack(0, 0, 0);
+ this.endItem = jewelry.copy();
+ if (hasModifier && modifier != new ItemStack(0, 0, 0)) JewelryNBT.addModifier(endItem, modifier);
+ if (hasJewel && jewel != new ItemStack(0, 0, 0)) JewelryNBT.addJewel(endItem, jewel);
+ this.hasJewelry = false;
+ this.jewelry = new ItemStack(0, 0, 0);
this.hasModifier = false;
this.modifier = new ItemStack(0, 0, 0);
+ this.hasJewel = false;
+ this.jewel = new ItemStack(0, 0, 0);
}
}
}