diff --git a/common/buildcraft/core/blueprints/BlueprintBase.java b/common/buildcraft/core/blueprints/BlueprintBase.java index a485249b..16026486 100644 --- a/common/buildcraft/core/blueprints/BlueprintBase.java +++ b/common/buildcraft/core/blueprints/BlueprintBase.java @@ -128,8 +128,8 @@ public abstract class BlueprintBase { Position pos = new Position(sub.getInteger("x"), sub.getInteger("y"), sub.getInteger("z")); Position np = context.rotatePositionLeft(pos); - sub.setInteger("x", (int) pos.x); - sub.setInteger("z", (int) pos.z); + sub.setInteger("x", (int) np.x); + sub.setInteger("z", (int) np.z); sub.setByte("dir", (byte) dir.ordinal()); NBTTagCompound bpt = sub.getCompoundTag("bpt"); diff --git a/common/buildcraft/core/blueprints/RecursiveBlueprintBuilder.java b/common/buildcraft/core/blueprints/RecursiveBlueprintBuilder.java index 839049f2..ccdd1579 100755 --- a/common/buildcraft/core/blueprints/RecursiveBlueprintBuilder.java +++ b/common/buildcraft/core/blueprints/RecursiveBlueprintBuilder.java @@ -10,11 +10,14 @@ package buildcraft.core.blueprints; import java.util.ArrayList; +import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import buildcraft.core.Box; + public class RecursiveBlueprintBuilder { private boolean returnedThis = false; @@ -25,8 +28,10 @@ public class RecursiveBlueprintBuilder { private int x, y, z; private ForgeDirection dir; private World world; + private Box box = new Box(); - public RecursiveBlueprintBuilder(BlueprintBase iBlueprint, World iWorld, int iX, int iY, int iZ, ForgeDirection iDir) { + public RecursiveBlueprintBuilder(BlueprintBase iBlueprint, World iWorld, int iX, int iY, int iZ, + ForgeDirection iDir) { blueprint = iBlueprint; subBlueprints = iBlueprint.subBlueprintsNBT; world = iWorld; @@ -42,13 +47,19 @@ public class RecursiveBlueprintBuilder { returnedThis = true; + BptBuilderBase builder; + if (blueprint instanceof Blueprint) { - return new BptBuilderBlueprint((Blueprint) blueprint, world, x, y, z); + builder = new BptBuilderBlueprint((Blueprint) blueprint, world, x, y, z); } else if (blueprint instanceof Template) { - return new BptBuilderTemplate(blueprint, world, x, y, z); + builder = new BptBuilderTemplate(blueprint, world, x, y, z); } else { return null; } + + box.initialize(builder); + + return builder; } blueprint = null; @@ -68,12 +79,15 @@ public class RecursiveBlueprintBuilder { NBTTagCompound nbt = subBlueprints.get(nextSubBlueprint); BlueprintBase bpt = BlueprintBase.loadBluePrint(nbt.getCompoundTag("bpt")); - int nx = x + nbt.getInteger("x"); - int ny = y + nbt.getInteger("y"); - int nz = z + nbt.getInteger("z"); + int nx = box.xMin + nbt.getInteger("x"); + int ny = box.yMin + nbt.getInteger("y"); + int nz = box.zMin + nbt.getInteger("z"); ForgeDirection nbtDir = ForgeDirection.values()[nbt.getByte("dir")]; + // TODO: this is just here for debug, to be removed + world.setBlock(nx, ny, nz, Blocks.sponge); + current = new RecursiveBlueprintBuilder(bpt, world, nx, ny, nz, nbtDir); nextSubBlueprint++; diff --git a/common/buildcraft/core/blueprints/RecursiveBlueprintReader.java b/common/buildcraft/core/blueprints/RecursiveBlueprintReader.java index 9ef5ca3c..243fa406 100755 --- a/common/buildcraft/core/blueprints/RecursiveBlueprintReader.java +++ b/common/buildcraft/core/blueprints/RecursiveBlueprintReader.java @@ -104,9 +104,9 @@ public class RecursiveBlueprintReader { if (currentSubReader.isDone()) { writingBlueprint.addSubBlueprint (currentSubReader.getBlueprint(), - currentSubReader.architect.xCoord - architect.xCoord, - currentSubReader.architect.yCoord - architect.yCoord, - currentSubReader.architect.zCoord - architect.zCoord, + currentSubReader.architect.xCoord - architect.getBox().xMin, + currentSubReader.architect.yCoord - architect.getBox().yMin, + currentSubReader.architect.zCoord - architect.getBox().zMin, ForgeDirection.values()[architect.getWorld().getBlockMetadata( architect.xCoord, architect.yCoord, architect.zCoord)].getOpposite());