Interface GeyserEntity
- All Known Subinterfaces:
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 Summary
Modifier and TypeMethodDescriptionThe Bedrock entity definition for this entity, which could also be aCustomEntityDefinition@org.checkerframework.checker.index.qual.Positive longgeyserId()The entity id used by Geyser to identify this entity with the Bedrock client.@org.checkerframework.checker.index.qual.NonNegative intjavaId()<T> @Nullable Toverride(GeyserEntityDataType<T> dataType) Reads the current override of a givenGeyserEntityDataType, or null if no override was defined.<T> voidoverride(GeyserEntityDataType<T> dataType, @Nullable T value) Overrides an entity data value for this entity.The passengers currently riding this entity.org.cloudburstmc.math.vector.Vector3fposition()The position of this entity as reported by the Java server, without any Bedrock vertical offset applied.default voidupdatePropertiesBatched(Consumer<BatchPropertyUpdater> consumer) Deprecated.voidupdatePropertiesBatched(Consumer<BatchPropertyUpdater> consumer, boolean immediate) Updates multiple entity properties with a single update, optionally sending it immediately.default <T> voidupdateProperty(GeyserEntityProperty<T> property, @Nullable T value) Convenience method to update a single entity property.@Nullable UUIDuuid()<T> @Nullable Tvalue(GeyserEntityDataType<T> dataType) Reads the current value of a givenGeyserEntityDataTypewhich would currently be sent to players - either theoverride(GeyserEntityDataType), or the base value, if one is sent by default.@Nullable GeyserEntityvehicle()The vehicle this entity is currently mounted on.
-
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
@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
- 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
The Bedrock entity definition for this entity, which could also be aCustomEntityDefinition- 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
The vehicle this entity is currently mounted on.- Returns:
- the vehicle of this entity, or
nullif this entity is not a passenger - Since:
- 2.11.0
-
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
Reads the current value of a givenGeyserEntityDataTypewhich would currently be sent to players - either theoverride(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
nullif none is known - Since:
- 2.11.0
- See Also:
-
override
Reads the current override of a givenGeyserEntityDataType, 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
nullif no override has been set - Since:
- 2.11.0
- See Also:
-
override
Overrides an entity data value for this entity. Ifvalueisnull, 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 fromGeyserEntityDataTypesvalue- the new value, ornullto reset the override- Since:
- 2.11.0
-
updateProperty
Convenience method to update a single entity property. Equivalent toupdatePropertiesBatchedwith a single-property consumer andimmediate = false.- Type Parameters:
T- the type of the value- Parameters:
property- aGeyserEntityPropertyregistered for this type in theGeyserDefineEntityPropertiesEventvalue- the new property value, ornullto reset- Since:
- 2.9.0
-
updatePropertiesBatched
@Deprecated(since="2.11.0") default void updatePropertiesBatched(Consumer<BatchPropertyUpdater> consumer) Deprecated.useupdateProperty(GeyserEntityProperty, Object)instead- Since:
- 2.9.0
-
updatePropertiesBatched
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 = trueonly 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- aBatchPropertyUpdatercallback that applies one or more property changesimmediate-trueto send the packet immediately rather than at the next tick- Since:
- 2.9.1
- See Also:
-
updateProperty(GeyserEntityProperty, Object)instead