-
-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathVRAPI.java
More file actions
62 lines (55 loc) · 2.17 KB
/
VRAPI.java
File metadata and controls
62 lines (55 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package org.vivecraft.api;
import net.minecraft.world.entity.player.Player;
import org.vivecraft.api.data.VRPose;
import org.vivecraft.api.data.VRPoseHistory;
import org.vivecraft.common.api_impl.VRAPIImpl;
import javax.annotation.Nullable;
/**
* The main interface for interacting with Vivecraft from common code.
*
* @since 1.3.0
*/
public interface VRAPI {
/**
* Gets API instance for interacting with Vivecraft's common API
*
* @return The Vivecraft API instance for interacting with Vivecraft's common API.
* @since 1.3.0
*/
static VRAPI instance() {
return VRAPIImpl.INSTANCE;
}
/**
* Check whether a given player is currently in VR.
*
* @param player The player to check the VR status of.
* @return true if the player is in VR.
* @since 1.3.0
*/
boolean isVRPlayer(Player player);
/**
* Returns the VR pose for the given player. Will return {@code null} if the player isn't in VR,
* or if no data for the player has been received yet. The VRPose can still be {@code null} if
* {@link VRAPI#isVRPlayer(Player)} returned true, since those two properties are independent of each other.
*
* @param player Player to get the VR pose of.
* @return The VR pose for a player, or {@code null} if the player isn't in VR or no data has been received for said player.
* @since 1.3.0
*/
@Nullable
VRPose getVRPose(Player player);
/**
* Returns the history of VR poses for the player. If one only needs the history for the local player, this can be
* more conveniently called using {@link org.vivecraft.api.client.VRClientAPI#getHistoricalVRPoses()}.
* <br>
* Note that due to the inherent latency of networking, historical VR data retrieved either by the server or by
* the client for a client other than the local player may be unideal.
*
* @param player Player to get the VR pose history of.
* @return The history of VR poses for the player. Will be {@code null} if the player isn't in VR or if VR-specific data
* hasn't been received.
* @since 1.3.0
*/
@Nullable
VRPoseHistory getHistoricalVRPoses(Player player);
}