fixed valid check

This commit is contained in:
Niklas 2020-06-28 01:42:28 +02:00
parent d7f1759502
commit 8bbcc2ae44

View File

@ -18,16 +18,16 @@ public class MultiblockStructure {
} }
public BlockComponent getComponent(int x, int y, int z){ public BlockComponent getComponent(int x, int y, int z){
return structure.get(x).get(y).get(z); return structure.get(y).get(z).get(x);
} }
public boolean isValid(Location location, BlockVector offset){ public boolean isValid(Location location, BlockVector offset){
for (int x = 0; x < structure.size(); x++) { for (int y = 0; y < structure.size(); y++) {
for (int y = 0; y < structure.get(x).size(); y++) { for (int z = 0; z < structure.get(y).size(); z++) {
for (int z = 0; z < structure.get(x).get(y).size(); z++) { for (int x = 0; x < structure.get(y).get(z).size() ; x++) {
BlockComponent currentComponent = getComponent(x,y,z); BlockComponent currentComponent = getComponent(x,y,z);
Location globalBlockLocation = location.clone().subtract(offset); Location globalBlockLocation = location.clone().subtract(offset).add(new BlockVector(x,y,z));
if(!currentComponent.isValidBlock(globalBlockLocation)){ if(!currentComponent.isValidBlock(globalBlockLocation)){
return false; return false;