Interface GeyserEntity

All Known Subinterfaces:
GeyserAvatarEntity, GeyserPlayerEntity

public interface GeyserEntity
Represents a unique entity instance as seen by a specific GeyserConnection. Each connection maintains its own set of entity objects; no two connections share the same GeyserEntity instance.
  • Method Details

    • javaId

      @org.checkerframework.checker.index.qual.NonNegative int javaId()
      Returns:
      the entity ID that the server has assigned to this entity, or -1 if none is present
    • geyserId

      @Experimental @org.checkerframework.checker.index.qual.Positive long geyserId()
      The entity id used by Geyser to identify this entity with the Bedrock client.
      Returns:
      the Geyser entity id that the Bedrock client sees
      Since:
      2.11.0
    • uuid

      @Experimental @Nullable UUID uuid()
      The entity's UUID, only null if the server has not spawned this entity.
      Returns:
      the entity UUID that the server has assigned to this entity, or null if this entity isn't known to the Java server
      Since:
      2.11.0
    • definition

      @Experimental GeyserEntityDefinition definition()
      The Bedrock entity definition for this entity, which can also be a CustomEntityDefinition.
      Returns:
      the Bedrock entity definition
      Since:
      2.11.0
    • position

      @Experimental org.cloudburstmc.math.vector.Vector3f position()
      The position of this entity as reported by the Java server, without any Bedrock vertical offset applied.
      Returns:
      the position of the entity as known to the Java server
      Since:
      2.11.0
    • vehicle

      @Experimental @Nullable GeyserEntity vehicle()
      The vehicle this entity is currently mounted on.
      Returns:
      the vehicle of this entity, or null if this entity is not a passenger
      Since:
      2.11.0
    • passengers

      @Experimental List<GeyserEntity> passengers()
      The passengers currently riding this entity.
      Returns:
      an immutable snapshot of this entity's passengers, or an empty list if none
      Since:
      2.11.0
    • value

      @Experimental <T> @Nullable T value(GeyserEntityDataType<T> dataType)
      Reads the current value of a given GeyserEntityDataType which would currently be sent to players - either the override(GeyserEntityDataType), or the base value, if one is sent by default.
      Type Parameters:
      T - the type of the value
      Parameters:
      dataType - the entity data type to query
      Returns:
      the current value, or null if none is known
      Since:
      2.11.0
      See Also:
    • override

      @Experimental <T> @Nullable T override(GeyserEntityDataType<T> dataType)
      Reads the current override of a given GeyserEntityDataType, or null if no override was defined.
      Type Parameters:
      T - the type of the value
      Parameters:
      dataType - the entity data type override to query
      Returns:
      the current override value, or null if no override has been set
      Since:
      2.11.0
      See Also:
    • override

      @Experimental <T> void override(GeyserEntityDataType<T> dataType, @Nullable T value)
      Overrides an entity data value for this entity. If value is null, the override is cleared and the default value (from the Java server or entity type definition) is restored.
      Type Parameters:
      T - the type of the value
      Parameters:
      dataType - an entity data type, such as a constant from GeyserEntityDataTypes
      value - the new value, or null to reset the override
      Since:
      2.11.0
    • updateProperty

      default <T> void updateProperty(GeyserEntityProperty<T> property, @Nullable T value)
      Convenience method to update a single entity property. Equivalent to updatePropertiesBatched with a single-property consumer and immediate = false.
      Type Parameters:
      T - the type of the value
      Parameters:
      property - a GeyserEntityProperty registered for this type in the GeyserDefineEntityPropertiesEvent
      value - the new property value, or null to reset
      Since:
      2.9.0
    • updatePropertiesBatched

      @Deprecated(since="2.11.0", forRemoval=true) default void updatePropertiesBatched(Consumer<BatchPropertyUpdater> consumer)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This method is deprecated for removal and will be removed in Geyser 2.13.0.
      Since:
      2.9.0
    • updatePropertiesBatched

      void updatePropertiesBatched(Consumer<BatchPropertyUpdater> consumer, boolean immediate)
      Updates multiple entity properties with a single update, optionally sending it immediately.

      Usually, sending immediately is unnecessary; batched updates are flushed once per tick. Pass immediate = true only when packet ordering requires the properties to be applied before the next tick (e.g., to avoid a visual flicker on the client).

      Parameters:
      consumer - a BatchPropertyUpdater callback that applies one or more property changes
      immediate - true to send the packet immediately rather than at the next tick
      Since:
      2.9.1
      See Also: