Bedrock walls

Discussion in 'Plugin Development' started by hostadam, Sep 2, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    hostadam

    I am trying to make a border plugin that generates bedrock walls. Before you comment. It is for 1.7 so I will not use WorldBorder. Any ideas how to do this?

    I have a working code, it does generate the walls but the walls height is up to Y 256, I want it to be world.getHighestBlockYAt() + 5. So 5 blocks above surface.

    I want it to be like it is on the right side and not the left side.

    [​IMG]

    [​IMG]

    CODE:
    Code:
        public void buildBorderWalls(Material m, int border, World w) {
            Location l = new Location(w, 0, 60, 0);
            for(int x = l.getBlockX() - border; x <= l.getBlockX() + border; x++) {
                for(int z = l.getBlockZ() - border; z <= l.getBlockZ() + border; z++) {
                    for(int y = 0; y < w.getHighestBlockYAt(x, z) + 5; y++) {
                         if ((x == l.getBlockX() - border) || (x == l.getBlockX() + border) || (z == l.getBlockZ() - border) || (z == l.getBlockZ() + border)) {
                             Location location = new Location(w, x, y, z);
                             location.getBlock().setType(m);
                         }
                    }
                }
            }
        }
     
  2. Online

    timtower Administrator Administrator Moderator

    @hostadam Your block is the highest block after you set it, so your wall is increasing the wall.
    To fix: get the highest block before the y loop.
     
  3. Offline

    hostadam

    It worked thanks. But now I ran into another problem. I'm setting the walls to be getHighestBlock + 5, but sometimes it's only 3 blocks high?

    [​IMG]

    Code:
        public void buildBorderWalls(Material m, int border, World w) {
            Location l = new Location(w, 0, w.getHighestBlockYAt(0, 0), 0);
            for(int x = l.getBlockX() - border; x <= l.getBlockX() + border; x++) {
                for(int z = l.getBlockZ() - border; z <= l.getBlockZ() + border; z++) {
                    int topY = w.getHighestBlockYAt(x, z) + 5;
                    for(int y = 0; y < topY; y++) {
                         if ((x == l.getBlockX() - border) || (x == l.getBlockX() + border) || (z == l.getBlockZ() - border) || (z == l.getBlockZ() + border)) {
                             Location location = new Location(w, x, y, z);
                             location.getBlock().setType(m);
                         }
                    }
                }
            }
        }
     
  4. Online

    timtower Administrator Administrator Moderator

  5. Offline

    hostadam

    Last edited by a moderator: Sep 2, 2017
  6. Online

    timtower Administrator Administrator Moderator

    @hostadam Then start debugging, print values, check those values.
     
Thread Status:
Not open for further replies.

Share This Page