diff --git a/common/buildcraft/builders/TileArchitect.java b/common/buildcraft/builders/TileArchitect.java index b41653b5..c8a838c0 100644 --- a/common/buildcraft/builders/TileArchitect.java +++ b/common/buildcraft/builders/TileArchitect.java @@ -89,6 +89,7 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro xCoord, yCoord, zCoord)].getOpposite(); writingBlueprint.rotate = readConfiguration.rotate; + writingBlueprint.excavate = readConfiguration.excavate; if (writingBlueprint.rotate) { if (o == ForgeDirection.EAST) { diff --git a/common/buildcraft/builders/gui/GuiArchitect.java b/common/buildcraft/builders/gui/GuiArchitect.java index 85cbee18..9593c497 100644 --- a/common/buildcraft/builders/gui/GuiArchitect.java +++ b/common/buildcraft/builders/gui/GuiArchitect.java @@ -35,6 +35,7 @@ public class GuiArchitect extends GuiBuildCraft { private GuiButton optionRotate; private GuiButton optionReadMods; private GuiButton optionReadBlocks; + private GuiButton optionExcavate; public GuiArchitect(IInventory playerInventory, TileArchitect architect) { super(new ContainerArchitect(playerInventory, architect), architect, TEXTURE); @@ -57,6 +58,9 @@ public class GuiArchitect extends GuiBuildCraft { optionReadBlocks = new GuiButton(1, x + 5, y + 55, 77, 20, ""); buttonList.add(optionReadBlocks); + optionExcavate = new GuiButton(2, x + 5, y + 80, 77, 20, ""); + buttonList.add(optionExcavate); + updateButtons(); } @@ -68,6 +72,8 @@ public class GuiArchitect extends GuiBuildCraft { conf.rotate = !conf.rotate; } else if (button == optionReadBlocks) { conf.readTiles = !conf.readTiles; + } else if (button == optionExcavate) { + conf.excavate = !conf.excavate; } architect.rpcSetConfiguration(conf); @@ -89,6 +95,12 @@ public class GuiArchitect extends GuiBuildCraft { } else { optionReadBlocks.displayString = "Blocks: Simple"; } + + if (conf.excavate) { + optionExcavate.displayString = "Excavate: On"; + } else { + optionExcavate.displayString = "Excavate: Off"; + } } @Override diff --git a/common/buildcraft/core/blueprints/BlueprintBase.java b/common/buildcraft/core/blueprints/BlueprintBase.java index 2f3fa7d0..a68aa2c6 100644 --- a/common/buildcraft/core/blueprints/BlueprintBase.java +++ b/common/buildcraft/core/blueprints/BlueprintBase.java @@ -34,6 +34,7 @@ public abstract class BlueprintBase { private String version = ""; protected MappingRegistry mapping = new MappingRegistry(); public boolean rotate = true; + public boolean excavate = true; private byte [] data; @@ -131,6 +132,7 @@ public abstract class BlueprintBase { nbt.setInteger("anchorY", anchorY); nbt.setInteger("anchorZ", anchorZ); nbt.setBoolean("rotate", rotate); + nbt.setBoolean("excavate", excavate); if (author != null) { nbt.setString("author", author); @@ -175,6 +177,12 @@ public abstract class BlueprintBase { rotate = true; } + if (nbt.hasKey("excavate")) { + excavate = nbt.getBoolean("excavate"); + } else { + excavate = true; + } + contents = new SchematicBlockBase [sizeX][sizeY][sizeZ]; try { diff --git a/common/buildcraft/core/blueprints/BlueprintReadConfiguration.java b/common/buildcraft/core/blueprints/BlueprintReadConfiguration.java index 9368960d..28820d4e 100755 --- a/common/buildcraft/core/blueprints/BlueprintReadConfiguration.java +++ b/common/buildcraft/core/blueprints/BlueprintReadConfiguration.java @@ -19,14 +19,19 @@ public class BlueprintReadConfiguration { @NetworkData public boolean readTiles = true; + @NetworkData + public boolean excavate = true; + public void writeToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setBoolean("rotate", rotate); nbttagcompound.setBoolean("readAllBlocks", readTiles); + nbttagcompound.setBoolean("excavate", excavate); } public void readFromNBT(NBTTagCompound nbttagcompound) { rotate = nbttagcompound.getBoolean("rotate"); readTiles = nbttagcompound.getBoolean("readAllBlocks"); + excavate = nbttagcompound.getBoolean("excavate"); } } diff --git a/common/buildcraft/core/blueprints/BptBuilderBlueprint.java b/common/buildcraft/core/blueprints/BptBuilderBlueprint.java index 35984b27..66d526b3 100644 --- a/common/buildcraft/core/blueprints/BptBuilderBlueprint.java +++ b/common/buildcraft/core/blueprints/BptBuilderBlueprint.java @@ -58,9 +58,14 @@ public class BptBuilderBlueprint extends BptBuilderBase { int yCoord = j + y - blueprint.anchorY; int zCoord = k + z - blueprint.anchorZ; - if (!clearedLocations.contains(new BlockIndex(xCoord, yCoord, zCoord))) { + if (!clearedLocations.contains(new BlockIndex(xCoord, + yCoord, zCoord))) { SchematicBlock slot = (SchematicBlock) blueprint.contents[i][j][k]; + if (slot == null && !blueprint.excavate) { + continue; + } + if (slot == null) { slot = new SchematicBlock(); slot.meta = 0; @@ -90,7 +95,6 @@ public class BptBuilderBlueprint extends BptBuilderBase { int yCoord = j + y - blueprint.anchorY; int zCoord = k + z - blueprint.anchorZ; - SchematicBlock slot = (SchematicBlock) blueprint.contents[i][j][k]; if (slot == null) { diff --git a/common/buildcraft/core/blueprints/BptBuilderTemplate.java b/common/buildcraft/core/blueprints/BptBuilderTemplate.java index f8bd09f2..881e40c7 100644 --- a/common/buildcraft/core/blueprints/BptBuilderTemplate.java +++ b/common/buildcraft/core/blueprints/BptBuilderTemplate.java @@ -32,25 +32,29 @@ public class BptBuilderTemplate extends BptBuilderBase { @Override protected void initialize () { - for (int j = blueprint.sizeY - 1; j >= 0; --j) { - for (int i = 0; i < blueprint.sizeX; ++i) { - for (int k = 0; k < blueprint.sizeZ; ++k) { - int xCoord = i + x - blueprint.anchorX; - int yCoord = j + y - blueprint.anchorY; - int zCoord = k + z - blueprint.anchorZ; + if (blueprint.excavate) { + for (int j = blueprint.sizeY - 1; j >= 0; --j) { + for (int i = 0; i < blueprint.sizeX; ++i) { + for (int k = 0; k < blueprint.sizeZ; ++k) { + int xCoord = i + x - blueprint.anchorX; + int yCoord = j + y - blueprint.anchorY; + int zCoord = k + z - blueprint.anchorZ; - SchematicBlockBase slot = blueprint.contents[i][j][k]; + SchematicBlockBase slot = blueprint.contents[i][j][k]; - if (slot == null && !clearedLocations.contains(new BlockIndex(xCoord, yCoord, zCoord))) { - BuildingSlotBlock b = new BuildingSlotBlock(); + if (slot == null + && !clearedLocations.contains(new BlockIndex( + xCoord, yCoord, zCoord))) { + BuildingSlotBlock b = new BuildingSlotBlock(); - b.schematic = null; - b.x = xCoord; - b.y = yCoord; - b.z = zCoord; - b.mode = Mode.ClearIfInvalid; + b.schematic = null; + b.x = xCoord; + b.y = yCoord; + b.z = zCoord; + b.mode = Mode.ClearIfInvalid; - buildList.add(b); + buildList.add(b); + } } } }