Class LivingEntity

All Implemented Interfaces:
DataComponentGetter, SyncedDataHolder, Attackable, EntityAccess, UniquelyIdentifyable, Nameable, ScoreHolder, Waypoint, WaypointTransmitter, IAttachmentHolder, IEntityExtension, ILivingEntityExtension
Direct Known Subclasses:
ArmorStand, Mob, Player

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 ResourceLocation SPEED_MODIFIER_POWDER_SNOW_ID
    • SPRINTING_MODIFIER_ID

      private static final ResourceLocation 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:
    • SWING_DURATION

      public static final int SWING_DURATION
      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:
    • 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:
    • 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
    • EMPTY_BRAIN

      private static final com.mojang.serialization.Dynamic<?> EMPTY_BRAIN
    • 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
    • walkAnimation

      public final WalkAnimationState walkAnimation
    • invulnerableDuration

      public final int invulnerableDuration
      See Also:
    • yBodyRot

      public float yBodyRot
    • yBodyRotO

      public float yBodyRotO
    • yHeadRot

      public float yHeadRot
    • yHeadRotO

      public float yHeadRotO
    • elytraAnimationState

      public final ElytraAnimationState elytraAnimationState
    • lastHurtByPlayer

      @Nullable protected 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 InterpolationHandler interpolation
    • lerpYHeadRot

      protected double lerpYHeadRot
    • lerpHeadSteps

      protected int lerpHeadSteps
    • effectsDirty

      private boolean effectsDirty
    • lastHurtByMob

      @Nullable private EntityReference<LivingEntity> lastHurtByMob
    • lastHurtByMobTimestamp

      private int lastHurtByMobTimestamp
    • lastHurtMob

      @Nullable private 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
    • lastPos

      private BlockPos lastPos
    • lastClimbablePos

      private Optional<BlockPos> lastClimbablePos
    • lastDamageSource

      @Nullable private DamageSource lastDamageSource
    • lastDamageStamp

      private long lastDamageStamp
    • autoSpinAttackTicks

      protected int autoSpinAttackTicks
    • autoSpinAttackDmg

      protected float autoSpinAttackDmg
    • autoSpinAttackItemStack

      @Nullable protected ItemStack autoSpinAttackItemStack
    • 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
    • damageContainers

      @Nullable protected 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

    • createEquipment

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

      public Brain<?> getBrain()
    • brainProvider

      protected Brain.Provider<?> brainProvider()
    • makeBrain

      protected Brain<?> makeBrain(com.mojang.serialization.Dynamic<?> p_21069_)
    • kill

      public void kill(ServerLevel pLevel)
      Overrides:
      kill in class Entity
    • canAttackType

      public boolean canAttackType(EntityType<?> pEntityType)
    • defineSynchedData

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

      public static AttributeSupplier.Builder createLivingAttributes()
    • checkFallDamage

      protected void checkFallDamage(double pY, boolean pOnGround, BlockState pState, BlockPos pPos)
      Overrides:
      checkFallDamage in class Entity
    • canBreatheUnderwater

      @Deprecated public boolean canBreatheUnderwater()
      Deprecated.
    • getSwimAmount

      public float getSwimAmount(float pPartialTicks)
    • hasLandedInLiquid

      public boolean hasLandedInLiquid()
    • baseTick

      public void baseTick()
      Overrides:
      baseTick in class Entity
    • 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 pLevel, BlockPos pPos)
    • isBaby

      public boolean isBaby()
    • getAgeScale

      public float getAgeScale()
    • getScale

      public final float getScale()
    • sanitizeScale

      protected float sanitizeScale(float pScale)
    • isAffectedByFluids

      public boolean isAffectedByFluids()
    • tickDeath

      protected void tickDeath()
    • shouldDropExperience

      public boolean shouldDropExperience()
    • shouldDropLoot

      protected boolean shouldDropLoot()
    • decreaseAirSupply

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

      protected int increaseAirSupply(int pCurrentAir)
    • getExperienceReward

      public final int getExperienceReward(ServerLevel pLevel, @Nullable Entity pKiller)
    • getBaseExperienceReward

      protected int getBaseExperienceReward(ServerLevel pLevel)
    • isAlwaysExperienceDropper

      protected boolean isAlwaysExperienceDropper()
    • getLastHurtByMob

      @Nullable public LivingEntity getLastHurtByMob()
    • getLastHurtByPlayer

      @Nullable public Player getLastHurtByPlayer()
    • getLastAttacker

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

      public int getLastHurtByMobTimestamp()
    • setLastHurtByPlayer

      public void setLastHurtByPlayer(Player pPlayer, int pMemoryTime)
    • setLastHurtByPlayer

      public void setLastHurtByPlayer(UUID pUuid, int pMemoryTime)
    • setLastHurtByPlayer

      private void setLastHurtByPlayer(EntityReference<Player> pPlayer, int pMemoryTime)
    • setLastHurtByMob

      public void setLastHurtByMob(@Nullable LivingEntity pLivingEntity)
      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

      @Nullable public LivingEntity getLastHurtMob()
    • getLastHurtMobTimestamp

      public int getLastHurtMobTimestamp()
    • setLastHurtMob

      public void setLastHurtMob(Entity pEntity)
    • getNoActionTime

      public int getNoActionTime()
    • setNoActionTime

      public void setNoActionTime(int pIdleTime)
    • shouldDiscardFriction

      public boolean shouldDiscardFriction()
    • setDiscardFriction

      public void setDiscardFriction(boolean pDiscardFriction)
    • doesEmitEquipEvent

      protected boolean doesEmitEquipEvent(EquipmentSlot pSlot)
    • onEquipItem

      public void onEquipItem(EquipmentSlot pSlot, ItemStack pOldItem, ItemStack pNewItem)
    • getEquipSound

      protected Holder<SoundEvent> getEquipSound(EquipmentSlot pSlot, ItemStack pStack, Equippable pEquippable)
    • remove

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

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

      protected void triggerOnDeathMobEffects(ServerLevel pLevel, Entity.RemovalReason pRemovalReason)
    • addAdditionalSaveData

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

      @Nullable public ItemEntity drop(ItemStack pStack, boolean pRandomizeMotion, boolean pIncludeThrower)
    • readAdditionalSaveData

      protected void readAdditionalSaveData(ValueInput pInput)
      Specified by:
      readAdditionalSaveData in class Entity
    • tickEffects

      protected void tickEffects()
    • updateInvisibilityStatus

      protected void updateInvisibilityStatus()
    • updateSynchronizedMobEffectParticles

      private void updateSynchronizedMobEffectParticles()
    • updateGlowingStatus

      private void updateGlowingStatus()
    • getVisibilityPercent

      public double getVisibilityPercent(@Nullable Entity pLookingEntity)
    • canAttack

      public boolean canAttack(LivingEntity pTarget)
    • canBeSeenAsEnemy

      public boolean canBeSeenAsEnemy()
    • canBeSeenByAnyone

      public boolean canBeSeenByAnyone()
    • areAllEffectsAmbient

      public static boolean areAllEffectsAmbient(Collection<MobEffectInstance> pPotionEffects)
      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> pEffect)
    • getEffect

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

      public float getEffectBlendFactor(Holder<MobEffect> pEffect, float pPartialTick)
    • addEffect

      public final boolean addEffect(MobEffectInstance pEffectInstance)
    • addEffect

      public boolean addEffect(MobEffectInstance pEffectInstance, @Nullable Entity pEntity)
    • canBeAffected

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

      public void forceAddEffect(MobEffectInstance pInstance, @Nullable Entity pEntity)
    • isInvertedHealAndHarm

      public boolean isInvertedHealAndHarm()
    • removeEffectNoUpdate

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

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

      protected void onEffectAdded(MobEffectInstance pEffectInstance, @Nullable Entity pEntity)
    • sendEffectToPassengers

      public void sendEffectToPassengers(MobEffectInstance pEffectInstance)
    • onEffectUpdated

      protected void onEffectUpdated(MobEffectInstance pEffectInstance, boolean pForced, @Nullable Entity pEntity)
    • onEffectsRemoved

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

      private void refreshDirtyAttributes()
    • onAttributeUpdated

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

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

      public float getHealth()
    • setHealth

      public void setHealth(float pHealth)
    • isDeadOrDying

      public boolean isDeadOrDying()
    • hurtServer

      public boolean hurtServer(ServerLevel pLevel, DamageSource pDamageSource, float pAmount)
      Specified by:
      hurtServer in class Entity
    • applyItemBlocking

      public float applyItemBlocking(ServerLevel pLevel, DamageSource pDamageSource, float pDamageAmount)
    • playSecondaryHurtSound

      private void playSecondaryHurtSound(DamageSource pDamageSource)
    • resolveMobResponsibleForDamage

      protected void resolveMobResponsibleForDamage(DamageSource pDamageSource)
    • resolvePlayerResponsibleForDamage

      @Nullable protected Player resolvePlayerResponsibleForDamage(DamageSource pDamageSource)
    • blockUsingItem

      protected void blockUsingItem(ServerLevel pLevel, LivingEntity pEntity)
    • blockedByItem

      protected void blockedByItem(LivingEntity pEntity)
    • checkTotemDeathProtection

      private boolean checkTotemDeathProtection(DamageSource pDamageSource)
    • getLastDamageSource

      @Nullable public DamageSource getLastDamageSource()
    • playHurtSound

      protected void playHurtSound(DamageSource pSource)
    • makeSound

      public void makeSound(@Nullable SoundEvent pSound)
    • breakItem

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

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

      protected void createWitherRose(@Nullable LivingEntity pEntitySource)
    • dropAllDeathLoot

      protected void dropAllDeathLoot(ServerLevel pLevel, DamageSource pDamageSource)
    • dropEquipment

      protected void dropEquipment(ServerLevel pLevel)
    • dropExperience

      protected void dropExperience(ServerLevel pLevel, @Nullable Entity pEntity)
    • dropCustomDeathLoot

      protected void dropCustomDeathLoot(ServerLevel pLevel, DamageSource pDamageSource, boolean pRecentlyHit)
    • getLootTableSeed

      public long getLootTableSeed()
    • getKnockback

      protected float getKnockback(Entity pAttacker, DamageSource pDamageSource)
    • dropFromLootTable

      protected void dropFromLootTable(ServerLevel pLevel, DamageSource pDamageSource, boolean pPlayerKill)
    • dropFromGiftLootTable

      public boolean dropFromGiftLootTable(ServerLevel pLevel, ResourceKey<LootTable> pLootTable, BiConsumer<ServerLevel,ItemStack> pDropConsumer)
    • dropFromShearingLootTable

      protected void dropFromShearingLootTable(ServerLevel pLevel, ResourceKey<LootTable> pLootTable, ItemStack pShears, BiConsumer<ServerLevel,ItemStack> pDropConsumer)
    • dropFromLootTable

      protected boolean dropFromLootTable(ServerLevel pLevel, ResourceKey<LootTable> pLootTable, Function<LootParams.Builder,LootParams> pParamsBuilder, BiConsumer<ServerLevel,ItemStack> pDropConsumer)
    • knockback

      public void knockback(double pStrength, double pX, double pZ)
    • indicateDamage

      public void indicateDamage(double pXDistance, double pZDistance)
    • getHurtSound

      @Nullable protected SoundEvent getHurtSound(DamageSource pDamageSource)
    • getDeathSound

      @Nullable protected SoundEvent getDeathSound()
    • getFallDamageSound

      private SoundEvent getFallDamageSound(int pHeight)
    • skipDropExperience

      public void skipDropExperience()
    • wasExperienceConsumed

      public boolean wasExperienceConsumed()
    • getHurtDir

      public float getHurtDir()
    • getHitbox

      public AABB getHitbox()
    • activeLocationDependentEnchantments

      public Map<Enchantment,Set<EnchantmentLocationBasedEffect>> activeLocationDependentEnchantments(EquipmentSlot pSlot)
    • getFallSounds

      public LivingEntity.Fallsounds getFallSounds()
    • getLastClimbablePos

      public Optional<BlockPos> getLastClimbablePos()
    • onClimbable

      public boolean onClimbable()
    • trapdoorUsableAsLadder

      private boolean trapdoorUsableAsLadder(BlockPos pPos, BlockState pState)
    • isAlive

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

      public boolean isLookingAtMe(LivingEntity pEntity, double pTolerance, boolean pScaleByDistance, boolean pVisual, double... pYValues)
    • getMaxFallDistance

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

      protected final int getComfortableFallDistance(float pHealth)
    • causeFallDamage

      public boolean causeFallDamage(double pFallDistance, float pDamageMultiplier, DamageSource pDamageSource)
      Overrides:
      causeFallDamage in class Entity
    • calculateFallDamage

      protected int calculateFallDamage(double pFallDistance, float pDamageMultiplier)
    • calculateFallPower

      private double calculateFallPower(double pFallDistance)
    • playBlockFallSound

      protected void playBlockFallSound()
    • animateHurt

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

      public int getArmorValue()
    • hurtArmor

      protected void hurtArmor(DamageSource pDamageSource, float pDamageAmount)
    • hurtHelmet

      protected void hurtHelmet(DamageSource pDamageSource, float pDamageAmount)
    • doHurtEquipment

      protected void doHurtEquipment(DamageSource pDamageSource, float pDamageAmount, EquipmentSlot... pSlots)
    • getDamageAfterArmorAbsorb

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

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

      protected void actuallyHurt(ServerLevel pLevel, DamageSource pDamageSource, float pAmount)
    • getCombatTracker

      public CombatTracker getCombatTracker()
    • getKillCredit

      @Nullable public LivingEntity getKillCredit()
    • getMaxHealth

      public final float getMaxHealth()
    • getMaxAbsorption

      public final float getMaxAbsorption()
    • getArrowCount

      public final int getArrowCount()
    • setArrowCount

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

      public final int getStingerCount()
    • setStingerCount

      public final void setStingerCount(int pStingerCount)
    • getCurrentSwingDuration

      public int getCurrentSwingDuration()
    • swing

      public void swing(InteractionHand pHand)
    • swing

      public void swing(InteractionHand pHand, boolean pUpdateSelf)
    • handleDamageEvent

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

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

      public void makePoofParticles()
    • makeDrownParticles

      private void makeDrownParticles()
    • swapHandItems

      private void swapHandItems()
    • onBelowWorld

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

      protected void updateSwingTime()
    • getAttribute

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

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

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

      public AttributeMap getAttributes()
    • getMainHandItem

      public ItemStack getMainHandItem()
    • getOffhandItem

      public ItemStack getOffhandItem()
    • getItemHeldByArm

      public ItemStack getItemHeldByArm(HumanoidArm pArm)
    • getWeaponItem

      @Nonnull public ItemStack getWeaponItem()
      Overrides:
      getWeaponItem in class Entity
    • isHolding

      public boolean isHolding(Item pItem)
    • isHolding

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

      public ItemStack getItemInHand(InteractionHand pHand)
    • setItemInHand

      public void setItemInHand(InteractionHand pHand, ItemStack pStack)
    • hasItemInSlot

      public boolean hasItemInSlot(EquipmentSlot pSlot)
    • canUseSlot

      public boolean canUseSlot(EquipmentSlot pSlot)
    • getItemBySlot

      public ItemStack getItemBySlot(EquipmentSlot pSlot)
    • setItemSlot

      public void setItemSlot(EquipmentSlot pSlot, ItemStack pStack)
    • getArmorCoverPercentage

      public float getArmorCoverPercentage()
    • setSprinting

      public void setSprinting(boolean pSprinting)
      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 pEntity)
      Applies a velocity to the entities, to push them away from each other.
      Overrides:
      push in class Entity
    • dismountVehicle

      private void dismountVehicle(Entity pVehicle)
    • shouldShowName

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

      protected float getJumpPower()
    • getJumpPower

      protected float getJumpPower(float pMultiplier)
    • getJumpBoostPower

      public float getJumpBoostPower()
    • jumpFromGround

      public void jumpFromGround()
    • goDownInWater

      @Deprecated protected void goDownInWater()
      Deprecated.
    • jumpInLiquid

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

      protected float getWaterSlowDown()
    • canStandOnFluid

      public boolean canStandOnFluid(FluidState pFluidState)
    • getDefaultGravity

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

      protected double getEffectiveGravity()
    • travel

      public void travel(Vec3 pTravelVector)
    • travelFlying

      protected void travelFlying(Vec3 pRelative, float pAmount)
    • travelFlying

      protected void travelFlying(Vec3 pRelative, float pInWaterAmount, float pInLavaAmount, float pAmount)
    • travelInAir

      private void travelInAir(Vec3 pTravelVector)
    • travelInFluid

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

      private void travelInFluid(Vec3 pTravelVector, FluidState fluidState)
    • travelFallFlying

      private void travelFallFlying(Vec3 pTravelVector)
    • stopFallFlying

      public void stopFallFlying()
    • updateFallFlyingMovement

      private Vec3 updateFallFlyingMovement(Vec3 pDeltaMovement)
    • handleFallFlyingCollisions

      private void handleFallFlyingCollisions(double pOldSpeed, double pNewSpeed)
    • travelRidden

      private void travelRidden(Player pPlayer, Vec3 pTravelVector)
    • tickRidden

      protected void tickRidden(Player pPlayer, Vec3 pTravelVector)
    • getRiddenInput

      protected Vec3 getRiddenInput(Player pPlayer, Vec3 pTravelVector)
    • getRiddenSpeed

      protected float getRiddenSpeed(Player pPlayer)
    • calculateEntityAnimation

      public void calculateEntityAnimation(boolean pIncludeHeight)
    • updateWalkAnimation

      protected void updateWalkAnimation(float pPartialTick)
    • handleRelativeFrictionAndCalculateMovement

      private Vec3 handleRelativeFrictionAndCalculateMovement(Vec3 pDeltaMovement, float pFriction)
    • getFluidFallingAdjustedMovement

      public Vec3 getFluidFallingAdjustedMovement(double pGravity, boolean pIsFalling, Vec3 pDeltaMovement)
    • handleOnClimbable

      private Vec3 handleOnClimbable(Vec3 pDeltaMovement)
    • getFrictionInfluencedSpeed

      private float getFrictionInfluencedSpeed(float pFriction)
    • getFlyingSpeed

      protected float getFlyingSpeed()
    • getSpeed

      public float getSpeed()
    • setSpeed

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

      public boolean doHurtTarget(ServerLevel pLevel, Entity pSource)
    • tick

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

      private void detectEquipmentUpdates()
    • collectEquipmentChanges

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

      public boolean equipmentHasChanged(ItemStack pOldItem, ItemStack pNewItem)
    • handleHandSwap

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

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

      protected void tickHeadTurn(float pYBodyRot)
    • 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 pBoundingBoxBeforeSpin, AABB pBoundingBoxAfterSpin)
    • doPush

      protected void doPush(Entity pEntity)
    • doAutoAttackOnTouch

      protected void doAutoAttackOnTouch(LivingEntity pTarget)
    • 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 pYaw, int pPitch)
      Overrides:
      lerpHeadTo in class Entity
    • setJumping

      public void setJumping(boolean pJumping)
    • onItemPickup

      public void onItemPickup(ItemEntity pItemEntity)
    • take

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

      public boolean hasLineOfSight(Entity pEntity)
    • hasLineOfSight

      public boolean hasLineOfSight(Entity pEntity, ClipContext.Block pBlock, ClipContext.Fluid pFluid, double pY)
    • getViewYRot

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

      public float getAttackAnim(float pPartialTick)
      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 pRotation)
      Sets the head's yaw rotation of the entity.
      Overrides:
      setYHeadRot in class Entity
    • setYBodyRot

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

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

      public static Vec3 resetForwardDirectionOfRelativePortalPosition(Vec3 pRelativePortalPosition)
    • getAbsorptionAmount

      public float getAbsorptionAmount()
    • setAbsorptionAmount

      public final void setAbsorptionAmount(float pAbsorptionAmount)
    • internalSetAbsorptionAmount

      protected void internalSetAbsorptionAmount(float pAbsorptionAmount)
    • 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

      @Nullable private ItemEntity createItemStackToDrop(ItemStack pStack, boolean pRandomizeMotion, boolean pIncludeThrower)
    • updateUsingItem

      protected void updateUsingItem(ItemStack pUsingItem)
    • updateSwimAmount

      private void updateSwimAmount()
    • setLivingEntityFlag

      protected void setLivingEntityFlag(int pKey, boolean pValue)
    • startUsingItem

      public void startUsingItem(InteractionHand pHand)
    • onSyncedDataUpdated

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

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

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

      public void spawnItemParticles(ItemStack pStack, int pAmount)
    • completeUsingItem

      protected void completeUsingItem()
    • handleExtraItemsCreatedOnUse

      public void handleExtraItemsCreatedOnUse(ItemStack pStack)
    • getUseItem

      public ItemStack getUseItem()
    • getUseItemRemainingTicks

      public int getUseItemRemainingTicks()
    • getTicksUsingItem

      public int getTicksUsingItem()
    • releaseUsingItem

      public void releaseUsingItem()
    • stopUsingItem

      public void stopUsingItem()
    • isBlocking

      public boolean isBlocking()
    • getItemBlockingWith

      @Nullable public 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 pX, double pY, double pZ, boolean pBroadcastTeleport)
    • isAffectedByPotions

      public boolean isAffectedByPotions()
    • attackable

      public boolean attackable()
    • setRecordPlayingNearby

      public void setRecordPlayingNearby(BlockPos pJukebox, boolean pPartyParrot)
      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 pPose)
      Overrides:
      getDimensions in class Entity
    • getDefaultDimensions

      protected EntityDimensions getDefaultDimensions(Pose pPose)
    • getDismountPoses

      public com.google.common.collect.ImmutableList<Pose> getDismountPoses()
    • getLocalBoundsForPose

      public AABB getLocalBoundsForPose(Pose pPose)
    • wouldNotSuffocateAtTargetPose

      protected boolean wouldNotSuffocateAtTargetPose(Pose pPose)
    • canUsePortal

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

      public Optional<BlockPos> getSleepingPos()
    • setSleepingPos

      public void setSleepingPos(BlockPos pPos)
    • clearSleepingPos

      public void clearSleepingPos()
    • isSleeping

      public boolean isSleeping()
    • startSleeping

      public void startSleeping(BlockPos pPos)
    • setPosToBed

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

      private boolean checkBedExists()
    • stopSleeping

      public void stopSleeping()
    • getBedOrientation

      @Nullable public Direction getBedOrientation()
    • isInWall

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

      public ItemStack getProjectile(ItemStack pWeaponStack)
    • entityEventForEquipmentBreak

      private static byte entityEventForEquipmentBreak(EquipmentSlot pSlot)
    • onEquippedItemBroken

      public void onEquippedItemBroken(Item pItem, EquipmentSlot pSlot)
    • stopLocationBasedEffects

      private void stopLocationBasedEffects(ItemStack pStack, EquipmentSlot pSlot, AttributeMap pAttributeMap)
    • getSlotForHand

      public static EquipmentSlot getSlotForHand(InteractionHand pHand)
    • canEquipWithDispenser

      public final boolean canEquipWithDispenser(ItemStack pStack)
    • canDispenserEquipIntoSlot

      protected boolean canDispenserEquipIntoSlot(EquipmentSlot pSlot)
    • getEquipmentSlotForItem

      public final EquipmentSlot getEquipmentSlotForItem(ItemStack pStack)
    • isEquippableInSlot

      public final boolean isEquippableInSlot(ItemStack pStack, EquipmentSlot pSlot)
    • createEquipmentSlotAccess

      private static SlotAccess createEquipmentSlotAccess(LivingEntity pEntity, EquipmentSlot pSlot)
    • getEquipmentSlot

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

      public SlotAccess getSlot(int pSlot)
      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()
      Overrides:
      getVisualRotationYInDegrees in class Entity
    • recreateFromPacket

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

      public float getSecondsToDisableBlocking()
    • maxUpStep

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

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

      protected void lerpHeadRotationStep(int pLerpHeadSteps, double pLerpYHeadRot)
    • igniteForTicks

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

      public boolean hasInfiniteMaterials()
    • isInvulnerableTo

      public boolean isInvulnerableTo(ServerLevel pLevel, DamageSource pDamageSource)
    • canGlideUsing

      public static boolean canGlideUsing(ItemStack pStack, EquipmentSlot pSlot)
    • getLastHurtByPlayerMemoryTime

      public int getLastHurtByPlayerMemoryTime()
    • isTransmittingWaypoint

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

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

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