# Getting the outline of a chunk?

Discussion in 'Plugin Development' started by belven000, Aug 14, 2014.

Not open for further replies.
1. Offline

### belven000

Hi,
My maths skills within the 3D world are a little poor. Curently I have this:

Code:java
` private void showClaims(Player p) {        if (isInATeam(p)) {            Team t = getTeam(p);            int y = (int) p.getLocation().getY();             for (Chunk c : t.ownedChunks) {                 for (int x = 0; x < 15; x++) {                    for (int z = 0; z < 15; z++) {                        Block b = c.getBlock(x, y, z);                        p.sendBlockChange(b.getLocation(),                                Material.REDSTONE_BLOCK, b.getData());                    }                }            }        }    }`

This works fine but it changes ALL the blocks within the region at the players Y axis. I only want to change the blocks around the edge of each chunk.

To my knowledge I would need to change blocks in these co-ords:

x: 0 - 15 while z is 0 = South wall
z: 0 - 15 while x is 0 = West Wall
x: 0 - 15 while z is 15 = North Wall
z: 0 - 15 while x is 15 = East Wall

I'm hoping someone has done this before. Any help would be great

#1
2. Offline

### Jogy34

Just check if either X or Z are equal to 0 or 15

#2
3. Offline

### belven000

Jogy34 it only seems to get the north and west wall:

Code:java
` for (Chunk c : t.ownedChunks) {                for (int x = 0; x < 15; x++) {                    for (int z = 0; z < 15; z++) {                        if (z == 15 || z == 0 || x == 15 || x == 0) {                            Block b = c.getBlock(x, y, z);                            p.sendBlockChange(b.getLocation(),                                    Material.REDSTONE_BLOCK, b.getData());                        }                    }                }            } `

#3
4. Offline

### PureGero

You have
for (int z = 0; z < 15; z++){
This will make z always smaller than 15 so z == 15 will always return false.
Simply change it to:
for (int z = 0; z < 16; z++){
and same for x

#4
5. Offline

### DinosParkour

or z <= 15 and x <= 15

#5
6. Offline

### belven000

PureGero lol, schoolboy error
Thanks mate

#6