Interface CameraData
public interface CameraData
This interface holds all the methods that relate to a client's camera.
Can be accessed through
GeyserConnection.camera().-
Method Summary
Modifier and TypeMethodDescriptionvoidStops all sent camera instructions (fades, movements, and perspective locks).Returns an immutable copy of all fog affects currently applied to this client.voidforceCameraPerspective(CameraPerspective perspective) Forces aCameraPerspectiveon the client.@Nullable CameraPerspectiveGets the client's currentCameraPerspective, if one is currently forced.Returns the currently hiddenGuiElements.voidhideElement(GuiElement... element) Hides aGuiElementon the client's side.booleanReturns whether the client's camera is locked.booleanisHudElementHidden(GuiElement element) Determines whether aGuiElementis currently hidden.booleanlockCamera(boolean lock, UUID owner) (Un)locks the client's camera, so that they cannot look around.voidRemoves the given fog IDs from the fog cache, then sends all fog IDs in the cache to the client.voidresetElement(GuiElement @Nullable ... element) Resets aGuiElementon the client's side.voidsendCameraFade(CameraFade fade) Sends a camera fade instruction to the client.voidsendCameraPosition(CameraPosition position) Sends a camera position instruction to the client.voidAdds the given fog IDs to the fog cache, then sends all fog IDs in the cache to the client.voidshakeCamera(float intensity, float duration, CameraShake type) Shakes the client's camera.voidStops all camera shakes of any type.
-
Method Details
-
sendCameraFade
Sends a camera fade instruction to the client. If an existing camera fade is already in progress, the current fade will be prolonged. Can be built usingCameraFade.Builder. To stop a fade early, useclearCameraInstructions().- Parameters:
fade- the camera fade instruction to send
-
sendCameraPosition
Sends a camera position instruction to the client. If an existing camera movement is already in progress, the final camera position will be the one of the latest instruction, and the (optional) camera fade will be added on top of the existing fade. Can be built usingCameraPosition.Builder. To stop reset the camera position/stop ongoing instructions, useclearCameraInstructions().- Parameters:
position- the camera position instruction to send
-
clearCameraInstructions
void clearCameraInstructions()Stops all sent camera instructions (fades, movements, and perspective locks). This will not stop any camera shakes/input locks/fog effects, use the respective methods for those. -
forceCameraPerspective
Forces aCameraPerspectiveon the client. This will prevent the client from changing their camera perspective until it is unlocked viaclearCameraInstructions().Note: You cannot force a client into a free camera perspective with this method. To do that, send a
CameraPositionviasendCameraPosition(CameraPosition)- it requires a set position instead of being relative to the player.- Parameters:
perspective- theCameraPerspectiveto force
-
forcedCameraPerspective
@Nullable CameraPerspective forcedCameraPerspective()Gets the client's currentCameraPerspective, if one is currently forced. This will returnnullif the client is not currently forced into a perspective. If a perspective is forced, the client will not be able to change their camera perspective until it is unlocked.- Returns:
- the forced perspective, or
nullif none is forced
-
shakeCamera
Shakes the client's camera.If the camera is already shaking with the same
CameraShaketype, then the additional intensity will be layered on top of the existing intensity, with their own distinct durations.
If the existing shake type is different and the new intensity/duration are not positive, the existing shake only switches to the new type. Otherwise, the existing shake is completely overridden.- Parameters:
intensity- the intensity of the shake. The client has a maximum total intensity of 4.duration- the time in seconds that the shake will occur fortype- the type of shake
-
stopCameraShake
void stopCameraShake()Stops all camera shakes of any type. -
sendFog
Adds the given fog IDs to the fog cache, then sends all fog IDs in the cache to the client.Fog IDs can be found here
- Parameters:
fogNameSpaces- the fog IDs to add. If empty, the existing cached IDs will still be sent.
-
removeFog
Removes the given fog IDs from the fog cache, then sends all fog IDs in the cache to the client.- Parameters:
fogNameSpaces- the fog IDs to remove. If empty, all fog IDs will be removed.
-
fogEffects
Returns an immutable copy of all fog affects currently applied to this client. -
lockCamera
(Un)locks the client's camera, so that they cannot look around. To ensure the camera is only unlocked when all locks are released, you must supply a UUID when using method, and use the same UUID to unlock the camera.- Parameters:
lock- whether to lock the cameraowner- the owner of the lock, represented with a UUID- Returns:
- if the camera is locked after this method call
-
isCameraLocked
boolean isCameraLocked()Returns whether the client's camera is locked.- Returns:
- whether the camera is currently locked
-
hideElement
Hides aGuiElementon the client's side.- Parameters:
element- theGuiElementto hide
-
resetElement
Resets aGuiElementon the client's side. This makes the client decide on its own - e.g. based on client settings - whether to show or hide the gui element.If no elements are specified, this will reset all currently hidden elements
- Parameters:
element- theGuiElementto reset
-
isHudElementHidden
Determines whether aGuiElementis currently hidden.- Parameters:
element- theGuiElementto check
-