NetworkUtil
The NetworkUtil class provides various methods to facilitate interaction with Minecraft's networking features.
Method summary
NetworkUtil.movePlayerGround(onGround: boolean, horizontalCollision: boolean): void
Sends a ServerboundMovePlayerPacket.StatusOnly packet.
List of parameters:
- onGround, whether the player is on the ground.
- horizontalCollision, whether the player collides horizontally.
NetworkUtil.movePlayerPosition(x: double, y: double, z: double, onGround: boolean, horizontalCollision: boolean): void
Sends a ServerboundMovePlayerPacket.Pos packet.
List of parameters:
- x, x position to move to.
- y, y position to move to.
- z, z position to move to.
- onGround, whether the player is on the ground.
- horizontalCollision, whether the player collides horizontally.
NetworkUtil.movePlayerPositionAndLook(x: double, y: double, z: double, yaw: float, pitch: float, onGround: boolean, horizontalCollision: boolean): void
Sends a ServerboundMovePlayerPacket.PosRot packet.
List of parameters:
- x, x position to move to.
- y, y position to move to.
- z, z position to move to.
- yaw, yaw of the player's head.
- pitch, pitch of the player's head.
- onGround, whether the player is on the ground.
- horizontalCollision, whether the player collides horizontally.
NetworkUtil.movePlayerLook(yaw: float, pitch: float, onGround: boolean, horizontalCollision: boolean): void
Sends a ServerboundMovePlayerPacket.Rot packet.
List of parameters:
- yaw, yaw of the player's head.
- pitch, pitch of the player's head.
- onGround, whether the player is on the ground.
- horizontalCollision, whether the player collides horizontally.
NetworkUtil.sendChatMessage(message: string): void
Sends a chat message to the server.
List of parameters:
- message, the message to send.
NetworkUtil.sendCommand(command: string): void
Executes a server command.
List of parameters:
- command, the command to execute, without the leading slash.
Last updated: 2026-11-11, based on source code