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 class
PlayerEntity.SleepFailureReason
Nested 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, upwardSpeed
Fields 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, yaw
Fields 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, updateTrackedPositionAndAngles
Methods 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:
initDataTracker
in classLivingEntity
-
tick
public void tick()- Overrides:
tick
in 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:
getMaxNetherPortalTime
in classEntity
-
getSwimSound
- Overrides:
getSwimSound
in classEntity
-
getSplashSound
- Overrides:
getSplashSound
in classEntity
-
getHighSpeedSplashSound
- Overrides:
getHighSpeedSplashSound
in classEntity
-
getDefaultNetherPortalCooldown
public int getDefaultNetherPortalCooldown()- Overrides:
getDefaultNetherPortalCooldown
in classEntity
-
playSound
-
playSound
-
getSoundCategory
- Overrides:
getSoundCategory
in classEntity
-
getBurningDuration
protected int getBurningDuration()- Overrides:
getBurningDuration
in classEntity
-
handleStatus
@Environment(CLIENT) public void handleStatus(byte status)- Overrides:
handleStatus
in classLivingEntity
-
spawnParticles
-
closeHandledScreen
protected void closeHandledScreen() -
tickRiding
public void tickRiding()- Overrides:
tickRiding
in classLivingEntity
-
afterSpawn
@Environment(CLIENT) public void afterSpawn()- Overrides:
afterSpawn
in classEntity
-
tickNewAi
protected void tickNewAi()- Overrides:
tickNewAi
in classLivingEntity
-
tickMovement
public void tickMovement()- Overrides:
tickMovement
in classLivingEntity
-
updateShoulderEntity
-
collideWithEntity
-
getScore
public int getScore() -
setScore
public void setScore(int score) -
addScore
public void addScore(int score) -
onDeath
- Overrides:
onDeath
in classLivingEntity
-
dropInventory
protected void dropInventory()- Overrides:
dropInventory
in classLivingEntity
-
vanishCursedItems
protected void vanishCursedItems() -
getHurtSound
- Overrides:
getHurtSound
in classLivingEntity
-
getDeathSound
- Overrides:
getDeathSound
in 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:
readCustomDataFromTag
in classLivingEntity
-
writeCustomDataToTag
- Overrides:
writeCustomDataToTag
in classLivingEntity
-
isInvulnerableTo
- Overrides:
isInvulnerableTo
in classEntity
-
damage
- Overrides:
damage
in classLivingEntity
-
takeShieldHit
- Overrides:
takeShieldHit
in classLivingEntity
-
shouldDamagePlayer
-
damageArmor
- Overrides:
damageArmor
in classLivingEntity
-
damageShield
protected void damageShield(float amount)- Overrides:
damageShield
in classLivingEntity
-
applyDamage
- Overrides:
applyDamage
in classLivingEntity
-
isOnSoulSpeedBlock
protected boolean isOnSoulSpeedBlock()- Overrides:
isOnSoulSpeedBlock
in 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:
getHeightOffset
in classEntity
-
method_29239
public void method_29239()- Overrides:
method_29239
in classEntity
-
isImmobile
protected boolean isImmobile()- Overrides:
isImmobile
in classLivingEntity
-
method_29920
public boolean method_29920()- Overrides:
method_29920
in classLivingEntity
-
adjustMovementForSneaking
- Overrides:
adjustMovementForSneaking
in classEntity
-
method_30263
private boolean method_30263() -
attack
-
attackLivingEntity
- Overrides:
attackLivingEntity
in 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:
wakeUp
in 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:
jump
in classLivingEntity
-
travel
- Overrides:
travel
in classLivingEntity
-
updateSwimming
public void updateSwimming()- Overrides:
updateSwimming
in classEntity
-
doesNotSuffocate
-
getMovementSpeed
public float getMovementSpeed()- Overrides:
getMovementSpeed
in 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:
handleFallDamage
in classLivingEntity
-
checkFallFlying
public boolean checkFallFlying() -
startFallFlying
public void startFallFlying() -
stopFallFlying
public void stopFallFlying() -
onSwimmingStart
protected void onSwimmingStart()- Overrides:
onSwimmingStart
in classEntity
-
getFallSound
- Overrides:
getFallSound
in classLivingEntity
-
onKilledOther
- Overrides:
onKilledOther
in classEntity
-
slowMovement
- Overrides:
slowMovement
in 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:
getCurrentExperience
in classLivingEntity
-
shouldAlwaysDropXp
protected boolean shouldAlwaysDropXp()- Overrides:
shouldAlwaysDropXp
in classLivingEntity
-
shouldRenderName
@Environment(CLIENT) public boolean shouldRenderName()- Overrides:
shouldRenderName
in classLivingEntity
-
canClimb
protected boolean canClimb() -
sendAbilitiesUpdate
public void sendAbilitiesUpdate() -
setGameMode
-
getName
-
getEnderChestInventory
-
getEquippedStack
- Specified by:
getEquippedStack
in classLivingEntity
-
equipStack
- Specified by:
equipStack
in classLivingEntity
-
giveItemStack
-
getItemsHand
- Overrides:
getItemsHand
in classEntity
-
getArmorItems
- Specified by:
getArmorItems
in classLivingEntity
-
addShoulderEntity
-
dropShoulderEntities
protected void dropShoulderEntities() -
dropShoulderEntity
-
isSpectator
public abstract boolean isSpectator()- Overrides:
isSpectator
in classEntity
-
isSwimming
public boolean isSwimming()- Overrides:
isSwimming
in classEntity
-
isCreative
public abstract boolean isCreative() -
canFly
public boolean canFly() -
getScoreboard
-
getDisplayName
- Specified by:
getDisplayName
in interfaceNameable
- Overrides:
getDisplayName
in classEntity
-
addTellClickEvent
-
getEntityName
- Overrides:
getEntityName
in classEntity
-
getActiveEyeHeight
- Overrides:
getActiveEyeHeight
in classLivingEntity
-
setAbsorptionAmount
public void setAbsorptionAmount(float amount)- Overrides:
setAbsorptionAmount
in classLivingEntity
-
getAbsorptionAmount
public float getAbsorptionAmount()- Overrides:
getAbsorptionAmount
in 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:
setFireTicks
in classEntity
-
getMainArm
- Specified by:
getMainArm
in 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:
getVelocityMultiplier
in classLivingEntity
-
getLuck
public float getLuck() -
isCreativeLevelTwoOp
public boolean isCreativeLevelTwoOp() -
canEquip
- Overrides:
canEquip
in classLivingEntity
-
getDimensions
- Overrides:
getDimensions
in classLivingEntity
-
getPoses
- Overrides:
getPoses
in classLivingEntity
-
getArrowType
- Overrides:
getArrowType
in classLivingEntity
-
eatFood
- Overrides:
eatFood
in classLivingEntity
-
method_29500
- Overrides:
method_29500
in classLivingEntity
-
method_30951
- Overrides:
method_30951
in classEntity
-