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 Details

    • sendCameraFade

      void sendCameraFade(@NonNull CameraFade fade)
      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 using CameraFade.Builder. To stop a fade early, use clearCameraInstructions().
      Parameters:
      fade - the camera fade instruction to send
    • sendCameraPosition

      void sendCameraPosition(@NonNull CameraPosition position)
      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 using CameraPosition.Builder. To stop reset the camera position/stop ongoing instructions, use clearCameraInstructions().
      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

      void forceCameraPerspective(@NonNull CameraPerspective perspective)
      Forces a CameraPerspective on the client. This will prevent the client from changing their camera perspective until it is unlocked via clearCameraInstructions().

      Note: You cannot force a client into a free camera perspective with this method. To do that, send a CameraPosition via sendCameraPosition(CameraPosition) - it requires a set position instead of being relative to the player.

      Parameters:
      perspective - the CameraPerspective to force
    • forcedCameraPerspective

      @Nullable CameraPerspective forcedCameraPerspective()
      Gets the client's current CameraPerspective, if one is currently forced. This will return null if 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 null if none is forced
    • shakeCamera

      void shakeCamera(float intensity, float duration, @NonNull CameraShake type)
      Shakes the client's camera.

      If the camera is already shaking with the same CameraShake type, 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 for
      type - the type of shake
    • stopCameraShake

      void stopCameraShake()
      Stops all camera shakes of any type.
    • sendFog

      void sendFog(String... fogNameSpaces)
      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

      void removeFog(String... fogNameSpaces)
      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

      @NonNull Set<String> fogEffects()
      Returns an immutable copy of all fog affects currently applied to this client.
    • lockCamera

      boolean lockCamera(boolean lock, @NonNull UUID owner)
      (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 camera
      owner - 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