Class BlockEntity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
- All Implemented Interfaces:
IAttachmentHolder
,IBlockEntityExtension
- Direct Known Subclasses:
BannerBlockEntity
,BaseContainerBlockEntity
,BeaconBlockEntity
,BedBlockEntity
,BeehiveBlockEntity
,BellBlockEntity
,BlockPropertyTests.LightBlockEntity
,BrushableBlockEntity
,CampfireBlockEntity
,ChiseledBookShelfBlockEntity
,CommandBlockEntity
,ComparatorBlockEntity
,ConduitBlockEntity
,CustomItemDisplayContextTest.ItemHangerBlockEntity
,DaylightDetectorBlockEntity
,DecoratedPotBlockEntity
,EnchantingTableBlockEntity
,EnderChestBlockEntity
,FullPotsAccessorDemo.DioriteFlowerPotBlockEntity
,GameTestTest.EnergyBlockEntity
,JigsawBlockEntity
,JukeboxBlockEntity
,LecternBlockEntity
,MegaModelTest.TestBlock.Entity
,PistonMovingBlockEntity
,SculkCatalystBlockEntity
,SculkSensorBlockEntity
,SculkShriekerBlockEntity
,SignBlockEntity
,SkullBlockEntity
,SpawnerBlockEntity
,StructureBlockEntity
,TheEndPortalBlockEntity
,TrialSpawnerBlockEntity
,VaultBlockEntity
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
protected static interface
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField
-
Field Summary
Modifier and TypeFieldDescriptionprivate BlockState
private DataComponentMap
private CompoundTag
protected Level
private static final org.slf4j.Logger
protected boolean
private final BlockEntityType
<?> protected final BlockPos
Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEY
-
Constructor Summary
ConstructorDescriptionBlockEntity
(BlockEntityType<?> p_155228_, BlockPos p_155229_, BlockState p_155230_) -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addEntityType
(CompoundTag p_187469_, BlockEntityType<?> p_187470_) final void
applyComponents
(DataComponentMap p_330364_, DataComponentPatch p_338381_) final void
applyComponentsFromItemStack
(ItemStack p_338428_) protected void
void
final DataComponentMap
protected void
void
fillCrashReportCategory
(CrashReportCategory p_58887_) getLevel()
Gets aCompoundTag
that can be used to store custom data for this block entity.static BlockPos
getPosFromTag
(CompoundTag p_187473_) getType()
getUpdateTag
(HolderLookup.Provider p_323910_) boolean
hasLevel()
boolean
protected void
loadAdditional
(CompoundTag p_338466_, HolderLookup.Provider p_338445_) final void
loadCustomOnly
(CompoundTag p_338387_, HolderLookup.Provider p_338713_) static BlockEntity
loadStatic
(BlockPos p_155242_, BlockState p_155243_, CompoundTag p_155244_, HolderLookup.Provider p_323542_) final void
loadWithComponents
(CompoundTag p_338356_, HolderLookup.Provider p_338558_) boolean
static Component
parseCustomNameSafe
(String p_342033_, HolderLookup.Provider p_342030_) void
removeComponentsFromTag
(CompoundTag p_332032_) Deprecated.final <T> T
removeData
(AttachmentType<T> type) Removes the data attachment of the given type.protected void
saveAdditional
(CompoundTag p_187471_, HolderLookup.Provider p_323635_) final CompoundTag
saveCustomAndMetadata
(HolderLookup.Provider p_339688_) final CompoundTag
saveCustomOnly
(HolderLookup.Provider p_338656_) private void
saveId
(CompoundTag p_187475_) private void
saveMetadata
(CompoundTag p_187479_) void
saveToItem
(ItemStack p_187477_, HolderLookup.Provider p_323484_) final CompoundTag
saveWithFullMetadata
(HolderLookup.Provider p_323767_) final CompoundTag
saveWithId
(HolderLookup.Provider p_324357_) final CompoundTag
saveWithoutMetadata
(HolderLookup.Provider p_324030_) void
setBlockState
(BlockState p_155251_) Deprecated.void
protected static void
setChanged
(Level p_155233_, BlockPos p_155234_, BlockState p_155235_) void
setComponents
(DataComponentMap p_338529_) final <T> T
setData
(AttachmentType<T> type, T data) Sets the data attachment of the given type.void
void
boolean
triggerEvent
(int p_58889_, int p_58890_) Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingData, hasAttachments, hasData, serializeAttachments
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, hasData, removeData, setData
Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdate
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
type
-
level
-
worldPosition
-
remove
protected boolean remove -
blockState
-
components
-
customPersistentData
-
-
Constructor Details
-
BlockEntity
-
-
Method Details
-
getPosFromTag
-
getLevel
-
setLevel
-
hasLevel
public boolean hasLevel() -
loadAdditional
-
loadWithComponents
-
loadCustomOnly
-
saveAdditional
-
saveWithFullMetadata
-
saveWithId
-
saveWithoutMetadata
-
saveCustomOnly
-
saveCustomAndMetadata
-
saveId
-
addEntityType
-
saveToItem
-
saveMetadata
-
loadStatic
@Nullable public static BlockEntity loadStatic(BlockPos p_155242_, BlockState p_155243_, CompoundTag p_155244_, HolderLookup.Provider p_323542_) -
setChanged
public void setChanged() -
setChanged
-
getBlockPos
-
getBlockState
-
getUpdatePacket
-
getUpdateTag
-
isRemoved
public boolean isRemoved() -
setRemoved
public void setRemoved() -
clearRemoved
public void clearRemoved() -
triggerEvent
public boolean triggerEvent(int p_58889_, int p_58890_) -
fillCrashReportCategory
-
onlyOpCanSetNbt
public boolean onlyOpCanSetNbt() -
getType
-
getPersistentData
Description copied from interface:IBlockEntityExtension
Gets aCompoundTag
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.- Specified by:
getPersistentData
in interfaceIBlockEntityExtension
- Returns:
- A compound tag for custom persistent data
-
setData
Description copied from interface:IAttachmentHolder
Sets the data attachment of the given type.- Specified by:
setData
in interfaceIAttachmentHolder
- Overrides:
setData
in classAttachmentHolder
- Returns:
- the previous value for that attachment type, if any, or
null
if there was none
-
removeData
Description copied from interface:IAttachmentHolder
Removes the data attachment of the given type.- Specified by:
removeData
in interfaceIAttachmentHolder
- Overrides:
removeData
in classAttachmentHolder
- Returns:
- the previous value for that attachment type, if any, or
null
if there was none
-
setBlockState
Deprecated. -
applyImplicitComponents
-
applyComponentsFromItemStack
-
applyComponents
-
collectImplicitComponents
-
removeComponentsFromTag
Deprecated. -
collectComponents
-
components
-
setComponents
-
parseCustomNameSafe
@Nullable public static Component parseCustomNameSafe(String p_342033_, HolderLookup.Provider p_342030_)
-