Class BaseBlockEntity
java.lang.Object
org.cloudburstmc.server.blockentity.BaseBlockEntity
- All Implemented Interfaces:
org.cloudburstmc.api.blockentity.BlockEntity
- Direct Known Subclasses:
BannerBlockEntity,BarrelBlockEntity,BeaconBlockEntity,BedBlockEntity,BrewingStandBlockEntity,CampfireBlockEntity,CauldronBlockEntity,ChestBlockEntity,ComparatorBlockEntity,DaylightDetectorBlockEntity,EnchantingTableBlockEntity,FlowerPotBlockEntity,FurnaceBlockEntity,HopperBlockEntity,ItemFrameBlockEntity,JukeboxBlockEntity,LecternBlockEntity,MovingBlockEntity,MusicBlockEntity,PistonBlockEntity,ShulkerBoxBlockEntity,SignBlockEntity,SkullBlockEntity,UnknownBlockEntity
public abstract class BaseBlockEntity
extends Object
implements org.cloudburstmc.api.blockentity.BlockEntity
- Author:
- MagicDroidX
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanlongstatic AtomicLongprotected longbooleanprotected CloudServerprotected Timing -
Constructor Summary
ConstructorsConstructorDescriptionBaseBlockEntity(org.cloudburstmc.api.blockentity.BlockEntityType<?> type, org.cloudburstmc.api.level.chunk.Chunk chunk, com.nukkitx.math.vector.Vector3i position) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()org.cloudburstmc.api.block.BlockgetBlock()org.cloudburstmc.api.block.BlockStategetChunk()com.nukkitx.nbt.NbtMapcom.nukkitx.nbt.NbtMapGets the name of this object.longgetId()com.nukkitx.nbt.NbtMapgetLevel()com.nukkitx.math.vector.Vector3icom.nukkitx.nbt.NbtMapcom.nukkitx.nbt.NbtMapgetTag()org.cloudburstmc.api.blockentity.BlockEntityType<?>getType()booleanWhether this object has a name.protected voidinit()booleanisClosed()booleanbooleanabstract booleanisValid()voidloadAdditionalData(com.nukkitx.nbt.NbtMap tag)voidonBreak()booleanonUpdate()voidsaveAdditionalData(com.nukkitx.nbt.NbtMapBuilder tag)protected voidsaveClientData(com.nukkitx.nbt.NbtMapBuilder tag)NBT data that is specifically sent to the clientvoidvoidsetCustomName(String customName)Changes the name of this object, or names it.voidsetDirty()voidsetMovable(boolean moveble)voidspawnTo(org.cloudburstmc.api.player.Player player)voidbooleanupdateFromClient(com.nukkitx.nbt.NbtMap tag, CloudPlayer player)protected booleanupdateNbtMap(com.nukkitx.nbt.NbtMap nbt, CloudPlayer player)Called when a player updates a block entity's NBT data for example when writing on a sign.
-
Field Details
-
ID_ALLOCATOR
-
id
public final long id -
movable
public boolean movable -
closed
public boolean closed -
lastUpdate
protected long lastUpdate -
server
-
timing
-
-
Constructor Details
-
BaseBlockEntity
public BaseBlockEntity(org.cloudburstmc.api.blockentity.BlockEntityType<?> type, org.cloudburstmc.api.level.chunk.Chunk chunk, com.nukkitx.math.vector.Vector3i position)
-
-
Method Details
-
getTag
public com.nukkitx.nbt.NbtMap getTag() -
getServer
-
getType
public org.cloudburstmc.api.blockentity.BlockEntityType<?> getType()- Specified by:
getTypein interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
init
protected void init() -
getId
public long getId() -
loadAdditionalData
public void loadAdditionalData(com.nukkitx.nbt.NbtMap tag) -
saveAdditionalData
public void saveAdditionalData(com.nukkitx.nbt.NbtMapBuilder tag) -
saveClientData
protected void saveClientData(com.nukkitx.nbt.NbtMapBuilder tag)NBT data that is specifically sent to the client- Parameters:
tag- tag to write data to
-
getItemTag
public final com.nukkitx.nbt.NbtMap getItemTag() -
getServerTag
public final com.nukkitx.nbt.NbtMap getServerTag() -
getClientTag
public final com.nukkitx.nbt.NbtMap getClientTag() -
getChunkTag
public final com.nukkitx.nbt.NbtMap getChunkTag() -
isValid
public abstract boolean isValid()- Specified by:
isValidin interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
onUpdate
public boolean onUpdate()- Specified by:
onUpdatein interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
scheduleUpdate
public final void scheduleUpdate()- Specified by:
scheduleUpdatein interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
close
public void close()- Specified by:
closein interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
onBreak
public void onBreak()- Specified by:
onBreakin interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
setDirty
public void setDirty()- Specified by:
setDirtyin interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
isMovable
public boolean isMovable()- Specified by:
isMovablein interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
setMovable
public void setMovable(boolean moveble)- Specified by:
setMovablein interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
getCustomName
Gets the name of this object.- Specified by:
getCustomNamein interfaceorg.cloudburstmc.api.blockentity.BlockEntity- Returns:
- The name of this object.
- Since:
- Nukkit 1.0 | Nukkit API 1.0.0
-
setCustomName
Changes the name of this object, or names it.- Specified by:
setCustomNamein interfaceorg.cloudburstmc.api.blockentity.BlockEntity- Parameters:
customName- The new name of this object.- Since:
- Nukkit 1.0 | Nukkit API 1.0.0
-
hasCustomName
public final boolean hasCustomName()Whether this object has a name.- Specified by:
hasCustomNamein interfaceorg.cloudburstmc.api.blockentity.BlockEntity- Returns:
truefor this object has a name.- Since:
- Nukkit 1.0 | Nukkit API 1.0.0
-
spawnTo
public void spawnTo(org.cloudburstmc.api.player.Player player)- Specified by:
spawnToin interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
spawnToAll
public void spawnToAll()- Specified by:
spawnToAllin interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
updateFromClient
-
updateNbtMap
Called when a player updates a block entity's NBT data for example when writing on a sign.- Parameters:
nbt- tagplayer- player- Returns:
- bool indication of success, will respawn the tile to the player if false.
-
isSpawnable
public boolean isSpawnable()- Specified by:
isSpawnablein interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
getPosition
public com.nukkitx.math.vector.Vector3i getPosition()- Specified by:
getPositionin interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
getLevel
- Specified by:
getLevelin interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
getChunk
-
getBlock
public org.cloudburstmc.api.block.Block getBlock()- Specified by:
getBlockin interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-
getBlockState
public org.cloudburstmc.api.block.BlockState getBlockState()- Specified by:
getBlockStatein interfaceorg.cloudburstmc.api.blockentity.BlockEntity
-