Class BlockEntity
java.lang.Object
net.neoforged.neoforge.common.capabilities.CapabilityProvider<BlockEntity>
net.minecraft.world.level.block.entity.BlockEntity
- All Implemented Interfaces:
ICapabilityProvider
,ICapabilityProviderImpl<BlockEntity>
,ICapabilitySerializable<CompoundTag>
,IBlockEntityExtension
,INBTSerializable<CompoundTag>
- Direct Known Subclasses:
BannerBlockEntity
,BaseContainerBlockEntity
,BeaconBlockEntity
,BedBlockEntity
,BeehiveBlockEntity
,BellBlockEntity
,BlockEntityOnLoadTest.TestBlockEntity
,BrushableBlockEntity
,CampfireBlockEntity
,ChiseledBookShelfBlockEntity
,CommandBlockEntity
,ComparatorBlockEntity
,ConduitBlockEntity
,CustomItemDisplayContextTest.ItemHangerBlockEntity
,DaylightDetectorBlockEntity
,DecoratedPotBlockEntity
,EnchantmentTableBlockEntity
,EnderChestBlockEntity
,FluidHandlerBlockEntity
,FullPotsAccessorDemo.DioriteFlowerPotBlockEntity
,GameTestTest.EnergyBlockEntity
,JigsawBlockEntity
,JukeboxBlockEntity
,LecternBlockEntity
,LevelSensitiveLightBlockTest.LightBlockEntity
,MegaModelTest.TestBlock.Entity
,PistonMovingBlockEntity
,SculkCatalystBlockEntity
,SculkSensorBlockEntity
,SculkShriekerBlockEntity
,SignBlockEntity
,SkullBlockEntity
,SpawnerBlockEntity
,StructureBlockEntity
,TheEndPortalBlockEntity
public abstract class BlockEntity
extends CapabilityProvider<BlockEntity>
implements IBlockEntityExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.common.capabilities.CapabilityProvider
CapabilityProvider.AsField<B extends ICapabilityProviderImpl<B>>
-
Field Summary
Modifier and TypeFieldDescriptionprivate BlockState
private CompoundTag
protected Level
private static final org.slf4j.Logger
protected boolean
private final BlockEntityType<?>
protected final BlockPos
-
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_) void
boolean
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_) void
void
boolean
triggerEvent
(int p_58889_, int p_58890_) Methods inherited from class net.neoforged.neoforge.common.capabilities.CapabilityProvider
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, getCapability, invalidateCaps, reviveCaps, serializeCaps
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.common.extensions.IBlockEntityExtension
deserializeNBT, getModelData, handleUpdateTag, hasCustomOutlineRendering, onDataPacket, onLoad, requestModelDataUpdate, serializeNBT
Methods inherited from interface net.neoforged.neoforge.common.capabilities.ICapabilityProvider
getCapability, getCapability
-
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() -
onChunkUnloaded
public void onChunkUnloaded()- Specified by:
onChunkUnloaded
in interfaceIBlockEntityExtension
-
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
-
setBlockState
Deprecated.
-