From e6f7fc7aa5de493745d1d62fa9681a21e9bc288f Mon Sep 17 00:00:00 2001 From: SpaceToad Date: Sat, 29 Mar 2014 16:57:51 +0100 Subject: [PATCH] finalized initial set of blueprint options, close #1541 --- common/buildcraft/BuildCraftBuilders.java | 1 - common/buildcraft/builders/TileArchitect.java | 27 ++++++++++--------- common/buildcraft/builders/TileBuilder.java | 24 +++++++++-------- .../buildcraft/builders/gui/GuiArchitect.java | 16 ++--------- .../buildcraft/core/blueprints/Blueprint.java | 6 ++--- .../core/blueprints/BlueprintBase.java | 8 ++++++ .../BlueprintReadConfiguration.java | 11 +++----- 7 files changed, 44 insertions(+), 49 deletions(-) diff --git a/common/buildcraft/BuildCraftBuilders.java b/common/buildcraft/BuildCraftBuilders.java index e2c97006..1e472d59 100644 --- a/common/buildcraft/BuildCraftBuilders.java +++ b/common/buildcraft/BuildCraftBuilders.java @@ -292,7 +292,6 @@ public class BuildCraftBuilders extends BuildCraftMod { fillerLifespanNormalProp.comment = "Lifespan in ticks of items dropped by the filler from non-tough blocks (those that can be broken by hand)"; fillerLifespanNormal = fillerLifespanNormalProp.getInt(DefaultProps.FILLER_LIFESPAN_NORMAL); - templateItem = new ItemBlueprintTemplate(); templateItem.setUnlocalizedName("templateItem"); LanguageRegistry.addName(templateItem, "Template"); diff --git a/common/buildcraft/builders/TileArchitect.java b/common/buildcraft/builders/TileArchitect.java index 71c70369..f9f9ff4b 100644 --- a/common/buildcraft/builders/TileArchitect.java +++ b/common/buildcraft/builders/TileArchitect.java @@ -79,19 +79,22 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro ForgeDirection o = ForgeDirection.values()[worldObj.getBlockMetadata( xCoord, yCoord, zCoord)].getOpposite(); - if (o == ForgeDirection.EAST) { - // Do nothing - } else if (o == ForgeDirection.SOUTH) { - writingBlueprint.rotateLeft(writingContext); - writingBlueprint.rotateLeft(writingContext); - writingBlueprint.rotateLeft(writingContext); - } else if (o == ForgeDirection.WEST) { - writingBlueprint.rotateLeft(writingContext); - writingBlueprint.rotateLeft(writingContext); - } else if (o == ForgeDirection.NORTH) { - writingBlueprint.rotateLeft(writingContext); - } + writingBlueprint.rotate = readConfiguration.rotate; + if (writingBlueprint.rotate) { + if (o == ForgeDirection.EAST) { + // Do nothing + } else if (o == ForgeDirection.SOUTH) { + writingBlueprint.rotateLeft(writingContext); + writingBlueprint.rotateLeft(writingContext); + writingBlueprint.rotateLeft(writingContext); + } else if (o == ForgeDirection.WEST) { + writingBlueprint.rotateLeft(writingContext); + writingBlueprint.rotateLeft(writingContext); + } else if (o == ForgeDirection.NORTH) { + writingBlueprint.rotateLeft(writingContext); + } + } } } else if (writingBlueprint.getData() != null) { createBlueprint(); diff --git a/common/buildcraft/builders/TileBuilder.java b/common/buildcraft/builders/TileBuilder.java index 68fe8e94..14d82bc7 100644 --- a/common/buildcraft/builders/TileBuilder.java +++ b/common/buildcraft/builders/TileBuilder.java @@ -271,17 +271,19 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IM BptContext context = bpt.getContext(worldObj, bpt.getBoxForPos(x, y, z)); - if (o == ForgeDirection.EAST) { - // Do nothing - } else if (o == ForgeDirection.SOUTH) { - bpt.rotateLeft(context); - } else if (o == ForgeDirection.WEST) { - bpt.rotateLeft(context); - bpt.rotateLeft(context); - } else if (o == ForgeDirection.NORTH) { - bpt.rotateLeft(context); - bpt.rotateLeft(context); - bpt.rotateLeft(context); + if (bpt.rotate) { + if (o == ForgeDirection.EAST) { + // Do nothing + } else if (o == ForgeDirection.SOUTH) { + bpt.rotateLeft(context); + } else if (o == ForgeDirection.WEST) { + bpt.rotateLeft(context); + bpt.rotateLeft(context); + } else if (o == ForgeDirection.NORTH) { + bpt.rotateLeft(context); + bpt.rotateLeft(context); + bpt.rotateLeft(context); + } } BptBuilderBase result = null; diff --git a/common/buildcraft/builders/gui/GuiArchitect.java b/common/buildcraft/builders/gui/GuiArchitect.java index 298324fb..85cbee18 100644 --- a/common/buildcraft/builders/gui/GuiArchitect.java +++ b/common/buildcraft/builders/gui/GuiArchitect.java @@ -57,9 +57,6 @@ public class GuiArchitect extends GuiBuildCraft { optionReadBlocks = new GuiButton(1, x + 5, y + 55, 77, 20, ""); buttonList.add(optionReadBlocks); - optionReadMods = new GuiButton(1, x + 5, y + 80, 77, 20, ""); - buttonList.add(optionReadMods); - updateButtons(); } @@ -69,10 +66,8 @@ public class GuiArchitect extends GuiBuildCraft { if (button == optionRotate) { conf.rotate = !conf.rotate; - } else if (button == optionReadMods) { - conf.readAllMods = !conf.readAllMods; } else if (button == optionReadBlocks) { - conf.readAllBlocks = !conf.readAllBlocks; + conf.readTiles = !conf.readTiles; } architect.rpcSetConfiguration(conf); @@ -89,18 +84,11 @@ public class GuiArchitect extends GuiBuildCraft { optionRotate.displayString = "Rotate: Off"; } - if (conf.readAllBlocks) { + if (conf.readTiles) { optionReadBlocks.displayString = "Blocks: All"; } else { optionReadBlocks.displayString = "Blocks: Simple"; } - - if (conf.readAllMods) { - optionReadMods.displayString = "Mods: All"; - } else { - optionReadMods.displayString = "Mods: Safe"; - } - } @Override diff --git a/common/buildcraft/core/blueprints/Blueprint.java b/common/buildcraft/core/blueprints/Blueprint.java index e7ca273d..53e33862 100644 --- a/common/buildcraft/core/blueprints/Blueprint.java +++ b/common/buildcraft/core/blueprints/Blueprint.java @@ -11,7 +11,6 @@ package buildcraft.core.blueprints; import java.util.LinkedList; import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -49,6 +48,7 @@ public class Blueprint extends BlueprintBase { @Override public void readFromWorld(IBuilderContext context, TileEntity anchorTile, int x, int y, int z) { + BptContext bptContext = (BptContext) context; Block block = anchorTile.getWorldObj().getBlock(x, y, z); SchematicBlock slot = SchematicRegistry.newSchematicBlock(block); @@ -64,8 +64,8 @@ public class Blueprint extends BlueprintBase { slot.block = block; slot.meta = anchorTile.getWorldObj().getBlockMetadata(x, y, z); - if (slot.block instanceof BlockContainer) { - TileEntity tile = anchorTile.getWorldObj().getTileEntity(x, y, z); + if (!bptContext.readConfiguration.readTiles && anchorTile.getWorldObj().getTileEntity(x, y, z) != null) { + return; } try { diff --git a/common/buildcraft/core/blueprints/BlueprintBase.java b/common/buildcraft/core/blueprints/BlueprintBase.java index 32195bf8..07bbc1d5 100644 --- a/common/buildcraft/core/blueprints/BlueprintBase.java +++ b/common/buildcraft/core/blueprints/BlueprintBase.java @@ -32,6 +32,7 @@ public abstract class BlueprintBase { public String author; private String version = ""; protected MappingRegistry mapping = new MappingRegistry(); + public boolean rotate = true; private byte [] data; @@ -104,6 +105,7 @@ public abstract class BlueprintBase { nbt.setInteger("anchorX", anchorX); nbt.setInteger("anchorY", anchorY); nbt.setInteger("anchorZ", anchorZ); + nbt.setBoolean("rotate", rotate); if (author != null) { nbt.setString("author", author); @@ -142,6 +144,12 @@ public abstract class BlueprintBase { author = nbt.getString("author"); + if (nbt.hasKey("rotate")) { + rotate = nbt.getBoolean("rotate"); + } else { + rotate = true; + } + contents = new Schematic [sizeX][sizeY][sizeZ]; try { diff --git a/common/buildcraft/core/blueprints/BlueprintReadConfiguration.java b/common/buildcraft/core/blueprints/BlueprintReadConfiguration.java index f1c9ef35..9368960d 100755 --- a/common/buildcraft/core/blueprints/BlueprintReadConfiguration.java +++ b/common/buildcraft/core/blueprints/BlueprintReadConfiguration.java @@ -17,21 +17,16 @@ public class BlueprintReadConfiguration { public boolean rotate = true; @NetworkData - public boolean readAllBlocks = true; - - @NetworkData - public boolean readAllMods = true; + public boolean readTiles = true; public void writeToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setBoolean("rotate", rotate); - nbttagcompound.setBoolean("readAllBlocks", readAllBlocks); - nbttagcompound.setBoolean("readAllMods", readAllMods); + nbttagcompound.setBoolean("readAllBlocks", readTiles); } public void readFromNBT(NBTTagCompound nbttagcompound) { rotate = nbttagcompound.getBoolean("rotate"); - readAllBlocks = nbttagcompound.getBoolean("readAllBlocks"); - readAllMods = nbttagcompound.getBoolean("readAllMods"); + readTiles = nbttagcompound.getBoolean("readAllBlocks"); } }