Class BlockEntity

All Implemented Interfaces:
ICapabilityProvider, ICapabilitySerializable<CompoundTag>, IForgeBlockEntity, INBTSerializable<CompoundTag>
Direct Known Subclasses:
BannerBlockEntity, BaseContainerBlockEntity, BeaconBlockEntity, BedBlockEntity, BeehiveBlockEntity, BellBlockEntity, BlockEntityOnLoadTest.TestBlockEntity, CampfireBlockEntity, CommandBlockEntity, ComparatorBlockEntity, ConduitBlockEntity, DaylightDetectorBlockEntity, EnchantmentTableBlockEntity, EnderChestBlockEntity, FullPotsAccessorDemo.DioriteFlowerPotBlockEntity, JigsawBlockEntity, JukeboxBlockEntity, LecternBlockEntity, PistonMovingBlockEntity, SculkSensorBlockEntity, SignBlockEntity, SkullBlockEntity, SpawnerBlockEntity, StructureBlockEntity, TheEndPortalBlockEntity, TileFluidHandler

public abstract class BlockEntity extends CapabilityProvider<BlockEntity> implements IForgeBlockEntity
  • Field Details

    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
    • type

      private final BlockEntityType<?> type
    • level

      @Nullable protected Level level
    • worldPosition

      protected final BlockPos worldPosition
    • remove

      protected boolean remove
    • blockState

      private BlockState blockState
    • customTileData

      private CompoundTag customTileData
  • Constructor Details

  • Method Details

    • getLevel

      @Nullable public Level getLevel()
    • setLevel

      public void setLevel(Level p_155231_)
    • hasLevel

      public boolean hasLevel()
    • load

      public void load(CompoundTag p_155245_)
    • save

      public CompoundTag save(CompoundTag p_58888_)
    • saveMetadata

      private CompoundTag saveMetadata(CompoundTag p_58895_)
    • loadStatic

      @Nullable public static BlockEntity loadStatic(BlockPos p_155242_, BlockState p_155243_, CompoundTag p_155244_)
    • setChanged

      public void setChanged()
    • setChanged

      protected static void setChanged(Level p_155233_, BlockPos p_155234_, BlockState p_155235_)
    • getBlockPos

      public BlockPos getBlockPos()
    • getBlockState

      public BlockState getBlockState()
    • getUpdatePacket

      @Nullable public ClientboundBlockEntityDataPacket getUpdatePacket()
    • getUpdateTag

      public CompoundTag getUpdateTag()
    • isRemoved

      public boolean isRemoved()
    • setRemoved

      public void setRemoved()
    • onChunkUnloaded

      public void onChunkUnloaded()
      Specified by:
      onChunkUnloaded in interface IForgeBlockEntity
    • clearRemoved

      public void clearRemoved()
    • triggerEvent

      public boolean triggerEvent(int p_58889_, int p_58890_)
    • fillCrashReportCategory

      public void fillCrashReportCategory(CrashReportCategory p_58887_)
    • onlyOpCanSetNbt

      public boolean onlyOpCanSetNbt()
    • getType

      public BlockEntityType<?> getType()
    • getTileData

      public CompoundTag getTileData()
      Description copied from interface: IForgeBlockEntity
      Gets a CompoundTag 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.
      Specified by:
      getTileData in interface IForgeBlockEntity
      Returns:
      A compound tag for custom data
    • setBlockState

      @Deprecated public void setBlockState(BlockState p_155251_)
      Deprecated.