public abstract class BaseBlockEntity extends Object implements BlockEntity
| Modifier and Type | Field and Description |
|---|---|
boolean |
closed |
long |
id |
static AtomicLong |
ID_ALLOCATOR |
protected long |
lastUpdate |
boolean |
movable |
protected Server |
server |
protected Timing |
timing |
| Constructor and Description |
|---|
BaseBlockEntity(BlockEntityType<?> type,
Chunk chunk,
com.nukkitx.math.vector.Vector3i position) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Block |
getBlock() |
BlockState |
getBlockState() |
Chunk |
getChunk() |
com.nukkitx.nbt.NbtMap |
getChunkTag()
Gets the block entity NBT that is sent in a chunk packet
Contains no server side NBT
|
com.nukkitx.nbt.NbtMap |
getClientTag()
Get the NBT for saving sending to the client in
BlockEntityDataPacket
Contains all server side NBT with ID but no position |
String |
getCustomName()
Gets the name of this object.
|
long |
getId() |
com.nukkitx.nbt.NbtMap |
getItemTag()
Gets the NBT for items with block entity data
Contains all server side NBT without ID and position
|
Level |
getLevel() |
com.nukkitx.math.vector.Vector3i |
getPosition() |
com.nukkitx.nbt.NbtMap |
getServerTag()
Get the NBT for saving the block entity to disk
Contains all server side NBT with ID and position
|
com.nukkitx.nbt.NbtMap |
getTag() |
BlockEntityType<?> |
getType() |
boolean |
hasCustomName()
Whether this object has a name.
|
protected void |
init() |
boolean |
isClosed() |
boolean |
isMovable() |
boolean |
isSpawnable() |
abstract boolean |
isValid() |
void |
loadAdditionalData(com.nukkitx.nbt.NbtMap tag) |
void |
onBreak() |
boolean |
onUpdate() |
void |
saveAdditionalData(com.nukkitx.nbt.NbtMapBuilder tag) |
protected void |
saveClientData(com.nukkitx.nbt.NbtMapBuilder tag)
NBT data that is specifically sent to the client
|
void |
scheduleUpdate() |
void |
setCustomName(String customName)
Changes the name of this object, or names it.
|
void |
setDirty() |
void |
setMovable(boolean moveble) |
void |
spawnTo(Player player) |
void |
spawnToAll() |
boolean |
updateFromClient(com.nukkitx.nbt.NbtMap tag,
Player player) |
protected boolean |
updateNbtMap(com.nukkitx.nbt.NbtMap nbt,
Player player)
Called when a player updates a block entity's NBT data
for example when writing on a sign.
|
public static AtomicLong ID_ALLOCATOR
public final long id
public boolean movable
public boolean closed
protected long lastUpdate
protected Server server
protected Timing timing
public BaseBlockEntity(BlockEntityType<?> type, Chunk chunk, com.nukkitx.math.vector.Vector3i position)
public com.nukkitx.nbt.NbtMap getTag()
public BlockEntityType<?> getType()
getType in interface BlockEntityprotected void init()
public long getId()
public void loadAdditionalData(com.nukkitx.nbt.NbtMap tag)
loadAdditionalData in interface BlockEntitypublic void saveAdditionalData(com.nukkitx.nbt.NbtMapBuilder tag)
saveAdditionalData in interface BlockEntityprotected void saveClientData(com.nukkitx.nbt.NbtMapBuilder tag)
tag - tag to write data topublic final com.nukkitx.nbt.NbtMap getItemTag()
BlockEntitygetItemTag in interface BlockEntitypublic final com.nukkitx.nbt.NbtMap getServerTag()
BlockEntitygetServerTag in interface BlockEntitypublic final com.nukkitx.nbt.NbtMap getClientTag()
BlockEntityBlockEntityDataPacket
Contains all server side NBT with ID but no positiongetClientTag in interface BlockEntitypublic final com.nukkitx.nbt.NbtMap getChunkTag()
BlockEntitygetChunkTag in interface BlockEntitypublic abstract boolean isValid()
isValid in interface BlockEntitypublic boolean onUpdate()
onUpdate in interface BlockEntitypublic final void scheduleUpdate()
scheduleUpdate in interface BlockEntitypublic void close()
close in interface BlockEntitypublic boolean isClosed()
isClosed in interface BlockEntitypublic void onBreak()
onBreak in interface BlockEntitypublic void setDirty()
setDirty in interface BlockEntitypublic boolean isMovable()
isMovable in interface BlockEntitypublic void setMovable(boolean moveble)
setMovable in interface BlockEntity@Nullable public final String getCustomName()
getCustomName in interface BlockEntitypublic final void setCustomName(@Nullable String customName)
setCustomName in interface BlockEntitycustomName - The new name of this object.public final boolean hasCustomName()
hasCustomName in interface BlockEntitytrue for this object has a name.public void spawnTo(Player player)
spawnTo in interface BlockEntitypublic void spawnToAll()
spawnToAll in interface BlockEntitypublic final boolean updateFromClient(com.nukkitx.nbt.NbtMap tag,
Player player)
updateFromClient in interface BlockEntityprotected boolean updateNbtMap(com.nukkitx.nbt.NbtMap nbt,
Player player)
nbt - tagplayer - playerpublic boolean isSpawnable()
isSpawnable in interface BlockEntitypublic com.nukkitx.math.vector.Vector3i getPosition()
getPosition in interface BlockEntitypublic Level getLevel()
getLevel in interface BlockEntitypublic Chunk getChunk()
public Block getBlock()
getBlock in interface BlockEntitypublic BlockState getBlockState()
getBlockState in interface BlockEntityCopyright © 2020. All rights reserved.