diff --git a/src/main/java/org/kapelle/multiblock/MultiblockStructure.java b/src/main/java/org/kapelle/multiblock/MultiblockStructure.java new file mode 100644 index 0000000..3502fb6 --- /dev/null +++ b/src/main/java/org/kapelle/multiblock/MultiblockStructure.java @@ -0,0 +1,37 @@ +package org.kapelle.multiblock; + +import org.bukkit.Location; +import org.bukkit.util.BlockVector; + +import java.util.List; + +public class MultiblockStructure { + + List>> structure; + + public MultiblockStructure(List>> structure){ + this.structure = structure; + } + + private BlockComponent getComponent(int x, int y, int z){ + return structure.get(x).get(y).get(z); + } + + public boolean isValid(Location location, BlockVector offset){ + for (int x = 0; x < structure.size(); x++) { + for (int y = 0; y < structure.get(x).size(); y++) { + for (int z = 0; z < structure.get(x).get(y).size(); z++) { + + BlockComponent currentComponent = getComponent(x,y,z); + Location globalBlockLocation = location.clone().subtract(offset); + + if(!currentComponent.isValidBlock(globalBlockLocation)){ + return false; + } + } + } + } + + return true; + } +}