Package org.moddingx.libx.base.tile
Class BlockEntityBase
java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
net.minecraft.world.level.block.entity.BlockEntity
org.moddingx.libx.base.tile.BlockEntityBase
- All Implemented Interfaces:
net.minecraftforge.common.capabilities.ICapabilityProvider
,net.minecraftforge.common.capabilities.ICapabilityProviderImpl<net.minecraft.world.level.block.entity.BlockEntity>
,net.minecraftforge.common.capabilities.ICapabilitySerializable<net.minecraft.nbt.CompoundTag>
,net.minecraftforge.common.extensions.IForgeBlockEntity
,net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
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.minecraftforge.common.capabilities.CapabilityProvider
net.minecraftforge.common.capabilities.CapabilityProvider.AsField<B extends net.minecraftforge.common.capabilities.ICapabilityProviderImpl<B>>
-
Field Summary
Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity
blockState, level, remove, worldPosition
Fields inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity
INFINITE_EXTENT_AABB
-
Constructor Summary
ConstructorDescriptionBlockEntityBase
(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) BlockEntityBase
(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraftforge.common.capabilities.Capability<?>... caps) This constructor accepts some capabilities that this block entity will have. -
Method Summary
Modifier and TypeMethodDescription<T> net.minecraftforge.common.util.LazyOptional<T>
getCapability
(net.minecraftforge.common.capabilities.Capability<T> cap, net.minecraft.core.Direction side) void
onLoad()
If the block entity is loaded on the logical client, this will update the block entity usingBlockEntity.getUpdateTag()
andIForgeBlockEntity.handleUpdateTag(CompoundTag)
.void
When called on the logical server, this will update the block entity to all clients that are tracking it usingBlockEntity.getUpdateTag()
andIForgeBlockEntity.handleUpdateTag(CompoundTag)
at the end of the current tick.Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, load, loadStatic, onChunkUnloaded, onlyOpCanSetNbt, saveAdditional, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setLevel, setRemoved, triggerEvent
Methods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, 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.minecraftforge.common.capabilities.ICapabilityProvider
getCapability
Methods inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity
deserializeNBT, getModelData, getRenderBoundingBox, handleUpdateTag, hasCustomOutlineRendering, onDataPacket, requestModelDataUpdate, serializeNBT
-
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) -
BlockEntityBase
public BlockEntityBase(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraftforge.common.capabilities.Capability<?>... caps) This constructor accepts some capabilities that this block entity will have. Just make sure that the class also implements the required capability types or you might crash the game.
-
-
Method Details
-
getCapability
@Nonnull public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(@Nonnull net.minecraftforge.common.capabilities.Capability<T> cap, @Nullable net.minecraft.core.Direction side) - Specified by:
getCapability
in interfacenet.minecraftforge.common.capabilities.ICapabilityProvider
- Overrides:
getCapability
in classnet.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
-
onLoad
public void onLoad()If the block entity is loaded on the logical client, this will update the block entity usingBlockEntity.getUpdateTag()
andIForgeBlockEntity.handleUpdateTag(CompoundTag)
. -
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()
andIForgeBlockEntity.handleUpdateTag(CompoundTag)
at the end of the current tick.
-