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, worldPosition

    Fields inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity

    INFINITE_EXTENT_AABB
  • Constructor Summary

    Constructors
    Constructor
    Description
    BlockEntityWithEntity(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 Type
    Method
    Description
    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.
    void
    load(net.minecraft.nbt.CompoundTag tag)
     
    void
     
    void
    saveAdditional(net.minecraft.nbt.CompoundTag tag)
     
    void
     
    void
     
    void
    tickForce(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
     
    void
    tickParticles(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, triggerEvent

    Methods inherited from class net.minecraftforge.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.minecraftforge.common.capabilities.ICapabilityProvider

    getCapability, getCapability

    Methods inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity

    deserializeNBT, getModelData, getRenderBoundingBox, handleUpdateTag, hasCustomOutlineRendering, onDataPacket, onLoad, requestModelDataUpdate, serializeNBT

    Methods 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:
      saveAdditional in class net.minecraft.world.level.block.entity.BlockEntity
    • load

      public void load(net.minecraft.nbt.CompoundTag tag)
      Overrides:
      load in class net.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:
      tickParticles in interface ParticleBlockEntity
    • 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:
      tickForce in interface ParticleBlockEntity