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
,BlockPropertyTests.LightBlockEntity
,BrushableBlockEntity
,CampfireBlockEntity
,ChiseledBookShelfBlockEntity
,CommandBlockEntity
,ComparatorBlockEntity
,ConduitBlockEntity
,CustomItemDisplayContextTest.ItemHangerBlockEntity
,DaylightDetectorBlockEntity
,DecoratedPotBlockEntity
,EnchantmentTableBlockEntity
,EnderChestBlockEntity
,FullPotsAccessorDemo.DioriteFlowerPotBlockEntity
,GameTestTest.EnergyBlockEntity
,JigsawBlockEntity
,JukeboxBlockEntity
,LecternBlockEntity
,MegaModelTest.TestBlock.Entity
,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
Modifier and TypeFieldDescriptionprivate BlockState
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_) 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()
boolean
hasLevel()
boolean
void
load
(CompoundTag p_155245_) static BlockEntity
loadStatic
(BlockPos p_155242_, BlockState p_155243_, CompoundTag p_155244_) boolean
final <T> T
removeData
(AttachmentType<T> type) Removes the data attachment of the given type.protected void
saveAdditional
(CompoundTag p_187471_) private void
saveId
(CompoundTag p_187475_) private void
saveMetadata
(CompoundTag p_187479_) void
saveToItem
(ItemStack p_187477_) final CompoundTag
final CompoundTag
final CompoundTag
void
setBlockState
(BlockState p_155251_) Deprecated.void
protected static void
setChanged
(Level p_155233_, BlockPos p_155234_, BlockState p_155235_) 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
areAttachmentsCompatible, deserializeAttachments, getData, 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, hasData, removeData, setData
Methods 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: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.
-