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

    • 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(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
    • setFlags

      public void setFlags(com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata entityMetadata)
      Overrides:
      setFlags in class Entity
    • 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(com.nukkitx.math.vector.Vector3f position)
      Overrides:
      setRiderSeatPosition in class Entity
    • addFakeTradeExperience

      public void addFakeTradeExperience(int tradeXp)
    • 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
    • hasShield

      protected boolean hasShield(boolean offhand, ItemMapping shieldMapping)
      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<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
    • setLastDeathPosition

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