use of minechem.tileentity.multiblock.MultiBlockTileEntity in project Minechem by iopleke.
the class BlueprintProjectorTileEntity method projectBlueprint.
private void projectBlueprint() {
int facing = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
ForgeDirection direction = MinechemUtil.getDirectionFromFacing(facing);
LocalPosition position = new LocalPosition(xCoord, yCoord, zCoord, direction);
position.moveForwards(blueprint.zSize + 1);
position.moveLeft(Math.floor(blueprint.xSize / 2));
boolean shouldProjectGhostBlocks = true;
int totalIncorrectCount = blueprint.getTotalSize();
for (int x = 0; x < blueprint.xSize; x++) {
int verticalIncorrectCount = blueprint.getVerticalSliceSize();
for (int y = 0; y < blueprint.ySize; y++) {
for (int z = 0; z < blueprint.zSize; z++) {
if (shouldProjectGhostBlocks) {
MultiBlockStatusEnum multiBlockStatusEnum;
if (isManagerBlock(x, y, z)) {
multiBlockStatusEnum = MultiBlockStatusEnum.CORRECT;
} else {
multiBlockStatusEnum = projectGhostBlock(x, y, z, position);
}
if (multiBlockStatusEnum == MultiBlockStatusEnum.CORRECT) {
verticalIncorrectCount--;
totalIncorrectCount--;
}
} else {
destroyGhostBlock(x, y, z, position);
}
}
}
if (verticalIncorrectCount != 0) {
shouldProjectGhostBlocks = false;
}
}
if (totalIncorrectCount == 0 && (!isComplete || !(worldObj.getTileEntity(blueprint.getManagerPosX(), blueprint.getManagerPosY(), blueprint.getManagerPosZ()) instanceof MultiBlockTileEntity))) {
isComplete = true;
buildStructure(position);
}
}
Aggregations