Class SessionPlayerEntity

All Implemented Interfaces:
org.geysermc.geyser.api.entity.type.GeyserEntity, org.geysermc.geyser.api.entity.type.player.GeyserPlayerEntity

public class SessionPlayerEntity extends PlayerEntity
The entity class specifically for a GeyserSession's player.
  • Field Details

    • attributes

      protected final Map<GeyserAttributeType,​org.cloudburstmc.protocol.bedrock.data.AttributeData> attributes
      Used to fix some inconsistencies, especially in respawning.
  • Constructor Details

    • SessionPlayerEntity

      public SessionPlayerEntity(GeyserSession session)
  • Method Details

    • setClientSideSilent

      protected void setClientSideSilent()
      Overrides:
      setClientSideSilent in class Entity
    • spawnEntity

      public void spawnEntity()
      Overrides:
      spawnEntity in class PlayerEntity
    • moveRelative

      public void moveRelative(double relX, double relY, double relZ, float yaw, float pitch, float headYaw, boolean isOnGround)
      Overrides:
      moveRelative in class PlayerEntity
    • setPosition

      public void setPosition(org.cloudburstmc.math.vector.Vector3f position)
      Overrides:
      setPosition in class PlayerEntity
    • setPositionManual

      public void setPositionManual(org.cloudburstmc.math.vector.Vector3f position)
      Set the player's position without applying an offset or moving the bounding box This is used in BedrockMovePlayerTranslator which receives the player's position with the offset pre-applied
      Parameters:
      position - the new position of the Bedrock player
    • setFlags

      public void setFlags(com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata entityMetadata)
      Sending any updated flags (sprinting, onFire, etc.) to the client while in spectator is not needed Also "fixes" https://github.com/GeyserMC/Geyser/issues/3318
      Overrides:
      setFlags in class Entity
    • updateBoundingBox

      public void updateBoundingBox()
      Since 1.19.40, the client must be re-informed of its bounding box on respawn See https://github.com/GeyserMC/Geyser/issues/3370
    • setBoundingBoxHeight

      public boolean setBoundingBoxHeight(float height)
      Overrides:
      setBoundingBoxHeight in class Entity
    • setPose

      public void setPose(com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose pose)
      Description copied from class: Entity
      Usually used for bounding box and not animation.
      Overrides:
      setPose in class Entity
    • getMaxHealth

      public float getMaxHealth()
    • getHealth

      public float getHealth()
    • setHealth

      public void setHealth(float health)
    • setAirSupply

      protected void setAirSupply(int amount)
      Overrides:
      setAirSupply in class Entity
    • setRiderSeatPosition

      public void setRiderSeatPosition(org.cloudburstmc.math.vector.Vector3f position)
      Overrides:
      setRiderSeatPosition in class Entity
    • createHealthAttribute

      public org.cloudburstmc.protocol.bedrock.data.AttributeData createHealthAttribute()
      Overrides:
      createHealthAttribute in class LivingEntity
      Returns:
      a Bedrock health attribute constructed from the data sent from the server
    • hasShield

      protected boolean hasShield(boolean offhand)
      Overrides:
      hasShield in class LivingEntity
    • updateBedrockMetadata

      public void updateBedrockMetadata()
      Description copied from class: Entity
      Sends the Bedrock metadata to the client
      Overrides:
      updateBedrockMetadata in class Entity
    • updateAttribute

      protected void updateAttribute(com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute javaAttribute, List<org.cloudburstmc.protocol.bedrock.data.AttributeData> newAttributes)
      Description copied from class: LivingEntity
      Takes the Java attribute and adds it to newAttributes as a Bedrock-formatted attribute
      Overrides:
      updateAttribute in class LivingEntity
    • calculateAttribute

      protected org.cloudburstmc.protocol.bedrock.data.AttributeData calculateAttribute(com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute javaAttribute, GeyserAttributeType type)
      Description copied from class: LivingEntity
      Calculates the complete attribute value to send to Bedrock. Will be overriden if attributes need to be cached.
      Overrides:
      calculateAttribute in class LivingEntity
    • setLastDeathPosition

      public void setLastDeathPosition(@Nullable com.github.steveice10.mc.protocol.data.game.entity.metadata.GlobalPos pos)
    • getTabListUuid

      public UUID getTabListUuid()
      Overrides:
      getTabListUuid in class PlayerEntity
      Returns:
      the UUID that should be used when dealing with Bedrock's tab list.
    • resetMetadata

      public void resetMetadata()
    • resetAir

      public void resetAir()
    • getAttributes

      public Map<GeyserAttributeType,​org.cloudburstmc.protocol.bedrock.data.AttributeData> getAttributes()
      Used to fix some inconsistencies, especially in respawning.
    • isRidingInFront

      public boolean isRidingInFront()
      Used in PlayerInputTranslator for movement checks.