Interface IBlockEntityExtension

All Known Implementing Classes:
net.minecraft.world.level.block.entity.BlockEntity, BlockPropertyTests.LightBlockEntity, CustomHeadTest.CustomSkullBlockEntity, CustomItemDisplayContextTest.ItemHangerBlockEntity, CustomSignsTest.CustomHangingSignBlockEntity, CustomSignsTest.CustomSignBlockEntity, FullPotsAccessorDemo.DioriteFlowerPotBlockEntity, net.minecraft.world.level.block.entity.HangingSignBlockEntity, MegaModelTest.TestBlock.Entity, net.minecraft.world.level.block.entity.SignBlockEntity, net.minecraft.world.level.block.entity.SkullBlockEntity

public interface IBlockEntityExtension
  • Method Summary

    Modifier and Type
    Method
    Description
    default ModelData
    Allows you to return additional model data.
    net.minecraft.nbt.CompoundTag
    Gets a CompoundTag that can be used to store custom data for this block entity.
    default void
    handleUpdateTag(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider lookupProvider)
    Called when the chunk's TE update tag, gotten from BlockEntity.getUpdateTag(HolderLookup.Provider), is received on the client.
    default void
    Notify all listeners that the capabilities at the positions of this block entity might have changed.
    default void
     
    default void
    onDataPacket(net.minecraft.network.Connection net, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket pkt, net.minecraft.core.HolderLookup.Provider lookupProvider)
    Called when you receive a TileEntityData packet for the location this TileEntity is currently in.
    default void
    Called when this is first added to the world (by LevelChunk.addAndRegisterBlockEntity(BlockEntity)) or right before the first tick when the chunk is generated or loaded from disk.
    default void
    Requests a refresh for the model data of your TE Call this every time your getModelData() changes
    private net.minecraft.world.level.block.entity.BlockEntity
     
  • Method Details

    • self

      private net.minecraft.world.level.block.entity.BlockEntity self()
    • onDataPacket

      default void onDataPacket(net.minecraft.network.Connection net, net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket pkt, net.minecraft.core.HolderLookup.Provider lookupProvider)
      Called when you receive a TileEntityData packet for the location this TileEntity is currently in. On the client, the NetworkManager will always be the remote server. On the server, it will be whomever is responsible for sending the packet.
      Parameters:
      net - The NetworkManager the packet originated from
      pkt - The data packet
    • handleUpdateTag

      default void handleUpdateTag(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider lookupProvider)
      Called when the chunk's TE update tag, gotten from BlockEntity.getUpdateTag(HolderLookup.Provider), is received on the client.

      Used to handle this tag in a special way. By default this simply calls BlockEntity.loadWithComponents(CompoundTag, HolderLookup.Provider).

      Parameters:
      tag - The CompoundTag sent from BlockEntity.getUpdateTag(HolderLookup.Provider)
    • getPersistentData

      net.minecraft.nbt.CompoundTag getPersistentData()
      Gets a CompoundTag that can be used to store custom data for this block entity. It will be written, and read from disc, so it persists over world saves.
      Returns:
      A compound tag for custom persistent data
    • onChunkUnloaded

      default void onChunkUnloaded()
    • onLoad

      default void onLoad()
      Called when this is first added to the world (by LevelChunk.addAndRegisterBlockEntity(BlockEntity)) or right before the first tick when the chunk is generated or loaded from disk. Override instead of adding if (firstTick) stuff in update.
    • requestModelDataUpdate

      default void requestModelDataUpdate()
      Requests a refresh for the model data of your TE Call this every time your getModelData() changes
    • getModelData

      default ModelData getModelData()
      Allows you to return additional model data. This data can be used to provide additional functionality in your BlockStateModel. You need to schedule a refresh of you model data via requestModelDataUpdate() if the result of this function changes.

      This method is always called on the main client thread.

      Returns:
      Your model data
    • invalidateCapabilities

      @NonExtendable default void invalidateCapabilities()
      Notify all listeners that the capabilities at the positions of this block entity might have changed. This includes new capabilities becoming available.

      This is just a convenience method for ILevelExtension.invalidateCapabilities(BlockPos).