summaryrefslogtreecommitdiff
path: root/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-03-23 14:51:06 +0000
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-03-23 14:51:06 +0000
commit6312636fd9a4d0f56dc7c9ff474a99d879bcb4e9 (patch)
treee3279753210bfb169a00cd3f146a80baf624150e /java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
parente86949a1ad3269ec66c9de65e2c92f5e66251411 (diff)
Reworked the whole repo.
Diffstat (limited to 'java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java')
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java88
1 files changed, 0 insertions, 88 deletions
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java b/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
deleted file mode 100644
index b16ce31..0000000
--- a/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package darkknight.jewelrycraft.tileentity;
-
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.MathHelper;
-import net.minecraft.world.EnumSkyBlock;
-
-public class TileEntityBlockShadow extends TileEntity
-{
- public int metadata;
-
- /**
- *
- */
- public TileEntityBlockShadow()
- {
- metadata = -1;
- }
-
- /**
- * @param nbt
- */
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- nbt.setInteger("metadata", metadata);
- }
-
- /**
- * @param nbt
- */
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- metadata = nbt.getInteger("metadata");
- }
-
- /**
- *
- */
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- 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(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;
- 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();
- writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
- }
-
- /**
- * @param net
- * @param packet
- */
- @Override
- public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
- {
- readFromNBT(packet.func_148857_g());
- worldObj.func_147479_m(xCoord, yCoord, zCoord);
- }
-}