From 420faddca46e70e3a70def168fb4e452ef193b0d Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Sat, 21 Feb 2015 21:31:16 +0000 Subject: Added just a butt ton of stuff, also thanks to pau101 for helping me with the Hand Pedestal animation :) --- .../tileentity/TileEntityBlockShadow.java | 42 ++++++++++++++-------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java') 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) { -- cgit v1.2.3