Class BlockEntityWithEntity<E extends net.minecraft.world.entity.Entity>
java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
net.minecraft.world.level.block.entity.BlockEntity
net.jcm.vsch.blocks.custom.template.BlockEntityWithEntity<E>
- Type Parameters:
E- The entity class to be using
- All Implemented Interfaces:
ParticleBlockEntity,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>
- Direct Known Subclasses:
MagnetBlockEntity
public abstract class BlockEntityWithEntity<E extends net.minecraft.world.entity.Entity>
extends net.minecraft.world.level.block.entity.BlockEntity
implements ParticleBlockEntity
A block entity for spawning and removing an entity with the block.
Make sure to overwrite createLinkedEntity.
- See Also:
-
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
level, remove, worldPositionFields inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity
INFINITE_EXTENT_AABB -
Constructor Summary
ConstructorsConstructorDescriptionBlockEntityWithEntity(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 TypeMethodDescriptionabstract EcreateLinkedEntity(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos) The function used by this BE to create the entity object to spawn.voidload(net.minecraft.nbt.CompoundTag tag) voidvoidsaveAdditional(net.minecraft.nbt.CompoundTag tag) voidvoidvoidtickForce(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) voidtickParticles(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, loadStatic, onChunkUnloaded, onlyOpCanSetNbt, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setLevel, setRemoved, triggerEventMethods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, getCapability, invalidateCaps, reviveCaps, serializeCapsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider
getCapability, getCapabilityMethods inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity
deserializeNBT, getModelData, getRenderBoundingBox, handleUpdateTag, hasCustomOutlineRendering, onDataPacket, onLoad, requestModelDataUpdate, serializeNBTMethods inherited from interface net.jcm.vsch.blocks.entity.template.ParticleBlockEntity
clientTick, serverTick
-
Constructor Details
-
BlockEntityWithEntity
public BlockEntityWithEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> type, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
-
-
Method Details
-
spawnLinkedEntity
public void spawnLinkedEntity() -
spawnLinkedEntityIfNeeded
public void spawnLinkedEntityIfNeeded() -
removeLinkedEntity
public void removeLinkedEntity() -
createLinkedEntity
public abstract E createLinkedEntity(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos) The function used by this BE to create the entity object to spawn. Overwrite with creating a new object of your entity class.- Parameters:
level- Level, for help creating the entity object- Returns:
-
saveAdditional
public void saveAdditional(net.minecraft.nbt.CompoundTag tag) - Overrides:
saveAdditionalin classnet.minecraft.world.level.block.entity.BlockEntity
-
load
public void load(net.minecraft.nbt.CompoundTag tag) - Overrides:
loadin classnet.minecraft.world.level.block.entity.BlockEntity
-
tickParticles
public void tickParticles(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) - Specified by:
tickParticlesin interfaceParticleBlockEntity
-
tickForce
public void tickForce(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) - Specified by:
tickForcein interfaceParticleBlockEntity
-