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, int 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.nukkitx.math.vector.Vector3i>,​?> entityMetadata)
    • hasShield

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

      public boolean isAlive()
      Overrides:
      isAlive in class Entity
    • interact

      public InteractionResult interact(com.github.steveice10.mc.protocol.data.game.entity.player.Hand hand)
      Description copied from class: Entity
      Simulates interacting with an entity. The code here should mirror Java Edition code to the best of its ability, to ensure packet parity as well as functionality parity (such as sound effect responses).
      Overrides:
      interact in class Entity
    • checkInteractWithNameTag

      protected final InteractionResult checkInteractWithNameTag(GeyserItemStack itemStack)
      Checks to see if a nametag interaction would go through.
    • 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.
    • getHelmet

      public com.nukkitx.protocol.bedrock.data.inventory.ItemData getHelmet()
    • getChestplate

      public com.nukkitx.protocol.bedrock.data.inventory.ItemData getChestplate()
    • getLeggings

      public com.nukkitx.protocol.bedrock.data.inventory.ItemData getLeggings()
    • getBoots

      public com.nukkitx.protocol.bedrock.data.inventory.ItemData getBoots()
    • getHand

      public com.nukkitx.protocol.bedrock.data.inventory.ItemData getHand()
    • getOffHand

      public com.nukkitx.protocol.bedrock.data.inventory.ItemData getOffHand()
    • isMaxFrozenState

      public boolean isMaxFrozenState()
      A convenience variable for if the entity has reached the maximum frozen ticks and should be shaking
    • setHelmet

      public void setHelmet(com.nukkitx.protocol.bedrock.data.inventory.ItemData helmet)
    • setChestplate

      public void setChestplate(com.nukkitx.protocol.bedrock.data.inventory.ItemData chestplate)
    • setLeggings

      public void setLeggings(com.nukkitx.protocol.bedrock.data.inventory.ItemData leggings)
    • setBoots

      public void setBoots(com.nukkitx.protocol.bedrock.data.inventory.ItemData boots)
    • setHand

      public void setHand(com.nukkitx.protocol.bedrock.data.inventory.ItemData hand)
    • setOffHand

      public void setOffHand(com.nukkitx.protocol.bedrock.data.inventory.ItemData offHand)
    • setMaxHealth

      public void setMaxHealth(float maxHealth)
    • setMaxFrozenState

      public void setMaxFrozenState(boolean isMaxFrozenState)
      A convenience variable for if the entity has reached the maximum frozen ticks and should be shaking