finalized initial set of blueprint options, close #1541

This commit is contained in:
SpaceToad 2014-03-29 16:57:51 +01:00
parent 307aeb2dfb
commit e6f7fc7aa5
7 changed files with 44 additions and 49 deletions

View file

@ -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)"; 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); fillerLifespanNormal = fillerLifespanNormalProp.getInt(DefaultProps.FILLER_LIFESPAN_NORMAL);
templateItem = new ItemBlueprintTemplate(); templateItem = new ItemBlueprintTemplate();
templateItem.setUnlocalizedName("templateItem"); templateItem.setUnlocalizedName("templateItem");
LanguageRegistry.addName(templateItem, "Template"); LanguageRegistry.addName(templateItem, "Template");

View file

@ -79,19 +79,22 @@ public class TileArchitect extends TileBuildCraft implements IInventory, IBoxPro
ForgeDirection o = ForgeDirection.values()[worldObj.getBlockMetadata( ForgeDirection o = ForgeDirection.values()[worldObj.getBlockMetadata(
xCoord, yCoord, zCoord)].getOpposite(); xCoord, yCoord, zCoord)].getOpposite();
if (o == ForgeDirection.EAST) { writingBlueprint.rotate = readConfiguration.rotate;
// 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);
}
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) { } else if (writingBlueprint.getData() != null) {
createBlueprint(); createBlueprint();

View file

@ -271,17 +271,19 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IM
BptContext context = bpt.getContext(worldObj, bpt.getBoxForPos(x, y, z)); BptContext context = bpt.getContext(worldObj, bpt.getBoxForPos(x, y, z));
if (o == ForgeDirection.EAST) { if (bpt.rotate) {
// Do nothing if (o == ForgeDirection.EAST) {
} else if (o == ForgeDirection.SOUTH) { // Do nothing
bpt.rotateLeft(context); } else if (o == ForgeDirection.SOUTH) {
} else if (o == ForgeDirection.WEST) { bpt.rotateLeft(context);
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); } else if (o == ForgeDirection.NORTH) {
bpt.rotateLeft(context); bpt.rotateLeft(context);
bpt.rotateLeft(context); bpt.rotateLeft(context);
bpt.rotateLeft(context);
}
} }
BptBuilderBase result = null; BptBuilderBase result = null;

View file

@ -57,9 +57,6 @@ public class GuiArchitect extends GuiBuildCraft {
optionReadBlocks = new GuiButton(1, x + 5, y + 55, 77, 20, ""); optionReadBlocks = new GuiButton(1, x + 5, y + 55, 77, 20, "");
buttonList.add(optionReadBlocks); buttonList.add(optionReadBlocks);
optionReadMods = new GuiButton(1, x + 5, y + 80, 77, 20, "");
buttonList.add(optionReadMods);
updateButtons(); updateButtons();
} }
@ -69,10 +66,8 @@ public class GuiArchitect extends GuiBuildCraft {
if (button == optionRotate) { if (button == optionRotate) {
conf.rotate = !conf.rotate; conf.rotate = !conf.rotate;
} else if (button == optionReadMods) {
conf.readAllMods = !conf.readAllMods;
} else if (button == optionReadBlocks) { } else if (button == optionReadBlocks) {
conf.readAllBlocks = !conf.readAllBlocks; conf.readTiles = !conf.readTiles;
} }
architect.rpcSetConfiguration(conf); architect.rpcSetConfiguration(conf);
@ -89,18 +84,11 @@ public class GuiArchitect extends GuiBuildCraft {
optionRotate.displayString = "Rotate: Off"; optionRotate.displayString = "Rotate: Off";
} }
if (conf.readAllBlocks) { if (conf.readTiles) {
optionReadBlocks.displayString = "Blocks: All"; optionReadBlocks.displayString = "Blocks: All";
} else { } else {
optionReadBlocks.displayString = "Blocks: Simple"; optionReadBlocks.displayString = "Blocks: Simple";
} }
if (conf.readAllMods) {
optionReadMods.displayString = "Mods: All";
} else {
optionReadMods.displayString = "Mods: Safe";
}
} }
@Override @Override

View file

@ -11,7 +11,6 @@ package buildcraft.core.blueprints;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -49,6 +48,7 @@ public class Blueprint extends BlueprintBase {
@Override @Override
public void readFromWorld(IBuilderContext context, TileEntity anchorTile, int x, int y, int z) { 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); Block block = anchorTile.getWorldObj().getBlock(x, y, z);
SchematicBlock slot = SchematicRegistry.newSchematicBlock(block); SchematicBlock slot = SchematicRegistry.newSchematicBlock(block);
@ -64,8 +64,8 @@ public class Blueprint extends BlueprintBase {
slot.block = block; slot.block = block;
slot.meta = anchorTile.getWorldObj().getBlockMetadata(x, y, z); slot.meta = anchorTile.getWorldObj().getBlockMetadata(x, y, z);
if (slot.block instanceof BlockContainer) { if (!bptContext.readConfiguration.readTiles && anchorTile.getWorldObj().getTileEntity(x, y, z) != null) {
TileEntity tile = anchorTile.getWorldObj().getTileEntity(x, y, z); return;
} }
try { try {

View file

@ -32,6 +32,7 @@ public abstract class BlueprintBase {
public String author; public String author;
private String version = ""; private String version = "";
protected MappingRegistry mapping = new MappingRegistry(); protected MappingRegistry mapping = new MappingRegistry();
public boolean rotate = true;
private byte [] data; private byte [] data;
@ -104,6 +105,7 @@ public abstract class BlueprintBase {
nbt.setInteger("anchorX", anchorX); nbt.setInteger("anchorX", anchorX);
nbt.setInteger("anchorY", anchorY); nbt.setInteger("anchorY", anchorY);
nbt.setInteger("anchorZ", anchorZ); nbt.setInteger("anchorZ", anchorZ);
nbt.setBoolean("rotate", rotate);
if (author != null) { if (author != null) {
nbt.setString("author", author); nbt.setString("author", author);
@ -142,6 +144,12 @@ public abstract class BlueprintBase {
author = nbt.getString("author"); author = nbt.getString("author");
if (nbt.hasKey("rotate")) {
rotate = nbt.getBoolean("rotate");
} else {
rotate = true;
}
contents = new Schematic [sizeX][sizeY][sizeZ]; contents = new Schematic [sizeX][sizeY][sizeZ];
try { try {

View file

@ -17,21 +17,16 @@ public class BlueprintReadConfiguration {
public boolean rotate = true; public boolean rotate = true;
@NetworkData @NetworkData
public boolean readAllBlocks = true; public boolean readTiles = true;
@NetworkData
public boolean readAllMods = true;
public void writeToNBT(NBTTagCompound nbttagcompound) { public void writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setBoolean("rotate", rotate); nbttagcompound.setBoolean("rotate", rotate);
nbttagcompound.setBoolean("readAllBlocks", readAllBlocks); nbttagcompound.setBoolean("readAllBlocks", readTiles);
nbttagcompound.setBoolean("readAllMods", readAllMods);
} }
public void readFromNBT(NBTTagCompound nbttagcompound) { public void readFromNBT(NBTTagCompound nbttagcompound) {
rotate = nbttagcompound.getBoolean("rotate"); rotate = nbttagcompound.getBoolean("rotate");
readAllBlocks = nbttagcompound.getBoolean("readAllBlocks"); readTiles = nbttagcompound.getBoolean("readAllBlocks");
readAllMods = nbttagcompound.getBoolean("readAllMods");
} }
} }