public abstract class TileEntity extends java.lang.Object implements ICapabilitySerializable<NBTTagCompound>
Modifier and Type | Field and Description |
---|---|
protected Block |
blockType |
static AxisAlignedBB |
INFINITE_EXTENT_AABB
Sometimes default render bounding box: infinite in scope.
|
protected BlockPos |
pos |
protected boolean |
tileEntityInvalid |
protected World |
world |
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() |
<T> T |
getCapability(Capability<T> capability,
EnumFacing facing)
Retrieves the handler for the capability requested on the specific side.
|
ITextComponent |
getDisplayName() |
double |
getDistanceSq(double x,
double y,
double z) |
static ResourceLocation |
getKey(java.lang.Class<? extends TileEntity> clazz) |
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() |
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() |
void |
invalidate() |
boolean |
isInvalid() |
void |
markDirty() |
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) |
static void |
register(java.lang.String id,
java.lang.Class<? extends TileEntity> clazz) |
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) |
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() |
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 void register(java.lang.String id, java.lang.Class<? extends TileEntity> clazz)
@Nullable public static ResourceLocation getKey(java.lang.Class<? extends TileEntity> clazz)
public World getWorld()
public void setWorld(World worldIn)
public boolean hasWorld()
public void readFromNBT(NBTTagCompound compound)
public NBTTagCompound writeToNBT(NBTTagCompound compound)
@Nullable 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()
@Nullable 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()
@Nullable 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, @Nullable 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'@Nullable public <T> T getCapability(Capability<T> capability, @Nullable 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>