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.
Collects property changes to be applied as a single, batched update to an entity.
Notes:
- Passing
nullas 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 TypeMethodDescription<T> voidupdate(@NonNull GeyserEntityProperty<T> property, @Nullable T value) Queues an update for the given property within the current batch.
-
Method Details
-
update
Queues an update for the given property within the current batch.If
valueisnull, the property will be reset to its default value as declared when the property was registered during theGeyserDefineEntityPropertiesEvent.- Type Parameters:
T- the property's value type- Parameters:
property- aGeyserEntityPropertyregistered for the target entity typevalue- the new value, ornullto reset to the default- Since:
- 2.9.0
-