public void hitScreenClient(double hitX, double hitY, double hitZ, int side) { float factor = large ? 2.0f : 1.0f; float dx = 0; float dy = (float) ((-hitY + 1.0) / factor); switch (side) { case 2: dx = (float) ((1.0 - hitX) / factor); break; case 3: dx = (float) (hitX / factor); break; case 4: dx = (float) (hitZ / factor); break; case 5: dx = (float) ((1.0 - hitZ) / factor); break; } int x = (int) (dx * 128); int y = (int) (dy * 128); int currenty = 7; int moduleIndex = 0; List<ClientScreenModule> clientScreenModules = getClientScreenModules(); for (ClientScreenModule module : clientScreenModules) { if (module != null) { int height = module.getHeight(); // Check if this module has enough room if (currenty + height <= 124) { if (currenty <= y && y < (currenty + height)) { break; } currenty += height; } } moduleIndex++; } if (moduleIndex >= clientScreenModules.size()) { return; } clientScreenModules.get(moduleIndex).mouseClick(worldObj, x, y - currenty, true); clickedModules.add(new ActivatedModule(moduleIndex, 5, x, y)); PacketHandler.INSTANCE.sendToServer( new PacketServerCommand( xCoord, yCoord, zCoord, CMD_CLICK, new Argument("x", x), new Argument("y", y - currenty), new Argument("module", moduleIndex))); }