Class SessionPlayerEntity


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

    • attributes

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

    • SessionPlayerEntity

      public SessionPlayerEntity(GeyserSession session)
  • Method Details

    • spawnEntity

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

      public void moveRelative(GeyserSession session, double relX, double relY, double relZ, com.nukkitx.math.vector.Vector3f rotation, boolean isOnGround)
      Overrides:
      moveRelative in class PlayerEntity
    • setPosition

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

      public void setPositionManual(com.nukkitx.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
    • updateBedrockMetadata

      public void updateBedrockMetadata(com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata entityMetadata, GeyserSession session)
      Description copied from class: Entity
      Applies the Java metadata to the local Bedrock metadata copy
      Overrides:
      updateBedrockMetadata in class PlayerEntity
      Parameters:
      entityMetadata - the Java entity metadata
      session - GeyserSession
    • getMaxHealth

      public float getMaxHealth()
    • setHealth

      public void setHealth(float health)
    • setAir

      protected void setAir(int amount)
      Description copied from class: Entity
      Set an int from 0 - this entity's maximum air - (air / maxAir) represents the percentage of bubbles left
      Overrides:
      setAir in class Entity
      Parameters:
      amount - the amount of air
    • createHealthAttribute

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

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

      protected void updateAttribute(com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute javaAttribute, List<com.nukkitx.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 com.nukkitx.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