/** * Adds a new player. * * @param packet The packet. * @param otherPlayer The player. */ public void addNewPlayer(PacketBuilder packet, Player otherPlayer) { packet.putBits(11, otherPlayer.getIndex()); int yPos = otherPlayer.getLocation().getY() - player.getLocation().getY(); int xPos = otherPlayer.getLocation().getX() - player.getLocation().getX(); if (xPos < 0) { xPos += 32; } if (yPos < 0) { yPos += 32; } packet.putBits(5, xPos); packet.putBits(1, 1); packet.putBits(3, 1); packet.putBits(1, 1); packet.putBits(5, yPos); }