Package net.glowstone.block.entity
Class BlockEntity
java.lang.Object
net.glowstone.block.entity.BlockEntity
- Direct Known Subclasses:
BannerEntity
,BeaconEntity
,BedEntity
,ContainerEntity
,EnchantingTableEntity
,FlowerPotEntity
,JukeboxEntity
,MobSpawnerEntity
,SignEntity
,SkullEntity
Base class for block entities (blocks with NBT data) in the world. Most access to block entities
should occur through the Bukkit BlockState API.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBlockEntity
(GlowBlock block) Create a new BlockEntity at the given location. -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Destroy this BlockEntity.getBlock()
Get the block this BlockEntity is associated with.getState()
Create a new BlockState which will correspond to this block entity.void
loadNbt
(CompoundTag tag) Read this BlockEntity's data from the saved tag.void
pulse()
Generic pulse for this block entity.void
saveNbt
(CompoundTag tag) Save this BlockEntity's data to NBT.protected final void
Set the text ID this block entity is saved to disk with.void
update
(GlowPlayer player) Update this BlockEntity's visible state to the given player.final void
Update this BlockEntity's visible state to all players in range.
-
Field Details
-
block
Get the block this BlockEntity is associated with.
-
-
Constructor Details
-
BlockEntity
Create a new BlockEntity at the given location.- Parameters:
block
- The block the BlockEntity is attached to.
-
-
Method Details
-
updateInRange
public final void updateInRange()Update this BlockEntity's visible state to all players in range. -
setSaveId
Set the text ID this block entity is saved to disk with. If this is not set, then load and save of the "id" tag must be performed manually.- Parameters:
saveId
- The ID.
-
loadNbt
Read this BlockEntity's data from the saved tag.- Parameters:
tag
- The tag to load from.
-
saveNbt
Save this BlockEntity's data to NBT.- Parameters:
tag
- The tag to save to.
-
getState
Create a new BlockState which will correspond to this block entity.- Returns:
- A GlowBlockState, or null to use a standard BlockState.
-
destroy
public void destroy()Destroy this BlockEntity. -
update
Update this BlockEntity's visible state to the given player.- Parameters:
player
- The player to update.
-
pulse
public void pulse()Generic pulse for this block entity. -
getBlock
Get the block this BlockEntity is associated with.- Returns:
- The entity's block.
-