Class LivingEntity

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

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

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • TAG_ACTIVE_EFFECTS

      private static final String TAG_ACTIVE_EFFECTS
      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:
    • ATTRIBUTES_FIELD

      public static final String ATTRIBUTES_FIELD
      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
    • 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
    • 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<?> dynamic)
    • kill

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

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

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

      public static AttributeSupplier.Builder createLivingAttributes()
    • checkFallDamage

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

      @Deprecated public final boolean canBreatheUnderwater()
      Deprecated.
    • getSwimAmount

      public float getSwimAmount(float partialTicks)
    • 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 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()
    • decreaseAirSupply

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

      protected int increaseAirSupply(int currentAir)
    • getExperienceReward

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

      protected int getBaseExperienceReward(ServerLevel level)
    • 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 player, int memoryTime)
    • setLastHurtByPlayer

      public void setLastHurtByPlayer(UUID uuid, int memoryTime)
    • setLastHurtByPlayer

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

      public void setLastHurtByMob(@Nullable LivingEntity livingEntity)
      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 entity)
    • getNoActionTime

      public int getNoActionTime()
    • setNoActionTime

      public void setNoActionTime(int idleTime)
    • shouldDiscardFriction

      public boolean shouldDiscardFriction()
    • setDiscardFriction

      public void setDiscardFriction(boolean discardFriction)
    • doesEmitEquipEvent

      protected boolean doesEmitEquipEvent(EquipmentSlot slot)
    • onEquipItem

      public void onEquipItem(EquipmentSlot slot, ItemStack oldItem, ItemStack newItem)
    • getEquipSound

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

      public void remove(Entity.RemovalReason p_276115_)
      Overrides:
      remove in class Entity
    • triggerOnDeathMobEffects

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

      public void addAdditionalSaveData(CompoundTag compound)
      Specified by:
      addAdditionalSaveData in class Entity
    • drop

      @Nullable public ItemEntity drop(ItemStack stack, boolean randomizeMotion, boolean includeThrower)
    • readAdditionalSaveData

      public void readAdditionalSaveData(CompoundTag compound)
      (abstract) Protected helper method to read subclass entity data from NBT.
      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 lookingEntity)
    • canAttack

      public boolean canAttack(LivingEntity target)
    • canBeSeenAsEnemy

      public boolean canBeSeenAsEnemy()
    • canBeSeenByAnyone

      public boolean canBeSeenByAnyone()
    • areAllEffectsAmbient

      public static boolean areAllEffectsAmbient(Collection<MobEffectInstance> potionEffects)
      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

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

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

      public final boolean addEffect(MobEffectInstance effectInstance)
    • addEffect

      public boolean addEffect(MobEffectInstance effectInstance, @Nullable Entity entity)
    • canBeAffected

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

      public void forceAddEffect(MobEffectInstance instance, @Nullable Entity entity)
    • isInvertedHealAndHarm

      public boolean isInvertedHealAndHarm()
    • removeEffectNoUpdate

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

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

      protected void onEffectAdded(MobEffectInstance effectInstance, @Nullable Entity entity)
    • sendEffectToPassengers

      public void sendEffectToPassengers(MobEffectInstance effectInstance)
    • onEffectUpdated

      protected void onEffectUpdated(MobEffectInstance effectInstance, boolean forced, @Nullable Entity entity)
    • onEffectsRemoved

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

      private void refreshDirtyAttributes()
    • onAttributeUpdated

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

      public void heal(float healAmount)
      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 p_376221_, DamageSource p_376460_, float p_376610_)
      Specified by:
      hurtServer in class Entity
    • applyItemBlocking

      public float applyItemBlocking(ServerLevel level, DamageSource damageSource, float damageAmount)
    • playSecondaryHurtSound

      private void playSecondaryHurtSound(DamageSource damageSource)
    • resolveMobResponsibleForDamage

      protected void resolveMobResponsibleForDamage(DamageSource damageSource)
    • resolvePlayerResponsibleForDamage

      @Nullable protected Player resolvePlayerResponsibleForDamage(DamageSource damageSource)
    • blockUsingItem

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

      protected void blockedByItem(LivingEntity entity)
    • checkTotemDeathProtection

      private boolean checkTotemDeathProtection(DamageSource damageSource)
    • getLastDamageSource

      @Nullable public DamageSource getLastDamageSource()
    • playHurtSound

      protected void playHurtSound(DamageSource source)
    • makeSound

      public void makeSound(@Nullable SoundEvent sound)
    • breakItem

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

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

      protected void createWitherRose(@Nullable LivingEntity entitySource)
    • dropAllDeathLoot

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

      protected void dropEquipment(ServerLevel level)
    • dropExperience

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

      protected void dropCustomDeathLoot(ServerLevel level, DamageSource damageSource, boolean recentlyHit)
    • getLootTableSeed

      public long getLootTableSeed()
    • getKnockback

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

      protected void dropFromLootTable(ServerLevel level, DamageSource damageSource, boolean playerKill)
    • dropFromGiftLootTable

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

      protected void dropFromShearingLootTable(ServerLevel level, ResourceKey<LootTable> lootTable, ItemStack shears, BiConsumer<ServerLevel,ItemStack> dropConsumer)
    • dropFromLootTable

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

      public void knockback(double strength, double x, double z)
    • indicateDamage

      public void indicateDamage(double xDistance, double zDistance)
    • getHurtSound

      @Nullable protected SoundEvent getHurtSound(DamageSource damageSource)
    • getDeathSound

      @Nullable protected SoundEvent getDeathSound()
    • getFallDamageSound

      private SoundEvent getFallDamageSound(int height)
    • 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)
    • 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 entity, double tolerance, boolean scaleByDistance, boolean visual, double... yValues)
    • getMaxFallDistance

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

      protected final int getComfortableFallDistance(float health)
    • causeFallDamage

      public boolean causeFallDamage(double p_397597_, float p_147187_, DamageSource p_147189_)
      Overrides:
      causeFallDamage in class Entity
    • calculateFallDamage

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

      private double calculateFallPower(double fallDistance)
    • playBlockFallSound

      protected void playBlockFallSound()
    • animateHurt

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

      public int getArmorValue()
    • hurtArmor

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

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

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

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

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

      protected void actuallyHurt(ServerLevel level, DamageSource damageSource, float amount)
    • 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 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 stingerCount)
    • getCurrentSwingDuration

      public int getCurrentSwingDuration()
    • swing

      public void swing(InteractionHand hand)
    • swing

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

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

      public void handleEntityEvent(byte id)
      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> 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

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

      public boolean isHolding(Item item)
    • isHolding

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

      public ItemStack getItemInHand(InteractionHand hand)
    • setItemInHand

      public void setItemInHand(InteractionHand hand, ItemStack stack)
    • 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 stack)
    • getArmorCoverPercentage

      public float getArmorCoverPercentage()
    • setSprinting

      public void setSprinting(boolean sprinting)
      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> fluidTag)
      Deprecated.
    • getWaterSlowDown

      protected float getWaterSlowDown()
    • canStandOnFluid

      public boolean canStandOnFluid(FluidState fluidState)
    • getDefaultGravity

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

      protected double getEffectiveGravity()
    • travel

      public void travel(Vec3 travelVector)
    • travelInAir

      private void travelInAir(Vec3 travelVector)
    • travelInFluid

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

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

      private void travelFallFlying(Vec3 travelVector)
    • stopFallFlying

      public void stopFallFlying()
    • updateFallFlyingMovement

      private Vec3 updateFallFlyingMovement(Vec3 deltaMovement)
    • handleFallFlyingCollisions

      private void handleFallFlyingCollisions(double oldSpeed, double newSpeed)
    • travelRidden

      private void travelRidden(Player player, Vec3 travelVector)
    • tickRidden

      protected void tickRidden(Player player, Vec3 travelVector)
    • getRiddenInput

      protected Vec3 getRiddenInput(Player player, Vec3 travelVector)
    • getRiddenSpeed

      protected float getRiddenSpeed(Player player)
    • calculateEntityAnimation

      public void calculateEntityAnimation(boolean includeHeight)
    • updateWalkAnimation

      protected void updateWalkAnimation(float partialTick)
    • handleRelativeFrictionAndCalculateMovement

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

      public Vec3 getFluidFallingAdjustedMovement(double gravity, boolean isFalling, Vec3 deltaMovement)
    • handleOnClimbable

      private Vec3 handleOnClimbable(Vec3 deltaMovement)
    • getFrictionInfluencedSpeed

      private float getFrictionInfluencedSpeed(float friction)
    • 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 source)
    • 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 oldItem, ItemStack newItem)
    • handleHandSwap

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

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

      protected void tickHeadTurn(float yBodyRot)
    • getMaxHeadRotationRelativeToBody

      protected float getMaxHeadRotationRelativeToBody()
    • aiStep

      public void aiStep()
    • applyInput

      protected void applyInput()
    • isSensitiveToWater

      public boolean isSensitiveToWater()
    • updateFallFlying

      protected void updateFallFlying()
    • canGlide

      protected boolean canGlide()
    • serverAiStep

      protected void serverAiStep()
    • pushEntities

      protected void pushEntities()
    • checkAutoSpinAttack

      protected void checkAutoSpinAttack(AABB boundingBoxBeforeSpin, AABB boundingBoxAfterSpin)
    • doPush

      protected void doPush(Entity entity)
    • doAutoAttackOnTouch

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

      public void setJumping(boolean jumping)
    • onItemPickup

      public void onItemPickup(ItemEntity itemEntity)
    • take

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

      public boolean hasLineOfSight(Entity entity)
    • hasLineOfSight

      public boolean hasLineOfSight(Entity entity, ClipContext.Block block, ClipContext.Fluid fluid, double y)
    • getViewYRot

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

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

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

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

      public static Vec3 resetForwardDirectionOfRelativePortalPosition(Vec3 relativePortalPosition)
    • 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

      @Nullable private ItemEntity createItemStackToDrop(ItemStack stack, boolean randomizeMotion, boolean includeThrower)
    • updateUsingItem

      protected void updateUsingItem(ItemStack usingItem)
    • updateSwimAmount

      private void updateSwimAmount()
    • setLivingEntityFlag

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

      public void startUsingItem(InteractionHand hand)
    • onSyncedDataUpdated

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

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

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

      public void spawnItemParticles(ItemStack stack, int amount)
    • completeUsingItem

      protected void completeUsingItem()
    • handleExtraItemsCreatedOnUse

      public void handleExtraItemsCreatedOnUse(ItemStack stack)
    • 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 x, double y, double z, boolean broadcastTeleport)
    • isAffectedByPotions

      public boolean isAffectedByPotions()
    • attackable

      public boolean attackable()
    • setRecordPlayingNearby

      public void setRecordPlayingNearby(BlockPos jukebox, boolean partyParrot)
      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 p_352946_)
      Overrides:
      canUsePortal in class Entity
    • getSleepingPos

      public Optional<BlockPos> getSleepingPos()
    • setSleepingPos

      public void setSleepingPos(BlockPos pos)
    • clearSleepingPos

      public void clearSleepingPos()
    • isSleeping

      public boolean isSleeping()
    • startSleeping

      public void startSleeping(BlockPos pos)
    • setPosToBed

      private void setPosToBed(BlockPos pos)
      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 weaponStack)
    • entityEventForEquipmentBreak

      private static byte entityEventForEquipmentBreak(EquipmentSlot slot)
    • onEquippedItemBroken

      public void onEquippedItemBroken(Item item, EquipmentSlot slot)
    • stopLocationBasedEffects

      private void stopLocationBasedEffects(ItemStack stack, EquipmentSlot slot, AttributeMap attributeMap)
    • getSlotForHand

      public static EquipmentSlot getSlotForHand(InteractionHand hand)
    • canEquipWithDispenser

      public final boolean canEquipWithDispenser(ItemStack stack)
    • canDispenserEquipIntoSlot

      protected boolean canDispenserEquipIntoSlot(EquipmentSlot slot)
    • getEquipmentSlotForItem

      public final EquipmentSlot getEquipmentSlotForItem(ItemStack stack)
    • isEquippableInSlot

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

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

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

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

      public float getSecondsToDisableBlocking()
    • maxUpStep

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

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

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

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

      public boolean hasInfiniteMaterials()
    • isInvulnerableTo

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

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

      public int getLastHurtByPlayerMemoryTime()