Class ClientPlayerEntity

All Implemented Interfaces:
CommandOutput, Nameable

@Environment(CLIENT)
public class ClientPlayerEntity
extends AbstractClientPlayerEntity
Represents the client's own player entity.
  • Field Details

    • networkHandler

      public final ClientPlayNetworkHandler networkHandler
    • statHandler

      private final StatHandler statHandler
    • recipeBook

      private final ClientRecipeBook recipeBook
    • tickables

      private final List<ClientPlayerTickable> tickables
    • clientPermissionLevel

      private int clientPermissionLevel
    • lastX

      private double lastX
    • lastBaseY

      private double lastBaseY
    • lastZ

      private double lastZ
    • lastYaw

      private float lastYaw
    • lastPitch

      private float lastPitch
    • lastOnGround

      private boolean lastOnGround
    • inSneakingPose

      private boolean inSneakingPose
    • lastSneaking

      private boolean lastSneaking
    • lastSprinting

      private boolean lastSprinting
    • ticksSinceLastPositionPacketSent

      private int ticksSinceLastPositionPacketSent
    • healthInitialized

      private boolean healthInitialized
    • serverBrand

      private String serverBrand
    • input

      public Input input
    • client

      protected final MinecraftClient client
    • ticksLeftToDoubleTapSprint

      protected int ticksLeftToDoubleTapSprint
    • ticksSinceSprintingChanged

      public int ticksSinceSprintingChanged
    • renderYaw

      public float renderYaw
    • renderPitch

      public float renderPitch
    • lastRenderYaw

      public float lastRenderYaw
    • lastRenderPitch

      public float lastRenderPitch
    • field_3938

      private int field_3938
    • field_3922

      private float field_3922
    • nextNauseaStrength

      public float nextNauseaStrength
    • lastNauseaStrength

      public float lastNauseaStrength
    • usingItem

      private boolean usingItem
    • activeHand

      private Hand activeHand
    • riding

      private boolean riding
    • autoJumpEnabled

      private boolean autoJumpEnabled
    • ticksToNextAutojump

      private int ticksToNextAutojump
    • field_3939

      private boolean field_3939
    • underwaterVisibilityTicks

      private int underwaterVisibilityTicks
    • showsDeathScreen

      private boolean showsDeathScreen
  • Constructor Details

  • Method Details

    • damage

      public boolean damage​(DamageSource source, float amount)
      Overrides:
      damage in class PlayerEntity
    • heal

      public void heal​(float amount)
      Heals this entity by the given amount of half-hearts.

      A dead entity cannot be healed.

      Overrides:
      heal in class LivingEntity
      See Also:
      LivingEntity.isDead()
    • startRiding

      public boolean startRiding​(Entity entity, boolean force)
      Overrides:
      startRiding in class Entity
    • method_29239

      public void method_29239()
      Overrides:
      method_29239 in class PlayerEntity
    • getPitch

      public float getPitch​(float tickDelta)
      Overrides:
      getPitch in class Entity
    • getYaw

      public float getYaw​(float tickDelta)
      Overrides:
      getYaw in class LivingEntity
    • tick

      public void tick()
      Overrides:
      tick in class PlayerEntity
    • getMoodPercentage

      public float getMoodPercentage()
      Returns the percentage for the biome mood sound for the debug HUD to display.
    • sendMovementPackets

      private void sendMovementPackets()
    • dropSelectedItem

      public boolean dropSelectedItem​(boolean dropEntireStack)
      Overrides:
      dropSelectedItem in class PlayerEntity
    • sendChatMessage

      public void sendChatMessage​(String message)
    • swingHand

      public void swingHand​(Hand hand)
      Overrides:
      swingHand in class LivingEntity
    • requestRespawn

      public void requestRespawn()
      Overrides:
      requestRespawn in class PlayerEntity
    • applyDamage

      protected void applyDamage​(DamageSource source, float amount)
      Overrides:
      applyDamage in class PlayerEntity
    • closeHandledScreen

      public void closeHandledScreen()
      Overrides:
      closeHandledScreen in class PlayerEntity
    • closeScreen

      public void closeScreen()
    • updateHealth

      public void updateHealth​(float health)
    • sendAbilitiesUpdate

      public void sendAbilitiesUpdate()
      Overrides:
      sendAbilitiesUpdate in class PlayerEntity
    • isMainPlayer

      public boolean isMainPlayer()
      Overrides:
      isMainPlayer in class PlayerEntity
    • isHoldingOntoLadder

      public boolean isHoldingOntoLadder()
      Overrides:
      isHoldingOntoLadder in class LivingEntity
      Returns:
      true if this entity should not lose height while in a climbing state
      See Also:
      LivingEntity
    • shouldSpawnSprintingParticles

      public boolean shouldSpawnSprintingParticles()
      Overrides:
      shouldSpawnSprintingParticles in class Entity
    • shouldDisplaySoulSpeedEffects

      public boolean shouldDisplaySoulSpeedEffects()
      Overrides:
      shouldDisplaySoulSpeedEffects in class LivingEntity
    • startRidingJump

      protected void startRidingJump()
    • openRidingInventory

      public void openRidingInventory()
    • setServerBrand

      public void setServerBrand​(String serverBrand)
    • getServerBrand

      public String getServerBrand()
    • getStatHandler

      public StatHandler getStatHandler()
    • getRecipeBook

      public ClientRecipeBook getRecipeBook()
    • onRecipeDisplayed

      public void onRecipeDisplayed​(Recipe<?> recipe)
    • getPermissionLevel

      protected int getPermissionLevel()
      Overrides:
      getPermissionLevel in class Entity
    • setClientPermissionLevel

      public void setClientPermissionLevel​(int clientPermissionLevel)
    • sendMessage

      public void sendMessage​(Text message, boolean actionBar)
      Overrides:
      sendMessage in class PlayerEntity
    • pushOutOfBlocks

      private void pushOutOfBlocks​(double x, double double2)
    • wouldCollideAt

      private boolean wouldCollideAt​(BlockPos pos)
    • setSprinting

      public void setSprinting​(boolean sprinting)
      Overrides:
      setSprinting in class LivingEntity
    • setExperience

      public void setExperience​(float progress, int total, int level)
    • sendSystemMessage

      public void sendSystemMessage​(Text message, UUID sender)
      Specified by:
      sendSystemMessage in interface CommandOutput
      Overrides:
      sendSystemMessage in class Entity
    • handleStatus

      public void handleStatus​(byte status)
      Overrides:
      handleStatus in class PlayerEntity
    • setShowsDeathScreen

      public void setShowsDeathScreen​(boolean shouldShow)
    • showsDeathScreen

      public boolean showsDeathScreen()
    • playSound

      public void playSound​(SoundEvent sound, float volume, float pitch)
      Overrides:
      playSound in class PlayerEntity
    • playSound

      public void playSound​(SoundEvent event, SoundCategory category, float volume, float pitch)
      Overrides:
      playSound in class PlayerEntity
    • canMoveVoluntarily

      public boolean canMoveVoluntarily()
      Overrides:
      canMoveVoluntarily in class LivingEntity
    • setCurrentHand

      public void setCurrentHand​(Hand hand)
      Overrides:
      setCurrentHand in class LivingEntity
    • isUsingItem

      public boolean isUsingItem()
      Overrides:
      isUsingItem in class LivingEntity
    • clearActiveItem

      public void clearActiveItem()
      Overrides:
      clearActiveItem in class LivingEntity
    • getActiveHand

      public Hand getActiveHand()
      Overrides:
      getActiveHand in class LivingEntity
    • onTrackedDataSet

      public void onTrackedDataSet​(TrackedData<?> data)
      Overrides:
      onTrackedDataSet in class LivingEntity
    • hasJumpingMount

      public boolean hasJumpingMount()
    • method_3151

      public float method_3151()
    • openEditSignScreen

      public void openEditSignScreen​(SignBlockEntity sign)
      Overrides:
      openEditSignScreen in class PlayerEntity
    • openCommandBlockMinecartScreen

      public void openCommandBlockMinecartScreen​(CommandBlockExecutor commandBlockExecutor)
      Overrides:
      openCommandBlockMinecartScreen in class PlayerEntity
    • openCommandBlockScreen

      public void openCommandBlockScreen​(CommandBlockBlockEntity commandBlock)
      Overrides:
      openCommandBlockScreen in class PlayerEntity
    • openStructureBlockScreen

      public void openStructureBlockScreen​(StructureBlockBlockEntity structureBlock)
      Overrides:
      openStructureBlockScreen in class PlayerEntity
    • openJigsawScreen

      public void openJigsawScreen​(JigsawBlockEntity jigsaw)
      Overrides:
      openJigsawScreen in class PlayerEntity
    • useBook

      public void useBook​(ItemStack book, Hand hand)
      Called when the player uses (defaults to right click) a writable or written book item.

      This can be called either on the client or the server player. Check book for whether this is a written or a writable book.

      Overrides:
      useBook in class PlayerEntity
      Parameters:
      book - the book
      hand - the hand holding the book
    • addCritParticles

      public void addCritParticles​(Entity target)
      Overrides:
      addCritParticles in class PlayerEntity
    • addEnchantedHitParticles

      public void addEnchantedHitParticles​(Entity target)
      Overrides:
      addEnchantedHitParticles in class PlayerEntity
    • isSneaking

      public boolean isSneaking()
      Overrides:
      isSneaking in class Entity
    • isInSneakingPose

      public boolean isInSneakingPose()
      Returns whether the entity is in a crouching pose.

      Compared to isSneaking(), it only makes the entity appear crouching and does not bring other effects of sneaking, such as no less obvious name label rendering, no dismounting while riding, etc.

      This is used by vanilla for non-player entities to crouch, such as for foxes and cats.

      Overrides:
      isInSneakingPose in class Entity
    • shouldSlowDown

      public boolean shouldSlowDown()
    • tickNewAi

      public void tickNewAi()
      Overrides:
      tickNewAi in class PlayerEntity
    • isCamera

      protected boolean isCamera()
    • tickMovement

      public void tickMovement()
      Overrides:
      tickMovement in class PlayerEntity
    • updateNausea

      private void updateNausea()
    • tickRiding

      public void tickRiding()
      Overrides:
      tickRiding in class PlayerEntity
    • isRiding

      public boolean isRiding()
    • removeStatusEffectInternal

      @Nullable public StatusEffectInstance removeStatusEffectInternal​(@Nullable StatusEffect type)
      Removes a status effect from this entity without calling any listener.

      This method does not perform any cleanup or synchronization operation. Under most circumstances, calling LivingEntity.removeStatusEffect(net.minecraft.entity.effect.StatusEffect) is highly preferable.

      Overrides:
      removeStatusEffectInternal in class LivingEntity
    • move

      public void move​(MovementType movementType, Vec3d movement)
      Overrides:
      move in class Entity
    • isAutoJumpEnabled

      public boolean isAutoJumpEnabled()
    • autoJump

      protected void autoJump​(float dx, float dz)
    • shouldAutoJump

      private boolean shouldAutoJump()
    • hasMovementInput

      private boolean hasMovementInput()
      Returns whether the player has movement input.
      Returns:
      True if the player has movement input, else false.
    • isWalking

      private boolean isWalking()
    • getUnderwaterVisibility

      public float getUnderwaterVisibility()
      Returns the color multiplier of vision in water, so that visibility in water is reduced when the player just entered water.
    • isSubmergedInWater

      public boolean isSubmergedInWater()
      Returns whether this entity's hitbox is fully submerged in water.
      Overrides:
      isSubmergedInWater in class Entity
    • updateWaterSubmersionState

      protected boolean updateWaterSubmersionState()
      Overrides:
      updateWaterSubmersionState in class PlayerEntity
    • method_30951

      public Vec3d method_30951​(float float2)
      Overrides:
      method_30951 in class PlayerEntity