Skip to content

Client

Methods related to the client.

INFO

See also: entity for entity-specific methods and world for world data.

addEnemy

Adds the specified player to the enemy list.

java
client.addEnemy(String username);

addFriend

Adds the specified player to the friend list.

java
client.addFriend(String username);

allowEditing

Returns true if the player may edit blocks.

java
boolean allowEditing = client.allowEditing();

allowFlying

Returns true if the player has the ability to fly.

java
boolean allowFlying = client.allowFlying();

attack

Performs an attack on the specified Entity.

java
client.attack(Entity entity);

async

Runs the provided task on a cached background thread.

java
client.async(() -> {
    // background work
});

canSeeEntity

Returns true if the player has line of sight to the entity.

java
boolean visible = client.canSeeEntity(Entity entity);

chat

Sends a chat message as the local player.

java
client.chat(String message);

closeScreen

Closes the currently open GUI.

java
client.closeScreen();

dropItem

Drops the currently held item. Set stack to true to drop the entire stack.

java
client.dropItem(boolean stack);

getDirection

Returns the movement direction string calculated by the client.

java
String direction = client.getDirection();

getDisplaySize

Returns [width, height, scaleFactor] for the scaled window.

java
int[] display = client.getDisplaySize();

getForward

Returns the forward movement input value.

java
float forward = client.getForward();

getFPS

Returns the current frames per second.

java
int fps = client.getFPS();

getFreeMemory

Returns the amount of free JVM memory in bytes.

java
long freeMemory = client.getFreeMemory();

getMaxMemory

Returns the maximum JVM memory allocation in bytes.

java
long maxMemory = client.getMaxMemory();

getMotion

Returns the local player's motion vector as a Vec3.

java
Vec3 motion = client.getMotion();

getPlayer

Returns the local player as an Entity.

java
Entity player = client.getPlayer();

getRenderArmPitch

Returns the render arm pitch angle.

java
float pitch = client.getRenderArmPitch();

getRotations

Returns [yaw, pitch] required to aim at a position.

java
float[] rotations = client.getRotations(Vec3 position);

getRotationsToBlock

Returns [yaw, pitch] needed to aim at a block. Provide a face or omit to use the default face.

java
float[] rotations = client.getRotationsToBlock(Vec3 position, String face);
float[] rotationsDefault = client.getRotationsToBlock(Vec3 position);

getRotationsToEntity

Returns [yaw, pitch] needed to aim at an entity.

java
float[] rotations = client.getRotationsToEntity(Entity entity);

getScreen

Returns the simple class name of the currently open GUI, or an empty string when no GUI is open.

java
String screen = client.getScreen();

getServerDirection

Returns the server-reported movement direction using a PlayerState.

java
String direction = client.getServerDirection(PlayerState state);

getServerIP

Returns the connected server IP, or an empty string in singleplayer.

java
String serverIP = client.getServerIP();

getStrafe

Returns the strafe movement input value.

java
float strafe = client.getStrafe();

getTotalMemory

Returns the total JVM memory in bytes currently allocated.

java
long totalMemory = client.getTotalMemory();

getUID

Returns the Raven user id.

java
int uid = client.getUID();

getUser

Returns the Raven username.

java
String user = client.getUser();

isCreative

Returns true if the player is in creative mode.

java
boolean creative = client.isCreative();

isDiagonal

Returns true if the player is moving diagonally.

java
boolean diagonal = client.isDiagonal();

isEnemy

Returns true if the specified name is on the enemy list.

java
boolean enemy = client.isEnemy(String username);

isFacingDiagonal

Returns true if the player is facing diagonally.

java
boolean facing = client.isFacingDiagonal();

isFlying

Returns true if the player is currently flying.

java
boolean flying = client.isFlying();

isFriend

Returns true if the specified name is on the friend list.

java
boolean friend = client.isFriend(String username);

isJump

Returns true if the jump input is active.

java
boolean jumping = client.isJump();

isMoving

Returns true if either forward or strafe input is active.

java
boolean moving = client.isMoving();

isSingleplayer

Returns true when running in a singleplayer world.

java
boolean singleplayer = client.isSingleplayer();

isSneak

Returns true if the sneak input is active.

java
boolean sneaking = client.isSneak();

jump

Makes the player jump.

java
client.jump();

log

Logs a value to latest.log.

java
client.log(Object value);

multiplyMotion

Multiplies horizontal motion by the supplied factor.

java
client.multiplyMotion(double factor);

ping

Sends a ping request to the server.

java
client.ping();

placeBlock

Attempts to place a block using the specified hit data. Returns true on success.

java
boolean placed = client.placeBlock(Vec3 blockPos, String side, Vec3 hitOffset);

playSound

Plays a sound at the player position.

java
client.playSound(String name, float volume, float pitch);

print

Prints a chat message without the Raven prefix.

java
client.print(Object value);

processPacket

Processes an incoming server packet immediately.

java
client.processPacket(SPacket packet);

raycastBlock

Performs a block raycast and returns [Vec3 blockPos, Vec3 hitOffset, String side], or null if nothing is hit.

java
Object[] hit = client.raycastBlock(double distance);
Object[] hitCustom = client.raycastBlock(double distance, float yaw, float pitch);

raycastEntity

Performs an entity raycast and returns [Entity target, Vec3 hitOffset, double distanceSq], or null if nothing is hit.

java
Object[] result = client.raycastEntity(double distance);
Object[] resultCustom = client.raycastEntity(double distance, float yaw, float pitch);

removeEnemy

Removes the specified name from the enemy list.

java
client.removeEnemy(String username);

removeFriend

Removes the specified name from the friend list.

java
client.removeFriend(String username);

removePotionEffect

Removes the specified potion effect from the player.

java
client.removePotionEffect(int potionId);

runCommand

Runs a Raven client command.

java
boolean success = client.runCommand(String command);

sendPacket

Sends a client packet and posts events.

java
client.sendPacket(CPacket packet);

sendPacketNoEvent

Sends a client packet without triggering events.

java
client.sendPacketNoEvent(CPacket packet);

setFlying

Enables or disables flying for the player.

java
client.setFlying(boolean flying);

setForward

Sets the forward movement input value, only works onPostPlayerInput.

java
client.setForward(float value);

setJump

Sets the jump input state, only works onPostPlayerInput.

java
client.setJump(boolean jumping);

setMotion

Sets the player motion using a vector or explicit components.

java
client.setMotion(Vec3 motion);
client.setMotion(double x, double y, double z);

setRenderArmPitch

Sets the render arm pitch.

java
client.setRenderArmPitch(float pitch);

setSneak

Sets the sneak input state, only works onPostPlayerInput.

java
client.setSneak(boolean sneaking);

setSpeed

Sets the horizontal speed value used by movement utilities.

java
client.setSpeed(double speed);

setSpeedForward

Sets the forward speed value used by movement utilities.

java
client.setSpeedForward(double speed);

setSprinting

Sets the sprinting state.

java
client.setSprinting(boolean sprinting);

setStrafe

Sets the strafe movement input value, only works onPostPlayerInput.

java
client.setStrafe(float value);

setTimer

Adjusts the client timer speed.

java
client.setTimer(double timer);

sleep

Sleeps the current thread for the specified milliseconds. Returns true if uninterrupted.

java
boolean ok = client.sleep(long milliseconds);

swing

Swings the held item.

java
client.swing();

swingReset

Swings the held item and resets the equipped animation.

java
client.swingReset();

time

Returns the current system time in milliseconds. Use in place of System.currentTimeMillis().

java
long ms = client.time();

timeTag

Returns truncated millisecond timestamp for lightweight debugging.

java
int tag = client.timeTag();