Package org.moddingx.libx.base.tile
Class BlockEntityBase
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
org.moddingx.libx.base.tile.BlockEntityBase
- All Implemented Interfaces:
net.neoforged.neoforge.attachment.IAttachmentHolder
,net.neoforged.neoforge.common.extensions.IBlockEntityExtension
public class BlockEntityBase
extends net.minecraft.world.level.block.entity.BlockEntity
A base class for
block entities
. This provides some useful methods.-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.entity.BlockEntity.DataComponentInput
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
net.neoforged.neoforge.attachment.AttachmentHolder.AsField
-
Field Summary
Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity
blockState, level, remove, worldPosition
Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEY
-
Constructor Summary
ConstructorsConstructorDescriptionBlockEntityBase
(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) -
Method Summary
Modifier and TypeMethodDescriptionfinal <T,
C> T getCapability
(net.neoforged.neoforge.capabilities.BlockCapability<T, C> capability, C context) void
onLoad()
If the block entity is loaded on the logical client, this will update the block entity usingBlockEntity.getUpdateTag(HolderLookup.Provider)
andIBlockEntityExtension.handleUpdateTag(CompoundTag, HolderLookup.Provider)
.void
void
When called on the logical server, this will update the block entity to all clients that are tracking it usingBlockEntity.getUpdateTag(HolderLookup.Provider)
andIBlockEntityExtension.handleUpdateTag(CompoundTag, HolderLookup.Provider)
at the end of the current tick.Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, isValidBlockState, loadAdditional, loadCustomOnly, loadStatic, loadWithComponents, onlyOpCanSetNbt, parseCustomNameSafe, removeComponentsFromTag, removeData, saveAdditional, saveCustomAndMetadata, saveCustomOnly, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setComponents, setData, setLevel, setRemoved, triggerEvent
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, requestModelDataUpdate
-
Constructor Details
-
BlockEntityBase
public BlockEntityBase(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
-
-
Method Details
-
getCapability
@Nullable public final <T,C> T getCapability(net.neoforged.neoforge.capabilities.BlockCapability<T, C> capability, C context) -
onLoad
public void onLoad()If the block entity is loaded on the logical client, this will update the block entity usingBlockEntity.getUpdateTag(HolderLookup.Provider)
andIBlockEntityExtension.handleUpdateTag(CompoundTag, HolderLookup.Provider)
. -
setChanged
public void setChanged()- Overrides:
setChanged
in classnet.minecraft.world.level.block.entity.BlockEntity
-
setDispatchable
public void setDispatchable()When called on the logical server, this will update the block entity to all clients that are tracking it usingBlockEntity.getUpdateTag(HolderLookup.Provider)
andIBlockEntityExtension.handleUpdateTag(CompoundTag, HolderLookup.Provider)
at the end of the current tick.
-