# Solved Find Block Diagonal to Given Location

Discussion in 'Plugin Development' started by SmearySubset, Jun 23, 2021.

Not open for further replies.
1. Offline

### SmearySubset

I want to retrieve the block that is behind one block and up one block from a given location. For example, if the location is 0,0,0, I want to get the block at 0,1,1 (Of course, the x or z value can equal -1 or 1 depending on the block face). If I'm not being clear enough, let me know.

Thanks!
SmearySubset

Last edited: Jul 14, 2021
#1
2. Offline

### davidclue

Code:
`location.add(0,1,1);`

#2
3. Offline

### KarimAKL

@davidclue, I think their problem is that the x & z change depending on the block's direction.

@SmearySubset, please elaborate on the problem itself rather than the goal.

#3
4. Offline

### SmearySubset

@davidclue @KarimAKL
Problem: Karim is right, the direction the chest is facing will vary so I need one universal method of finding the block behind and above it.

#4
5. Offline

### KarimAKL

@SmearySubset, I believe this should work:
Now that you have the direction, you can add 1 or -1 to either x or z.

Edit: I mentioned Directional, but you can check for a chest by replacing Directional with Chest (make sure it is org.bukkit.block.data.type.Chest).

#5
6. Offline

### SmearySubset

Thanks, I found a workaround.

#6