Solved Making a hollow cube with holes in faces

Discussion in 'Spigot Plugin Development' started by Puyodead1, Feb 19, 2020.

  1. Hello, I'm looking for some help generating a cube outline with the spigot api:
    [​IMG]
    I can make a regular hollow cube but I cant figure out how to make the faces open.

    My current code that I tried:
    Code (Text):

    for (int x = 0; x < 5; x++) {
        for (int y = 0; y < 5; y++) {
            for (int z = 0; z <= 5; z++) {
                if (x == 0 || y == 0 || z == 0 || x == 4 || y == 4 || z == 4) {
                    Location bl = new Location(center.getWorld(), center.getX() + x, center.getY() + y, center.getZ() + z);
                    bl.getBlock().setType(Material.BEDROCK);
                }
            }
        }
    }

     
     
  2. What’s the current output?
     
  3. Only fill if either an x, y, or z value is 0 or max (I think)
     
  4. currently its a hollow cube but the faces are filled in


    I'll try it but isnt that how you make a solid hollow cube?
     
  5. Oh, might be. Probably need to check that 2 values are 0 or max.
     
  6. Yep, thank you!

    Code (Text):

    if ((x == 0 || x == 4) && (y == 0 || y == 4) || (x == 0 || x == 4) && (z == 0 || z == 4) || (y == 0 || y == 4) && (z == 0 || z == 4)) {
        bl.setType(Material.BEDROCK);
    }

     
     
    • Like Like x 1
  7. Glad that worked. I suggest making a boolean method that can take in your numbers and return true if at least 2 are 0 or max just so you can scale your work easily. Good luck with your project!