added mode where air blocks are not cleared by blueprint, close #1562
This commit is contained in:
parent
6c42fd02bc
commit
ee349e00b5
6 changed files with 51 additions and 17 deletions
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -32,6 +32,7 @@ public class BptBuilderTemplate extends BptBuilderBase {
|
|||
|
||||
@Override
|
||||
protected void initialize () {
|
||||
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) {
|
||||
|
@ -41,7 +42,9 @@ public class BptBuilderTemplate extends BptBuilderBase {
|
|||
|
||||
SchematicBlockBase slot = blueprint.contents[i][j][k];
|
||||
|
||||
if (slot == null && !clearedLocations.contains(new BlockIndex(xCoord, yCoord, zCoord))) {
|
||||
if (slot == null
|
||||
&& !clearedLocations.contains(new BlockIndex(
|
||||
xCoord, yCoord, zCoord))) {
|
||||
BuildingSlotBlock b = new BuildingSlotBlock();
|
||||
|
||||
b.schematic = null;
|
||||
|
@ -55,6 +58,7 @@ public class BptBuilderTemplate extends BptBuilderBase {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < blueprint.sizeY; ++j) {
|
||||
for (int i = 0; i < blueprint.sizeX; ++i) {
|
||||
|
|
Loading…
Reference in a new issue