summaryrefslogtreecommitdiff
path: root/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.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/TileEntityBlockShadow.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/TileEntityBlockShadow.java')
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java42
1 files changed, 28 insertions, 14 deletions
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java b/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
index 88ae7e3..b16ce31 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
@@ -12,11 +12,17 @@ public class TileEntityBlockShadow extends TileEntity
{
public int metadata;
+ /**
+ *
+ */
public TileEntityBlockShadow()
{
- this.metadata = -1;
+ metadata = -1;
}
+ /**
+ * @param nbt
+ */
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@@ -24,13 +30,19 @@ public class TileEntityBlockShadow extends TileEntity
nbt.setInteger("metadata", metadata);
}
+ /**
+ * @param nbt
+ */
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
- this.metadata = nbt.getInteger("metadata");
+ metadata = nbt.getInteger("metadata");
}
+ /**
+ *
+ */
@Override
public void updateEntity()
{
@@ -38,33 +50,35 @@ public class TileEntityBlockShadow extends TileEntity
int blockLight, realLight;
int lightValue = worldObj.getSavedLightValue(EnumSkyBlock.Sky, xCoord, yCoord, zCoord) - worldObj.skylightSubtracted;
float sunPosAngle = worldObj.getCelestialAngleRadians(1.0F);
-
- if (sunPosAngle < (float) Math.PI) sunPosAngle += (0.0F - sunPosAngle) * 0.2F;
- else sunPosAngle += (((float) Math.PI * 2F) - sunPosAngle) * 0.2F;
-
- lightValue = Math.round((float) lightValue * MathHelper.cos(sunPosAngle));
-
+ if (sunPosAngle < (float)Math.PI) sunPosAngle += (0.0F - sunPosAngle) * 0.2F;
+ else sunPosAngle += ((float)Math.PI * 2F - sunPosAngle) * 0.2F;
+ lightValue = Math.round(lightValue * MathHelper.cos(sunPosAngle));
if (lightValue < 0) lightValue = 0;
if (lightValue > 15) lightValue = 15;
-
blockLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord).getSavedLightValue(EnumSkyBlock.Block, xCoord & 15, yCoord, zCoord & 15);
realLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord).getBlockLightValue(xCoord & 15, yCoord, zCoord & 15, 0);
-
- if ((blockLight == 0 && worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) || (lightValue >= blockLight)) metadata = 15 - lightValue;
+ if (blockLight == 0 && worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) || lightValue >= blockLight) metadata = 15 - lightValue;
else if (!worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) metadata = 15 - realLight;
else if (lightValue < blockLight) metadata = 15 - blockLight;
-
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, metadata, 2);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
}
+ /**
+ * @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)
{