Class LivingEntity

All Implemented Interfaces:
CommandSource, SyncedDataHolder, Attackable, EntityAccess, Nameable, ScoreHolder, IAttachmentHolder, IEntityExtension, ILivingEntityExtension, INBTSerializable<CompoundTag>
Direct Known Subclasses:
ArmorStand, EntityRendererEventsTest.MyEntity, 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<?> p_21069_)
    • kill

      public void kill()
      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 final 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
    • 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 float getScale()
    • sanitizeScale

      protected float sanitizeScale(float pScale)
    • isAffectedByFluids

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

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

      protected void triggerOnDeathMobEffects(Entity.RemovalReason pRemovalReason)
    • addAdditionalSaveData

      public void addAdditionalSaveData(CompoundTag pCompound)
      Specified by:
      addAdditionalSaveData in class Entity
    • readAdditionalSaveData

      public void readAdditionalSaveData(CompoundTag pCompound)
      (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 pLookingEntity)
    • canAttack

      public boolean canAttack(LivingEntity pTarget)
    • canAttack

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

      protected void onEffectRemoved(MobEffectInstance pEffectInstance)
    • refreshDirtyAttributes

      private void refreshDirtyAttributes()
    • onAttributeUpdated

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

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

      protected void blockUsingShield(LivingEntity pAttacker)
    • blockedByShield

      protected void blockedByShield(LivingEntity pDefender)
    • checkTotemDeathProtection

      private boolean checkTotemDeathProtection(DamageSource pDamageSource)
    • getLastDamageSource

      @Nullable public DamageSource getLastDamageSource()
    • playHurtSound

      protected void playHurtSound(DamageSource pSource)
    • makeSound

      public void makeSound(@Nullable SoundEvent pSound)
    • isDamageSourceBlocked

      public boolean isDamageSourceBlocked(DamageSource pDamageSource)
      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 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()
    • dropExperience

      protected void dropExperience(@Nullable Entity pEntity)
    • dropCustomDeathLoot

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

      public ResourceKey<LootTable> getLootTable()
    • getLootTableSeed

      public long getLootTableSeed()
    • getKnockback

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

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

      public LivingEntity.Fallsounds getFallSounds()
    • getDrinkingSound

      protected SoundEvent getDrinkingSound(ItemStack pStack)
    • getEatingSound

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

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

      protected final int getComfortableFallDistance(float pHealth)
    • causeFallDamage

      public boolean causeFallDamage(float pFallDistance, float pMultiplier, DamageSource pSource)
      Overrides:
      causeFallDamage in class Entity
    • calculateFallDamage

      protected int calculateFallDamage(float pFallDistance, float pDamageMultiplier)
    • 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)
    • hurtCurrentlyUsedShield

      protected void hurtCurrentlyUsedShield(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(DamageSource pDamageSource, float pDamageAmount)
      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 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

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

      public abstract Iterable<ItemStack> getArmorSlots()
    • getItemBySlot

      public abstract ItemStack getItemBySlot(EquipmentSlot pSlot)
    • setItemSlot

      public abstract void setItemSlot(EquipmentSlot pSlot, ItemStack pStack)
    • getHandSlots

      public Iterable<ItemStack> getHandSlots()
    • getArmorAndBodyArmorSlots

      public Iterable<ItemStack> getArmorAndBodyArmorSlots()
    • getAllSlots

      public Iterable<ItemStack> getAllSlots()
    • verifyEquippedItem

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

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

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

      private ItemStack getLastArmorItem(EquipmentSlot pSlot)
    • setLastArmorItem

      private void setLastArmorItem(EquipmentSlot pSlot, ItemStack pStack)
    • getLastHandItem

      private ItemStack getLastHandItem(EquipmentSlot pSlot)
    • setLastHandItem

      private void setLastHandItem(EquipmentSlot pSlot, ItemStack pStack)
    • tickHeadTurn

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

      protected void doPush(Entity p_20971_)
    • 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
    • lerpTo

      public void lerpTo(double pX, double pY, double pZ, float pYRot, float pXRot, int pSteps)
      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 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)
    • 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()
    • updateUsingItem

      protected void updateUsingItem(ItemStack pUsingItem)
    • shouldTriggerItemUseEffects

      private boolean shouldTriggerItemUseEffects()
    • 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
    • triggerItemUseEffects

      protected void triggerItemUseEffects(ItemStack pStack, int pAmount)
    • spawnItemParticles

      private void spawnItemParticles(ItemStack pStack, int pAmount)
    • 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 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.
    • canTakeItem

      public boolean canTakeItem(ItemStack pStack)
    • 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)
      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 pLevel, ItemStack pFood)
    • eat

      public ItemStack eat(Level pLevel, ItemStack pFood, FoodProperties pFoodProperties)
    • addEatEffect

      private void addEatEffect(FoodProperties pFoodProperties)
    • entityEventForEquipmentBreak

      private static byte entityEventForEquipmentBreak(EquipmentSlot pSlot)
    • onEquippedItemBroken

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

      public static EquipmentSlot getSlotForHand(InteractionHand pHand)
    • 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 pStack)
    • 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
    • canDisableShield

      public boolean canDisableShield()
    • 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(DamageSource pSource)
      Returns whether this Entity is invulnerable to the given DamageSource.
      Overrides:
      isInvulnerableTo in class Entity