/** * Sends a teleport. * * @param position The new position. * @param rotation The new rotation. */ public void sendTeleport(Position position, Rotation rotation) { session.getPlayer().teleportPosition = position.toBlockPos(); PacketBuilder bldr = new PacketBuilder(PersistingPacketManager.getPacketManager().getOutgoingPacket(8)); bldr.putByte("id", -1); bldr.putShort("x", position.getX()); bldr.putShort("y", position.getY()); bldr.putShort("z", position.getZ()); bldr.putByte("rotation", rotation.getRotation()); bldr.putByte("look", rotation.getLook()); session.send(bldr.toPacket()); session.getPlayer().teleporting = true; }