Class LivingEntity

java.lang.Object
org.geysermc.geyser.entity.type.Entity
org.geysermc.geyser.entity.type.LivingEntity
Direct Known Subclasses:
ArmorStandEntity, MobEntity, PlayerEntity

public class LivingEntity extends Entity
  • Field Details

    • helmet

      protected com.nukkitx.protocol.bedrock.data.inventory.ItemData helmet
    • chestplate

      protected com.nukkitx.protocol.bedrock.data.inventory.ItemData chestplate
    • leggings

      protected com.nukkitx.protocol.bedrock.data.inventory.ItemData leggings
    • boots

      protected com.nukkitx.protocol.bedrock.data.inventory.ItemData boots
    • hand

      protected com.nukkitx.protocol.bedrock.data.inventory.ItemData hand
    • offHand

      protected com.nukkitx.protocol.bedrock.data.inventory.ItemData offHand
    • health

      protected float health
    • maxHealth

      protected float maxHealth
  • Constructor Details

    • LivingEntity

      public LivingEntity(GeyserSession session, long entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, com.nukkitx.math.vector.Vector3f position, com.nukkitx.math.vector.Vector3f motion, float yaw, float pitch, float headYaw)
  • Method Details

    • initializeMetadata

      protected void initializeMetadata()
      Description copied from class: Entity
      Called on entity spawn. Used to populate the entity metadata and flags with default values.
      Overrides:
      initializeMetadata in class Entity
    • setLivingEntityFlags

      public void setLivingEntityFlags(com.github.steveice10.mc.protocol.data.game.entity.metadata.type.ByteEntityMetadata entityMetadata)
    • setHealth

      public void setHealth(com.github.steveice10.mc.protocol.data.game.entity.metadata.type.FloatEntityMetadata entityMetadata)
    • setBedPosition

      public com.nukkitx.math.vector.Vector3i setBedPosition(com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadata<Optional<com.github.steveice10.mc.protocol.data.game.entity.metadata.Position>,​?> entityMetadata)
    • isShaking

      protected boolean isShaking()
      Description copied from class: Entity
      If true, the entity should be shaking on the client's end.
      Overrides:
      isShaking in class Entity
      Returns:
      whether EntityFlag.SHAKING should be set to true.
    • setDimensions

      protected void setDimensions(com.github.steveice10.mc.protocol.data.game.entity.metadata.Pose pose)
      Description copied from class: Entity
      Set the height and width of the entity's bounding box
      Overrides:
      setDimensions in class Entity
    • setFreezing

      public float setFreezing(com.github.steveice10.mc.protocol.data.game.entity.metadata.type.IntEntityMetadata entityMetadata)
      Description copied from class: Entity
      Set a float from 0-1 - how strong the "frozen" overlay should be on screen.
      Overrides:
      setFreezing in class Entity
    • createHealthAttribute

      protected com.nukkitx.protocol.bedrock.data.AttributeData createHealthAttribute()
      Returns:
      a Bedrock health attribute constructed from the data sent from the server
    • updateArmor

      public void updateArmor(GeyserSession session)
    • updateMainHand

      public void updateMainHand(GeyserSession session)
    • updateOffHand

      public void updateOffHand(GeyserSession session)
    • updateBedrockAttributes

      public void updateBedrockAttributes(GeyserSession session, List<com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute> attributes)
      Attributes are properties of an entity that are generally more runtime-based instead of permanent properties. Movement speed, current attack damage with a weapon, current knockback resistance.
      Parameters:
      attributes - the Java list of attributes sent from the server
    • updateAttribute

      protected void updateAttribute(com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute javaAttribute, List<com.nukkitx.protocol.bedrock.data.AttributeData> newAttributes)
      Takes the Java attribute and adds it to newAttributes as a Bedrock-formatted attribute
    • calculateAttribute

      protected com.nukkitx.protocol.bedrock.data.AttributeData calculateAttribute(com.github.steveice10.mc.protocol.data.game.entity.attribute.Attribute javaAttribute, GeyserAttributeType type)
      Calculates the complete attribute value to send to Bedrock. Will be overriden if attributes need to be cached.