Interface IEntityExtension

All Known Subinterfaces:
ILivingEntityExtension
All Known Implementing Classes:
net.minecraft.world.entity.AgeableMob, net.minecraft.world.entity.animal.Animal, net.minecraft.world.entity.Entity, EntityDataSerializerTest.TestEntity, EntityRendererEventsTest.MyEntity, EntityTests.AdaptedSpawnEntity, EntityTests.CustomComplexSpawnEntity, EntityTests.SimpleEntity, FakePlayer, GameTestPlayer, net.minecraft.world.entity.LivingEntity, net.minecraft.world.entity.Mob, PartEntity, PartEntityTest.TestEntity, PartEntityTest.TestEntityPart, net.minecraft.world.entity.PathfinderMob, net.minecraft.world.entity.animal.Pig, net.minecraft.world.entity.player.Player, net.minecraft.server.level.ServerPlayer

public interface IEntityExtension
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    canBeRiddenUnderFluidType(FluidType type, net.minecraft.world.entity.Entity rider)
    Returns whether the entity can ride in this vehicle under the fluid.
    default boolean
    Returns whether the entity can be extinguished by this fluid.
    default boolean
    Returns whether the entity can be hydrated by this fluid.
    default boolean
    If a rider of this entity can interact with this entity.
    default boolean
    Returns whether the entity can start swimming in the fluid.
    default boolean
    Returns whether the entity can swim in the fluid.
    boolean
    canTrample(net.minecraft.server.level.ServerLevel level, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, double fallDistance)
    Checks if this Entity can trample a Block.
    @Nullable Collection<net.minecraft.world.entity.item.ItemEntity>
     
    Collection<net.minecraft.world.entity.item.ItemEntity>
    captureDrops(@Nullable Collection<net.minecraft.world.entity.item.ItemEntity> captureDrops)
     
    default void
    copyAttachmentsFrom(net.minecraft.world.entity.Entity other, boolean isDeath)
    Copies the serialized attachments from another entity to this entity.
    default net.minecraft.world.entity.MobCategory
    getClassification(boolean forSpawnCount)
    Returns The classification of this entity
    Returns the fluid that is on the entity's eyes.
    default float
    Returns how much the fluid should scale the damage done to a falling entity when hitting the ground per tick.
    default double
    Returns how much the velocity of the fluid should be scaled by when applied to an entity.
    double
    Returns the height of the fluid type in relation to the bounding box of the entity.
    Returns the fluid type which is the highest on the bounding box of the entity.
    default @Nullable PartEntity<?>[]
    Gets the individual sub parts that make up this entity.
    net.minecraft.nbt.CompoundTag
    Returns a NBTTagCompound that can be used to store custom data for this entity.
    default @Nullable net.minecraft.sounds.SoundEvent
    Returns a sound to play when a certain action is performed by the entity in the fluid.
    default boolean
    hasCustomOutlineRendering(net.minecraft.world.entity.player.Player player)
    Returns whether this Entity has custom outline rendering behavior which does not use the existing automatic outline rendering based on Entity.isCurrentlyGlowing() and the entity's team color.
    boolean
    Gets whether this entity has been added to a world (for tracking).
    default boolean
    Returns whether the fluid is on the entity's eyes.
    boolean
    Returns whether the entity is in a fluid.
    default boolean
    Returns whether any fluid type the entity is currently in matches the specified condition.
    boolean
    isInFluidType(BiPredicate<FluidType,Double> predicate, boolean forAllTypes)
    Returns whether the fluid type the entity is currently in matches the specified condition.
    default boolean
    isInFluidType(net.minecraft.world.level.material.FluidState state)
    Returns whether the entity is within the fluid type of the state.
    default boolean
    Returns whether the entity is within the fluid type.
    default boolean
    This is used to specify that your entity has multiple individual parts, such as the Vanilla Ender Dragon.
    default boolean
    Returns whether the fluid can push an entity.
    void
    Called after the entity has been added to the world's ticking list.
    void
    Called after the entity has been removed to the world's ticking list.
    void
    Revives an entity that has been removed from a world.
    private net.minecraft.world.entity.Entity
     
    default void
    sendPairingData(net.minecraft.server.level.ServerPlayer serverPlayer, Consumer<net.minecraft.network.protocol.common.custom.CustomPacketPayload> bundleBuilder)
    Sends the pairing data to the client.
    default boolean
    Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position.
  • Method Details

    • self

      private net.minecraft.world.entity.Entity self()
    • captureDrops

      @Nullable @Nullable Collection<net.minecraft.world.entity.item.ItemEntity> captureDrops()
    • captureDrops

      Collection<net.minecraft.world.entity.item.ItemEntity> captureDrops(@Nullable @Nullable Collection<net.minecraft.world.entity.item.ItemEntity> captureDrops)
    • getPersistentData

      net.minecraft.nbt.CompoundTag getPersistentData()
      Returns a NBTTagCompound that can be used to store custom data for this entity. It will be written, and read from disc, so it persists over world saves.
      Returns:
      A NBTTagCompound
    • shouldRiderSit

      default boolean shouldRiderSit()
      Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position.
      Returns:
      false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation.
    • canRiderInteract

      default boolean canRiderInteract()
      If a rider of this entity can interact with this entity. Should return true on the ridden entity if so.
      Returns:
      if the entity can be interacted with from a rider
    • canBeRiddenUnderFluidType

      default boolean canBeRiddenUnderFluidType(FluidType type, net.minecraft.world.entity.Entity rider)
      Returns whether the entity can ride in this vehicle under the fluid.
      Parameters:
      type - the type of the fluid
      rider - the entity riding the vehicle
      Returns:
      true if the vehicle can be ridden in under this fluid, false otherwise
    • canTrample

      boolean canTrample(net.minecraft.server.level.ServerLevel level, net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos, double fallDistance)
      Checks if this Entity can trample a Block.
      Parameters:
      pos - The block pos
      fallDistance - The fall distance
      Returns:
      true if this entity can trample, false otherwise
    • getClassification

      default net.minecraft.world.entity.MobCategory getClassification(boolean forSpawnCount)
      Returns The classification of this entity
      Parameters:
      forSpawnCount - If this is being invoked to check spawn count caps.
      Returns:
      If the creature is of the type provided
    • isAddedToLevel

      boolean isAddedToLevel()
      Gets whether this entity has been added to a world (for tracking). Specifically between the times when an entity is added to a world and the entity being removed from the world's tracked lists.
      Returns:
      True if this entity is being tracked by a world
    • onAddedToLevel

      void onAddedToLevel()
      Called after the entity has been added to the world's ticking list.
    • onRemovedFromLevel

      void onRemovedFromLevel()
      Called after the entity has been removed to the world's ticking list.
    • revive

      void revive()
      Revives an entity that has been removed from a world. Used as replacement for entity.removed = true. Having it as a function allows the entity to react to being revived.
    • isMultipartEntity

      default boolean isMultipartEntity()
      This is used to specify that your entity has multiple individual parts, such as the Vanilla Ender Dragon. See EnderDragon for an example implementation.
      Returns:
      true if this is a multipart entity.
    • getParts

      @Nullable default @Nullable PartEntity<?>[] getParts()
      Gets the individual sub parts that make up this entity. The entities returned by this method are NOT saved to the world in nay way, they exist as an extension of their host entity. The child entity does not track its server-side(or client-side) counterpart, and the host entity is responsible for moving and managing these children. Only used if isMultipartEntity() returns true. See EnderDragon for an example implementation.
      Returns:
      The child parts of this entity. The value to be returned here should be cached.
    • getFluidTypeHeight

      double getFluidTypeHeight(FluidType type)
      Returns the height of the fluid type in relation to the bounding box of the entity. If the entity is not in the fluid type, then 0 is returned.
      Parameters:
      type - the type of the fluid
      Returns:
      the height of the fluid compared to the entity
    • getMaxHeightFluidType

      FluidType getMaxHeightFluidType()
      Returns the fluid type which is the highest on the bounding box of the entity.
      Returns:
      the fluid type which is the highest on the bounding box of the entity
    • isInFluidType

      default boolean isInFluidType(net.minecraft.world.level.material.FluidState state)
      Returns whether the entity is within the fluid type of the state.
      Parameters:
      state - the state of the fluid
      Returns:
      true if the entity is within the fluid type of the state, false otherwise
    • isInFluidType

      default boolean isInFluidType(FluidType type)
      Returns whether the entity is within the fluid type.
      Parameters:
      type - the type of the fluid
      Returns:
      true if the entity is within the fluid type, false otherwise
    • isInFluidType

      default boolean isInFluidType(BiPredicate<FluidType,Double> predicate)
      Returns whether any fluid type the entity is currently in matches the specified condition.
      Parameters:
      predicate - a test taking in the fluid type and its height
      Returns:
      true if a fluid type meets the condition, false otherwise
    • isInFluidType

      boolean isInFluidType(BiPredicate<FluidType,Double> predicate, boolean forAllTypes)
      Returns whether the fluid type the entity is currently in matches the specified condition.
      Parameters:
      predicate - a test taking in the fluid type and its height
      forAllTypes - true if all fluid types should match the condition instead of at least one
      Returns:
      true if a fluid type meets the condition, false otherwise
    • isInFluidType

      boolean isInFluidType()
      Returns whether the entity is in a fluid.
      Returns:
      true if the entity is in a fluid, false otherwise
    • getEyeInFluidType

      FluidType getEyeInFluidType()
      Returns the fluid that is on the entity's eyes.
      Returns:
      the fluid that is on the entity's eyes
    • isEyeInFluidType

      default boolean isEyeInFluidType(FluidType type)
      Returns whether the fluid is on the entity's eyes.
      Returns:
      true if the fluid is on the entity's eyes, false otherwise
    • canStartSwimming

      default boolean canStartSwimming()
      Returns whether the entity can start swimming in the fluid.
      Returns:
      true if the entity can start swimming, false otherwise
    • getFluidMotionScale

      default double getFluidMotionScale(FluidType type)
      Returns how much the velocity of the fluid should be scaled by when applied to an entity.
      Parameters:
      type - the type of the fluid
      Returns:
      a scalar to multiply to the fluid velocity
    • isPushedByFluid

      default boolean isPushedByFluid(FluidType type)
      Returns whether the fluid can push an entity.
      Parameters:
      type - the type of the fluid
      Returns:
      true if the entity can be pushed by the fluid, false otherwise
    • canSwimInFluidType

      default boolean canSwimInFluidType(FluidType type)
      Returns whether the entity can swim in the fluid.
      Parameters:
      type - the type of the fluid
      Returns:
      true if the entity can swim in the fluid, false otherwise
    • canFluidExtinguish

      default boolean canFluidExtinguish(FluidType type)
      Returns whether the entity can be extinguished by this fluid.
      Parameters:
      type - the type of the fluid
      Returns:
      true if the entity can be extinguished, false otherwise
    • getFluidFallDistanceModifier

      default float getFluidFallDistanceModifier(FluidType type)
      Returns how much the fluid should scale the damage done to a falling entity when hitting the ground per tick.

      Implementation: If the entity is in many fluids, the smallest modifier is applied.

      Parameters:
      type - the type of the fluid
      Returns:
      a scalar to multiply to the fall damage
    • canHydrateInFluidType

      default boolean canHydrateInFluidType(FluidType type)
      Returns whether the entity can be hydrated by this fluid.

      Hydration is an arbitrary word which depends on the entity.

      Parameters:
      type - the type of the fluid
      Returns:
      true if the entity can be hydrated, false otherwise
    • getSoundFromFluidType

      @Nullable default @Nullable net.minecraft.sounds.SoundEvent getSoundFromFluidType(FluidType type, SoundAction action)
      Returns a sound to play when a certain action is performed by the entity in the fluid. If no sound is present, then the sound will be null.
      Parameters:
      type - the type of the fluid
      action - the action being performed
      Returns:
      the sound to play when performing the action
    • hasCustomOutlineRendering

      default boolean hasCustomOutlineRendering(net.minecraft.world.entity.player.Player player)
      Returns whether this Entity has custom outline rendering behavior which does not use the existing automatic outline rendering based on Entity.isCurrentlyGlowing() and the entity's team color.
      Parameters:
      player - the local player currently viewing this Entity
      Returns:
      true to enable outline processing
    • sendPairingData

      default void sendPairingData(net.minecraft.server.level.ServerPlayer serverPlayer, Consumer<net.minecraft.network.protocol.common.custom.CustomPacketPayload> bundleBuilder)
      Sends the pairing data to the client.
      Parameters:
      serverPlayer - The player to send the data to.
      bundleBuilder - Callback to add a custom payload to the packet.
    • copyAttachmentsFrom

      default void copyAttachmentsFrom(net.minecraft.world.entity.Entity other, boolean isDeath)
      Copies the serialized attachments from another entity to this entity.
      Parameters:
      other - the entity that attachments should be copied from
      isDeath - if true, only attachments with AttachmentType.Builder.copyOnDeath() set are copied; if false, all serializable attachments are copied.