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 Summary
Modifier and TypeMethodDescriptionThe Bedrock entity definition for this entity.@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()The passengers riding on this entity.org.cloudburstmc.math.vector.Vector3fposition()The position of this entity, without the Bedrock edition offset defined in the Bedrock entity definition.<T> voidupdate(GeyserEntityDataType<T> dataType, @Nullable T value) Updates an entity property with a new value.default voidupdatePropertiesBatched(Consumer<BatchPropertyUpdater> consumer) Deprecated.voidupdatePropertiesBatched(Consumer<BatchPropertyUpdater> consumer, boolean immediate) Updates multiple properties with just one update packet, which can be sent immediately to the client.default <T> voidupdateProperty(GeyserEntityProperty<T> property, @Nullable T value) Updates an entity property with a new value.@Nullable UUIDuuid()<T> @Nullable Tvalue(GeyserEntityDataType<T> dataType) Queries the current value of a givenGeyserEntityDataType.@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
@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
@Nullable UUID 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
GeyserEntityDefinition definition()The Bedrock entity definition for this entity.- Returns:
- the Bedrock entity definition
- Since:
- 2.11.0
-
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.
- Since:
- 2.11.0
-
vehicle
@Nullable GeyserEntity vehicle()The vehicle this entity is currently mounted on.- Returns:
- the vehicle of this entity or null if missing
- Since:
- 2.11.0
-
passengers
List<GeyserEntity> passengers()The passengers riding on this entity.- Returns:
- the passengers of this entity, or empty if this entity has no passengers
- Since:
- 2.11.0
-
value
Queries the current value of a givenGeyserEntityDataType.- Type Parameters:
T- the type of the value- Parameters:
dataType- the entity data type to query- Returns:
- the current value, or null if not set
- Since:
- 2.11.0
- See Also:
-
update
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 fromGeyserEntityDataTypesvalue- the new property value or null to reset the custom override- Since:
- 2.11.0
-
updateProperty
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- aGeyserEntityPropertyregistered for this type in theGeyserDefineEntityPropertiesEventvalue- the new property value or null- Since:
- 2.9.0
-
updatePropertiesBatched
Deprecated.- useupdateProperty(GeyserEntityProperty, Object)instead -
updatePropertiesBatched
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 updaterimmediate- whether this update should be sent immediately- Since:
- 2.9.1
- See Also:
-
updateProperty(GeyserEntityProperty, Object)instead