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
Nested ClassesModifier and TypeClassDescription(package private) static classprotected static interfaceNested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BlockStateprivate DataComponentMapprivate CompoundTagprotected Levelprivate static final org.slf4j.Loggerprotected booleanprivate final BlockEntityType<?> protected final BlockPosFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEY -
Constructor Summary
ConstructorsConstructorDescriptionBlockEntity(BlockEntityType<?> p_155228_, BlockPos p_155229_, BlockState p_155230_) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddEntityType(CompoundTag p_187469_, BlockEntityType<?> p_187470_) final voidapplyComponents(DataComponentMap p_330364_, DataComponentPatch p_338381_) final voidapplyComponentsFromItemStack(ItemStack p_338428_) protected voidvoidfinal DataComponentMapprotected voidvoidfillCrashReportCategory(CrashReportCategory p_58887_) getLevel()Gets aCompoundTagthat can be used to store custom data for this block entity.static BlockPosgetPosFromTag(CompoundTag p_187473_) getType()getUpdateTag(HolderLookup.Provider p_323910_) booleanhasLevel()booleanprotected voidloadAdditional(CompoundTag p_338466_, HolderLookup.Provider p_338445_) final voidloadCustomOnly(CompoundTag p_338387_, HolderLookup.Provider p_338713_) static BlockEntityloadStatic(BlockPos p_155242_, BlockState p_155243_, CompoundTag p_155244_, HolderLookup.Provider p_323542_) final voidloadWithComponents(CompoundTag p_338356_, HolderLookup.Provider p_338558_) booleanstatic ComponentparseCustomNameSafe(String p_342033_, HolderLookup.Provider p_342030_) voidremoveComponentsFromTag(CompoundTag p_332032_) Deprecated.final <T> TremoveData(AttachmentType<T> type) Removes the data attachment of the given type.protected voidsaveAdditional(CompoundTag p_187471_, HolderLookup.Provider p_323635_) final CompoundTagsaveCustomAndMetadata(HolderLookup.Provider p_339688_) final CompoundTagsaveCustomOnly(HolderLookup.Provider p_338656_) private voidsaveId(CompoundTag p_187475_) private voidsaveMetadata(CompoundTag p_187479_) voidsaveToItem(ItemStack p_187477_, HolderLookup.Provider p_323484_) final CompoundTagsaveWithFullMetadata(HolderLookup.Provider p_323767_) final CompoundTagsaveWithId(HolderLookup.Provider p_324357_) final CompoundTagsaveWithoutMetadata(HolderLookup.Provider p_324030_) voidsetBlockState(BlockState p_155251_) Deprecated.voidprotected static voidsetChanged(Level p_155233_, BlockPos p_155234_, BlockState p_155235_) voidsetComponents(DataComponentMap p_338529_) final <T> TsetData(AttachmentType<T> type, T data) Sets the data attachment of the given type.voidvoidbooleantriggerEvent(int p_58889_, int p_58890_) Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingData, hasAttachments, hasData, serializeAttachmentsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, hasData, removeData, setDataMethods 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:IBlockEntityExtensionGets aCompoundTagthat 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:
getPersistentDatain interfaceIBlockEntityExtension- Returns:
- A compound tag for custom persistent data
-
setData
Description copied from interface:IAttachmentHolderSets the data attachment of the given type.- Specified by:
setDatain interfaceIAttachmentHolder- Overrides:
setDatain classAttachmentHolder- Returns:
- the previous value for that attachment type, if any, or
nullif there was none
-
removeData
Description copied from interface:IAttachmentHolderRemoves the data attachment of the given type.- Specified by:
removeDatain interfaceIAttachmentHolder- Overrides:
removeDatain classAttachmentHolder- Returns:
- the previous value for that attachment type, if any, or
nullif 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_)
-