private static void initTransparentBlocks() {
   transparentBlocks.add(((Integer) Material.AIR.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.BREWING_STAND.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.BROWN_MUSHROOM.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.CAKE.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.CROPS.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.DETECTOR_RAIL.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.DIODE_BLOCK_ON.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.DIODE_BLOCK_OFF.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.LADDER.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.LAVA.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.LEVER.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.LONG_GRASS.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.MELON_STEM.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.NETHER_STALK.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.PAINTING.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.PORTAL.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.POWERED_RAIL.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.PUMPKIN_STEM.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.RAILS.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.RED_MUSHROOM.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.RED_ROSE.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.REDSTONE_TORCH_ON.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.REDSTONE_TORCH_OFF.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.REDSTONE_WIRE.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.SAPLING.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.SIGN_POST.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.SNOW.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.TORCH.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.VINE.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.WALL_SIGN.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.WATER.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.YELLOW_FLOWER.getId()).byteValue());
 }
 public PlayerManager() {
   nonSolid.add(0);
   for (int b = 8; b < 12; b++) nonSolid.add(b);
   nonSolid.add(Material.SNOW.getId());
   nonSolid.add(Material.LONG_GRASS.getId());
   nonSolid.add(Material.RED_MUSHROOM.getId());
   nonSolid.add(Material.RED_ROSE.getId());
   nonSolid.add(Material.YELLOW_FLOWER.getId());
   nonSolid.add(Material.BROWN_MUSHROOM.getId());
   nonSolid.add(Material.SIGN_POST.getId());
   nonSolid.add(Material.WALL_SIGN.getId());
   nonSolid.add(Material.FIRE.getId());
   nonSolid.add(Material.TORCH.getId());
   nonSolid.add(Material.REDSTONE_WIRE.getId());
   nonSolid.add(Material.REDSTONE_TORCH_OFF.getId());
   nonSolid.add(Material.REDSTONE_TORCH_ON.getId());
   nonSolid.add(Material.VINE.getId());
 }
 @Override
 public void execute(SyncBlockList aSyncList) {
   fMaze.build();
   initializeArea();
   if (!ceilingInTopLevel) {
     for (int x = 0; x < fMaze.width; x++) {
       for (int z = 0; z < fMaze.depth; z++) {
         Maze.Cell lCell = fMaze.get(x, fMaze.height - 1, z);
         lCell.links[Maze.DirectionTop].broken = true;
       }
     }
   }
   for (Passage lPas : passages) {
     Maze.Cell lCell = null;
     if (lPas.mazePos.x >= 0) {
       lCell = fMaze.get(lPas.mazePos.x, lPas.mazePos.y, lPas.mazePos.z);
     } else {
       int x = (lPas.pos.x - (borderThickness + wallThickness)) / (corridorWidth + wallThickness);
       int y =
           (lPas.pos.y - (borderThickness + ceilingThickness))
               / (corridorHeight + ceilingThickness);
       int z = (lPas.pos.z - (borderThickness + wallThickness)) / (corridorWidth + wallThickness);
       if (x < 0) x = 0;
       if (x > fMaze.width) x = fMaze.width - 1;
       if (y < 0) y = 0;
       if (y > fMaze.height) y = fMaze.height - 1;
       if (z < 0) z = 0;
       if (z > fMaze.depth) z = fMaze.depth - 1;
       lCell = fMaze.get(x, y, z);
     }
     if (lPas.up) lCell.links[Maze.DirectionTop].broken = true;
     if (lPas.down) lCell.links[Maze.DirectionBottom].broken = true;
     if (lPas.left) lCell.links[Maze.DirectionLeft].broken = true;
     if (lPas.right) lCell.links[Maze.DirectionRight].broken = true;
     if (lPas.forward) lCell.links[Maze.DirectionForward].broken = true;
     if (lPas.backward) lCell.links[Maze.DirectionBackward].broken = true;
   }
   for (int x = 0; x < fMaze.width; x++) {
     for (int y = 0; y < fMaze.height; y++) {
       for (int z = 0; z < fMaze.depth; z++) {
         Maze.Cell lCell = fMaze.get(x, y, z);
         setCellEmpty(x, y, z);
         for (int d = 0; d < 6; d++) {
           if (lCell.links[d].broken) {
             breakWall(x, y, z, d);
           }
         }
       }
     }
   }
   if (placeTorches) {
     Random lRnd = new Random();
     for (int x = 0; x < fMaze.width; x++) {
       for (int y = 0; y < fMaze.height; y++) {
         for (int z = 0; z < fMaze.depth; z++) {
           Maze.Cell lCell = fMaze.get(x, y, z);
           if (!lCell.links[Maze.DirectionBottom].broken) {
             if (lRnd.nextInt(100) < chanceForTorches) {
               BlockAreaItem lItem = area.get(getX(x), getY(y), getZ(z));
               lItem.id = Material.TORCH.getId();
               lItem.data = (byte) 5;
             }
           }
         }
       }
     }
   }
   if (placeLadders && fMaze.height > 1) {
     for (int x = 0; x < fMaze.width; x++) {
       for (int y = 0; y < (fMaze.height - 1); y++) {
         for (int z = 0; z < fMaze.depth; z++) {
           Maze.Cell lCell = fMaze.get(x, y, z);
           if (lCell.links[Maze.DirectionTop].broken) {
             Maze.Cell lCellTop = fMaze.get(x, y + 1, z);
             for (int d = 2; d < 6; d++) {
               if (!lCell.links[d].broken && !lCellTop.links[d].broken) {
                 int lcx = 0;
                 int lcz = 0;
                 if (fMaze.getDeltaX(d) > 0) {
                   lcx = corridorWidth - 1;
                 }
                 if (fMaze.getDeltaZ(d) > 0) {
                   lcz = corridorWidth - 1;
                 }
                 for (int ldy = 0; ldy < (corridorHeight * 2 + ceilingThickness); ldy++) {
                   BlockAreaItem lItem = area.get(getX(x) + lcx, getY(y) + ldy, getZ(z) + lcz);
                   lItem.id = Material.LADDER.getId();
                   lItem.data = (byte) fMazeToLadderDirs[d];
                 }
                 break;
               }
             }
           }
         }
       }
     }
   }
   if (placeChests) {
     Random lRnd = new Random();
     for (int x = 0; x < fMaze.width; x++) {
       for (int y = 0; y < fMaze.height; y++) {
         for (int z = 0; z < fMaze.depth; z++) {
           Maze.Cell lCell = fMaze.get(x, y, z);
           if (!lCell.links[Maze.DirectionTop].broken
               && !lCell.links[Maze.DirectionBottom].broken) {
             int lBCount = 0;
             int lFDir = 0;
             for (int d = 2; d < 6; d++) {
               if (lCell.links[d].broken) {
                 lBCount++;
               } else {
                 lFDir = d;
               }
             }
             if (lBCount < 2 && lRnd.nextInt(100) < chanceForChests) {
               BlockAreaItem lItem = area.get(getX(x), getY(y), getZ(z));
               lItem.id = Material.CHEST.getId();
               lItem.data = (byte) fMazeToLadderDirs[lFDir];
               lItem.itemStacks = chestItems.getNext(y);
               /*lItem.itemStacks = new ItemStack[1];
               lItem.itemStacks[0] = new ItemStack(Material.GOLD_BLOCK, 1, (short)0, (byte)0);*/
             }
           }
         }
       }
     }
   }
   if (placeWoodenDoors) {
     Random lRnd = new Random();
     for (int x = 0; x < fMaze.width; x++) {
       for (int y = 0; y < fMaze.height; y++) {
         for (int z = 0; z < fMaze.depth; z++) {
           Maze.Cell lCell = fMaze.get(x, y, z);
           if (!lCell.links[Maze.DirectionTop].broken
               && !lCell.links[Maze.DirectionBottom].broken) {
             for (int d = 2; d < 6; d++) {
               if (lCell.links[d].broken && lRnd.nextInt(100) < chanceForWoodenDoors) {
                 int lcx = fMaze.getDeltaX(d) > 0 ? corridorWidth : 0;
                 int lcz = fMaze.getDeltaZ(d) > 0 ? corridorWidth : 0;
                 int xx = getX(x);
                 int yy = getY(y);
                 int zz = getZ(z);
                 int lfx = fMaze.getDeltaZ(d) > 0 ? 1 : 0;
                 int lfz = fMaze.getDeltaX(d) > 0 ? 1 : 0;
                 for (int ld = 0; ld < corridorWidth; ld++) {
                   for (int ly = 0; ly < corridorHeight; ly++) {
                     if (ld > 0 || ly > 1) {
                       BlockAreaItem lItem =
                           area.get(xx + lcx + lfx * ld, yy + ly, zz + lcz + lfz * ld);
                       Mat lMat = wallMaterials.getNext(y);
                       lItem.id = lMat.material.getId();
                       lItem.data = lMat.data;
                     } else {
                       BlockAreaItem lItem =
                           area.get(xx + lcx + lfx * ld, yy + ly, zz + lcz + lfz * ld);
                       lItem.id = Material.WOODEN_DOOR.getId();
                       lItem.data = (byte) (ly > 0 ? 8 : 0);
                     }
                   }
                 }
                 break;
               }
             }
           }
         }
       }
     }
   }
   if (placeEntities) {
     Random lRnd = new Random();
     for (int x = 0; x < fMaze.width; x++) {
       for (int y = 0; y < fMaze.height; y++) {
         for (int z = 0; z < fMaze.depth; z++) {
           for (EntityItem lItem : entities) {
             if (lRnd.nextInt(100) < lItem.chance) {
               BlockPosition lPos = new BlockPosition(getX(x), getY(y), getZ(z));
               int lCount = lItem.amount;
               if (lCount < lItem.maxAmount) {
                 lCount += lRnd.nextInt(lItem.maxAmount - lCount + 1);
               }
               for (int i = 0; i < lCount; i++) {
                 BlockAreaEntity lEntity = area.newEntity();
                 lEntity.type = lItem.type;
                 lEntity.location = lPos;
               }
             }
           }
         }
       }
     }
   }
   /* Statistics
   int fStats[] = new int[6]; fStats[0]=fStats[1]=fStats[2]=fStats[3]=fStats[4]=fStats[5]=0;
   for(int x=0; x<fMaze.width; x++) {
       for(int y=0; y<fMaze.height; y++) {
           for(int z=0; z<fMaze.depth; z++) {
               Maze.Cell lCell = fMaze.get(x, y, z);
               for(int d=0; d<6;d++) {
                   if (lCell.links[d].broken) {
                       fStats[d]++;
                   }
               }
           }
       }
   }
   quest.log("0=" + fStats[0] + " 1=" + fStats[1] + " 2=" + fStats[2] + " 3=" + fStats[3] + " 4=" + fStats[4] + " 5=" + fStats[5]);
   */
   area.toList(aSyncList, from, blockPlaceMode);
 }