Interface GeyserEntity

All Known Subinterfaces:
GeyserPlayerEntity

public interface GeyserEntity
Represents a unique instance of an entity. Each GeyserConnection have their own sets of entities - no two instances will 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 0 if none is present
    • geyserId

      @org.checkerframework.checker.index.qual.Positive long geyserId()
      Returns:
      the Geyser entity id that the Bedrock client sees
    • uuid

      @Nullable UUID uuid()
      Returns:
      the entity uuid that the server has assigned to this entity, or null if none is assigned
    • definition

      Returns:
      the Bedrock entity definition
    • position

      org.cloudburstmc.math.vector.Vector3f position()
      The position of this entity, without the Bedrock edition offset defined in the Bedrock entity definition.
      Returns:
      the position of the entity, as it is known to the Java server.
    • vehicle

      @Nullable GeyserEntity vehicle()
      The vehicle this entity is currently on, or null if not present.
    • passengers

      List<GeyserEntity> passengers()
      The passengers of this entity, or an empty list if none are present.
    • value

      <T> @Nullable T value(GeyserEntityDataType<T> dataType)
      Queries the current value of a given GeyserEntityDataType.
      Type Parameters:
      T - the type of the value
      Parameters:
      dataType - the entity data type to query
      Returns:
      the value, or null if not set
      See Also:
    • update

      <T> void update(GeyserEntityDataType<T> dataType, @Nullable T value)
      Updates an entity property with a new value. If the new value is null, the property is reset to the default value.
      Type Parameters:
      T - the type of the value
      Parameters:
      dataType - an entity data type, such as from GeyserEntityDataTypes
      value - the new property value
    • updateProperty

      default <T> void updateProperty(GeyserEntityProperty<T> property, @Nullable T value)
      Updates an entity property with a new value. If the new value is null, the property is reset to the default value.
      Type Parameters:
      T - the type of the value
      Parameters:
      property - a GeyserEntityProperty registered for this type in the GeyserDefineEntityPropertiesEvent
      value - the new property value
      Since:
      2.9.0
    • updatePropertiesBatched

      @Deprecated default void updatePropertiesBatched(Consumer<BatchPropertyUpdater> consumer)
    • updatePropertiesBatched

      void updatePropertiesBatched(Consumer<BatchPropertyUpdater> consumer, boolean immediate)
      Updates multiple properties with just one update packet, which can be sent immediately to the client. Usually, sending updates immediately is not required except for specific situations where packet batching would result in update order issues.
      Parameters:
      consumer - a batch updater
      immediate - whether this update should be sent immediately
      Since:
      2.9.1
      See Also: