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 Details

    • ID_ALLOCATOR

      public static AtomicLong ID_ALLOCATOR
    • id

      public final long id
    • movable

      public boolean movable
    • closed

      public boolean closed
    • lastUpdate

      protected long lastUpdate
    • server

      protected CloudServer server
    • timing

      protected Timing 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

      public CloudServer getServer()
    • getType

      public org.cloudburstmc.api.blockentity.BlockEntityType<?> getType()
      Specified by:
      getType in interface org.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:
      isValid in interface org.cloudburstmc.api.blockentity.BlockEntity
    • onUpdate

      public boolean onUpdate()
      Specified by:
      onUpdate in interface org.cloudburstmc.api.blockentity.BlockEntity
    • scheduleUpdate

      public final void scheduleUpdate()
      Specified by:
      scheduleUpdate in interface org.cloudburstmc.api.blockentity.BlockEntity
    • close

      public void close()
      Specified by:
      close in interface org.cloudburstmc.api.blockentity.BlockEntity
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface org.cloudburstmc.api.blockentity.BlockEntity
    • onBreak

      public void onBreak()
      Specified by:
      onBreak in interface org.cloudburstmc.api.blockentity.BlockEntity
    • setDirty

      public void setDirty()
      Specified by:
      setDirty in interface org.cloudburstmc.api.blockentity.BlockEntity
    • isMovable

      public boolean isMovable()
      Specified by:
      isMovable in interface org.cloudburstmc.api.blockentity.BlockEntity
    • setMovable

      public void setMovable(boolean moveble)
      Specified by:
      setMovable in interface org.cloudburstmc.api.blockentity.BlockEntity
    • getCustomName

      @Nullable public final String getCustomName()
      Gets the name of this object.
      Specified by:
      getCustomName in interface org.cloudburstmc.api.blockentity.BlockEntity
      Returns:
      The name of this object.
      Since:
      Nukkit 1.0 | Nukkit API 1.0.0
    • setCustomName

      public final void setCustomName(@Nullable String customName)
      Changes the name of this object, or names it.
      Specified by:
      setCustomName in interface org.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:
      hasCustomName in interface org.cloudburstmc.api.blockentity.BlockEntity
      Returns:
      true for 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:
      spawnTo in interface org.cloudburstmc.api.blockentity.BlockEntity
    • spawnToAll

      public void spawnToAll()
      Specified by:
      spawnToAll in interface org.cloudburstmc.api.blockentity.BlockEntity
    • updateFromClient

      public final boolean updateFromClient(com.nukkitx.nbt.NbtMap tag, CloudPlayer player)
    • updateNbtMap

      protected boolean updateNbtMap(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.
      Parameters:
      nbt - tag
      player - player
      Returns:
      bool indication of success, will respawn the tile to the player if false.
    • isSpawnable

      public boolean isSpawnable()
      Specified by:
      isSpawnable in interface org.cloudburstmc.api.blockentity.BlockEntity
    • getPosition

      public com.nukkitx.math.vector.Vector3i getPosition()
      Specified by:
      getPosition in interface org.cloudburstmc.api.blockentity.BlockEntity
    • getLevel

      public CloudLevel getLevel()
      Specified by:
      getLevel in interface org.cloudburstmc.api.blockentity.BlockEntity
    • getChunk

      public CloudChunk getChunk()
    • getBlock

      public org.cloudburstmc.api.block.Block getBlock()
      Specified by:
      getBlock in interface org.cloudburstmc.api.blockentity.BlockEntity
    • getBlockState

      public org.cloudburstmc.api.block.BlockState getBlockState()
      Specified by:
      getBlockState in interface org.cloudburstmc.api.blockentity.BlockEntity