Class Camera
- java.lang.Object
-
- net.eternalclient.api.wrappers.camera.Camera
-
public class Camera extends java.lang.Object
A class that provides methods to control and manipulate the game camera.
-
-
Constructor Summary
Constructors Constructor Description Camera()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
getAngle()
Returns the angle of the camera in degrees, calculated based on the camera yaw.static int
getAngleTo(Entity entity)
Calculates the angle between the player's camera and a given entity.static int
getCameraPitch()
Returns the pitch of the camera.static int
getCameraX()
Returns the x-coordinate of the camera in the game window.static int
getCameraY()
Returns the y-coordinate of the camera position in the game world.static int
getCameraYaw()
Retrieves the current yaw angle of the in-game camera.static int
getCameraZ()
Retrieves the camera Z coordinate.static int
getDiff(int currAngle, int angle)
Calculates the difference between two angles, taking into account the possibility of overflow.static int
getZoom()
Returns the current zoom level of the camera.static int
normalizeAngle(int angle)
Normalizes an angle to be within the range of 0 to 359 degrees.static boolean
turnAngleTo(Entity entity)
Turns the camera to face the given entity by adjusting the angle accordingly, and returns a boolean value indicating whether the camera angle event was successfully executed.static boolean
turnPitchTo(Entity entity)
Turns the pitch of the camera towards the given entity.static boolean
turnTo(Entity entity)
Rotates the camera to face the specified entity asynchronously.
-
-
-
Method Detail
-
getCameraX
public static int getCameraX()
Returns the x-coordinate of the camera in the game window.- Returns:
- the x-coordinate of the camera
-
getCameraY
public static int getCameraY()
Returns the y-coordinate of the camera position in the game world.- Returns:
- the camera's y-coordinate
-
getCameraZ
public static int getCameraZ()
Retrieves the camera Z coordinate.- Returns:
- the camera Z coordinate as an integer value.
-
getCameraPitch
public static int getCameraPitch()
Returns the pitch of the camera.- Returns:
- an integer representing the pitch of the camera
-
getCameraYaw
public static int getCameraYaw()
Retrieves the current yaw angle of the in-game camera.- Returns:
- the yaw angle of the camera in degrees.
-
getZoom
public static int getZoom()
Returns the current zoom level of the camera.- Returns:
- the zoom level of the camera as an integer value.
-
getAngle
public static int getAngle()
Returns the angle of the camera in degrees, calculated based on the camera yaw. The camera yaw is divided by 5.68 and the absolute value of the result is subtracted from 360.- Returns:
- the angle of the camera in degrees
-
getAngleTo
public static int getAngleTo(Entity entity)
Calculates the angle between the player's camera and a given entity.- Parameters:
entity
- the entity to calculate the angle to- Returns:
- the angle in degrees
-
normalizeAngle
public static int normalizeAngle(int angle)
Normalizes an angle to be within the range of 0 to 359 degrees.- Parameters:
angle
- the angle to be normalized- Returns:
- the normalized angle
-
getDiff
public static int getDiff(int currAngle, int angle)
Calculates the difference between two angles, taking into account the possibility of overflow.- Parameters:
currAngle
- the current angle in degreesangle
- the target angle in degrees- Returns:
- the normalized difference between the current angle and the target angle
-
turnTo
public static boolean turnTo(Entity entity)
Rotates the camera to face the specified entity asynchronously.- Parameters:
entity
- the entity to turn the camera towards- Returns:
- true if the camera successfully turns towards the entity, false otherwise
-
turnAngleTo
public static boolean turnAngleTo(Entity entity)
Turns the camera to face the given entity by adjusting the angle accordingly, and returns a boolean value indicating whether the camera angle event was successfully executed.- Parameters:
entity
- the entity to turn the camera towards- Returns:
- true if the camera angle event was executed successfully, false otherwise
-
turnPitchTo
public static boolean turnPitchTo(Entity entity)
Turns the pitch of the camera towards the given entity. The pitch is calculated based on the distance from the entity. The calculated pitch is then transformed into a value between 0 and 255 and used to create a CameraPitchEvent. Returns true if the CameraPitchEvent is successfully executed.- Parameters:
entity
- the entity to turn the camera towards- Returns:
- true if the camera pitch is successfully turned towards the entity
-
-