summaryrefslogtreecommitdiff
path: root/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-02-21 21:31:16 +0000
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-02-21 21:31:16 +0000
commit420faddca46e70e3a70def168fb4e452ef193b0d (patch)
tree247e334012e4bf9e4fa6d42718bf601ce6bd42d9 /java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
parent3f4c717de5ebc9b942d65ae45ac87c43bdf8a31b (diff)
Added just a butt ton of stuff, also thanks to pau101 for helping me with the Hand Pedestal animation :)
Diffstat (limited to 'java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java')
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java83
1 files changed, 49 insertions, 34 deletions
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java b/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
index 7a678e2..047f254 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
@@ -1,7 +1,5 @@
package darkknight.jewelrycraft.tileentity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -17,22 +15,28 @@ public class TileEntityDisplayer extends TileEntity
public ItemStack object;
public int quantity, infoIndex, timer = 0;
+ /**
+ *
+ */
public TileEntityDisplayer()
{
- this.ringTranslation1 = 0.6f;
- this.ringTranslation2 = 0.3f;
- this.ringTranslation3 = 0.0f;
- this.rotAngle = 0;
- this.quantity = 0;
- this.infoIndex = 1;
- this.isDescending1 = false;
- this.isDescending2 = false;
- this.isDescending3 = false;
- this.isDirty = false;
- this.hasObject = false;
- this.object = new ItemStack(Item.getItemById(0), 0, 0);
+ ringTranslation1 = 0.6f;
+ ringTranslation2 = 0.3f;
+ ringTranslation3 = 0.0f;
+ rotAngle = 0;
+ quantity = 0;
+ infoIndex = 1;
+ isDescending1 = false;
+ isDescending2 = false;
+ isDescending3 = false;
+ isDirty = false;
+ hasObject = false;
+ object = new ItemStack(Item.getItemById(0), 0, 0);
}
+ /**
+ * @param nbt
+ */
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@@ -48,34 +52,39 @@ public class TileEntityDisplayer extends TileEntity
nbt.setBoolean("descending3", isDescending3);
nbt.setBoolean("hasObject", hasObject);
NBTTagCompound tag = new NBTTagCompound();
- this.object.writeToNBT(tag);
+ object.writeToNBT(tag);
nbt.setTag("object", tag);
}
+ /**
+ * @param nbt
+ */
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
- this.ringTranslation1 = nbt.getFloat("translation1");
- this.ringTranslation2 = nbt.getFloat("translation2");
- this.ringTranslation3 = nbt.getFloat("translation3");
- this.rotAngle = nbt.getFloat("angle");
- this.quantity = nbt.getInteger("quantity");
- this.infoIndex = nbt.getInteger("infoIndex");
- this.isDescending1 = nbt.getBoolean("descending1");
- this.isDescending2 = nbt.getBoolean("descending2");
- this.isDescending3 = nbt.getBoolean("descending3");
- this.hasObject = nbt.getBoolean("hasObject");
- this.object = new ItemStack(Item.getItemById(0), 0, 0);
- this.object.readFromNBT(nbt.getCompoundTag("object"));
+ ringTranslation1 = nbt.getFloat("translation1");
+ ringTranslation2 = nbt.getFloat("translation2");
+ ringTranslation3 = nbt.getFloat("translation3");
+ rotAngle = nbt.getFloat("angle");
+ quantity = nbt.getInteger("quantity");
+ infoIndex = nbt.getInteger("infoIndex");
+ isDescending1 = nbt.getBoolean("descending1");
+ isDescending2 = nbt.getBoolean("descending2");
+ isDescending3 = nbt.getBoolean("descending3");
+ hasObject = nbt.getBoolean("hasObject");
+ object = new ItemStack(Item.getItemById(0), 0, 0);
+ object.readFromNBT(nbt.getCompoundTag("object"));
}
+ /**
+ *
+ */
@Override
public void updateEntity()
{
super.updateEntity();
- if (isDirty)
- {
+ if (isDirty){
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
@@ -83,12 +92,10 @@ public class TileEntityDisplayer extends TileEntity
if (ringTranslation1 <= 0) isDescending1 = false;
if (!isDescending1) ringTranslation1 += 0.05;
if (isDescending1) ringTranslation1 -= 0.05;
-
if (ringTranslation2 >= 0.6) isDescending2 = true;
if (ringTranslation2 <= 0) isDescending2 = false;
if (!isDescending2) ringTranslation2 += 0.04;
if (isDescending2) ringTranslation2 -= 0.04;
-
if (ringTranslation3 >= 0.6) isDescending3 = true;
if (ringTranslation3 <= 0) isDescending3 = false;
if (!isDescending3) ringTranslation3 += 0.03;
@@ -96,19 +103,27 @@ public class TileEntityDisplayer extends TileEntity
if (rotAngle < 360F) rotAngle += 6F;
if (rotAngle >= 360F) rotAngle = 0F;
timer++;
- if(timer >= 20){
+ if (timer >= 20){
infoIndex++;
timer = 0;
}
}
+ /**
+ * @return
+ */
+ @Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
+ /**
+ * @param net
+ * @param packet
+ */
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{