Class BlockEntityBase

java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
org.moddingx.libx.base.tile.BlockEntityBase
All Implemented Interfaces:
net.minecraft.core.TypedInstance<net.minecraft.world.level.block.entity.BlockEntityType<?>>, net.minecraft.util.debug.DebugValueSource, net.neoforged.neoforge.attachment.IAttachmentHolder, net.neoforged.neoforge.common.extensions.IBlockEntityExtension, net.neoforged.neoforge.common.extensions.TypedInstanceExtension<net.minecraft.world.level.block.entity.BlockEntityType<?>>, net.neoforged.neoforge.registries.datamaps.IWithData<net.minecraft.world.level.block.entity.BlockEntityType<?>>

public class BlockEntityBase extends net.minecraft.world.level.block.entity.BlockEntity
A base class for block entities. This provides some useful methods.
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    net.neoforged.neoforge.attachment.AttachmentHolder.AsField

    Nested classes/interfaces inherited from interface net.minecraft.util.debug.DebugValueSource

    net.minecraft.util.debug.DebugValueSource.Registration, net.minecraft.util.debug.DebugValueSource.ValueGetter<T>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final Logger
     

    Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity

    blockState, level, remove, worldPosition

    Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    ATTACHMENTS_NBT_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
    BlockEntityBase(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final <T,C> T
    getCapability(net.neoforged.neoforge.capabilities.BlockCapability<T,C> capability, C context)
     
    net.minecraft.nbt.CompoundTag
    getUpdateTag(net.minecraft.core.HolderLookup.Provider registries)
     
    void
    If the block entity is loaded on the logical client, this will update the block entity using getUpdateTag(HolderLookup.Provider) and IBlockEntityExtension.handleUpdateTag(ValueInput).
    void
    preRemoveSideEffects(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
     
    void
     
    void
    When called on the logical server, this will update the block entity to all clients that are tracking it using getUpdateTag(HolderLookup.Provider) and IBlockEntityExtension.handleUpdateTag(ValueInput) at the end of the current tick.

    Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity

    addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getAndClearAttachmentTypesToSync, getBlockPos, getBlockState, getLevel, getNameForReporting, getPersistentData, getPosFromTag, getType, getUpdatePacket, hasLevel, isRemoved, isValidBlockState, loadAdditional, loadCustomOnly, loadStatic, loadWithComponents, parseCustomNameSafe, problemPath, registerDebugValues, removeComponentsFromTag, removeData, saveAdditional, saveCustomOnly, saveCustomOnly, saveWithFullMetadata, saveWithFullMetadata, saveWithId, saveWithoutMetadata, saveWithoutMetadata, setBlockState, setChanged, setComponents, setData, setLevel, setRemoved, syncData, triggerEvent, typeHolder

    Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachments

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder

    getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncData

    Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension

    applyStructureRotation, getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, requestModelDataUpdate

    Methods inherited from interface net.minecraft.core.TypedInstance

    is, is, is, is, is, tags

    Methods inherited from interface net.neoforged.neoforge.common.extensions.TypedInstanceExtension

    getData
  • Field Details

    • LOGGER

      protected static final Logger LOGGER
  • Constructor Details

    • BlockEntityBase

      public BlockEntityBase(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
  • Method Details

    • preRemoveSideEffects

      public void preRemoveSideEffects(@Nonnull net.minecraft.core.BlockPos pos, @Nonnull net.minecraft.world.level.block.state.BlockState state)
      Overrides:
      preRemoveSideEffects in class net.minecraft.world.level.block.entity.BlockEntity
    • getCapability

      @Nullable public final <T,C> T getCapability(net.neoforged.neoforge.capabilities.BlockCapability<T,C> capability, C context)
    • getUpdateTag

      @Nonnull public net.minecraft.nbt.CompoundTag getUpdateTag(@Nonnull net.minecraft.core.HolderLookup.Provider registries)
      Overrides:
      getUpdateTag in class net.minecraft.world.level.block.entity.BlockEntity
    • onLoad

      public void onLoad()
      If the block entity is loaded on the logical client, this will update the block entity using getUpdateTag(HolderLookup.Provider) and IBlockEntityExtension.handleUpdateTag(ValueInput).
    • setChanged

      public void setChanged()
      Overrides:
      setChanged in class net.minecraft.world.level.block.entity.BlockEntity
    • setDispatchable

      public void setDispatchable()
      When called on the logical server, this will update the block entity to all clients that are tracking it using getUpdateTag(HolderLookup.Provider) and IBlockEntityExtension.handleUpdateTag(ValueInput) at the end of the current tick.