Class LivingEntity

All Implemented Interfaces:
CommandSource, SyncedDataHolder, Attackable, EntityAccess, Nameable, ScoreHolder, IAttachmentHolder, IEntityExtension, ILivingEntityExtension, INBTSerializable<CompoundTag>
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
    • HAND_SLOTS

      public static final int HAND_SLOTS
      See Also:
    • ARMOR_SLOTS

      public static final int ARMOR_SLOTS
      See Also:
    • 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:
    • 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:
    • 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:
    • USE_ITEM_INTERVAL

      public static final int USE_ITEM_INTERVAL
      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:
    • ITEM_USE_EFFECT_START_FRACTION

      private static final float ITEM_USE_EFFECT_START_FRACTION
      See Also:
    • ATTRIBUTES_FIELD

      public static final String ATTRIBUTES_FIELD
      See Also:
    • attributes

      private final AttributeMap attributes
    • combatTracker

      private final CombatTracker combatTracker
    • activeEffects

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

      private final NonNullList<ItemStack> lastHandItemStacks
    • lastArmorItemStacks

      private final NonNullList<ItemStack> lastArmorItemStacks
    • lastBodyItemStack

      private ItemStack lastBodyItemStack
    • 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:
    • timeOffs

      public final float timeOffs
    • rotA

      public final float rotA
    • yBodyRot

      public float yBodyRot
    • yBodyRotO

      public float yBodyRotO
    • yHeadRot

      public float yHeadRot
    • yHeadRotO

      public float yHeadRotO
    • lastHurtByPlayer

      @Nullable protected Player lastHurtByPlayer
    • lastHurtByPlayerTime

      protected int lastHurtByPlayerTime
    • dead

      protected boolean dead
    • noActionTime

      protected int noActionTime
    • oRun

      protected float oRun
    • run

      protected float run
    • animStep

      protected float animStep
    • animStepO

      protected float animStepO
    • rotOffs

      protected float rotOffs
    • deathScore

      protected int deathScore
    • 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
    • lerpSteps

      protected int lerpSteps
    • lerpX

      protected double lerpX
    • lerpY

      protected double lerpY
    • lerpZ

      protected double lerpZ
    • lerpYRot

      protected double lerpYRot
    • lerpXRot

      protected double lerpXRot
    • lerpYHeadRot

      protected double lerpYHeadRot
    • lerpHeadSteps

      protected int lerpHeadSteps
    • effectsDirty

      private boolean effectsDirty
    • lastHurtByMob

      @Nullable private 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 it.unimi.dsi.fastutil.objects.Reference2ObjectMap<Enchantment,Set<EnchantmentLocationBasedEffect>> activeLocationDependentEnchantments
    • appliedScale

      protected float appliedScale
    • damageContainers

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

  • Method Details

    • getBrain

      public Brain<?> getBrain()
    • brainProvider

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

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

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

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

      protected void defineSynchedData(SynchedEntityData.Builder builder)
      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
    • 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 float getScale()
    • sanitizeScale

      protected float sanitizeScale(float scale)
    • isAffectedByFluids

      protected 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()
    • isAlwaysExperienceDropper

      protected boolean isAlwaysExperienceDropper()
    • getLastHurtByMob

      @Nullable public LivingEntity getLastHurtByMob()
    • getLastAttacker

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

      public int getLastHurtByMobTimestamp()
    • setLastHurtByPlayer

      public void setLastHurtByPlayer(@Nullable Player player)
    • 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)
    • remove

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

      protected void triggerOnDeathMobEffects(Entity.RemovalReason removalReason)
    • addAdditionalSaveData

      public void addAdditionalSaveData(CompoundTag compound)
      Specified by:
      addAdditionalSaveData in class Entity
    • 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)
    • canAttack

      public boolean canAttack(LivingEntity livingentity, TargetingConditions condition)
    • 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)
    • 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 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)
    • onEffectRemoved

      protected void onEffectRemoved(MobEffectInstance effectInstance)
    • refreshDirtyAttributes

      private void refreshDirtyAttributes()
    • onAttributeUpdated

      private 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()
    • hurt

      public boolean hurt(DamageSource source, float amount)
      Called when the entity is attacked.
      Overrides:
      hurt in class Entity
    • blockUsingShield

      protected void blockUsingShield(LivingEntity attacker)
    • blockedByShield

      protected void blockedByShield(LivingEntity defender)
    • checkTotemDeathProtection

      private boolean checkTotemDeathProtection(DamageSource damageSource)
    • getLastDamageSource

      @Nullable public DamageSource getLastDamageSource()
    • playHurtSound

      protected void playHurtSound(DamageSource source)
    • makeSound

      public void makeSound(@Nullable SoundEvent sound)
    • isDamageSourceBlocked

      public boolean isDamageSourceBlocked(DamageSource damageSource)
      Determines whether the entity can block the damage source based on the damage source's location, whether the damage source is blockable, and whether the entity is blocking.
    • 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 p_level, DamageSource damageSource)
    • dropEquipment

      protected void dropEquipment()
    • dropExperience

      protected void dropExperience(@Nullable Entity entity)
    • dropCustomDeathLoot

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

      public ResourceKey<LootTable> getLootTable()
    • getLootTableSeed

      public long getLootTableSeed()
    • getKnockback

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

      protected void dropFromLootTable(DamageSource damageSource, boolean hitByPlayer)
    • 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()
    • getFallSounds

      public LivingEntity.Fallsounds getFallSounds()
    • getDrinkingSound

      protected SoundEvent getDrinkingSound(ItemStack stack)
    • getEatingSound

      public SoundEvent getEatingSound(ItemStack stack)
    • 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
    • getMaxFallDistance

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

      protected final int getComfortableFallDistance(float health)
    • causeFallDamage

      public boolean causeFallDamage(float fallDistance, float multiplier, DamageSource source)
      Overrides:
      causeFallDamage in class Entity
    • calculateFallDamage

      protected int calculateFallDamage(float fallDistance, float damageMultiplier)
    • 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 damageAmount)
    • hurtHelmet

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

      protected void hurtCurrentlyUsedShield(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(DamageSource damageSource, float damageAmount)
      Deals damage to the entity. This will take the armor of the entity into consideration before damaging the health bar.
    • 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 damageSource)
      Overrides:
      handleDamageEvent in class Entity
    • handleEntityEvent

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

      private void makePoofParticles()
    • 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()
    • 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)
    • getArmorSlots

      public abstract Iterable<ItemStack> getArmorSlots()
    • getItemBySlot

      public abstract ItemStack getItemBySlot(EquipmentSlot slot)
    • setItemSlot

      public abstract void setItemSlot(EquipmentSlot slot, ItemStack stack)
    • getHandSlots

      public Iterable<ItemStack> getHandSlots()
    • getArmorAndBodyArmorSlots

      public Iterable<ItemStack> getArmorAndBodyArmorSlots()
    • getAllSlots

      public Iterable<ItemStack> getAllSlots()
    • verifyEquippedItem

      protected void verifyEquippedItem(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
    • travel

      public void travel(Vec3 travelVector)
    • 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

      public 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(Entity target)
    • 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)
    • getLastArmorItem

      private ItemStack getLastArmorItem(EquipmentSlot slot)
    • setLastArmorItem

      private void setLastArmorItem(EquipmentSlot slot, ItemStack stack)
    • getLastHandItem

      private ItemStack getLastHandItem(EquipmentSlot slot)
    • setLastHandItem

      private void setLastHandItem(EquipmentSlot slot, ItemStack stack)
    • tickHeadTurn

      protected float tickHeadTurn(float yRot, float animStep)
    • getMaxHeadRotationRelativeToBody

      protected float getMaxHeadRotationRelativeToBody()
    • aiStep

      public void aiStep()
    • isSensitiveToWater

      public boolean isSensitiveToWater()
    • updateFallFlying

      private void updateFallFlying()
    • 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
    • lerpTo

      public void lerpTo(double x, double y, double z, float yRot, float xRot, int steps)
      Overrides:
      lerpTo in class Entity
    • lerpTargetX

      public double lerpTargetX()
      Overrides:
      lerpTargetX in class Entity
    • lerpTargetY

      public double lerpTargetY()
      Overrides:
      lerpTargetY in class Entity
    • lerpTargetZ

      public double lerpTargetZ()
      Overrides:
      lerpTargetZ in class Entity
    • lerpTargetXRot

      public float lerpTargetXRot()
      Overrides:
      lerpTargetXRot in class Entity
    • lerpTargetYRot

      public float lerpTargetYRot()
      Overrides:
      lerpTargetYRot 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)
    • 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 axis, BlockUtil.FoundRectangle portal)
      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()
    • updateUsingItem

      protected void updateUsingItem(ItemStack usingItem)
    • shouldTriggerItemUseEffects

      private boolean shouldTriggerItemUseEffects()
    • 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 partialTick)
      Overrides:
      getPreciseBodyRotation in class Entity
    • triggerItemUseEffects

      protected void triggerItemUseEffects(ItemStack stack, int amount)
    • spawnItemParticles

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

      protected void completeUsingItem()
    • getUseItem

      public ItemStack getUseItem()
    • getUseItemRemainingTicks

      public int getUseItemRemainingTicks()
    • getTicksUsingItem

      public int getTicksUsingItem()
    • releaseUsingItem

      public void releaseUsingItem()
    • stopUsingItem

      public void stopUsingItem()
    • isBlocking

      public boolean isBlocking()
    • 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.
    • canTakeItem

      public boolean canTakeItem(ItemStack stack)
    • getDimensions

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

      protected EntityDimensions getDefaultDimensions(Pose pose)
    • getDismountPoses

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

      public AABB getLocalBoundsForPose(Pose pose)
    • wouldNotSuffocateAtTargetPose

      protected boolean wouldNotSuffocateAtTargetPose(Pose pose)
    • canUsePortal

      public boolean canUsePortal(boolean allowPassengers)
      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)
      Gets an item stack available to this entity to be loaded into the provided weapon, or an empty item stack if no such item stack is available.
    • eat

      public final ItemStack eat(Level level, ItemStack food)
    • eat

      public ItemStack eat(Level level, ItemStack food, FoodProperties foodProperties)
    • addEatEffect

      private void addEatEffect(FoodProperties foodProperties)
    • entityEventForEquipmentBreak

      private static byte entityEventForEquipmentBreak(EquipmentSlot slot)
    • onEquippedItemBroken

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

      public static EquipmentSlot getSlotForHand(InteractionHand hand)
    • removeEffectsCuredBy

      public boolean removeEffectsCuredBy(EffectCure cure)
      Neo: Removes all potion effects that have the given EffectCure in their set of cures
      Parameters:
      cure - the EffectCure being used
    • shouldRiderFaceForward

      public boolean shouldRiderFaceForward(Player player)
      Neo: Returns true if the entity's rider (EntityPlayer) should face forward when mounted. currently only used in vanilla code by pigs.
      Parameters:
      player - The player who is riding the entity.
      Returns:
      If the player should orient the same direction as this entity.
    • getBoundingBoxForCulling

      public AABB getBoundingBoxForCulling()
      Overrides:
      getBoundingBoxForCulling in class Entity
    • getEquipmentSlotForItem

      public EquipmentSlot getEquipmentSlotForItem(ItemStack stack)
    • createEquipmentSlotAccess

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

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

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

      public boolean canDisableShield()
    • maxUpStep

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

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

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

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

      public boolean hasInfiniteMaterials()
    • isInvulnerableTo

      public boolean isInvulnerableTo(DamageSource source)
      Returns whether this Entity is invulnerable to the given DamageSource.
      Overrides:
      isInvulnerableTo in class Entity