public abstract class LivingEntity extends Entity
Entity.PositionUpdater
age, chunkX, chunkY, chunkZ, dataTracker, distanceTraveled, fallDistance, field_25599, firstUpdate, FLAGS, fluidHeight, glowing, horizontalCollision, horizontalSpeed, ignoreCameraFrustum, inanimate, inNetherPortal, lastNetherPortalPosition, lastRenderX, lastRenderY, lastRenderZ, LOGGER, movementMultiplier, netherPortalTime, noClip, onGround, pitch, POSE, prevHorizontalSpeed, prevPitch, prevX, prevY, prevYaw, prevZ, pushSpeedReduction, random, removed, ridingCooldown, stepHeight, submergedInWater, teleporting, timeUntilRegen, touchingWater, updateNeeded, uuid, uuidString, velocityDirty, velocityModified, verticalCollision, world, yaw
DUMMY
Modifier | Constructor and Description |
---|---|
protected |
LivingEntity(EntityType<? extends LivingEntity> type,
World world) |
addPassenger, addScoreboardTag, addVelocity, adjustMovementForCollisions, adjustMovementForCollisions, adjustMovementForPiston, adjustMovementForSneaking, adjustSingleAxisMovementForCollisions, afterSpawn, applyMirror, applyRotation, bypassesLandingEffects, bypassesSteppingEffects, calculateBoundsForPose, calculateDimensions, calculateNextStepSoundDistance, canAddPassenger, canAvoidTraps, canBeSpectated, canClimb, canExplosionDestroyBlock, canFly, canStartRiding, canUsePortals, changeLookDirection, checkBlockCollision, checkDespawn, checkWaterState, collidesWith, copyFrom, copyPositionAndRotation, dealDamage, detach, distanceTo, doesNotCollide, doesRenderOnFire, dropItem, dropItem, dropStack, dropStack, entityDataRequiresOperator, equals, equip, extinguish, fromTag, getAir, getBlockPos, getBodyY, getBoundingBox, getBrightnessAtEyes, getBurningDuration, getCameraPosVec, getCommandSource, getCustomName, getDataTracker, getDefaultName, getDefaultNetherPortalCooldown, getDisplayName, getEffectiveExplosionResistance, getEntityId, getEntityName, getEntityWorld, getEyeHeight, getEyeY, getFireTicks, getFlag, getFluidHeight, getHeight, getHeightOffset, getHighSpeedSplashSound, getHorizontalFacing, getHoverEvent, getItemsEquipped, getItemsHand, getJumpVelocityMultiplier, getLandingBlockState, getLandingPos, getMaxAir, getMaxNetherPortalTime, getMountedHeightOffset, getMovementDirection, getName, getOppositeRotationVector, getOppositeRotationVector, getParticleX, getParticleZ, getPassengerDismountOffset, getPassengerList, getPassengersDeep, getPermissionLevel, getPistonBehavior, getPitch, getPos, getPose, getPrimaryPassenger, getRandomBodyY, getRenderDistanceMultiplier, getRootVehicle, getRotationClient, getRotationVec, getRotationVecClient, getRotationVector, getRotationVector, getSafeFallDistance, getSavedEntityId, getScoreboardTags, getScoreboardTeam, getServer, getSoundCategory, getSplashSound, getStandingEyeHeight, getSwimSound, getTargetingMargin, getTeamColorValue, getTeleportTarget, getTrackedPosition, getType, getUuid, getUuidAsString, getVehicle, getVelocity, getVelocityAffectingPos, getWidth, getX, getY, getZ, handleAttack, hasCustomName, hashCode, hasNetherPortalCooldown, hasNoGravity, hasPassenger, hasPassengerDeep, hasPassengers, hasPassengerType, hasPermissionLevel, hasPlayerRider, hasVehicle, hasWings, interact, interactAt, isAttackable, isChunkPosUpdateRequested, isCollidable, isConnectedThroughVehicle, isCustomNameVisible, isDescending, isFireImmune, isGlowing, isImmuneToExplosion, isInLava, isInRange, isInsideWaterOrBubbleColumn, isInSneakingPose, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableTo, isLiving, isLogicalSideForUpdatingMovement, isOnFire, isOnGround, isPartOf, isSilent, isSneaking, isSneaky, isSpectator, isSprinting, isSubmergedIn, isSubmergedInWater, isSwimming, isTeammate, isTeamPlayer, isTouchingWater, isTouchingWaterOrRain, isWet, method_29239, method_29241, method_29919, method_30076, method_30330, method_30632, method_30634, method_30950, method_30951, method_31166, move, moveToBoundingBoxCenter, moveToWorld, offsetX, offsetZ, onBlockCollision, onBubbleColumnCollision, onBubbleColumnSurfaceCollision, onKilledOther, onPassengerLookAround, onPlayerCollision, onStartedTrackingBy, onStoppedTrackingBy, onStruckByLightning, onSwimmingStart, playFlySound, playSound, playStepSound, playSwimSound, populateCrashReport, pushOutOfBlocks, raycast, refreshPosition, refreshPositionAfterTeleport, refreshPositionAfterTeleport, refreshPositionAndAngles, refreshPositionAndAngles, remove, removeAllPassengers, removePassenger, removeScoreboardTag, requestTeleport, resetNetherPortalCooldown, resetPosition, saveSelfToTag, saveToTag, sendSystemMessage, setAir, setBoundingBox, setCustomName, setCustomNameVisible, setEntityId, setFireTicks, setFlag, setGlowing, setInNetherPortal, setInvisible, setInvulnerable, setNoGravity, setOnFireFor, setOnFireFromLava, setPos, setPose, setRenderDistanceMultiplier, setRotation, setSilent, setSneaking, setSwimming, setUuid, setVelocity, setVelocity, setVelocityClient, setWorld, shouldBroadcastConsoleToOps, shouldLeaveSwimmingPose, shouldReceiveFeedback, shouldRender, shouldRender, shouldSetPositionOnLoad, shouldSpawnSprintingParticles, shouldTrackOutput, slowMovement, spawnSprintingParticles, squaredDistanceTo, squaredDistanceTo, squaredDistanceTo, squaredHorizontalLength, startRiding, startRiding, streamPassengersRecursively, teleport, teleportRequested, tickNetherPortal, tickNetherPortalCooldown, toListTag, toListTag, toString, toTag, updateKilledAdvancementCriterion, updateMovementInFluid, updatePassengerForDismount, updatePassengerPosition, updatePosition, updatePositionAndAngles, updateSwimming, updateTrackedPosition, updateTrackedPosition, updateVelocity, updateWaterState, wouldPoseNotCollide
private static final UUID SPRINTING_SPEED_BOOST_ID
private static final UUID SOUL_SPEED_BOOST_ID
private static final EntityAttributeModifier SPRINTING_SPEED_BOOST
protected static final TrackedData<Byte> LIVING_FLAGS
private static final TrackedData<Float> HEALTH
private static final TrackedData<Integer> POTION_SWIRLS_COLOR
private static final TrackedData<Boolean> POTION_SWIRLS_AMBIENT
private static final TrackedData<Integer> STUCK_ARROW_COUNT
private static final TrackedData<Integer> STINGER_COUNT
private static final TrackedData<Optional<BlockPos>> SLEEPING_POSITION
protected static final EntityDimensions SLEEPING_DIMENSIONS
private final AttributeContainer attributes
private final DamageTracker damageTracker
private final Map<StatusEffect,StatusEffectInstance> activeStatusEffects
private final DefaultedList<ItemStack> equippedHand
private final DefaultedList<ItemStack> equippedArmor
public boolean handSwinging
public Hand preferredHand
public int handSwingTicks
public int stuckArrowTimer
public int stuckStingerTimer
public int hurtTime
public int maxHurtTime
public float knockbackVelocity
public int deathTime
public float lastHandSwingProgress
public float handSwingProgress
protected int lastAttackedTicks
public float lastLimbDistance
public float limbDistance
public float limbAngle
public final int defaultMaxHealth
public final float randomLargeSeed
public final float randomSmallSeed
public float bodyYaw
public float prevBodyYaw
public float headYaw
public float prevHeadYaw
public float flyingSpeed
@Nullable protected PlayerEntity attackingPlayer
protected int playerHitTimer
protected boolean dead
protected int despawnCounter
protected float prevStepBobbingAmount
protected float stepBobbingAmount
protected float lookDirection
protected float prevLookDirection
protected float field_6215
protected int scoreAmount
protected float lastDamageTaken
protected boolean jumping
public float sidewaysSpeed
public float upwardSpeed
public float forwardSpeed
protected int bodyTrackingIncrements
protected double serverX
protected double serverY
protected double serverZ
protected double serverYaw
protected double serverPitch
protected double serverHeadYaw
protected int headTrackingIncrements
private boolean effectsChanged
@Nullable private LivingEntity attacker
private int lastAttackedTime
private LivingEntity attacking
private int lastAttackTime
private float movementSpeed
private int jumpingCooldown
private float absorptionAmount
protected ItemStack activeItemStack
protected int itemUseTimeLeft
protected int roll
private BlockPos lastBlockPos
private DamageSource lastDamageSource
private long lastDamageTime
protected int riptideTicks
private float leaningPitch
private float lastLeaningPitch
protected Brain<?> brain
protected LivingEntity(EntityType<? extends LivingEntity> type, World world)
public Brain<?> getBrain()
protected Brain.Profile<?> createBrainProfile()
protected Brain<?> deserializeBrain(com.mojang.serialization.Dynamic<?> dynamic)
public boolean canTarget(EntityType<?> type)
protected void initDataTracker()
initDataTracker
in class Entity
public static DefaultAttributeContainer.Builder createLivingAttributes()
protected void fall(double heightDifference, boolean onGround, BlockState landedState, BlockPos landedPosition)
public boolean canBreatheInWater()
@Environment(value=CLIENT) public float getLeaningPitch(float tickDelta)
public boolean shouldDisplaySoulSpeedEffects()
protected void displaySoulSpeedEffects()
protected boolean isOnSoulSpeedBlock()
protected float getVelocityMultiplier()
getVelocityMultiplier
in class Entity
protected boolean method_29500(BlockState blockState)
protected void removeSoulSpeedBoost()
protected void addSoulSpeedBoostIfNeeded()
protected void applyMovementEffects(BlockPos pos)
public boolean isBaby()
public float getScaleFactor()
protected boolean method_29920()
public boolean canBeRiddenInWater()
canBeRiddenInWater
in class Entity
protected void updatePostDeath()
protected boolean canDropLootAndXp()
protected boolean shouldDropLoot()
protected int getNextAirUnderwater(int air)
protected int getNextAirOnLand(int air)
protected int getCurrentExperience(PlayerEntity player)
protected boolean shouldAlwaysDropXp()
public Random getRandom()
@Nullable public LivingEntity getAttacker()
public int getLastAttackedTime()
public void setAttacking(@Nullable PlayerEntity attacking)
public void setAttacker(@Nullable LivingEntity attacker)
@Nullable public LivingEntity getAttacking()
public int getLastAttackTime()
public void onAttacking(Entity target)
public int getDespawnCounter()
public void setDespawnCounter(int despawnCounter)
protected void onEquipStack(ItemStack stack)
public void writeCustomDataToTag(CompoundTag tag)
writeCustomDataToTag
in class Entity
public void readCustomDataFromTag(CompoundTag tag)
readCustomDataFromTag
in class Entity
protected void tickStatusEffects()
protected void updatePotionVisibility()
public double getAttackDistanceScalingFactor(@Nullable Entity entity)
public boolean canTarget(LivingEntity target)
public boolean isTarget(LivingEntity entity, TargetPredicate predicate)
public static boolean containsOnlyAmbientEffects(Collection<StatusEffectInstance> effects)
protected void clearPotionSwirls()
public boolean clearStatusEffects()
public Collection<StatusEffectInstance> getStatusEffects()
public Map<StatusEffect,StatusEffectInstance> getActiveStatusEffects()
public boolean hasStatusEffect(StatusEffect effect)
@Nullable public StatusEffectInstance getStatusEffect(StatusEffect effect)
public boolean addStatusEffect(StatusEffectInstance effect)
public boolean canHaveStatusEffect(StatusEffectInstance effect)
@Environment(value=CLIENT) public void applyStatusEffect(StatusEffectInstance effect)
public boolean isUndead()
@Nullable public StatusEffectInstance removeStatusEffectInternal(@Nullable StatusEffect type)
This method does not perform any cleanup or synchronization operation.
Under most circumstances, calling removeStatusEffect(net.minecraft.entity.effect.StatusEffect)
is highly preferable.
public boolean removeStatusEffect(StatusEffect type)
Calling this method will call cleanup methods on the status effect and trigger synchronization of effect particles with watching clients. If this entity is a player, the change in the list of effects will also be synchronized with the corresponding client.
true
if a StatusEffectInstance
with the given type was in effect before the removal.protected void onStatusEffectApplied(StatusEffectInstance effect)
protected void onStatusEffectUpgraded(StatusEffectInstance effect, boolean reapplyEffect)
protected void onStatusEffectRemoved(StatusEffectInstance effect)
public void heal(float amount)
public float getHealth()
public void setHealth(float health)
public boolean isDead()
public boolean damage(DamageSource source, float amount)
protected void takeShieldHit(LivingEntity attacker)
protected void knockback(LivingEntity target)
private boolean tryUseTotem(DamageSource source)
@Nullable public DamageSource getRecentDamageSource()
protected void playHurtSound(DamageSource source)
private boolean blockedByShield(DamageSource source)
@Environment(value=CLIENT) private void playEquipmentBreakEffects(ItemStack stack)
public void onDeath(DamageSource source)
protected void onKilledBy(@Nullable LivingEntity adversary)
The default behavior spawns a wither rose if adversary
is a WitherEntity
.
adversary
- the main adversary responsible for this entity's deathprotected void drop(DamageSource source)
protected void dropInventory()
protected void dropXp()
protected void dropEquipment(DamageSource source, int lootingMultiplier, boolean allowDrops)
public Identifier getLootTable()
protected void dropLoot(DamageSource source, boolean causedByPlayer)
protected LootContext.Builder getLootContextBuilder(boolean causedByPlayer, DamageSource source)
public void takeKnockback(float float2, double double2, double double3)
@Nullable protected SoundEvent getHurtSound(DamageSource source)
@Nullable protected SoundEvent getDeathSound()
protected SoundEvent getFallSound(int distance)
protected SoundEvent getDrinkSound(ItemStack stack)
public SoundEvent getEatSound(ItemStack stack)
public void setOnGround(boolean onGround)
setOnGround
in class Entity
public boolean isClimbing()
public BlockState getBlockState()
private boolean canEnterTrapdoor(BlockPos pos, BlockState state)
public boolean handleFallDamage(float fallDistance, float damageMultiplier)
handleFallDamage
in class Entity
protected int computeFallDamage(float fallDistance, float damageMultiplier)
protected void playBlockFallSound()
@Environment(value=CLIENT) public void animateDamage()
animateDamage
in class Entity
public int getArmor()
protected void damageArmor(DamageSource source, float amount)
protected void damageShield(float amount)
protected float applyArmorToDamage(DamageSource source, float amount)
protected float applyEnchantmentsToDamage(DamageSource source, float amount)
protected void applyDamage(DamageSource source, float amount)
public DamageTracker getDamageTracker()
@Nullable public LivingEntity getPrimeAdversary()
public final float getMaxHealth()
public final int getStuckArrowCount()
public final void setStuckArrowCount(int stuckArrowCount)
public final int getStingerCount()
public final void setStingerCount(int stingerCount)
private int getHandSwingDuration()
public void swingHand(Hand hand)
public void swingHand(Hand hand, boolean bool)
@Environment(value=CLIENT) public void handleStatus(byte status)
handleStatus
in class Entity
@Environment(value=CLIENT) private void method_30127()
protected void tickHandSwing()
@Nullable public EntityAttributeInstance getAttributeInstance(EntityAttribute attribute)
public double getAttributeValue(EntityAttribute attribute)
public double getAttributeBaseValue(EntityAttribute attribute)
public AttributeContainer getAttributes()
public EntityGroup getGroup()
public ItemStack getMainHandStack()
public ItemStack getOffHandStack()
public boolean isHolding(Item item)
This checks both the entity's main and off hand.
public boolean isHolding(Predicate<Item> predicate)
This checks both the entity's main and off hand.
public boolean hasStackEquipped(EquipmentSlot slot)
public abstract Iterable<ItemStack> getArmorItems()
getArmorItems
in class Entity
public abstract ItemStack getEquippedStack(EquipmentSlot slot)
public abstract void equipStack(EquipmentSlot slot, ItemStack stack)
equipStack
in class Entity
public float getArmorVisibility()
public void setSprinting(boolean sprinting)
setSprinting
in class Entity
protected float getSoundVolume()
protected float getSoundPitch()
protected boolean isImmobile()
public void pushAwayFrom(Entity entity)
pushAwayFrom
in class Entity
private void onDismounted(Entity vehicle)
@Environment(value=CLIENT) public boolean shouldRenderName()
shouldRenderName
in class Entity
protected float getJumpVelocity()
protected void jump()
@Environment(value=CLIENT) protected void knockDownwards()
protected float getBaseMovementSpeedMultiplier()
public boolean canWalkOnFluid(Fluid fluid)
public void travel(Vec3d movementInput)
public void method_29242(LivingEntity livingEntity, boolean bool)
private float getMovementSpeed(float slipperiness)
public float getMovementSpeed()
public void setMovementSpeed(float movementSpeed)
public boolean tryAttack(Entity target)
private void method_30128()
@Nullable private Map<EquipmentSlot,ItemStack> method_30129()
private void method_30121(Map<EquipmentSlot,ItemStack> map)
private void method_30123(Map<EquipmentSlot,ItemStack> map)
private ItemStack method_30125(EquipmentSlot equipmentSlot)
private void method_30122(EquipmentSlot equipmentSlot, ItemStack itemStack)
private ItemStack method_30126(EquipmentSlot equipmentSlot)
private void method_30124(EquipmentSlot equipmentSlot, ItemStack itemStack)
protected float turnHead(float bodyRotation, float headRotation)
public void tickMovement()
public boolean hurtByWater()
private void initAi()
protected void tickNewAi()
protected void tickCramming()
protected void pushAway(Entity entity)
protected void attackLivingEntity(LivingEntity target)
public void setRiptideTicks(int int2)
public boolean isUsingRiptide()
public void stopRiding()
stopRiding
in class Entity
public void tickRiding()
tickRiding
in class Entity
@Environment(value=CLIENT) public void updateTrackedPositionAndAngles(double x, double y, double z, float yaw, float pitch, int interpolationSteps, boolean interpolate)
updateTrackedPositionAndAngles
in class Entity
@Environment(value=CLIENT) public void updateTrackedHeadRotation(float yaw, int interpolationSteps)
updateTrackedHeadRotation
in class Entity
public void setJumping(boolean jumping)
public void method_29499(ItemEntity itemEntity)
public void sendPickup(Entity item, int count)
public boolean canSee(Entity entity)
@Environment(value=CLIENT) public float getHandSwingProgress(float tickDelta)
public boolean canMoveVoluntarily()
public boolean isPushable()
isPushable
in class Entity
protected void scheduleVelocityUpdate()
scheduleVelocityUpdate
in class Entity
public float getHeadYaw()
getHeadYaw
in class Entity
public void setHeadYaw(float headYaw)
setHeadYaw
in class Entity
protected Vec3d method_30633(Direction.Axis axis, class_5459.class_5460 class_5460)
method_30633
in class Entity
public float getAbsorptionAmount()
public void setAbsorptionAmount(float amount)
public void enterCombat()
public void endCombat()
protected void markEffectsDirty()
public abstract Arm getMainArm()
public boolean isUsingItem()
public Hand getActiveHand()
private void tickActiveItemStack()
private boolean shouldSpawnConsumptionEffects()
private void updateLeaningPitch()
protected void setLivingFlag(int mask, boolean value)
public void setCurrentHand(Hand hand)
public void onTrackedDataSet(TrackedData<?> data)
onTrackedDataSet
in class Entity
public void lookAt(EntityAnchorArgumentType.EntityAnchor anchorPoint, Vec3d target)
protected void spawnConsumptionEffects(ItemStack stack, int particleCount)
private void spawnItemParticles(ItemStack stack, int count)
protected void consumeItem()
public ItemStack getActiveItem()
public int getItemUseTimeLeft()
public int getItemUseTime()
public void stopUsingItem()
public void clearActiveItem()
public boolean isBlocking()
public boolean isHoldingOntoLadder()
true
if this entity should not lose height while in a climbing stateLivingEntity
public boolean isFallFlying()
public boolean isInSwimmingPose()
isInSwimmingPose
in class Entity
@Environment(value=CLIENT) public int getRoll()
public boolean teleport(double x, double y, double z, boolean particleEffects)
public boolean isAffectedBySplashPotions()
public boolean isMobOrPlayer()
@Environment(value=CLIENT) public void setNearbySongPlaying(BlockPos songPosition, boolean playing)
public boolean canEquip(ItemStack stack)
public Packet<?> createSpawnPacket()
createSpawnPacket
in class Entity
public EntityDimensions getDimensions(EntityPose pose)
getDimensions
in class Entity
public ImmutableList<EntityPose> getPoses()
public Box getBoundingBox(EntityPose pose)
public void setSleepingPosition(BlockPos pos)
public void clearSleepingPosition()
public boolean isSleeping()
public void sleep(BlockPos pos)
private void setPositionInBed(BlockPos pos)
private boolean isSleepingInBed()
public void wakeUp()
public boolean isInsideWall()
isInsideWall
in class Entity
protected final float getEyeHeight(EntityPose pose, EntityDimensions dimensions)
getEyeHeight
in class Entity
protected float getActiveEyeHeight(EntityPose pose, EntityDimensions dimensions)
private void applyFoodEffects(ItemStack stack, World world, LivingEntity targetEntity)
private static byte getEquipmentBreakStatus(EquipmentSlot slot)
public void sendEquipmentBreakStatus(EquipmentSlot slot)
public void sendToolBreakStatus(Hand hand)
@Environment(value=CLIENT) public Box getVisibilityBoundingBox()
getVisibilityBoundingBox
in class Entity