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. 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); } } } } }
@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.
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? 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); } } } } }
https://gyazo.com/dd6ee933cb9e91bd47c831553049af80 ? EDIT by Moderator: merged posts, please use the edit button instead of double posting.