public abstract class TileEntity extends java.lang.Object implements ICapabilitySerializable<NBTTagCompound>
Modifier and Type | Field and Description |
---|---|
protected Block |
blockType
the Block type that this TileEntity is contained within
|
static AxisAlignedBB |
INFINITE_EXTENT_AABB
Sometimes default render bounding box: infinite in scope.
|
protected BlockPos |
pos |
protected boolean |
tileEntityInvalid |
protected World |
world
the instance of the world the tile entity is in.
|
Constructor and Description |
---|
TileEntity() |
Modifier and Type | Method and Description |
---|---|
void |
addInfoToCrashReport(CrashReportCategory reportCategory) |
boolean |
canRenderBreaking()
Checks if this tile entity knows how to render its 'breaking' overlay effect.
|
static TileEntity |
create(World worldIn,
NBTTagCompound compound) |
void |
deserializeNBT(NBTTagCompound nbt) |
int |
getBlockMetadata() |
Block |
getBlockType()
Gets the block type at the location of this entity (client-only).
|
<T> T |
getCapability(Capability<T> capability,
EnumFacing facing)
Retrieves the handler for the capability requested on the specific side.
|
ITextComponent |
getDisplayName()
Get the formatted ChatComponent that will be used for the sender's username in chat
|
double |
getDistanceSq(double x,
double y,
double z)
Returns the square of the distance between this entity and the passed in coordinates.
|
static ResourceLocation |
getKey(java.lang.Class<? extends TileEntity> p_190559_0_) |
double |
getMaxRenderDistanceSquared() |
BlockPos |
getPos() |
AxisAlignedBB |
getRenderBoundingBox()
Return an
AxisAlignedBB that controls the visible scope of a TileEntitySpecialRenderer associated with this TileEntity
Defaults to the collision bounding box Block#getCollisionBoundingBoxFromPool(World, int, int, int) associated with the block
at this location. |
NBTTagCompound |
getTileData()
Gets a
NBTTagCompound that can be used to store custom data for this tile entity. |
SPacketUpdateTileEntity |
getUpdatePacket() |
NBTTagCompound |
getUpdateTag() |
World |
getWorld()
Returns the worldObj for this tileEntity.
|
void |
handleUpdateTag(NBTTagCompound tag)
Called when the chunk's TE update tag, gotten from
getUpdateTag() , is received on the client. |
boolean |
hasCapability(Capability<?> capability,
EnumFacing facing)
Determines if this object has support for the capability in question on the specific side.
|
boolean |
hasFastRenderer()
If the TileEntitySpecialRenderer associated with this TileEntity can be batched in with another renderers, and won't access the GL state.
|
boolean |
hasWorld()
Returns true if the worldObj isn't null.
|
void |
invalidate()
invalidates a tile entity
|
boolean |
isInvalid() |
void |
markDirty()
For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it
hasn't changed and skip it.
|
void |
mirror(Mirror mirrorIn) |
void |
onChunkUnload()
Called when the chunk this TileEntity is on is Unloaded.
|
void |
onDataPacket(NetworkManager net,
SPacketUpdateTileEntity pkt)
Called when you receive a TileEntityData packet for the location this
TileEntity is currently in.
|
void |
onLoad()
Called when this is first added to the world (by
World.addTileEntity(TileEntity) ). |
boolean |
onlyOpsCanSetNbt() |
void |
readFromNBT(NBTTagCompound compound) |
boolean |
receiveClientEvent(int id,
int type) |
boolean |
restrictNBTCopy()
Determines if the player can overwrite the NBT data of this tile entity while they place it using a ItemStack.
|
void |
rotate(Rotation rotationIn) |
NBTTagCompound |
serializeNBT() |
void |
setPos(BlockPos posIn) |
void |
setWorld(World worldIn)
Sets the worldObj for this tileEntity.
|
protected void |
setWorldCreate(World worldIn) |
boolean |
shouldRefresh(World world,
BlockPos pos,
IBlockState oldState,
IBlockState newSate)
Called from Chunk.setBlockIDWithMetadata and Chunk.fillChunk, determines if this tile entity should be re-created when the ID, or Metadata changes.
|
boolean |
shouldRenderInPass(int pass) |
void |
updateContainingBlockInfo() |
void |
validate()
validates a tile entity
|
NBTTagCompound |
writeToNBT(NBTTagCompound compound) |
protected World world
protected BlockPos pos
protected boolean tileEntityInvalid
protected Block blockType
public static final AxisAlignedBB INFINITE_EXTENT_AABB
TileEntitySpecialRenderer
.public static ResourceLocation getKey(java.lang.Class<? extends TileEntity> p_190559_0_)
public World getWorld()
public void setWorld(World worldIn)
public boolean hasWorld()
public void readFromNBT(NBTTagCompound compound)
public NBTTagCompound writeToNBT(NBTTagCompound compound)
public static TileEntity create(World worldIn, NBTTagCompound compound)
protected void setWorldCreate(World worldIn)
public int getBlockMetadata()
public void markDirty()
public double getDistanceSq(double x, double y, double z)
public double getMaxRenderDistanceSquared()
public BlockPos getPos()
public Block getBlockType()
public SPacketUpdateTileEntity getUpdatePacket()
public NBTTagCompound getUpdateTag()
public boolean isInvalid()
public void invalidate()
public void validate()
public boolean receiveClientEvent(int id, int type)
public void updateContainingBlockInfo()
public void addInfoToCrashReport(CrashReportCategory reportCategory)
public void setPos(BlockPos posIn)
public boolean onlyOpsCanSetNbt()
public ITextComponent getDisplayName()
public void rotate(Rotation rotationIn)
public void mirror(Mirror mirrorIn)
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
net
- The NetworkManager the packet originated frompkt
- The data packetpublic void handleUpdateTag(NBTTagCompound tag)
getUpdateTag()
, is received on the client.
Used to handle this tag in a special way. By default this simply calls readFromNBT(NBTTagCompound)
.
tag
- The NBTTagCompound
sent from getUpdateTag()
public void onChunkUnload()
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate)
world
- Current worldpos
- Tile's world positionoldState
- The old ID of the blocknewState
- The new ID of the block (May be the same)public boolean shouldRenderInPass(int pass)
public AxisAlignedBB getRenderBoundingBox()
AxisAlignedBB
that controls the visible scope of a TileEntitySpecialRenderer
associated with this TileEntity
Defaults to the collision bounding box Block#getCollisionBoundingBoxFromPool(World, int, int, int)
associated with the block
at this location.AxisAlignedBB
for the TileEntity
public boolean canRenderBreaking()
public NBTTagCompound getTileData()
NBTTagCompound
that can be used to store custom data for this tile entity.
It will be written, and read from disc, so it persists over world saves.public boolean restrictNBTCopy()
public void onLoad()
World.addTileEntity(TileEntity)
).
Override instead of adding if (firstTick)
stuff in update.public boolean hasFastRenderer()
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
ICapabilityProvider
hasCapability
in interface ICapabilityProvider
capability
- The capability to checkfacing
- The Side to check from:
CAN BE NULL. Null is defined to represent 'internal' or 'self'public <T> T getCapability(Capability<T> capability, EnumFacing facing)
ICapabilityProvider
getCapability
in interface ICapabilityProvider
capability
- The capability to checkfacing
- The Side to check from:
CAN BE NULL. Null is defined to represent 'internal' or 'self'ICapabilityProvider.hasCapability(Capability, EnumFacing)
would return false.public void deserializeNBT(NBTTagCompound nbt)
deserializeNBT
in interface INBTSerializable<NBTTagCompound>
public NBTTagCompound serializeNBT()
serializeNBT
in interface INBTSerializable<NBTTagCompound>