net.minecraft.tileentity
Class TileEntity

java.lang.Object
  extended by net.minecraft.tileentity.TileEntity
Direct Known Subclasses:
TileEntityBeacon, TileEntityBrewingStand, TileEntityChest, TileEntityCommandBlock, TileEntityDispenser, TileEntityEnchantmentTable, TileEntityEnderChest, TileEntityEndPortal, TileEntityFurnace, TileEntityMobSpawner, TileEntityNote, TileEntityPiston, TileEntityRecordPlayer, TileEntitySign, TileEntitySkull

public class TileEntity
extends Object


Field Summary
 int blockMetadata
           
 Block blockType
          the Block type that this TileEntity is contained within
 World worldObj
          The reference to the world.
 int xCoord
          The x coordinate of the tile entity.
 int yCoord
          The y coordinate of the tile entity.
 int zCoord
          The z coordinate of the tile entity.
 
Constructor Summary
TileEntity()
           
 
Method Summary
static void addMapping(Class par0Class, String par1Str)
          Adds a new two-way mapping between the class and its string name in both hashmaps.
 boolean canUpdate()
          Determines if this TileEntity requires update calls.
static TileEntity createAndLoadEntity(NBTTagCompound par0NBTTagCompound)
          Creates a new entity and loads its data from the specified NBT.
 boolean func_70309_m()
           
 double func_82115_m()
           
 void func_85027_a(CrashReportCategory par1CrashReportCategory)
           
 int getBlockMetadata()
          Returns block data at the location of this entity (client-only).
 Block getBlockType()
          Gets the block type at the location of this entity (client-only).
 Packet getDescriptionPacket()
          Overriden in a sign to provide the text.
 double getDistanceFrom(double par1, double par3, double par5)
           
 World getWorldObj()
           
 void invalidate()
          invalidates a tile entity
 boolean isInvalid()
          returns true if tile entity is invalid, false otherwise
 void onChunkUnload()
          Called when the chunk this TileEntity is on is Unloaded.
 void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
          Called when you receive a TileEntityData packet for the location this TileEntity is currently in.
 void onInventoryChanged()
          Called when an the contents of an Inventory change, usually
 void readFromNBT(NBTTagCompound par1NBTTagCompound)
          Reads a tile entity from NBT.
 void receiveClientEvent(int par1, int par2)
          Called when a client event is received with the event number and argument, see World.sendClientEvent
 void setWorldObj(World par1World)
          Sets the worldObj for this tileEntity.
 boolean shouldRefresh(int oldID, int newID, int oldMeta, int newMeta, World world, int x, int y, int z)
          Called from Chunk.setBlockIDWithMetadata, determines if this tile entity should be re-created when the ID, or Metadata changes.
 void updateContainingBlockInfo()
          Causes the TileEntity to reset all it's cached values for it's container block, blockID, metaData and in the case of chests, the adjcacent chest check
 void updateEntity()
          Allows the entity to update its state.
 void validate()
          validates a tile entity
 void writeToNBT(NBTTagCompound par1NBTTagCompound)
          Writes a tile entity to NBT.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

worldObj

public World worldObj
The reference to the world.


xCoord

public int xCoord
The x coordinate of the tile entity.


yCoord

public int yCoord
The y coordinate of the tile entity.


zCoord

public int zCoord
The z coordinate of the tile entity.


blockMetadata

public int blockMetadata

blockType

public Block blockType
the Block type that this TileEntity is contained within

Constructor Detail

TileEntity

public TileEntity()
Method Detail

addMapping

public static void addMapping(Class par0Class,
                              String par1Str)
Adds a new two-way mapping between the class and its string name in both hashmaps.


getWorldObj

public World getWorldObj()

setWorldObj

public void setWorldObj(World par1World)
Sets the worldObj for this tileEntity.


func_70309_m

public boolean func_70309_m()

readFromNBT

public void readFromNBT(NBTTagCompound par1NBTTagCompound)
Reads a tile entity from NBT.


writeToNBT

public void writeToNBT(NBTTagCompound par1NBTTagCompound)
Writes a tile entity to NBT.


updateEntity

public void updateEntity()
Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count ticks and creates a new spawn inside its implementation.


createAndLoadEntity

public static TileEntity createAndLoadEntity(NBTTagCompound par0NBTTagCompound)
Creates a new entity and loads its data from the specified NBT.


getBlockMetadata

public int getBlockMetadata()
Returns block data at the location of this entity (client-only).


onInventoryChanged

public void onInventoryChanged()
Called when an the contents of an Inventory change, usually


getDistanceFrom

public double getDistanceFrom(double par1,
                              double par3,
                              double par5)

func_82115_m

public double func_82115_m()

getBlockType

public Block getBlockType()
Gets the block type at the location of this entity (client-only).


getDescriptionPacket

public Packet getDescriptionPacket()
Overriden in a sign to provide the text.


isInvalid

public boolean isInvalid()
returns true if tile entity is invalid, false otherwise


invalidate

public void invalidate()
invalidates a tile entity


validate

public void validate()
validates a tile entity


receiveClientEvent

public void receiveClientEvent(int par1,
                               int par2)
Called when a client event is received with the event number and argument, see World.sendClientEvent


updateContainingBlockInfo

public void updateContainingBlockInfo()
Causes the TileEntity to reset all it's cached values for it's container block, blockID, metaData and in the case of chests, the adjcacent chest check


func_85027_a

public void func_85027_a(CrashReportCategory par1CrashReportCategory)

canUpdate

public boolean canUpdate()
Determines if this TileEntity requires update calls.

Returns:
True if you want updateEntity() to be called, false if not

onDataPacket

public void onDataPacket(INetworkManager net,
                         Packet132TileEntityData pkt)
Called when you receive a TileEntityData packet for the location this TileEntity is currently in. On the client, the NetworkManager will always be the remote server. On the server, it will be whomever is responsible for sending the packet.

Parameters:
net - The NetworkManager the packet originated from
pkt - The data packet

onChunkUnload

public void onChunkUnload()
Called when the chunk this TileEntity is on is Unloaded.


shouldRefresh

public boolean shouldRefresh(int oldID,
                             int newID,
                             int oldMeta,
                             int newMeta,
                             World world,
                             int x,
                             int y,
                             int z)
Called from Chunk.setBlockIDWithMetadata, determines if this tile entity should be re-created when the ID, or Metadata changes. Use with caution as this will leave straggler TileEntities, or create conflicts with other TileEntities if not used properly.

Parameters:
oldID - The old ID of the block
newID - The new ID of the block (May be the same)
oldMeta - The old metadata of the block
newMeta - The new metadata of the block (May be the same)
world - Current world
x - X Postion
y - Y Position
z - Z Position
Returns:
True to remove the old tile entity, false to keep it in tact {and create a new one if the new values specify to}