Class LocationData
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final floatThe pitch (rotation around the horizontal axis) of the entity.private static final longprivate final UUIDThe unique identifier for the entity.private final StringOptional world namespaced key for safer cross-platform/world resolution (Paper/Folia).private final StringFallback world name (legacy Bukkit).private final doubleThe x-coordinate of the entity's position.private final doubleThe y-coordinate of the entity's position.private final floatThe yaw (rotation around the vertical axis) of the entity.private final doubleThe z-coordinate of the entity's position. -
Constructor Summary
ConstructorsConstructorDescriptionLocationData(org.bukkit.Location location) Constructs a new LocationData instance from a given Location. -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.LocationConverts the serialized data back into a Location object.private static org.bukkit.NamespacedKeysafeGetKey(org.bukkit.World world) Safely retrieves the world's namespaced key without hard-crashing on non-Paper servers.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
uuid
The unique identifier for the entity.This
UUIDuniquely identifies the entity within the application. -
worldKey
Optional world namespaced key for safer cross-platform/world resolution (Paper/Folia).This is used as a secondary lookup if the UUID-based lookup fails.
-
worldName
Fallback world name (legacy Bukkit). -
yaw
private final float yawThe yaw (rotation around the vertical axis) of the entity.This
floatvalue represents the yaw of the entity, which controls its horizontal orientation. -
pitch
private final float pitchThe pitch (rotation around the horizontal axis) of the entity.This
floatvalue represents the pitch of the entity, which controls its vertical orientation. -
x
private final double xThe x-coordinate of the entity's position.This
doublevalue represents the entity's location on the x-axis in the world. -
y
private final double yThe y-coordinate of the entity's position.This
doublevalue represents the entity's location on the y-axis in the world. -
z
private final double zThe z-coordinate of the entity's position.This
doublevalue represents the entity's location on the z-axis in the world.
-
-
Constructor Details
-
LocationData
public LocationData(org.bukkit.Location location) Constructs a new LocationData instance from a given Location.- Parameters:
location- The location to serialize.
-
-
Method Details
-
getLocation
public org.bukkit.Location getLocation()Converts the serialized data back into a Location object.On Folia and other Paper-family servers, this attempts resolution by world UUID first, then by namespaced key (if present), and finally by legacy world name. This method only resolves the
Worldreference and constructs aLocation; it does not schedule any thread/region actions. Ensure you use the returnedLocationon the correct region thread.- Returns:
- The deserialized Location, or null if the world cannot be resolved.
-
safeGetKey
private static org.bukkit.NamespacedKey safeGetKey(org.bukkit.World world) Safely retrieves the world's namespaced key without hard-crashing on non-Paper servers.
-