Interface BatchPropertyUpdater

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface BatchPropertyUpdater
Collects property changes to be applied as a single, batched update to an entity.

Notes:

  • Passing null as a value resets the property to its default.
  • Numeric properties must be within declared ranges; enum properties must use an allowed value.
  • Multiple updates to the same property within a single batch will result in the last value being applied.
  • The updater is short-lived and should not be retained outside the batching callback.

 entity.updatePropertiesBatched(updater -> {
     updater.update(SOME_FLOAT_PROPERTY, 0.15f);
     updater.update(SOME_BOOLEAN_PROPERTY, true);
     updater.update(SOME_INT_PROPERTY, null); // reset to default
 });
 
Since:
2.9.0
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> void
    update(GeyserEntityProperty<T> property, @Nullable T value)
    Queues an update for the given property within the current batch.
  • Method Details

    • update

      <T> void update(GeyserEntityProperty<T> property, @Nullable T value)
      Queues an update for the given property within the current batch.

      If value is null, the property will be reset to its default value as declared when the property was registered during the GeyserDefineEntityPropertiesEvent.

      Type Parameters:
      T - the property's value type
      Parameters:
      property - a GeyserEntityProperty registered for the target entity type
      value - the new value, or null to reset to the default
      Since:
      2.9.0