Class BlockEntity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
- All Implemented Interfaces:
 IAttachmentHolder,IBlockEntityExtension,INBTSerializable<CompoundTag>
- Direct Known Subclasses:
 BannerBlockEntity,BaseContainerBlockEntity,BeaconBlockEntity,BedBlockEntity,BeehiveBlockEntity,BellBlockEntity,BrushableBlockEntity,CampfireBlockEntity,ChiseledBookShelfBlockEntity,CommandBlockEntity,ComparatorBlockEntity,ConduitBlockEntity,DaylightDetectorBlockEntity,DecoratedPotBlockEntity,EnchantmentTableBlockEntity,EnderChestBlockEntity,JigsawBlockEntity,JukeboxBlockEntity,LecternBlockEntity,PistonMovingBlockEntity,SculkCatalystBlockEntity,SculkSensorBlockEntity,SculkShriekerBlockEntity,SignBlockEntity,SkullBlockEntity,SpawnerBlockEntity,StructureBlockEntity,TheEndPortalBlockEntity,TrialSpawnerBlockEntity
- 
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField - 
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BlockStateprivate 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_) voidvoidfillCrashReportCategory(CrashReportCategory p_58887_) getLevel()Gets aCompoundTagthat can be used to store custom data for this block entity.static BlockPosgetPosFromTag(CompoundTag p_187473_) getType()booleanhasLevel()booleanvoidload(CompoundTag p_155245_) static BlockEntityloadStatic(BlockPos p_155242_, BlockState p_155243_, CompoundTag p_155244_) booleanfinal <T> TremoveData(AttachmentType<T> type) Removes the data attachment of the given type.protected voidsaveAdditional(CompoundTag p_187471_) private voidsaveId(CompoundTag p_187475_) private voidsaveMetadata(CompoundTag p_187479_) voidsaveToItem(ItemStack p_187477_) final CompoundTagfinal CompoundTagfinal CompoundTagvoidsetBlockState(BlockState p_155251_) Deprecated.voidprotected static voidsetChanged(Level p_155233_, BlockPos p_155234_, BlockState p_155235_) 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
areAttachmentsCompatible, deserializeAttachments, getData, 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, hasData, removeData, setDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
deserializeNBT, getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdate, serializeNBT 
- 
Field Details
- 
LOGGER
private static final org.slf4j.Logger LOGGER - 
type
 - 
level
 - 
worldPosition
 - 
remove
protected boolean remove - 
blockState
 - 
customPersistentData
 
 - 
 - 
Constructor Details
- 
BlockEntity
 
 - 
 - 
Method Details
- 
getPosFromTag
 - 
getLevel
 - 
setLevel
 - 
hasLevel
public boolean hasLevel() - 
load
 - 
saveAdditional
 - 
saveWithFullMetadata
 - 
saveWithId
 - 
saveWithoutMetadata
 - 
saveId
 - 
addEntityType
 - 
saveToItem
 - 
saveMetadata
 - 
loadStatic
@Nullable public static BlockEntity loadStatic(BlockPos p_155242_, BlockState p_155243_, CompoundTag p_155244_)  - 
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. 
 -