Class LivingEntity

java.lang.Object
org.geysermc.geyser.entity.type.Entity
org.geysermc.geyser.entity.type.LivingEntity
All Implemented Interfaces:
org.geysermc.geyser.api.entity.type.GeyserEntity
Direct Known Subclasses:
ArmorStandEntity, MobEntity, PlayerEntity

public class LivingEntity extends Entity
  • Field Details

    • helmet

      protected org.cloudburstmc.protocol.bedrock.data.inventory.ItemData helmet
    • chestplate

      protected org.cloudburstmc.protocol.bedrock.data.inventory.ItemData chestplate
    • leggings

      protected org.cloudburstmc.protocol.bedrock.data.inventory.ItemData leggings
    • boots

      protected org.cloudburstmc.protocol.bedrock.data.inventory.ItemData boots
    • hand

      protected org.cloudburstmc.protocol.bedrock.data.inventory.ItemData hand
    • offhand

      protected org.cloudburstmc.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, org.cloudburstmc.math.vector.Vector3f position, org.cloudburstmc.math.vector.Vector3f motion, float yaw, float pitch, float headYaw)
  • Method Details

    • setHelmet

      public void setHelmet(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack)
    • setChestplate

      public void setChestplate(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack)
    • setLeggings

      public void setLeggings(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack)
    • setBoots

      public void setBoots(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack)
    • setHand

      public void setHand(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack)
    • setOffhand

      public void setOffhand(org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack stack)
    • switchHands

      public void switchHands()
    • 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(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ByteEntityMetadata entityMetadata)
    • setHealth

      public void setHealth(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.FloatEntityMetadata entityMetadata)
    • setParticles

      public void setParticles(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.type.ObjectEntityMetadata<List<org.geysermc.mcprotocollib.protocol.data.game.level.particle.Particle>> entityMetadata)
    • setBedPosition

      public @Nullable org.cloudburstmc.math.vector.Vector3i setBedPosition(org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.EntityMetadata<Optional<org.cloudburstmc.math.vector.Vector3i>,?> entityMetadata)
    • hasShield

      protected boolean hasShield(boolean offhand)
    • 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(org.geysermc.mcprotocollib.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(org.geysermc.mcprotocollib.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
    • setScale

      protected void setScale(float scale)
    • createHealthAttribute

      protected org.cloudburstmc.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(org.geysermc.mcprotocollib.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)
    • useArmSwingAttack

      public boolean useArmSwingAttack()
      Called when a SWING_ARM animation packet is received
      Returns:
      true if an ATTACK_START event should be used instead
    • updateBedrockAttributes

      public void updateBedrockAttributes(GeyserSession session, List<org.geysermc.mcprotocollib.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(org.geysermc.mcprotocollib.protocol.data.game.entity.attribute.Attribute javaAttribute, List<org.cloudburstmc.protocol.bedrock.data.AttributeData> newAttributes)
      Takes the Java attribute and adds it to newAttributes as a Bedrock-formatted attribute
    • calculateAttribute

      protected org.cloudburstmc.protocol.bedrock.data.AttributeData calculateAttribute(org.geysermc.mcprotocollib.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 org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getHelmet()
    • getChestplate

      public org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getChestplate()
    • getLeggings

      public org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getLeggings()
    • getBoots

      public org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getBoots()
    • getHand

      public org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getHand()
    • getOffhand

      public org.cloudburstmc.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
    • 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