diff options
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java')
| -rwxr-xr-x[-rw-r--r--] | src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java | 138 |
1 files changed, 67 insertions, 71 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java index 1cee6d0..5d37f65 100644..100755 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMidasTouch.java @@ -9,75 +9,71 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; -public class TileEntityMidasTouch extends TileEntity -{ - public Entity target; - - public TileEntityMidasTouch() - {} - - public void setEntity(Entity ent) - { - target = ent; - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - if (target != null){ - int id = EntityList.getEntityID(target); - NBTTagCompound tag = new NBTTagCompound(); - target.writeToNBT(tag); - nbt.setInteger("entityID", id); - nbt.setTag("entity", tag); - } - } - - /** - * @param nbt - */ - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - NBTTagCompound en = (NBTTagCompound)nbt.getTag("entity"); - int entityID = nbt.getInteger("entityID"); - EntityLivingBase entity = (EntityLivingBase)EntityList.createEntityByID(entityID, worldObj); - if (entity != null){ - entity.readFromNBT(en); - target = entity; - } - } - - /** - * - */ - @Override - public boolean canUpdate() - { - return false; - } - - /** - * @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); - } +public class TileEntityMidasTouch extends TileEntity { + public Entity target; + + public TileEntityMidasTouch() { + } + + public void setEntity(Entity ent) { + target = ent; + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + if (target != null) { + int id = EntityList.getEntityID(target); + NBTTagCompound tag = new NBTTagCompound(); + target.writeToNBT(tag); + nbt.setInteger("entityID", id); + nbt.setTag("entity", tag); + } + } + + /** + * @param nbt + */ + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + NBTTagCompound en = (NBTTagCompound) nbt.getTag("entity"); + int entityID = nbt.getInteger("entityID"); + EntityLivingBase entity = (EntityLivingBase) EntityList + .createEntityByID(entityID, worldObj); + if (entity != null) { + entity.readFromNBT(en); + target = entity; + } + } + + /** + * + */ + @Override + public boolean canUpdate() { + return false; + } + + /** + * @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); + } } |
