Class LivingEntity

All Implemented Interfaces:
DataComponentGetter, TypedInstance<EntityType<?>>, SyncedDataHolder, DebugValueSource, Attackable, ItemOwner, SlotProvider, EntityAccess, UniquelyIdentifyable, Nameable, ScoreHolder, Waypoint, WaypointTransmitter, IAttachmentHolder, IEntityExtension, ILivingEntityExtension
Direct Known Subclasses:
ArmorStand, Avatar, Mob

public abstract class LivingEntity extends Entity implements Attackable, WaypointTransmitter, ILivingEntityExtension
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • TAG_ACTIVE_EFFECTS

      private static final String TAG_ACTIVE_EFFECTS
      See Also:
    • TAG_ATTRIBUTES

      public static final String TAG_ATTRIBUTES
      See Also:
    • TAG_SLEEPING_POS

      public static final String TAG_SLEEPING_POS
      See Also:
    • TAG_EQUIPMENT

      public static final String TAG_EQUIPMENT
      See Also:
    • TAG_BRAIN

      public static final String TAG_BRAIN
      See Also:
    • TAG_FALL_FLYING

      public static final String TAG_FALL_FLYING
      See Also:
    • TAG_HURT_TIME

      public static final String TAG_HURT_TIME
      See Also:
    • TAG_DEATH_TIME

      public static final String TAG_DEATH_TIME
      See Also:
    • TAG_HURT_BY_TIMESTAMP

      public static final String TAG_HURT_BY_TIMESTAMP
      See Also:
    • TAG_HEALTH

      public static final String TAG_HEALTH
      See Also:
    • SPEED_MODIFIER_POWDER_SNOW_ID

      private static final Identifier SPEED_MODIFIER_POWDER_SNOW_ID
    • SPRINTING_MODIFIER_ID

      private static final Identifier SPRINTING_MODIFIER_ID
    • SPEED_MODIFIER_SPRINTING

      private static final AttributeModifier SPEED_MODIFIER_SPRINTING
    • EQUIPMENT_SLOT_OFFSET

      public static final int EQUIPMENT_SLOT_OFFSET
      See Also:
    • ARMOR_SLOT_OFFSET

      public static final int ARMOR_SLOT_OFFSET
      See Also:
    • BODY_ARMOR_OFFSET

      public static final int BODY_ARMOR_OFFSET
      See Also:
    • SADDLE_OFFSET

      public static final int SADDLE_OFFSET
      See Also:
    • PLAYER_HURT_EXPERIENCE_TIME

      public static final int PLAYER_HURT_EXPERIENCE_TIME
      See Also:
    • DAMAGE_SOURCE_TIMEOUT

      private static final int DAMAGE_SOURCE_TIMEOUT
      See Also:
    • MIN_MOVEMENT_DISTANCE

      public static final double MIN_MOVEMENT_DISTANCE
      See Also:
    • DEFAULT_BASE_GRAVITY

      public static final double DEFAULT_BASE_GRAVITY
      See Also:
    • DEATH_DURATION

      public static final int DEATH_DURATION
      See Also:
    • INPUT_FRICTION

      protected static final float INPUT_FRICTION
      See Also:
    • TICKS_PER_ELYTRA_FREE_FALL_EVENT

      private static final int TICKS_PER_ELYTRA_FREE_FALL_EVENT
      See Also:
    • FREE_FALL_EVENTS_PER_ELYTRA_BREAK

      private static final int FREE_FALL_EVENTS_PER_ELYTRA_BREAK
      See Also:
    • BASE_JUMP_POWER

      public static final float BASE_JUMP_POWER
      See Also:
    • DEFAULT_KNOCKBACK

      protected static final float DEFAULT_KNOCKBACK
      See Also:
    • INVULNERABLE_DURATION

      protected static final int INVULNERABLE_DURATION
      See Also:
    • MAX_LINE_OF_SIGHT_TEST_RANGE

      private static final double MAX_LINE_OF_SIGHT_TEST_RANGE
      See Also:
    • LIVING_ENTITY_FLAG_IS_USING

      protected static final int LIVING_ENTITY_FLAG_IS_USING
      See Also:
    • LIVING_ENTITY_FLAG_OFF_HAND

      protected static final int LIVING_ENTITY_FLAG_OFF_HAND
      See Also:
    • LIVING_ENTITY_FLAG_SPIN_ATTACK

      protected static final int LIVING_ENTITY_FLAG_SPIN_ATTACK
      See Also:
    • DATA_LIVING_ENTITY_FLAGS

      protected static final EntityDataAccessor<Byte> DATA_LIVING_ENTITY_FLAGS
    • DATA_HEALTH_ID

      private static final EntityDataAccessor<Float> DATA_HEALTH_ID
    • DATA_EFFECT_PARTICLES

      private static final EntityDataAccessor<List<ParticleOptions>> DATA_EFFECT_PARTICLES
    • DATA_EFFECT_AMBIENCE_ID

      private static final EntityDataAccessor<Boolean> DATA_EFFECT_AMBIENCE_ID
    • DATA_ARROW_COUNT_ID

      private static final EntityDataAccessor<Integer> DATA_ARROW_COUNT_ID
    • DATA_STINGER_COUNT_ID

      private static final EntityDataAccessor<Integer> DATA_STINGER_COUNT_ID
    • SLEEPING_POS_ID

      private static final EntityDataAccessor<Optional<BlockPos>> SLEEPING_POS_ID
    • PARTICLE_FREQUENCY_WHEN_INVISIBLE

      private static final int PARTICLE_FREQUENCY_WHEN_INVISIBLE
      See Also:
    • SLEEPING_DIMENSIONS

      protected static final EntityDimensions SLEEPING_DIMENSIONS
    • EXTRA_RENDER_CULLING_SIZE_WITH_BIG_HAT

      public static final float EXTRA_RENDER_CULLING_SIZE_WITH_BIG_HAT
      See Also:
    • DEFAULT_BABY_SCALE

      public static final float DEFAULT_BABY_SCALE
      See Also:
    • WATER_FLOAT_IMPULSE

      private static final float WATER_FLOAT_IMPULSE
      See Also:
    • CURRENT_IMPULSE_CONTEXT_RESET_GRACE_TIME_TICKS

      private static final int CURRENT_IMPULSE_CONTEXT_RESET_GRACE_TIME_TICKS
      See Also:
    • DEFAULT_CURRENT_IMPULSE_CONTEXT_RESET_GRACE_TIME

      private static final int DEFAULT_CURRENT_IMPULSE_CONTEXT_RESET_GRACE_TIME
      See Also:
    • currentImpulseContextResetGraceTime

      private int currentImpulseContextResetGraceTime
    • PLAYER_NOT_WEARING_DISGUISE_ITEM_FOR_TARGET

      public static final BiPredicate<LivingEntity, @Nullable LivingEntity> PLAYER_NOT_WEARING_DISGUISE_ITEM_FOR_TARGET
    • PLAYER_NOT_WEARING_DISGUISE_ITEM

      @Deprecated public static final Predicate<LivingEntity> PLAYER_NOT_WEARING_DISGUISE_ITEM
      Deprecated.
      Neo: use PLAYER_NOT_WEARING_DISGUISE_ITEM_FOR_TARGET with target info instead
    • attributes

      private final AttributeMap attributes
    • combatTracker

      private final CombatTracker combatTracker
    • activeEffects

      private final Map<Holder<MobEffect>, MobEffectInstance> activeEffects
    • lastEquipmentItems

      private final Map<EquipmentSlot, ItemStack> lastEquipmentItems
    • swinging

      public boolean swinging
    • discardFriction

      private boolean discardFriction
    • swingingArm

      public InteractionHand swingingArm
    • swingTime

      public int swingTime
    • removeArrowTime

      public int removeArrowTime
    • removeStingerTime

      public int removeStingerTime
    • hurtTime

      public int hurtTime
    • hurtDuration

      public int hurtDuration
    • deathTime

      public int deathTime
    • oAttackAnim

      public float oAttackAnim
    • attackAnim

      public float attackAnim
    • attackStrengthTicker

      protected int attackStrengthTicker
    • itemSwapTicker

      protected int itemSwapTicker
    • walkAnimation

      public final WalkAnimationState walkAnimation
    • yBodyRot

      public float yBodyRot
    • yBodyRotO

      public float yBodyRotO
    • yHeadRot

      public float yHeadRot
    • yHeadRotO

      public float yHeadRotO
    • elytraAnimationState

      public final ElytraAnimationState elytraAnimationState
    • lastHurtByPlayer

      protected @Nullable EntityReference<Player> lastHurtByPlayer
    • lastHurtByPlayerMemoryTime

      protected int lastHurtByPlayerMemoryTime
    • dead

      protected boolean dead
    • noActionTime

      protected int noActionTime
    • lastHurt

      protected float lastHurt
      Damage taken in the last hit. Mobs are resistant to damage less than this for a short time after taking damage.
    • jumping

      protected boolean jumping
    • xxa

      public float xxa
    • yya

      public float yya
    • zza

      public float zza
    • interpolation

      protected final InterpolationHandler interpolation
    • lerpYHeadRot

      protected double lerpYHeadRot
    • lerpHeadSteps

      protected int lerpHeadSteps
    • effectsDirty

      private boolean effectsDirty
    • lastHurtByMob

      private @Nullable EntityReference<LivingEntity> lastHurtByMob
    • lastHurtByMobTimestamp

      private int lastHurtByMobTimestamp
    • lastHurtMob

      private @Nullable LivingEntity lastHurtMob
    • lastHurtMobTimestamp

      private int lastHurtMobTimestamp
      Holds the value of ticksExisted when setLastAttacker was last called.
    • speed

      private float speed
    • noJumpDelay

      private int noJumpDelay
    • absorptionAmount

      private float absorptionAmount
    • useItem

      protected ItemStack useItem
    • useItemRemaining

      protected int useItemRemaining
    • fallFlyTicks

      protected int fallFlyTicks
    • lastKineticHitFeedbackTime

      private long lastKineticHitFeedbackTime
    • lastPos

      private BlockPos lastPos
    • lastClimbablePos

      private Optional<BlockPos> lastClimbablePos
    • lastDamageSource

      private @Nullable DamageSource lastDamageSource
    • lastDamageStamp

      private long lastDamageStamp
    • autoSpinAttackTicks

      protected int autoSpinAttackTicks
    • autoSpinAttackDmg

      protected float autoSpinAttackDmg
    • autoSpinAttackItemStack

      protected @Nullable ItemStack autoSpinAttackItemStack
    • recentKineticEnemies

      protected @Nullable it.unimi.dsi.fastutil.objects.Object2LongMap<Entity> recentKineticEnemies
    • swimAmount

      private float swimAmount
    • swimAmountO

      private float swimAmountO
    • brain

      protected Brain<?> brain
    • skipDropExperience

      private boolean skipDropExperience
    • activeLocationDependentEnchantments

      private final EnumMap<EquipmentSlot, it.unimi.dsi.fastutil.objects.Reference2ObjectMap<Enchantment, Set<EnchantmentLocationBasedEffect>>> activeLocationDependentEnchantments
    • equipment

      protected final EntityEquipment equipment
    • locatorBarIcon

      private Waypoint.Icon locatorBarIcon
    • currentImpulseImpactPos

      public @Nullable Vec3 currentImpulseImpactPos
    • currentExplosionCause

      public @Nullable Entity currentExplosionCause
    • damageContainers

      protected @Nullable Stack<DamageContainer> damageContainers
      This field stores information about damage dealt to this entity. a new DamageContainer is instantiated via Entity.hurt(DamageSource, float) after invulnerability checks, and is removed from the stack before the method's return.
  • Constructor Details

  • Method Details

    • asLivingEntity

      public @Nullable LivingEntity asLivingEntity()
      Specified by:
      asLivingEntity in interface ItemOwner
    • createEquipment

      @Contract(pure=true) protected EntityEquipment createEquipment()
    • getBrain

      public Brain<? extends LivingEntity> getBrain()
    • makeBrain

      protected Brain<? extends LivingEntity> makeBrain(Brain.Packed packedBrain)
    • kill

      public void kill(ServerLevel level)
      Overrides:
      kill in class Entity
    • defineSynchedData

      protected void defineSynchedData(SynchedEntityData.Builder entityData)
      Specified by:
      defineSynchedData in class Entity
    • createLivingAttributes

      public static AttributeSupplier.Builder createLivingAttributes()
    • checkFallDamage

      protected void checkFallDamage(double ya, boolean onGround, BlockState onState, BlockPos pos)
      Overrides:
      checkFallDamage in class Entity
    • canBreatheUnderwater

      @Deprecated public boolean canBreatheUnderwater()
      Deprecated.
    • getSwimAmount

      public float getSwimAmount(float a)
    • hasLandedInLiquid

      public boolean hasLandedInLiquid()
    • baseTick

      public void baseTick()
      Overrides:
      baseTick in class Entity
    • shouldTakeDrowningDamage

      protected boolean shouldTakeDrowningDamage()
    • getBlockSpeedFactor

      protected float getBlockSpeedFactor()
      Overrides:
      getBlockSpeedFactor in class Entity
    • getLuck

      public float getLuck()
    • removeFrost

      protected void removeFrost()
    • tryAddFrost

      protected void tryAddFrost()
    • onChangedBlock

      protected void onChangedBlock(ServerLevel level, BlockPos pos)
    • isBaby

      public boolean isBaby()
    • getAgeScale

      public float getAgeScale()
    • getScale

      public final float getScale()
    • sanitizeScale

      protected float sanitizeScale(float scale)
    • isAffectedByFluids

      public boolean isAffectedByFluids()
    • tickDeath

      protected void tickDeath()
    • shouldDropExperience

      public boolean shouldDropExperience()
    • shouldDropLoot

      protected boolean shouldDropLoot(ServerLevel level)
    • decreaseAirSupply

      protected int decreaseAirSupply(int currentSupply)
      Decrements the entity's air supply when underwater
    • increaseAirSupply

      protected int increaseAirSupply(int currentSupply)
    • getExperienceReward

      public final int getExperienceReward(ServerLevel level, @Nullable Entity killer)
    • getBaseExperienceReward

      protected int getBaseExperienceReward(ServerLevel level)
    • isAlwaysExperienceDropper

      protected boolean isAlwaysExperienceDropper()
    • getLastHurtByMob

      public @Nullable LivingEntity getLastHurtByMob()
    • getLastHurtByPlayer

      public @Nullable Player getLastHurtByPlayer()
    • getLastAttacker

      public LivingEntity getLastAttacker()
      Specified by:
      getLastAttacker in interface Attackable
    • getLastHurtByMobTimestamp

      public int getLastHurtByMobTimestamp()
    • setLastHurtByPlayer

      public void setLastHurtByPlayer(Player player, int timeToRemember)
    • setLastHurtByPlayer

      public void setLastHurtByPlayer(UUID player, int timeToRemember)
    • setLastHurtByPlayer

      private void setLastHurtByPlayer(EntityReference<Player> player, int timeToRemember)
    • setLastHurtByMob

      public void setLastHurtByMob(@Nullable LivingEntity hurtBy)
      Hint to AI tasks that we were attacked by the passed EntityLivingBase and should retaliate. Is not guaranteed to change our actual active target (for example if we are currently busy attacking someone else)
    • getLastHurtMob

      public @Nullable LivingEntity getLastHurtMob()
    • getLastHurtMobTimestamp

      public int getLastHurtMobTimestamp()
    • setLastHurtMob

      public void setLastHurtMob(Entity target)
    • getNoActionTime

      public int getNoActionTime()
    • setNoActionTime

      public void setNoActionTime(int noActionTime)
    • shouldDiscardFriction

      public boolean shouldDiscardFriction()
    • setDiscardFriction

      public void setDiscardFriction(boolean discardFriction)
    • doesEmitEquipEvent

      protected boolean doesEmitEquipEvent(EquipmentSlot slot)
    • onEquipItem

      public void onEquipItem(EquipmentSlot slot, ItemStack oldStack, ItemStack stack)
    • getEquipSound

      protected Holder<SoundEvent> getEquipSound(EquipmentSlot slot, ItemStack stack, Equippable equippable)
    • remove

      public void remove(Entity.RemovalReason reason)
      Overrides:
      remove in class Entity
    • onRemoval

      public void onRemoval(Entity.RemovalReason reason)
      Overrides:
      onRemoval in class Entity
    • triggerOnDeathMobEffects

      protected void triggerOnDeathMobEffects(ServerLevel level, Entity.RemovalReason reason)
    • addAdditionalSaveData

      protected void addAdditionalSaveData(ValueOutput output)
      Specified by:
      addAdditionalSaveData in class Entity
    • drop

      public @Nullable ItemEntity drop(ItemStack itemStack, boolean randomly, boolean thrownFromHand)
    • readAdditionalSaveData

      protected void readAdditionalSaveData(ValueInput input)
      Specified by:
      readAdditionalSaveData in class Entity
    • updateDataBeforeSync

      public void updateDataBeforeSync()
      Overrides:
      updateDataBeforeSync in class Entity
    • tickEffects

      protected void tickEffects()
    • updateDirtyEffects

      private void updateDirtyEffects()
    • updateInvisibilityStatus

      protected void updateInvisibilityStatus()
    • updateSynchronizedMobEffectParticles

      private void updateSynchronizedMobEffectParticles()
    • updateGlowingStatus

      private void updateGlowingStatus()
    • getVisibilityPercent

      public double getVisibilityPercent(@Nullable Entity targetingEntity)
    • canAttack

      public boolean canAttack(LivingEntity target)
    • canBeSeenAsEnemy

      public boolean canBeSeenAsEnemy()
    • canBeSeenByAnyone

      public boolean canBeSeenByAnyone()
    • areAllEffectsAmbient

      public static boolean areAllEffectsAmbient(Collection<MobEffectInstance> effects)
      Returns true if all the potion effects in the specified collection are ambient.
    • removeEffectParticles

      protected void removeEffectParticles()
    • removeAllEffects

      public boolean removeAllEffects()
    • getActiveEffects

      public Collection<MobEffectInstance> getActiveEffects()
    • getActiveEffectsMap

      public Map<Holder<MobEffect>, MobEffectInstance> getActiveEffectsMap()
    • hasEffect

      public boolean hasEffect(Holder<MobEffect> effect)
    • getEffect

      public @Nullable MobEffectInstance getEffect(Holder<MobEffect> effect)
    • getEffectBlendFactor

      public float getEffectBlendFactor(Holder<MobEffect> effect, float partialTicks)
    • addEffect

      public final boolean addEffect(MobEffectInstance newEffect)
    • addEffect

      public boolean addEffect(MobEffectInstance newEffect, @Nullable Entity source)
    • canBeAffected

      @Deprecated @OverrideOnly public boolean canBeAffected(MobEffectInstance newEffect)
      Deprecated.
      Parameters:
      newEffect - A mob effect instance
      Returns:
      If the mob effect instance can be applied to this entity
    • forceAddEffect

      public void forceAddEffect(MobEffectInstance newEffect, @Nullable Entity source)
    • isInvertedHealAndHarm

      public boolean isInvertedHealAndHarm()
    • removeEffectNoUpdate

      public final @Nullable MobEffectInstance removeEffectNoUpdate(Holder<MobEffect> effect)
    • removeEffect

      public boolean removeEffect(Holder<MobEffect> effect)
    • onEffectAdded

      protected void onEffectAdded(MobEffectInstance effect, @Nullable Entity source)
    • sendEffectToPassengers

      public void sendEffectToPassengers(MobEffectInstance effect)
    • onEffectUpdated

      protected void onEffectUpdated(MobEffectInstance effect, boolean doRefreshAttributes, @Nullable Entity source)
    • onEffectsRemoved

      protected void onEffectsRemoved(Collection<MobEffectInstance> effects)
    • refreshDirtyAttributes

      private void refreshDirtyAttributes()
    • onAttributeUpdated

      protected void onAttributeUpdated(Holder<Attribute> attribute)
    • heal

      public void heal(float heal)
      Heal living entity (param: amount of half-hearts)
    • getHealth

      public float getHealth()
    • setHealth

      public void setHealth(float health)
    • isDeadOrDying

      public boolean isDeadOrDying()
    • hurtServer

      public boolean hurtServer(ServerLevel level, DamageSource source, float damage)
      Specified by:
      hurtServer in class Entity
    • applyItemBlocking

      public float applyItemBlocking(ServerLevel level, DamageSource source, float damage)
    • playSecondaryHurtSound

      private void playSecondaryHurtSound(DamageSource source)
    • resolveMobResponsibleForDamage

      protected void resolveMobResponsibleForDamage(DamageSource source)
    • resolvePlayerResponsibleForDamage

      protected @Nullable Player resolvePlayerResponsibleForDamage(DamageSource source)
    • blockUsingItem

      protected void blockUsingItem(ServerLevel level, LivingEntity attacker)
    • blockedByItem

      protected void blockedByItem(LivingEntity defender)
    • checkTotemDeathProtection

      private boolean checkTotemDeathProtection(DamageSource killingDamage)
    • getLastDamageSource

      public @Nullable DamageSource getLastDamageSource()
    • playHurtSound

      protected void playHurtSound(DamageSource source)
    • makeSound

      public void makeSound(@Nullable SoundEvent sound)
    • breakItem

      private void breakItem(ItemStack itemStack)
      Renders broken item particles using the given ItemStack
    • die

      public void die(DamageSource source)
      Called when the mob's health reaches 0.
    • createWitherRose

      protected void createWitherRose(@Nullable LivingEntity killer)
    • dropAllDeathLoot

      protected void dropAllDeathLoot(ServerLevel level, DamageSource source)
    • dropEquipment

      protected void dropEquipment(ServerLevel level)
    • dropExperience

      protected void dropExperience(ServerLevel level, @Nullable Entity killer)
    • dropCustomDeathLoot

      protected void dropCustomDeathLoot(ServerLevel level, DamageSource source, boolean killedByPlayer)
    • getLootTableSeed

      public long getLootTableSeed()
    • getKnockback

      protected float getKnockback(Entity target, DamageSource damageSource)
    • dropFromLootTable

      protected void dropFromLootTable(ServerLevel level, DamageSource source, boolean playerKilled)
    • dropFromLootTable

      public void dropFromLootTable(ServerLevel level, DamageSource source, boolean playerKilled, ResourceKey<LootTable> lootTable)
    • dropFromLootTable

      public void dropFromLootTable(ServerLevel level, DamageSource source, boolean playerKilled, ResourceKey<LootTable> lootTable, Consumer<ItemStack> itemStackConsumer)
    • dropFromEntityInteractLootTable

      public boolean dropFromEntityInteractLootTable(ServerLevel level, ResourceKey<LootTable> key, @Nullable Entity interactingEntity, ItemInstance tool, BiConsumer<ServerLevel, ItemStack> consumer)
    • dropFromGiftLootTable

      public boolean dropFromGiftLootTable(ServerLevel level, ResourceKey<LootTable> key, BiConsumer<ServerLevel, ItemStack> consumer)
    • dropFromShearingLootTable

      protected void dropFromShearingLootTable(ServerLevel level, ResourceKey<LootTable> key, ItemInstance tool, BiConsumer<ServerLevel, ItemStack> consumer)
    • dropFromLootTable

      protected boolean dropFromLootTable(ServerLevel level, ResourceKey<LootTable> key, Function<LootParams.Builder, LootParams> paramsBuilder, BiConsumer<ServerLevel, ItemStack> consumer)
    • knockback

      public void knockback(double power, double xd, double zd)
    • indicateDamage

      public void indicateDamage(double xd, double zd)
    • getHurtSound

      protected @Nullable SoundEvent getHurtSound(DamageSource source)
    • getDeathSound

      protected @Nullable SoundEvent getDeathSound()
    • getFallDamageSound

      private SoundEvent getFallDamageSound(int dmg)
    • skipDropExperience

      public void skipDropExperience()
    • wasExperienceConsumed

      public boolean wasExperienceConsumed()
    • getHurtDir

      public float getHurtDir()
    • getHitbox

      public AABB getHitbox()
    • activeLocationDependentEnchantments

      public Map<Enchantment, Set<EnchantmentLocationBasedEffect>> activeLocationDependentEnchantments(EquipmentSlot slot)
    • postPiercingAttack

      public void postPiercingAttack()
    • getFallSounds

      public LivingEntity.Fallsounds getFallSounds()
    • getLastClimbablePos

      public Optional<BlockPos> getLastClimbablePos()
    • onClimbable

      public boolean onClimbable()
    • trapdoorUsableAsLadder

      private boolean trapdoorUsableAsLadder(BlockPos pos, BlockState state)
    • isAlive

      public boolean isAlive()
      Overrides:
      isAlive in class Entity
    • isLookingAtMe

      public boolean isLookingAtMe(LivingEntity target, double coneSize, boolean adjustForDistance, boolean seeThroughTransparentBlocks, double... gazeHeights)
    • getMaxFallDistance

      public int getMaxFallDistance()
      Overrides:
      getMaxFallDistance in class Entity
    • getComfortableFallDistance

      protected final int getComfortableFallDistance(float allowedDamage)
    • causeFallDamage

      public boolean causeFallDamage(double fallDistance, float damageModifier, DamageSource damageSource)
      Overrides:
      causeFallDamage in class Entity
    • setIgnoreFallDamageFromCurrentImpulse

      public void setIgnoreFallDamageFromCurrentImpulse(boolean ignoreFallDamage, Vec3 newImpulseImpactPos)
    • applyPostImpulseGraceTime

      public void applyPostImpulseGraceTime(int ticks)
    • isIgnoringFallDamageFromCurrentImpulse

      public boolean isIgnoringFallDamageFromCurrentImpulse()
    • tryResetCurrentImpulseContext

      public void tryResetCurrentImpulseContext()
    • isInPostImpulseGraceTime

      public boolean isInPostImpulseGraceTime()
    • resetCurrentImpulseContext

      public void resetCurrentImpulseContext()
    • calculateFallDamage

      protected int calculateFallDamage(double fallDistance, float damageModifier)
    • calculateFallPower

      private double calculateFallPower(double fallDistance)
    • playBlockFallSound

      protected void playBlockFallSound()
    • animateHurt

      public void animateHurt(float yaw)
      Overrides:
      animateHurt in class Entity
    • getArmorValue

      public int getArmorValue()
    • hurtArmor

      protected void hurtArmor(DamageSource damageSource, float damage)
    • hurtHelmet

      protected void hurtHelmet(DamageSource damageSource, float damage)
    • doHurtEquipment

      protected void doHurtEquipment(DamageSource damageSource, float damage, EquipmentSlot... slots)
    • getDamageAfterArmorAbsorb

      protected float getDamageAfterArmorAbsorb(DamageSource damageSource, float damage)
      Reduces damage, depending on armor
    • getDamageAfterMagicAbsorb

      protected float getDamageAfterMagicAbsorb(DamageSource damageSource, float damage)
      Reduces damage, depending on potions
    • actuallyHurt

      protected void actuallyHurt(ServerLevel level, DamageSource source, float dmg)
    • getCombatTracker

      public CombatTracker getCombatTracker()
    • getKillCredit

      public @Nullable LivingEntity getKillCredit()
    • getMaxHealth

      public final float getMaxHealth()
    • getMaxAbsorption

      public final float getMaxAbsorption()
    • getArrowCount

      public final int getArrowCount()
    • setArrowCount

      public final void setArrowCount(int count)
      Sets the amount of arrows stuck in the entity. Used for rendering those.
    • getStingerCount

      public final int getStingerCount()
    • setStingerCount

      public final void setStingerCount(int count)
    • getCurrentSwingDuration

      public int getCurrentSwingDuration()
    • swing

      public void swing(InteractionHand hand)
    • swing

      public void swing(InteractionHand hand, boolean sendToSwingingEntity)
    • handleDamageEvent

      public void handleDamageEvent(DamageSource source)
      Overrides:
      handleDamageEvent in class Entity
    • handleEntityEvent

      public void handleEntityEvent(byte id)
      Handler for
      invalid reference
      World#setEntityState
      Overrides:
      handleEntityEvent in class Entity
    • getTicksSinceLastKineticHitFeedback

      public float getTicksSinceLastKineticHitFeedback(float partial)
    • makePoofParticles

      public void makePoofParticles()
    • makeDrownParticles

      private void makeDrownParticles()
    • onKineticHit

      private void onKineticHit()
    • swapHandItems

      private void swapHandItems()
    • onBelowWorld

      protected void onBelowWorld()
      Overrides:
      onBelowWorld in class Entity
    • updateSwingTime

      protected void updateSwingTime()
    • getAttribute

      public @Nullable AttributeInstance getAttribute(Holder<Attribute> attribute)
    • getAttributeValue

      public double getAttributeValue(Holder<Attribute> attribute)
    • getAttributeBaseValue

      public double getAttributeBaseValue(Holder<Attribute> attribute)
    • getAttributes

      public AttributeMap getAttributes()
    • getMainHandItem

      public ItemStack getMainHandItem()
    • getOffhandItem

      public ItemStack getOffhandItem()
    • getItemHeldByArm

      public ItemStack getItemHeldByArm(HumanoidArm arm)
    • getWeaponItem

      public ItemStack getWeaponItem()
      Overrides:
      getWeaponItem in class Entity
    • getAttackRangeWith

      public AttackRange getAttackRangeWith(ItemStack weaponItem)
    • getActiveItem

      public ItemStack getActiveItem()
    • isHolding

      public boolean isHolding(Item item)
    • isHolding

      public boolean isHolding(Predicate<ItemStack> itemPredicate)
    • getItemInHand

      public ItemStack getItemInHand(InteractionHand hand)
    • setItemInHand

      public void setItemInHand(InteractionHand hand, ItemStack itemStack)
    • hasItemInSlot

      public boolean hasItemInSlot(EquipmentSlot slot)
    • canUseSlot

      public boolean canUseSlot(EquipmentSlot slot)
    • getItemBySlot

      public ItemStack getItemBySlot(EquipmentSlot slot)
    • setItemSlot

      public void setItemSlot(EquipmentSlot slot, ItemStack itemStack)
    • setItemSlot

      public void setItemSlot(EquipmentSlot slot, ItemStack itemStack, boolean insideTransaction)
      Neo: Passing true for insideTransaction sets the item without side-effects (calling onEquipItem(EquipmentSlot, ItemStack, ItemStack)). Callers are responsible for performing the deferred side-effects, when the active transaction commits.
    • getArmorCoverPercentage

      public float getArmorCoverPercentage()
    • setSprinting

      public void setSprinting(boolean isSprinting)
      Set sprinting switch for Entity.
      Overrides:
      setSprinting in class Entity
    • getSoundVolume

      protected float getSoundVolume()
    • getVoicePitch

      public float getVoicePitch()
    • isImmobile

      protected boolean isImmobile()
    • push

      public void push(Entity entity)
      Applies a velocity to the entities, to push them away from each other.
      Overrides:
      push in class Entity
    • dismountVehicle

      private void dismountVehicle(Entity vehicle)
    • shouldShowName

      public boolean shouldShowName()
      Overrides:
      shouldShowName in class Entity
    • getJumpPower

      protected float getJumpPower()
    • getJumpPower

      protected float getJumpPower(float multiplier)
    • getJumpBoostPower

      public float getJumpBoostPower()
    • jumpFromGround

      public void jumpFromGround()
    • goDownInWater

      @Deprecated protected void goDownInWater()
      Deprecated.
    • jumpInLiquid

      @Deprecated protected void jumpInLiquid(TagKey<Fluid> type)
      Deprecated.
    • getWaterSlowDown

      protected float getWaterSlowDown()
    • canStandOnFluid

      public boolean canStandOnFluid(FluidState fluid)
    • getDefaultGravity

      protected double getDefaultGravity()
      Overrides:
      getDefaultGravity in class Entity
    • getEffectiveGravity

      protected double getEffectiveGravity()
    • travel

      public void travel(Vec3 input)
    • getLiquidCollisionShape

      public VoxelShape getLiquidCollisionShape()
    • shouldTravelInFluid

      protected boolean shouldTravelInFluid(FluidState fluidState)
    • travelFlying

      protected void travelFlying(Vec3 input, float speed)
    • travelFlying

      protected void travelFlying(Vec3 input, float waterSpeed, float lavaSpeed, float airSpeed)
    • travelInAir

      private void travelInAir(Vec3 input)
    • travelInFluid

      @Deprecated private void travelInFluid(Vec3 input)
      Deprecated.
    • travelInFluid

      private void travelInFluid(Vec3 input, FluidState fluidState)
    • travelInWater

      protected void travelInWater(Vec3 input, double baseGravity, boolean isFalling, double oldY)
    • travelInLava

      private void travelInLava(Vec3 input, double baseGravity, boolean isFalling, double oldY)
    • jumpOutOfFluid

      private void jumpOutOfFluid(double oldY)
    • floatInWaterWhileRidden

      private void floatInWaterWhileRidden()
    • travelFallFlying

      private void travelFallFlying(Vec3 input)
    • stopFallFlying

      public void stopFallFlying()
    • updateFallFlyingMovement

      private Vec3 updateFallFlyingMovement(Vec3 movement)
    • handleFallFlyingCollisions

      private void handleFallFlyingCollisions(double moveHorLength, double newMoveHorLength)
    • travelRidden

      private void travelRidden(Player controller, Vec3 selfInput)
    • tickRidden

      protected void tickRidden(Player controller, Vec3 riddenInput)
    • getRiddenInput

      protected Vec3 getRiddenInput(Player controller, Vec3 selfInput)
    • getRiddenSpeed

      protected float getRiddenSpeed(Player controller)
    • calculateEntityAnimation

      public void calculateEntityAnimation(boolean useY)
    • updateWalkAnimation

      protected void updateWalkAnimation(float distance)
    • handleRelativeFrictionAndCalculateMovement

      private Vec3 handleRelativeFrictionAndCalculateMovement(Vec3 input, float friction)
    • getFluidFallingAdjustedMovement

      public Vec3 getFluidFallingAdjustedMovement(double baseGravity, boolean isFalling, Vec3 movement)
    • handleOnClimbable

      private Vec3 handleOnClimbable(Vec3 delta)
    • getFrictionInfluencedSpeed

      private float getFrictionInfluencedSpeed(float blockFriction)
    • getFlyingSpeed

      protected float getFlyingSpeed()
    • getSpeed

      public float getSpeed()
    • setSpeed

      public void setSpeed(float speed)
      Sets the movespeed used for the new AI system.
    • doHurtTarget

      public boolean doHurtTarget(ServerLevel level, Entity target)
    • causeExtraKnockback

      public void causeExtraKnockback(Entity target, float knockback, Vec3 oldMovement)
    • playAttackSound

      protected void playAttackSound()
    • tick

      public void tick()
      Overrides:
      tick in class Entity
    • wasRecentlyStabbed

      public boolean wasRecentlyStabbed(Entity target, int allowedTime)
    • rememberStabbedEntity

      public void rememberStabbedEntity(Entity target)
    • stabbedEntities

      public int stabbedEntities(Predicate<Entity> filter)
    • stabAttack

      public boolean stabAttack(EquipmentSlot weaponSlot, Entity target, float baseDamage, boolean dealsDamage, boolean dealsKnockback, boolean dismounts)
    • onAttack

      public void onAttack()
    • detectEquipmentUpdates

      private void detectEquipmentUpdates()
    • collectEquipmentChanges

      private @Nullable Map<EquipmentSlot, ItemStack> collectEquipmentChanges()
    • equipmentHasChanged

      public boolean equipmentHasChanged(ItemStack previous, ItemStack current)
    • handleHandSwap

      private void handleHandSwap(Map<EquipmentSlot, ItemStack> changedItems)
    • handleEquipmentChanges

      private void handleEquipmentChanges(Map<EquipmentSlot, ItemStack> changedItems)
    • tickHeadTurn

      protected void tickHeadTurn(float yBodyRotT)
    • getMaxHeadRotationRelativeToBody

      protected float getMaxHeadRotationRelativeToBody()
    • aiStep

      public void aiStep()
    • applyInput

      protected void applyInput()
    • isSensitiveToWater

      public boolean isSensitiveToWater()
    • isJumping

      public boolean isJumping()
    • updateFallFlying

      protected void updateFallFlying()
    • canGlide

      protected boolean canGlide()
    • serverAiStep

      protected void serverAiStep()
    • pushEntities

      protected void pushEntities()
    • checkAutoSpinAttack

      protected void checkAutoSpinAttack(AABB old, AABB current)
    • doPush

      protected void doPush(Entity entity)
    • doAutoAttackOnTouch

      protected void doAutoAttackOnTouch(LivingEntity entity)
    • isAutoSpinAttack

      public boolean isAutoSpinAttack()
    • stopRiding

      public void stopRiding()
      Overrides:
      stopRiding in class Entity
    • rideTick

      public void rideTick()
      Overrides:
      rideTick in class Entity
    • getInterpolation

      public InterpolationHandler getInterpolation()
      Overrides:
      getInterpolation in class Entity
    • lerpHeadTo

      public void lerpHeadTo(float yRot, int steps)
      Overrides:
      lerpHeadTo in class Entity
    • setJumping

      public void setJumping(boolean jump)
    • onItemPickup

      public void onItemPickup(ItemEntity entity)
    • take

      public void take(Entity entity, int orgCount)
      Called when the entity picks up an item.
    • hasLineOfSight

      public boolean hasLineOfSight(Entity target)
    • hasLineOfSight

      public boolean hasLineOfSight(Entity target, ClipContext.Block blockCollidingContext, ClipContext.Fluid fluidCollidingContext, double eyeHeight)
    • getViewYRot

      public float getViewYRot(float a)
      Gets the current yaw of the entity
      Overrides:
      getViewYRot in class Entity
    • getAttackAnim

      public float getAttackAnim(float a)
      Gets the progression of the swing animation, ranges from 0.0 to 1.0.
    • isPickable

      public boolean isPickable()
      Overrides:
      isPickable in class Entity
    • isPushable

      public boolean isPushable()
      Overrides:
      isPushable in class Entity
    • getYHeadRot

      public float getYHeadRot()
      Overrides:
      getYHeadRot in class Entity
    • setYHeadRot

      public void setYHeadRot(float yHeadRot)
      Sets the head's yaw rotation of the entity.
      Overrides:
      setYHeadRot in class Entity
    • setYBodyRot

      public void setYBodyRot(float yBodyRot)
      Set the render yaw offset
      Overrides:
      setYBodyRot in class Entity
    • getRelativePortalPosition

      public Vec3 getRelativePortalPosition(Direction.Axis axis, BlockUtil.FoundRectangle portalArea)
      Overrides:
      getRelativePortalPosition in class Entity
    • resetForwardDirectionOfRelativePortalPosition

      public static Vec3 resetForwardDirectionOfRelativePortalPosition(Vec3 offsets)
    • getAbsorptionAmount

      public float getAbsorptionAmount()
    • setAbsorptionAmount

      public final void setAbsorptionAmount(float absorptionAmount)
    • internalSetAbsorptionAmount

      protected void internalSetAbsorptionAmount(float absorptionAmount)
    • onEnterCombat

      public void onEnterCombat()
    • onLeaveCombat

      public void onLeaveCombat()
    • updateEffectVisibility

      protected void updateEffectVisibility()
    • getMainArm

      public abstract HumanoidArm getMainArm()
    • isUsingItem

      public boolean isUsingItem()
    • getUsedItemHand

      public InteractionHand getUsedItemHand()
    • updatingUsingItem

      private void updatingUsingItem()
    • createItemStackToDrop

      private @Nullable ItemEntity createItemStackToDrop(ItemStack itemStack, boolean randomly, boolean thrownFromHand)
    • updateUsingItem

      protected void updateUsingItem(ItemStack useItem)
    • updateSwimAmount

      private void updateSwimAmount()
    • setLivingEntityFlag

      protected void setLivingEntityFlag(int flag, boolean value)
    • startUsingItem

      public void startUsingItem(InteractionHand hand)
    • onSyncedDataUpdated

      public void onSyncedDataUpdated(EntityDataAccessor<?> accessor)
      Specified by:
      onSyncedDataUpdated in interface SyncedDataHolder
      Overrides:
      onSyncedDataUpdated in class Entity
    • lookAt

      public void lookAt(EntityAnchorArgument.Anchor anchor, Vec3 pos)
      Overrides:
      lookAt in class Entity
    • getPreciseBodyRotation

      public float getPreciseBodyRotation(float partial)
      Overrides:
      getPreciseBodyRotation in class Entity
    • spawnItemParticles

      public void spawnItemParticles(ItemStack itemStack, int count)
    • completeUsingItem

      protected void completeUsingItem()
    • handleExtraItemsCreatedOnUse

      public void handleExtraItemsCreatedOnUse(ItemStack extraCreatedRemainder)
    • getUseItem

      public ItemStack getUseItem()
    • getUseItemRemainingTicks

      public int getUseItemRemainingTicks()
    • getTicksUsingItem

      public int getTicksUsingItem()
    • getTicksUsingItem

      public float getTicksUsingItem(float partialTicks)
    • releaseUsingItem

      public void releaseUsingItem()
    • stopUsingItem

      public void stopUsingItem()
    • isBlocking

      public boolean isBlocking()
    • getItemBlockingWith

      public @Nullable ItemStack getItemBlockingWith()
    • isSuppressingSlidingDownLadder

      public boolean isSuppressingSlidingDownLadder()
    • isFallFlying

      public boolean isFallFlying()
    • isVisuallySwimming

      public boolean isVisuallySwimming()
      Overrides:
      isVisuallySwimming in class Entity
    • getFallFlyingTicks

      public int getFallFlyingTicks()
    • randomTeleport

      public boolean randomTeleport(double xx, double yy, double zz, boolean showParticles)
    • isAffectedByPotions

      public boolean isAffectedByPotions()
    • attackable

      public boolean attackable()
    • setRecordPlayingNearby

      public void setRecordPlayingNearby(BlockPos jukebox, boolean isPlaying)
      Called when a record starts or stops playing. Used to make parrots start or stop partying.
    • canPickUpLoot

      public boolean canPickUpLoot()
    • getDimensions

      public final EntityDimensions getDimensions(Pose pose)
      Overrides:
      getDimensions in class Entity
    • getDefaultDimensions

      protected EntityDimensions getDefaultDimensions(Pose pose)
    • getDismountPoses

      public ImmutableList<Pose> getDismountPoses()
    • getLocalBoundsForPose

      public AABB getLocalBoundsForPose(Pose pose)
    • wouldNotSuffocateAtTargetPose

      protected boolean wouldNotSuffocateAtTargetPose(Pose pose)
    • canUsePortal

      public boolean canUsePortal(boolean ignorePassenger)
      Overrides:
      canUsePortal in class Entity
    • getSleepingPos

      public Optional<BlockPos> getSleepingPos()
    • setSleepingPos

      public void setSleepingPos(BlockPos bedPosition)
    • clearSleepingPos

      public void clearSleepingPos()
    • isSleeping

      public boolean isSleeping()
    • startSleeping

      public void startSleeping(BlockPos bedPosition)
    • setPosToBed

      private void setPosToBed(BlockPos bedPosition)
      Sets entity position to a supplied BlockPos plus a little offset
    • checkBedExists

      private boolean checkBedExists()
    • stopSleeping

      public void stopSleeping()
    • getBedOrientation

      public @Nullable Direction getBedOrientation()
    • isInWall

      public boolean isInWall()
      Overrides:
      isInWall in class Entity
    • getProjectile

      public ItemStack getProjectile(ItemStack heldWeapon)
    • entityEventForEquipmentBreak

      private static byte entityEventForEquipmentBreak(EquipmentSlot equipmentSlot)
    • onEquippedItemBroken

      public void onEquippedItemBroken(Item brokenItem, EquipmentSlot inSlot)
    • stopLocationBasedEffects

      private void stopLocationBasedEffects(ItemStack previous, EquipmentSlot inSlot, AttributeMap attributes)
    • canEquipWithDispenser

      public final boolean canEquipWithDispenser(ItemStack itemStack)
    • canDispenserEquipIntoSlot

      protected boolean canDispenserEquipIntoSlot(EquipmentSlot slot)
    • getEquipmentSlotForItem

      public final EquipmentSlot getEquipmentSlotForItem(ItemStack itemStack)
    • isEquippableInSlot

      public final boolean isEquippableInSlot(ItemStack itemStack, EquipmentSlot slot)
    • createEquipmentSlotAccess

      private static SlotAccess createEquipmentSlotAccess(LivingEntity entity, EquipmentSlot equipmentSlot)
    • getEquipmentSlot

      private static @Nullable EquipmentSlot getEquipmentSlot(int slot)
    • getSlot

      public @Nullable SlotAccess getSlot(int slot)
      Specified by:
      getSlot in interface SlotProvider
      Overrides:
      getSlot in class Entity
    • canFreeze

      public boolean canFreeze()
      Overrides:
      canFreeze in class Entity
    • isCurrentlyGlowing

      public boolean isCurrentlyGlowing()
      Overrides:
      isCurrentlyGlowing in class Entity
    • getVisualRotationYInDegrees

      public float getVisualRotationYInDegrees()
      Specified by:
      getVisualRotationYInDegrees in interface ItemOwner
      Overrides:
      getVisualRotationYInDegrees in class Entity
    • recreateFromPacket

      public void recreateFromPacket(ClientboundAddEntityPacket packet)
      Overrides:
      recreateFromPacket in class Entity
    • getSecondsToDisableBlocking

      public float getSecondsToDisableBlocking()
    • maxUpStep

      public float maxUpStep()
      Overrides:
      maxUpStep in class Entity
    • getPassengerRidingPosition

      public Vec3 getPassengerRidingPosition(Entity passenger)
      Overrides:
      getPassengerRidingPosition in class Entity
    • lerpHeadRotationStep

      protected void lerpHeadRotationStep(int lerpHeadSteps, double targetYHeadRot)
    • igniteForTicks

      public void igniteForTicks(int numberOfTicks)
      Overrides:
      igniteForTicks in class Entity
    • hasInfiniteMaterials

      public boolean hasInfiniteMaterials()
    • isInvulnerableTo

      public boolean isInvulnerableTo(ServerLevel level, DamageSource source)
    • canGlideUsing

      public static boolean canGlideUsing(ItemStack itemStack, EquipmentSlot slot)
    • getLastHurtByPlayerMemoryTime

      public int getLastHurtByPlayerMemoryTime()
    • isTransmittingWaypoint

      public boolean isTransmittingWaypoint()
      Specified by:
      isTransmittingWaypoint in interface WaypointTransmitter
    • makeWaypointConnectionWith

      public Optional<WaypointTransmitter.Connection> makeWaypointConnectionWith(ServerPlayer player)
      Specified by:
      makeWaypointConnectionWith in interface WaypointTransmitter
    • waypointIcon

      public Waypoint.Icon waypointIcon()
      Specified by:
      waypointIcon in interface WaypointTransmitter