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

View file

@ -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();

View file

@ -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;

View file

@ -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

View file

@ -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 {

View file

@ -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 {

View file

@ -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");
}
}