Package net.minecraft.entity.player
Class PlayerEntity
java.lang.Object
net.minecraft.entity.Entity
net.minecraft.entity.LivingEntity
net.minecraft.entity.player.PlayerEntity
- All Implemented Interfaces:
CommandOutput,Nameable
- Direct Known Subclasses:
AbstractClientPlayerEntity,ServerPlayerEntity
public abstract class PlayerEntity extends LivingEntity
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPlayerEntity.SleepFailureReasonNested classes/interfaces inherited from class net.minecraft.entity.Entity
Entity.PositionUpdater -
Field Summary
Fields inherited from class net.minecraft.entity.LivingEntity
activeItemStack, 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, upwardSpeedFields inherited from class net.minecraft.entity.Entity
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, yawFields inherited from interface net.minecraft.server.command.CommandOutput
DUMMY -
Constructor Summary
Constructors Constructor Description PlayerEntity(World world, BlockPos pos, float yaw, com.mojang.authlib.GameProfile profile) -
Method Summary
Methods inherited from class net.minecraft.entity.LivingEntity
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, updateTrackedPositionAndAnglesMethods inherited from class net.minecraft.entity.Entity
addPassenger, 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, wouldPoseNotCollide
-
Field Details
-
STANDING_DIMENSIONS
-
POSE_DIMENSIONS
-
ABSORPTION_AMOUNT
-
SCORE
-
PLAYER_MODEL_PARTS
-
MAIN_ARM
-
LEFT_SHOULDER_ENTITY
-
RIGHT_SHOULDER_ENTITY
-
shoulderEntityAddedTime
private long shoulderEntityAddedTime -
inventory
-
enderChestInventory
-
playerScreenHandler
-
currentScreenHandler
-
hungerManager
-
abilityResyncCountdown
protected int abilityResyncCountdown -
prevStrideDistance
public float prevStrideDistance -
strideDistance
public float strideDistance -
experiencePickUpDelay
public int experiencePickUpDelay -
prevCapeX
public double prevCapeX -
prevCapeY
public double prevCapeY -
prevCapeZ
public double prevCapeZ -
capeX
public double capeX -
capeY
public double capeY -
capeZ
public double capeZ -
sleepTimer
private int sleepTimer -
isSubmergedInWater
protected boolean isSubmergedInWater -
abilities
-
experienceLevel
public int experienceLevel -
totalExperience
public int totalExperience -
experienceProgress
public float experienceProgress -
enchantmentTableSeed
protected int enchantmentTableSeed -
field_7509
protected final float field_7509- See Also:
- Constant Field Values
-
lastPlayedLevelUpSoundTime
private int lastPlayedLevelUpSoundTime -
gameProfile
private final com.mojang.authlib.GameProfile gameProfile -
reducedDebugInfo
@Environment(CLIENT) private boolean reducedDebugInfo -
selectedItem
-
itemCooldownManager
-
fishHook
-
-
Constructor Details
-
PlayerEntity
-
-
Method Details
-
isBlockBreakingRestricted
-
createPlayerAttributes
-
initDataTracker
protected void initDataTracker()- Overrides:
initDataTrackerin classLivingEntity
-
tick
public void tick()- Overrides:
tickin classLivingEntity
-
shouldCancelInteraction
public boolean shouldCancelInteraction() -
shouldDismount
protected boolean shouldDismount() -
clipAtLedge
protected boolean clipAtLedge() -
updateWaterSubmersionState
protected boolean updateWaterSubmersionState() -
updateTurtleHelmet
private void updateTurtleHelmet() -
createCooldownManager
-
updateCapeAngles
private void updateCapeAngles() -
updateSize
protected void updateSize() -
getMaxNetherPortalTime
public int getMaxNetherPortalTime()- Overrides:
getMaxNetherPortalTimein classEntity
-
getSwimSound
- Overrides:
getSwimSoundin classEntity
-
getSplashSound
- Overrides:
getSplashSoundin classEntity
-
getHighSpeedSplashSound
- Overrides:
getHighSpeedSplashSoundin classEntity
-
getDefaultNetherPortalCooldown
public int getDefaultNetherPortalCooldown()- Overrides:
getDefaultNetherPortalCooldownin classEntity
-
playSound
-
playSound
-
getSoundCategory
- Overrides:
getSoundCategoryin classEntity
-
getBurningDuration
protected int getBurningDuration()- Overrides:
getBurningDurationin classEntity
-
handleStatus
@Environment(CLIENT) public void handleStatus(byte status)- Overrides:
handleStatusin classLivingEntity
-
spawnParticles
-
closeHandledScreen
protected void closeHandledScreen() -
tickRiding
public void tickRiding()- Overrides:
tickRidingin classLivingEntity
-
afterSpawn
@Environment(CLIENT) public void afterSpawn()- Overrides:
afterSpawnin classEntity
-
tickNewAi
protected void tickNewAi()- Overrides:
tickNewAiin classLivingEntity
-
tickMovement
public void tickMovement()- Overrides:
tickMovementin classLivingEntity
-
updateShoulderEntity
-
collideWithEntity
-
getScore
public int getScore() -
setScore
public void setScore(int score) -
addScore
public void addScore(int score) -
onDeath
- Overrides:
onDeathin classLivingEntity
-
dropInventory
protected void dropInventory()- Overrides:
dropInventoryin classLivingEntity
-
vanishCursedItems
protected void vanishCursedItems() -
getHurtSound
- Overrides:
getHurtSoundin classLivingEntity
-
getDeathSound
- Overrides:
getDeathSoundin classLivingEntity
-
dropSelectedItem
public boolean dropSelectedItem(boolean dropEntireStack) -
dropItem
-
dropItem
@Nullable public ItemEntity dropItem(ItemStack stack, boolean throwRandomly, boolean retainOwnership)- Parameters:
throwRandomly- If true, the item will be thrown in a random direction from the entity regardless of which direction the entity is facing
-
getBlockBreakingSpeed
-
isUsingEffectiveTool
-
readCustomDataFromTag
- Overrides:
readCustomDataFromTagin classLivingEntity
-
writeCustomDataToTag
- Overrides:
writeCustomDataToTagin classLivingEntity
-
isInvulnerableTo
- Overrides:
isInvulnerableToin classEntity
-
damage
- Overrides:
damagein classLivingEntity
-
takeShieldHit
- Overrides:
takeShieldHitin classLivingEntity
-
shouldDamagePlayer
-
damageArmor
- Overrides:
damageArmorin classLivingEntity
-
damageShield
protected void damageShield(float amount)- Overrides:
damageShieldin classLivingEntity
-
applyDamage
- Overrides:
applyDamagein classLivingEntity
-
isOnSoulSpeedBlock
protected boolean isOnSoulSpeedBlock()- Overrides:
isOnSoulSpeedBlockin classLivingEntity
-
openEditSignScreen
-
openCommandBlockMinecartScreen
-
openCommandBlockScreen
-
openStructureBlockScreen
-
openJigsawScreen
-
openHorseInventory
-
openHandledScreen
-
sendTradeOffers
public void sendTradeOffers(int syncId, TradeOfferList offers, int levelProgress, int experience, boolean leveled, boolean refreshable) -
openEditBookScreen
-
interact
-
getHeightOffset
public double getHeightOffset()- Overrides:
getHeightOffsetin classEntity
-
method_29239
public void method_29239()- Overrides:
method_29239in classEntity
-
isImmobile
protected boolean isImmobile()- Overrides:
isImmobilein classLivingEntity
-
method_29920
public boolean method_29920()- Overrides:
method_29920in classLivingEntity
-
adjustMovementForSneaking
- Overrides:
adjustMovementForSneakingin classEntity
-
method_30263
private boolean method_30263() -
attack
-
attackLivingEntity
- Overrides:
attackLivingEntityin classLivingEntity
-
disableShield
public void disableShield(boolean sprinting) -
addCritParticles
-
addEnchantedHitParticles
-
spawnSweepAttackParticles
public void spawnSweepAttackParticles() -
requestRespawn
@Environment(CLIENT) public void requestRespawn() -
remove
public void remove() -
isMainPlayer
public boolean isMainPlayer() -
getGameProfile
public com.mojang.authlib.GameProfile getGameProfile() -
trySleep
public com.mojang.datafixers.util.Either<PlayerEntity.SleepFailureReason,Unit> trySleep(BlockPos pos) -
wakeUp
public void wakeUp(boolean bool, boolean updateSleepingPlayers) -
wakeUp
public void wakeUp()- Overrides:
wakeUpin classLivingEntity
-
findRespawnPosition
public static Optional<Vec3d> findRespawnPosition(ServerWorld world, BlockPos pos, float float2, boolean bool, boolean bool2) -
isSleepingLongEnough
public boolean isSleepingLongEnough() -
getSleepTimer
public int getSleepTimer() -
sendMessage
-
incrementStat
-
increaseStat
-
incrementStat
-
increaseStat
-
resetStat
-
unlockRecipes
-
unlockRecipes
-
lockRecipes
-
jump
public void jump()- Overrides:
jumpin classLivingEntity
-
travel
- Overrides:
travelin classLivingEntity
-
updateSwimming
public void updateSwimming()- Overrides:
updateSwimmingin classEntity
-
doesNotSuffocate
-
getMovementSpeed
public float getMovementSpeed()- Overrides:
getMovementSpeedin classLivingEntity
-
increaseTravelMotionStats
public void increaseTravelMotionStats(double dx, double dy, double dz) -
increaseRidingMotionStats
private void increaseRidingMotionStats(double dx, double dy, double dz) -
handleFallDamage
public boolean handleFallDamage(float fallDistance, float damageMultiplier)- Overrides:
handleFallDamagein classLivingEntity
-
checkFallFlying
public boolean checkFallFlying() -
startFallFlying
public void startFallFlying() -
stopFallFlying
public void stopFallFlying() -
onSwimmingStart
protected void onSwimmingStart()- Overrides:
onSwimmingStartin classEntity
-
getFallSound
- Overrides:
getFallSoundin classLivingEntity
-
onKilledOther
- Overrides:
onKilledOtherin classEntity
-
slowMovement
- Overrides:
slowMovementin classEntity
-
addExperience
public void addExperience(int experience) -
getEnchantmentTableSeed
public int getEnchantmentTableSeed() -
applyEnchantmentCosts
-
addExperienceLevels
public void addExperienceLevels(int levels) -
getNextLevelExperience
public int getNextLevelExperience() -
addExhaustion
public void addExhaustion(float exhaustion) -
getHungerManager
-
canConsume
public boolean canConsume(boolean ignoreHunger) -
canFoodHeal
public boolean canFoodHeal() -
canModifyBlocks
public boolean canModifyBlocks() -
canPlaceOn
-
getCurrentExperience
- Overrides:
getCurrentExperiencein classLivingEntity
-
shouldAlwaysDropXp
protected boolean shouldAlwaysDropXp()- Overrides:
shouldAlwaysDropXpin classLivingEntity
-
shouldRenderName
@Environment(CLIENT) public boolean shouldRenderName()- Overrides:
shouldRenderNamein classLivingEntity
-
canClimb
protected boolean canClimb() -
sendAbilitiesUpdate
public void sendAbilitiesUpdate() -
setGameMode
-
getName
-
getEnderChestInventory
-
getEquippedStack
- Specified by:
getEquippedStackin classLivingEntity
-
equipStack
- Specified by:
equipStackin classLivingEntity
-
giveItemStack
-
getItemsHand
- Overrides:
getItemsHandin classEntity
-
getArmorItems
- Specified by:
getArmorItemsin classLivingEntity
-
addShoulderEntity
-
dropShoulderEntities
protected void dropShoulderEntities() -
dropShoulderEntity
-
isSpectator
public abstract boolean isSpectator()- Overrides:
isSpectatorin classEntity
-
isSwimming
public boolean isSwimming()- Overrides:
isSwimmingin classEntity
-
isCreative
public abstract boolean isCreative() -
canFly
public boolean canFly() -
getScoreboard
-
getDisplayName
- Specified by:
getDisplayNamein interfaceNameable- Overrides:
getDisplayNamein classEntity
-
addTellClickEvent
-
getEntityName
- Overrides:
getEntityNamein classEntity
-
getActiveEyeHeight
- Overrides:
getActiveEyeHeightin classLivingEntity
-
setAbsorptionAmount
public void setAbsorptionAmount(float amount)- Overrides:
setAbsorptionAmountin classLivingEntity
-
getAbsorptionAmount
public float getAbsorptionAmount()- Overrides:
getAbsorptionAmountin classLivingEntity
-
getUuidFromProfile
-
getOfflinePlayerUuid
-
isPartVisible
-
equip
-
getReducedDebugInfo
@Environment(CLIENT) public boolean getReducedDebugInfo() -
setReducedDebugInfo
@Environment(CLIENT) public void setReducedDebugInfo(boolean reducedDebugInfo) -
setFireTicks
public void setFireTicks(int ticks)- Overrides:
setFireTicksin classEntity
-
getMainArm
- Specified by:
getMainArmin classLivingEntity
-
setMainArm
-
getShoulderEntityLeft
-
setShoulderEntityLeft
-
getShoulderEntityRight
-
setShoulderEntityRight
-
getAttackCooldownProgressPerTick
public float getAttackCooldownProgressPerTick() -
getAttackCooldownProgress
public float getAttackCooldownProgress(float baseTime) -
resetLastAttackedTicks
public void resetLastAttackedTicks() -
getItemCooldownManager
-
getVelocityMultiplier
protected float getVelocityMultiplier()- Overrides:
getVelocityMultiplierin classLivingEntity
-
getLuck
public float getLuck() -
isCreativeLevelTwoOp
public boolean isCreativeLevelTwoOp() -
canEquip
- Overrides:
canEquipin classLivingEntity
-
getDimensions
- Overrides:
getDimensionsin classLivingEntity
-
getPoses
- Overrides:
getPosesin classLivingEntity
-
getArrowType
- Overrides:
getArrowTypein classLivingEntity
-
eatFood
- Overrides:
eatFoodin classLivingEntity
-
method_29500
- Overrides:
method_29500in classLivingEntity
-
method_30951
- Overrides:
method_30951in classEntity
-