public abstract class PlayerEntity extends LivingEntity
| Modifier and Type | Class and Description |
|---|---|
static class |
PlayerEntity.SleepFailureReason |
Entity.PositionUpdateractiveItemStack, attackingPlayer, bodyTrackingIncrements, bodyYaw, brain, dead, deathTime, defaultMaxHealth, despawnCounter, field_6215, flyingSpeed, forwardSpeed, handSwinging, handSwingProgress, handSwingTicks, headTrackingIncrements, headYaw, hurtTime, itemUseTimeLeft, jumping, knockbackVelocity, lastAttackedTicks, lastDamageTaken, lastHandSwingProgress, lastLimbDistance, limbAngle, limbDistance, LIVING_FLAGS, lookDirection, maxHurtTime, playerHitTimer, preferredHand, prevBodyYaw, prevHeadYaw, prevLookDirection, prevStepBobbingAmount, randomLargeSeed, randomSmallSeed, riptideTicks, roll, scoreAmount, serverHeadYaw, serverPitch, serverX, serverY, serverYaw, serverZ, sidewaysSpeed, SLEEPING_DIMENSIONS, stepBobbingAmount, stuckArrowTimer, stuckStingerTimer, upwardSpeedage, 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, yawDUMMY| Constructor and Description |
|---|
PlayerEntity(World world,
BlockPos pos,
float yaw,
com.mojang.authlib.GameProfile profile) |
addSoulSpeedBoostIfNeeded, addStatusEffect, animateDamage, applyArmorToDamage, applyEnchantmentsToDamage, applyMovementEffects, applyStatusEffect, baseTick, canBeRiddenInWater, canBreatheInWater, canDropLootAndXp, canHaveStatusEffect, canMoveVoluntarily, canSee, canTarget, canTarget, canWalkOnFluid, clearActiveItem, clearPotionSwirls, clearSleepingPosition, clearStatusEffects, collides, computeFallDamage, consumeItem, containsOnlyAmbientEffects, createBrainProfile, createLivingAttributes, createSpawnPacket, deserializeBrain, destroy, displaySoulSpeedEffects, drop, dropEquipment, dropLoot, dropXp, endCombat, enterCombat, fall, getActiveHand, getActiveItem, getActiveStatusEffects, getArmor, getArmorVisibility, getAttackDistanceScalingFactor, getAttacker, getAttacking, getAttributeBaseValue, getAttributeInstance, getAttributes, getAttributeValue, getBaseMovementSpeedMultiplier, getBlockState, getBoundingBox, getBrain, getClimbingPos, getDamageTracker, getDespawnCounter, getDrinkSound, getEatSound, getEyeHeight, getGroup, getHandSwingProgress, getHeadYaw, getHealth, getItemUseTime, getItemUseTimeLeft, getJumpVelocity, getLastAttackedTime, getLastAttackTime, getLeaningPitch, getLootContextBuilder, getLootTable, getMainHandStack, getMaxHealth, getNextAirOnLand, getNextAirUnderwater, getOffHandStack, getPrimeAdversary, getRandom, getRecentDamageSource, getRoll, getScaleFactor, getSleepingDirection, getSleepingPosition, getSoundPitch, getSoundVolume, getStackInHand, getStatusEffect, getStatusEffects, getStingerCount, getStuckArrowCount, getVisibilityBoundingBox, getYaw, hasStackEquipped, hasStatusEffect, heal, hurtByWater, isAffectedBySplashPotions, isAlive, isBaby, isBlocking, isClimbing, isDead, isFallFlying, isHolding, isHolding, isHoldingOntoLadder, isInsideWall, isInSwimmingPose, isMobOrPlayer, isPushable, isSleeping, isTarget, isUndead, isUsingItem, isUsingRiptide, kill, knockback, knockDownwards, lookAt, markEffectsDirty, method_26317, method_26318, method_29242, method_29499, method_30633, method_31079, onAttacking, onEquipStack, onKilledBy, onStatusEffectApplied, onStatusEffectRemoved, onStatusEffectUpgraded, onTrackedDataSet, playBlockFallSound, playHurtSound, pushAway, pushAwayFrom, removeSoulSpeedBoost, removeStatusEffect, removeStatusEffectInternal, scheduleVelocityUpdate, sendEquipmentBreakStatus, sendPickup, sendToolBreakStatus, setAttacker, setAttacking, setCurrentHand, setDespawnCounter, setHeadYaw, setHealth, setJumping, setLivingFlag, setMovementSpeed, setNearbySongPlaying, setOnGround, setRiptideTicks, setSleepingPosition, setSprinting, setStackInHand, setStingerCount, setStuckArrowCount, setYaw, shouldDisplaySoulSpeedEffects, shouldDropLoot, sleep, spawnConsumptionEffects, stopRiding, stopUsingItem, swimUpward, swingHand, swingHand, takeKnockback, teleport, tickCramming, tickHandSwing, tickRiptide, tickStatusEffects, tryAttack, turnHead, updatePostDeath, updatePotionVisibility, updateTrackedHeadRotation, updateTrackedPositionAndAnglesaddPassenger, addScoreboardTag, addVelocity, adjustMovementForCollisions, adjustMovementForCollisions, adjustMovementForPiston, adjustSingleAxisMovementForCollisions, applyMirror, applyRotation, bypassesLandingEffects, bypassesSteppingEffects, calculateBoundsForPose, calculateDimensions, calculateNextStepSoundDistance, canAddPassenger, canAvoidTraps, canBeSpectated, canExplosionDestroyBlock, canStartRiding, canUsePortals, changeLookDirection, checkBlockCollision, checkDespawn, collidesWith, copyFrom, copyPositionAndRotation, dealDamage, detach, distanceTo, doesNotCollide, doesRenderOnFire, dropItem, dropItem, dropStack, dropStack, entityDataRequiresOperator, equals, extinguish, fromTag, getAir, getBlockPos, getBodyY, getBoundingBox, getBrightnessAtEyes, getCameraPosVec, getCommandSource, getCustomName, getDataTracker, getDefaultName, getEffectiveExplosionResistance, getEntityId, getEntityWorld, getEyeHeight, getEyeY, getFireTicks, getFlag, getFluidHeight, getHeight, getHorizontalFacing, getHoverEvent, getItemsEquipped, getJumpVelocityMultiplier, getLandingBlockState, getLandingPos, getMaxAir, getMountedHeightOffset, getMovementDirection, 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, getStandingEyeHeight, 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, isLiving, isLogicalSideForUpdatingMovement, isOnFire, isOnGround, isPartOf, isSilent, isSneaking, isSneaky, isSprinting, isSubmergedIn, isSubmergedInWater, isTeammate, isTeamPlayer, isTouchingWater, isTouchingWaterOrRain, isWet, method_29241, method_29919, method_30076, method_30330, method_30632, method_30634, method_30950, method_31166, move, moveToBoundingBoxCenter, moveToWorld, offsetX, offsetZ, onBlockCollision, onBubbleColumnCollision, onBubbleColumnSurfaceCollision, onPassengerLookAround, onPlayerCollision, onStartedTrackingBy, onStoppedTrackingBy, onStruckByLightning, playFlySound, playStepSound, playSwimSound, populateCrashReport, pushOutOfBlocks, raycast, refreshPosition, refreshPositionAfterTeleport, refreshPositionAfterTeleport, refreshPositionAndAngles, refreshPositionAndAngles, removeAllPassengers, removePassenger, removeScoreboardTag, requestTeleport, resetNetherPortalCooldown, resetPosition, saveSelfToTag, saveToTag, sendSystemMessage, setAir, setBoundingBox, setCustomName, setCustomNameVisible, setEntityId, 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, spawnSprintingParticles, squaredDistanceTo, squaredDistanceTo, squaredDistanceTo, squaredHorizontalLength, startRiding, startRiding, streamPassengersRecursively, teleport, teleportRequested, tickNetherPortal, tickNetherPortalCooldown, toListTag, toListTag, toString, toTag, updateKilledAdvancementCriterion, updateMovementInFluid, updatePassengerForDismount, updatePassengerPosition, updatePosition, updatePositionAndAngles, updateTrackedPosition, updateTrackedPosition, updateVelocity, updateWaterState, wouldPoseNotCollidepublic static final EntityDimensions STANDING_DIMENSIONS
private static final Map<EntityPose,EntityDimensions> POSE_DIMENSIONS
private static final TrackedData<Float> ABSORPTION_AMOUNT
private static final TrackedData<Integer> SCORE
protected static final TrackedData<Byte> PLAYER_MODEL_PARTS
protected static final TrackedData<Byte> MAIN_ARM
protected static final TrackedData<CompoundTag> LEFT_SHOULDER_ENTITY
protected static final TrackedData<CompoundTag> RIGHT_SHOULDER_ENTITY
private long shoulderEntityAddedTime
public final PlayerInventory inventory
protected EnderChestInventory enderChestInventory
public final PlayerScreenHandler playerScreenHandler
public ScreenHandler currentScreenHandler
protected HungerManager hungerManager
protected int abilityResyncCountdown
public float prevStrideDistance
public float strideDistance
public int experiencePickUpDelay
public double prevCapeX
public double prevCapeY
public double prevCapeZ
public double capeX
public double capeY
public double capeZ
private int sleepTimer
protected boolean isSubmergedInWater
public final PlayerAbilities abilities
public int experienceLevel
public int totalExperience
public float experienceProgress
protected int enchantmentTableSeed
protected final float field_7509
private int lastPlayedLevelUpSoundTime
private final com.mojang.authlib.GameProfile gameProfile
@Environment(value=CLIENT) private boolean reducedDebugInfo
private ItemStack selectedItem
private final ItemCooldownManager itemCooldownManager
@Nullable public FishingBobberEntity fishHook
public boolean isBlockBreakingRestricted(World world, BlockPos pos, GameMode gameMode)
public static DefaultAttributeContainer.Builder createPlayerAttributes()
protected void initDataTracker()
initDataTracker in class LivingEntitypublic void tick()
tick in class LivingEntitypublic boolean shouldCancelInteraction()
protected boolean shouldDismount()
protected boolean clipAtLedge()
protected boolean updateWaterSubmersionState()
private void updateTurtleHelmet()
protected ItemCooldownManager createCooldownManager()
private void updateCapeAngles()
protected void updateSize()
public int getMaxNetherPortalTime()
getMaxNetherPortalTime in class Entityprotected SoundEvent getSwimSound()
getSwimSound in class Entityprotected SoundEvent getSplashSound()
getSplashSound in class Entityprotected SoundEvent getHighSpeedSplashSound()
getHighSpeedSplashSound in class Entitypublic int getDefaultNetherPortalCooldown()
getDefaultNetherPortalCooldown in class Entitypublic void playSound(SoundEvent sound, float volume, float pitch)
public void playSound(SoundEvent event, SoundCategory category, float volume, float pitch)
public SoundCategory getSoundCategory()
getSoundCategory in class Entityprotected int getBurningDuration()
getBurningDuration in class Entity@Environment(value=CLIENT) public void handleStatus(byte status)
handleStatus in class LivingEntity@Environment(value=CLIENT) private void spawnParticles(ParticleEffect parameters)
protected void closeHandledScreen()
public void tickRiding()
tickRiding in class LivingEntity@Environment(value=CLIENT) public void afterSpawn()
afterSpawn in class Entityprotected void tickNewAi()
tickNewAi in class LivingEntitypublic void tickMovement()
tickMovement in class LivingEntityprivate void updateShoulderEntity(@Nullable CompoundTag compoundTag)
private void collideWithEntity(Entity entity)
public int getScore()
public void setScore(int score)
public void addScore(int score)
public void onDeath(DamageSource source)
onDeath in class LivingEntityprotected void dropInventory()
dropInventory in class LivingEntityprotected void vanishCursedItems()
protected SoundEvent getHurtSound(DamageSource source)
getHurtSound in class LivingEntityprotected SoundEvent getDeathSound()
getDeathSound in class LivingEntitypublic boolean dropSelectedItem(boolean dropEntireStack)
@Nullable public ItemEntity dropItem(ItemStack stack, boolean retainOwnership)
@Nullable public ItemEntity dropItem(ItemStack stack, boolean throwRandomly, boolean retainOwnership)
throwRandomly - If true, the item will be thrown in a random direction from the entity regardless of which direction the entity is facingpublic float getBlockBreakingSpeed(BlockState block)
public boolean isUsingEffectiveTool(BlockState block)
public void readCustomDataFromTag(CompoundTag tag)
readCustomDataFromTag in class LivingEntitypublic void writeCustomDataToTag(CompoundTag tag)
writeCustomDataToTag in class LivingEntitypublic boolean isInvulnerableTo(DamageSource damageSource)
isInvulnerableTo in class Entitypublic boolean damage(DamageSource source, float amount)
damage in class LivingEntityprotected void takeShieldHit(LivingEntity attacker)
takeShieldHit in class LivingEntitypublic boolean shouldDamagePlayer(PlayerEntity player)
protected void damageArmor(DamageSource source, float amount)
damageArmor in class LivingEntityprotected void damageShield(float amount)
damageShield in class LivingEntityprotected void applyDamage(DamageSource source, float amount)
applyDamage in class LivingEntityprotected boolean isOnSoulSpeedBlock()
isOnSoulSpeedBlock in class LivingEntitypublic void openEditSignScreen(SignBlockEntity sign)
public void openCommandBlockMinecartScreen(CommandBlockExecutor commandBlockExecutor)
public void openCommandBlockScreen(CommandBlockBlockEntity commandBlock)
public void openStructureBlockScreen(StructureBlockBlockEntity structureBlock)
public void openJigsawScreen(JigsawBlockEntity jigsaw)
public void openHorseInventory(HorseBaseEntity horse, Inventory inventory)
public OptionalInt openHandledScreen(@Nullable NamedScreenHandlerFactory factory)
public void sendTradeOffers(int syncId,
TradeOfferList offers,
int levelProgress,
int experience,
boolean leveled,
boolean refreshable)
public ActionResult interact(Entity entity, Hand hand)
public double getHeightOffset()
getHeightOffset in class Entitypublic void method_29239()
method_29239 in class Entityprotected boolean isImmobile()
isImmobile in class LivingEntitypublic boolean method_29920()
method_29920 in class LivingEntityprotected Vec3d adjustMovementForSneaking(Vec3d movement, MovementType type)
adjustMovementForSneaking in class Entityprivate boolean method_30263()
public void attack(Entity target)
protected void attackLivingEntity(LivingEntity target)
attackLivingEntity in class LivingEntitypublic void disableShield(boolean sprinting)
public void addCritParticles(Entity target)
public void addEnchantedHitParticles(Entity target)
public void spawnSweepAttackParticles()
@Environment(value=CLIENT) public void requestRespawn()
public boolean isMainPlayer()
public com.mojang.authlib.GameProfile getGameProfile()
public com.mojang.datafixers.util.Either<PlayerEntity.SleepFailureReason,Unit> trySleep(BlockPos pos)
public void wakeUp(boolean bool,
boolean updateSleepingPlayers)
public void wakeUp()
wakeUp in class LivingEntitypublic static Optional<Vec3d> findRespawnPosition(ServerWorld world, BlockPos pos, float float2, boolean bool, boolean bool2)
public boolean isSleepingLongEnough()
public int getSleepTimer()
public void sendMessage(Text message, boolean actionBar)
public void incrementStat(Identifier stat)
public void increaseStat(Identifier stat, int amount)
public void incrementStat(Stat<?> stat)
public void increaseStat(Stat<?> stat, int amount)
public void resetStat(Stat<?> stat)
public int unlockRecipes(Collection<Recipe<?>> recipes)
public void unlockRecipes(Identifier[] ids)
public int lockRecipes(Collection<Recipe<?>> recipes)
public void jump()
jump in class LivingEntitypublic void travel(Vec3d movementInput)
travel in class LivingEntitypublic void updateSwimming()
updateSwimming in class Entityprotected boolean doesNotSuffocate(BlockPos pos)
public float getMovementSpeed()
getMovementSpeed in class LivingEntitypublic void increaseTravelMotionStats(double dx,
double dy,
double dz)
private void increaseRidingMotionStats(double dx,
double dy,
double dz)
public boolean handleFallDamage(float fallDistance,
float damageMultiplier)
handleFallDamage in class LivingEntitypublic boolean checkFallFlying()
public void startFallFlying()
public void stopFallFlying()
protected void onSwimmingStart()
onSwimmingStart in class Entityprotected SoundEvent getFallSound(int distance)
getFallSound in class LivingEntitypublic void onKilledOther(ServerWorld serverWorld, LivingEntity livingEntity)
onKilledOther in class Entitypublic void slowMovement(BlockState state, Vec3d multiplier)
slowMovement in class Entitypublic void addExperience(int experience)
public int getEnchantmentTableSeed()
public void applyEnchantmentCosts(ItemStack enchantedItem, int experienceLevels)
public void addExperienceLevels(int levels)
public int getNextLevelExperience()
public void addExhaustion(float exhaustion)
public HungerManager getHungerManager()
public boolean canConsume(boolean ignoreHunger)
public boolean canFoodHeal()
public boolean canModifyBlocks()
protected int getCurrentExperience(PlayerEntity player)
getCurrentExperience in class LivingEntityprotected boolean shouldAlwaysDropXp()
shouldAlwaysDropXp in class LivingEntity@Environment(value=CLIENT) public boolean shouldRenderName()
shouldRenderName in class LivingEntitypublic void sendAbilitiesUpdate()
public void setGameMode(GameMode gameMode)
public Text getName()
public EnderChestInventory getEnderChestInventory()
public ItemStack getEquippedStack(EquipmentSlot slot)
getEquippedStack in class LivingEntitypublic void equipStack(EquipmentSlot slot, ItemStack stack)
equipStack in class LivingEntitypublic boolean giveItemStack(ItemStack stack)
public Iterable<ItemStack> getItemsHand()
getItemsHand in class Entitypublic Iterable<ItemStack> getArmorItems()
getArmorItems in class LivingEntitypublic boolean addShoulderEntity(CompoundTag tag)
protected void dropShoulderEntities()
private void dropShoulderEntity(CompoundTag entityNbt)
public abstract boolean isSpectator()
isSpectator in class Entitypublic boolean isSwimming()
isSwimming in class Entitypublic abstract boolean isCreative()
public Scoreboard getScoreboard()
public Text getDisplayName()
getDisplayName in interface NameablegetDisplayName in class Entityprivate MutableText addTellClickEvent(MutableText component)
public String getEntityName()
getEntityName in class Entitypublic float getActiveEyeHeight(EntityPose pose, EntityDimensions dimensions)
getActiveEyeHeight in class LivingEntitypublic void setAbsorptionAmount(float amount)
setAbsorptionAmount in class LivingEntitypublic float getAbsorptionAmount()
getAbsorptionAmount in class LivingEntitypublic static UUID getUuidFromProfile(com.mojang.authlib.GameProfile profile)
@Environment(value=CLIENT) public boolean isPartVisible(PlayerModelPart modelPart)
@Environment(value=CLIENT) public boolean getReducedDebugInfo()
@Environment(value=CLIENT) public void setReducedDebugInfo(boolean reducedDebugInfo)
public void setFireTicks(int ticks)
setFireTicks in class Entitypublic Arm getMainArm()
getMainArm in class LivingEntitypublic void setMainArm(Arm arm)
public CompoundTag getShoulderEntityLeft()
protected void setShoulderEntityLeft(CompoundTag entityTag)
public CompoundTag getShoulderEntityRight()
protected void setShoulderEntityRight(CompoundTag entityTag)
public float getAttackCooldownProgressPerTick()
public float getAttackCooldownProgress(float baseTime)
public void resetLastAttackedTicks()
public ItemCooldownManager getItemCooldownManager()
protected float getVelocityMultiplier()
getVelocityMultiplier in class LivingEntitypublic float getLuck()
public boolean isCreativeLevelTwoOp()
public boolean canEquip(ItemStack stack)
canEquip in class LivingEntitypublic EntityDimensions getDimensions(EntityPose pose)
getDimensions in class LivingEntitypublic ImmutableList<EntityPose> getPoses()
getPoses in class LivingEntitypublic ItemStack getArrowType(ItemStack stack)
getArrowType in class LivingEntitypublic ItemStack eatFood(World world, ItemStack stack)
eatFood in class LivingEntityprotected boolean method_29500(BlockState blockState)
method_29500 in class LivingEntity@Environment(value=CLIENT) public Vec3d method_30951(float float2)
method_30951 in class Entity