From 4a1469a05566b2cfd83005865b743979ed93ca3a Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Sun, 30 Jun 2013 17:49:20 -0700 Subject: [PATCH] Convert TileQuarry and EntityRobot to new API Note this breaks the builder. --- .../buildcraft/api/builder/BlockHandler.java | 28 ++-- .../api/builder/BlockSchematic.java | 17 ++- common/buildcraft/api/builder/Blueprint.java | 7 +- .../api/builder/BlueprintBuilder.java | 5 +- common/buildcraft/builders/TileBuilder.java | 6 +- common/buildcraft/core/EntityRobot.java | 125 ++++++------------ common/buildcraft/factory/TileQuarry.java | 110 +++++++-------- 7 files changed, 133 insertions(+), 165 deletions(-) diff --git a/common/buildcraft/api/builder/BlockHandler.java b/common/buildcraft/api/builder/BlockHandler.java index f958b7cc..b18e350f 100644 --- a/common/buildcraft/api/builder/BlockHandler.java +++ b/common/buildcraft/api/builder/BlockHandler.java @@ -6,6 +6,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -31,12 +32,11 @@ public class BlockHandler { } public static BlockHandler getHandler(BlockSchematic schematic) { -// BlockHandler handler = handlers.get(s); // TODO: replace with mapping -> id code -// if (handler == null) { -// return DEFAULT_HANDLER; -// } -// return handler; - return null; + BlockHandler handler = null; // TODO: replace with mapping -> id code + if (handler == null) { + return DEFAULT_HANDLER; + } + return handler; } public static void registerHandler(int blockId, BlockHandler handler) { @@ -83,8 +83,8 @@ public class BlockHandler { if (block == null) { return null; } - BlockSchematic schematic = new BlockSchematic(block.getUnlocalizedName()); - schematic.metadata = world.getBlockMetadata(x, y, z); + BlockSchematic schematic = new BlockSchematic(block); + schematic.blockMeta = world.getBlockMetadata(x, y, z); return schematic; } @@ -103,7 +103,7 @@ public class BlockHandler { List cost = new ArrayList(); Block block = null; // TODO: replace with mapping -> id code if (block != null) { - cost.add(new ItemStack(block.idDropped(schematic.metadata, Utils.RANDOM, 0), 1, block.damageDropped(schematic.metadata))); + cost.add(new ItemStack(block.idDropped(schematic.blockMeta, Utils.RANDOM, 0), 1, block.damageDropped(schematic.blockMeta))); } return cost; } @@ -157,14 +157,16 @@ public class BlockHandler { } /** - * FEEDBACK REQUIRED: Should this place the block or should the block - * already be placed and this just initializes it? + * This function handles the placement of the block in the world. * * The ForgeDirection parameter can be use to determine the orientation of * the blueprint. Blueprints are always saved facing North. This function * will have to rotate the block accordingly. */ - public boolean readBlockFromSchematic(World world, int x, int y, int z, ForgeDirection blueprintOrientation, BlockSchematic schematic) { + public boolean readBlockFromSchematic(World world, int x, int y, int z, ForgeDirection blueprintOrientation, BlockSchematic schematic, EntityPlayer bcPlayer) { + if (schematic.blockId != 0) { + return world.setBlock(x, y, z, schematic.blockId, schematic.blockMeta, 3); + } return false; } @@ -180,6 +182,6 @@ public class BlockHandler { if (!schematic.blockName.equals(block.getUnlocalizedName())) { return false; } - return schematic.metadata == world.getBlockMetadata(x, y, z); + return schematic.blockMeta == world.getBlockMetadata(x, y, z); } } diff --git a/common/buildcraft/api/builder/BlockSchematic.java b/common/buildcraft/api/builder/BlockSchematic.java index 0bd1abf8..d51c9587 100644 --- a/common/buildcraft/api/builder/BlockSchematic.java +++ b/common/buildcraft/api/builder/BlockSchematic.java @@ -1,5 +1,6 @@ package buildcraft.api.builder; +import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; /** @@ -9,17 +10,27 @@ import net.minecraft.nbt.NBTTagCompound; public final class BlockSchematic { public final String blockName; - public int metadata = 0; + public final int blockId; + public int blockMeta = 0; public NBTTagCompound blockData = null; public int x, y, z; + public BlockSchematic(Block block) { + this(block.getUnlocalizedName(), block.blockID); + } + public BlockSchematic(String blockName) { + this(blockName, 0); // TODO: Add block id from name + } + + public BlockSchematic(String blockName, int blockId) { this.blockName = blockName; + this.blockId = blockId; } public void writeToNBT(NBTTagCompound nbt) { nbt.setString("blockName", blockName); - nbt.setByte("metadata", (byte) metadata); + nbt.setByte("blockMeta", (byte) blockMeta); nbt.setInteger("x", x); nbt.setInteger("y", y); nbt.setInteger("z", z); @@ -28,7 +39,7 @@ public final class BlockSchematic { public static BlockSchematic readFromNBT(NBTTagCompound nbt) { BlockSchematic block = new BlockSchematic(nbt.getString("blockName")); - block.metadata = nbt.getInteger("metadata"); + block.blockMeta = nbt.getInteger("blockMeta"); block.x = nbt.getInteger("x"); block.y = nbt.getInteger("y"); block.z = nbt.getInteger("z"); diff --git a/common/buildcraft/api/builder/Blueprint.java b/common/buildcraft/api/builder/Blueprint.java index fd1bc82a..b54f5014 100644 --- a/common/buildcraft/api/builder/Blueprint.java +++ b/common/buildcraft/api/builder/Blueprint.java @@ -74,8 +74,8 @@ public class Blueprint { if (block == null) { return; } - BlockSchematic schematic = new BlockSchematic(block.getUnlocalizedName()); - schematic.metadata = meta; + BlockSchematic schematic = new BlockSchematic(block); + schematic.blockMeta = meta; setBlock(x, y, z, schematic); } @@ -101,7 +101,8 @@ public class Blueprint { for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { for (int z = 0; z < sizeZ; z++) { - list.add(blocks[x][y][z]); + if (blocks[x][y][z] != null) + list.add(blocks[x][y][z]); } } } diff --git a/common/buildcraft/api/builder/BlueprintBuilder.java b/common/buildcraft/api/builder/BlueprintBuilder.java index 64f4aeb7..2b938cc6 100644 --- a/common/buildcraft/api/builder/BlueprintBuilder.java +++ b/common/buildcraft/api/builder/BlueprintBuilder.java @@ -13,6 +13,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.List; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; @@ -100,7 +101,7 @@ public class BlueprintBuilder { return handler.canPlaceNow(worldObj, getX(), getY(), getZ(), orientation, schematic); } - public boolean build() { + public boolean build(EntityPlayer bcPlayer) { // if (blockExists()) { // markComplete(); // return false; @@ -116,7 +117,7 @@ public class BlueprintBuilder { return false; } - boolean built = handler.readBlockFromSchematic(worldObj, getX(), getY(), getZ(), orientation, schematic); + boolean built = handler.readBlockFromSchematic(worldObj, getX(), getY(), getZ(), orientation, schematic, bcPlayer); if (built) { markComplete(); diff --git a/common/buildcraft/builders/TileBuilder.java b/common/buildcraft/builders/TileBuilder.java index 3e590d65..95c74d60 100644 --- a/common/buildcraft/builders/TileBuilder.java +++ b/common/buildcraft/builders/TileBuilder.java @@ -288,7 +288,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP box.createLasers(worldObj, LaserKind.Stripes); - builderRobot.scheduleContruction(bluePrintBuilder.getNextBlock(worldObj, this), bluePrintBuilder.getContext()); +// builderRobot.scheduleContruction(bluePrintBuilder.getNextBlock(worldObj, this), bluePrintBuilder.getContext()); } } @@ -325,7 +325,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP } if (bluePrintBuilder != null && builderRobot != null) { - builderRobot.markEndOfBlueprint(bluePrintBuilder); +// builderRobot.markEndOfBlueprint(bluePrintBuilder); } bluePrintBuilder = currentPathIterator.next(); @@ -351,7 +351,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP } else { if (bluePrintBuilder != null && bluePrintBuilder.done) { if (builderRobot != null) { - builderRobot.markEndOfBlueprint(bluePrintBuilder); +// builderRobot.markEndOfBlueprint(bluePrintBuilder); } done = true; diff --git a/common/buildcraft/core/EntityRobot.java b/common/buildcraft/core/EntityRobot.java index 0d291710..ecdb7621 100644 --- a/common/buildcraft/core/EntityRobot.java +++ b/common/buildcraft/core/EntityRobot.java @@ -1,12 +1,10 @@ /** - * Copyright (c) SpaceToad, 2011-2012 - * http://www.mod-buildcraft.com + * Copyright (c) SpaceToad, 2011-2012 http://www.mod-buildcraft.com * - * BuildCraft is distributed under the terms of the Minecraft Mod Public - * License 1.0, or MMPL. Please check the contents of the license located in + * BuildCraft is distributed under the terms of the Minecraft Mod Public License + * 1.0, or MMPL. Please check the contents of the license located in * http://www.mod-buildcraft.com/MMPL-1.0.txt */ - package buildcraft.core; import java.util.ArrayList; @@ -17,12 +15,8 @@ import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import buildcraft.BuildCraftCore; -import buildcraft.api.blueprints.BptSlotInfo; +import buildcraft.api.builder.BlueprintBuilder.SchematicBuilder; import buildcraft.api.core.Position; -import buildcraft.core.blueprints.BptBuilderBase; -import buildcraft.core.blueprints.BptContext; -import buildcraft.core.blueprints.BptSlot; -import buildcraft.core.blueprints.BptSlot.Mode; import buildcraft.core.proxy.CoreProxy; import buildcraft.core.utils.BlockUtil; @@ -35,29 +29,11 @@ public class EntityRobot extends Entity implements IEntityAdditionalSpawnData { private Box box; private int destX, destY, destZ; - EntityEnergyLaser laser; - - public LinkedList targets = new LinkedList(); + public LinkedList targets = new LinkedList(); public static int MAX_TARGETS = 20; public int wait = 0; - private class Action { - - public Action(BptSlot slot, BptContext context) { - this.slot = slot; - this.context = context; - } - - public Action(BptBuilderBase builder) { - this.builder = builder; - } - - BptSlot slot; - BptBuilderBase builder; - BptContext context; - } - public EntityRobot(World world) { super(world); } @@ -129,6 +105,8 @@ public class EntityRobot extends Entity implements IEntityAdditionalSpawnData { @Override public void onUpdate() { + if (CoreProxy.proxy.isRenderWorld(worldObj)) + return; move(); build(); @@ -199,48 +177,31 @@ public class EntityRobot extends Entity implements IEntityAdditionalSpawnData { updateWait(); - if (targets.size() > 0) { + if (wait <= 0 && !targets.isEmpty()) { - Action a = targets.getFirst(); - if (a.slot != null) { - - BptSlot target = a.slot; - //System.out.printf("RobotChanging %d %d %d %s\n",target.x, target.y, target.z, target.mode); - if (wait <= 0 && BlockUtil.canChangeBlock(worldObj, target.x, target.y, target.z)) { - - if (!CoreProxy.proxy.isRenderWorld(worldObj)) { - - if (target.mode == Mode.ClearIfInvalid) { - - if (!target.isValid(a.context)) { - worldObj.setBlock(target.x, target.y, target.z, 0, 0,3); - } - - } else if (target.stackToUse != null) { - - worldObj.setBlock(target.x, target.y, target.z, 0); - throw new RuntimeException("NOT IMPLEMENTED"); - // target.stackToUse.getItem().onItemUse(target.stackToUse, - // CoreProxy.getBuildCraftPlayer(worldObj), worldObj, target.x, target.y - 1, - // target.z, 1); - } else { - - try { - target.buildBlock(a.context); - } catch (Throwable t) { - // Defensive code against errors in implementers - t.printStackTrace(); - BuildCraftCore.bcLog.throwing("EntityRobot", "update", t); - } - } - } - - targets.pop(); - } - - } else if (a.builder != null) { - a.builder.postProcessing(worldObj); + SchematicBuilder target = targets.peek(); + if (target.blockExists()) { + target.markComplete(); targets.pop(); + } else if (BlockUtil.canChangeBlock(worldObj, target.getX(), target.getY(), target.getZ())) { + //System.out.printf("RobotChanging %d %d %d %s\n",target.x, target.y, target.z, target.mode); + if (!worldObj.isAirBlock(target.getX(), target.getY(), target.getZ())) { + BlockUtil.breakBlock(worldObj, target.getX(), target.getY(), target.getZ()); + } else { + targets.pop(); + try { + target.build(CoreProxy.proxy.getBuildCraftPlayer(worldObj, target.getX(), target.getY() + 2, target.getZ())); + } catch (Throwable t) { + target.markComplete(); + targets.pop(); + // Defensive code against errors in implementers + t.printStackTrace(); + BuildCraftCore.bcLog.throwing("EntityRobot", "update", t); + } + if (!target.isComplete()) { + targets.addLast(target); + } + } } } } @@ -262,12 +223,10 @@ public class EntityRobot extends Entity implements IEntityAdditionalSpawnData { if (targets.size() > 0) { - Action a = targets.getFirst(); - BptSlotInfo target = a.slot; + SchematicBuilder target = targets.getFirst(); if (target != null) { - - laser.setPositions(new Position(posX, posY, posZ), new Position(target.x + 0.5, target.y + 0.5, target.z + 0.5)); + laser.setPositions(new Position(posX, posY, posZ), new Position(target.getX() + 0.5, target.getY() + 0.5, target.getZ() + 0.5)); laser.show(); } } else { @@ -277,16 +236,14 @@ public class EntityRobot extends Entity implements IEntityAdditionalSpawnData { laser.pushPower(((float) targets.size()) / ((float) MAX_TARGETS) * 4F); } - public void scheduleContruction(BptSlot slot, BptContext context) { - - if (slot != null) { - targets.add(new Action(slot, context)); - + public boolean scheduleContruction(SchematicBuilder schematic) { + if (!readyToBuild()) { + return false; } - } - - public void markEndOfBlueprint(BptBuilderBase builder) { - targets.add(new Action(builder)); + if (schematic != null && !schematic.blockExists()) { + return targets.add(schematic); + } + return false; } public boolean readyToBuild() { @@ -298,19 +255,15 @@ public class EntityRobot extends Entity implements IEntityAdditionalSpawnData { } public void setBox(Box box) { - this.box = box; setDestination((int) box.centerX(), (int) box.centerY(), (int) box.centerZ()); } @Override public void setDead() { - if (laser != null) { laser.setDead(); } - super.setDead(); } - } diff --git a/common/buildcraft/factory/TileQuarry.java b/common/buildcraft/factory/TileQuarry.java index 989355ee..05258bb5 100755 --- a/common/buildcraft/factory/TileQuarry.java +++ b/common/buildcraft/factory/TileQuarry.java @@ -24,6 +24,9 @@ import net.minecraftforge.common.ForgeChunkManager.Type; import net.minecraftforge.common.ForgeDirection; import buildcraft.BuildCraftCore; import buildcraft.BuildCraftFactory; +import buildcraft.api.builder.Blueprint; +import buildcraft.api.builder.BlueprintBuilder; +import buildcraft.api.builder.BlueprintBuilder.SchematicBuilder; import buildcraft.api.core.IAreaProvider; import buildcraft.api.core.LaserKind; import buildcraft.api.gates.IAction; @@ -36,9 +39,6 @@ import buildcraft.core.EntityRobot; import buildcraft.core.IBuilderInventory; import buildcraft.core.IMachine; import buildcraft.core.TileBuildCraft; -import buildcraft.core.blueprints.BptBlueprint; -import buildcraft.core.blueprints.BptBuilderBase; -import buildcraft.core.blueprints.BptBuilderBlueprint; import buildcraft.core.network.PacketUpdate; import buildcraft.core.network.TileNetworkData; import buildcraft.core.proxy.CoreProxy; @@ -50,6 +50,7 @@ import com.google.common.collect.Sets; import cpw.mods.fml.common.network.PacketDispatcher; import cpw.mods.fml.common.network.Player; +import java.util.ListIterator; public class TileQuarry extends TileBuildCraft implements IMachine, IPowerReceptor, IPipeConnection, IBuilderInventory { @@ -66,7 +67,8 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept public @TileNetworkData boolean builderDone = false; public EntityRobot builder; - BptBuilderBase bluePrintBuilder; + private BlueprintBuilder blueprintBuilder; + private ListIterator blueprintIterator; public EntityMechanicalArm arm; public PowerProvider powerProvider; boolean isDigging = false; @@ -83,13 +85,13 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept } public void createUtilsIfNeeded() { - if (bluePrintBuilder == null) { + if (blueprintBuilder == null) { if (!box.isInitialized()) { setBoundaries(loadDefaultBoundaries); } - initializeBluePrintBuilder(); + initializeBlueprintBuilder(); } if (builderDone) { @@ -124,8 +126,8 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept private void createArm() { - worldObj.spawnEntityInWorld(new EntityMechanicalArm(worldObj, box.xMin + Utils.pipeMaxPos, yCoord + bluePrintBuilder.bluePrint.sizeY - 1 - + Utils.pipeMinPos, box.zMin + Utils.pipeMaxPos, bluePrintBuilder.bluePrint.sizeX - 2 + Utils.pipeMinPos * 2, bluePrintBuilder.bluePrint.sizeZ + worldObj.spawnEntityInWorld(new EntityMechanicalArm(worldObj, box.xMin + Utils.pipeMaxPos, yCoord + blueprintBuilder.blueprint.sizeY - 1 + + Utils.pipeMinPos, box.zMin + Utils.pipeMaxPos, blueprintBuilder.blueprint.sizeX - 2 + Utils.pipeMinPos * 2, blueprintBuilder.blueprint.sizeZ - 2 + Utils.pipeMinPos * 2, this)); } @@ -136,15 +138,13 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept @Override public void updateEntity() { + super.updateEntity(); if (!isAlive && CoreProxy.proxy.isSimulating(worldObj)) { - super.updateEntity(); return; } if (!CoreProxy.proxy.isSimulating(worldObj) && isAlive) { - super.updateEntity(); return; } - super.updateEntity(); if (inProcess) { float energyToUse = 2 + powerProvider.getEnergyStored() / 500; @@ -163,23 +163,16 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept createUtilsIfNeeded(); - if (bluePrintBuilder != null) { + if (blueprintBuilder != null) { - builderDone = bluePrintBuilder.done; + builderDone = !blueprintIterator.hasNext(); if (!builderDone) { - buildFrame(); return; - - } else { - - if (builder != null && builder.done()) { - - box.deleteLasers(); - builder.setDead(); - builder = null; - } + } else if (builder != null && builder.done()) { + killBuilder(); } + } if (builder == null) { @@ -188,6 +181,12 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept } + private void killBuilder() { + box.deleteLasers(); + builder.setDead(); + builder = null; + } + @Override public void doWork(PowerProvider workProvider) { } @@ -195,7 +194,11 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept protected void buildFrame() { powerProvider.configure(50, 100, 25, MAX_ENERGY); - if (powerProvider.useEnergy(25, 25, true) != 25) + + if (!blueprintIterator.hasNext()) + return; + + if (powerProvider.useEnergy(25, 25, false) != 25) return; if (builder == null) { @@ -204,7 +207,12 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept } if (builder.readyToBuild()) { - builder.scheduleContruction(bluePrintBuilder.getNextBlock(worldObj, this), bluePrintBuilder.getContext()); + while (blueprintIterator.hasNext()) { + if (builder.scheduleContruction(blueprintIterator.next())) { + powerProvider.useEnergy(0, 25, true); + break; + } + } } } @@ -275,17 +283,17 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept private void createColumnVisitList() { visitList.clear(); - Integer[][] columnHeights = new Integer[bluePrintBuilder.bluePrint.sizeX - 2][bluePrintBuilder.bluePrint.sizeZ - 2]; - boolean[][] blockedColumns = new boolean[bluePrintBuilder.bluePrint.sizeX - 2][bluePrintBuilder.bluePrint.sizeZ - 2]; + Integer[][] columnHeights = new Integer[blueprintBuilder.blueprint.sizeX - 2][blueprintBuilder.blueprint.sizeZ - 2]; + boolean[][] blockedColumns = new boolean[blueprintBuilder.blueprint.sizeX - 2][blueprintBuilder.blueprint.sizeZ - 2]; for (int searchY = yCoord + 3; searchY >= 0; --searchY) { int startX, endX, incX; if (searchY % 2 == 0) { startX = 0; - endX = bluePrintBuilder.bluePrint.sizeX - 2; + endX = blueprintBuilder.blueprint.sizeX - 2; incX = 1; } else { - startX = bluePrintBuilder.bluePrint.sizeX - 3; + startX = blueprintBuilder.blueprint.sizeX - 3; endX = -1; incX = -1; } @@ -295,10 +303,10 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept if (searchX % 2 == searchY % 2) { startZ = 0; - endZ = bluePrintBuilder.bluePrint.sizeZ - 2; + endZ = blueprintBuilder.blueprint.sizeZ - 2; incZ = 1; } else { - startZ = bluePrintBuilder.bluePrint.sizeZ - 3; + startZ = blueprintBuilder.blueprint.sizeZ - 3; endZ = -1; incZ = -1; } @@ -322,7 +330,7 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept visitList.add(new int[]{bx, by, bz}); } // Stop at two planes - generally any obstructions will have been found and will force a recompute prior to this - if (visitList.size() > bluePrintBuilder.bluePrint.sizeZ * bluePrintBuilder.bluePrint.sizeX * 2) + if (visitList.size() > blueprintBuilder.blueprint.sizeZ * blueprintBuilder.blueprint.sizeX * 2) return; } } @@ -593,38 +601,31 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept forceChunkLoading(chunkTicket); } - private void initializeBluePrintBuilder() { - BptBlueprint bluePrint = new BptBlueprint(box.sizeX(), box.sizeY(), box.sizeZ()); - - for (int i = 0; i < bluePrint.sizeX; ++i) { - for (int j = 0; j < bluePrint.sizeY; ++j) { - for (int k = 0; k < bluePrint.sizeZ; ++k) { - bluePrint.setBlockId(i, j, k, 0); - } - } - } + private void initializeBlueprintBuilder() { + Blueprint blueprint = new Blueprint(box.sizeX(), box.sizeY(), box.sizeZ()); for (int it = 0; it < 2; it++) { - for (int i = 0; i < bluePrint.sizeX; ++i) { - bluePrint.setBlockId(i, it * (box.sizeY() - 1), 0, BuildCraftFactory.frameBlock.blockID); - bluePrint.setBlockId(i, it * (box.sizeY() - 1), bluePrint.sizeZ - 1, BuildCraftFactory.frameBlock.blockID); + for (int i = 0; i < blueprint.sizeX; ++i) { + blueprint.setBlock(i, it * (box.sizeY() - 1), 0, BuildCraftFactory.frameBlock.blockID, 0); + blueprint.setBlock(i, it * (box.sizeY() - 1), blueprint.sizeZ - 1, BuildCraftFactory.frameBlock.blockID, 0); } - for (int k = 0; k < bluePrint.sizeZ; ++k) { - bluePrint.setBlockId(0, it * (box.sizeY() - 1), k, BuildCraftFactory.frameBlock.blockID); - bluePrint.setBlockId(bluePrint.sizeX - 1, it * (box.sizeY() - 1), k, BuildCraftFactory.frameBlock.blockID); + for (int k = 0; k < blueprint.sizeZ; ++k) { + blueprint.setBlock(0, it * (box.sizeY() - 1), k, BuildCraftFactory.frameBlock.blockID, 0); + blueprint.setBlock(blueprint.sizeX - 1, it * (box.sizeY() - 1), k, BuildCraftFactory.frameBlock.blockID, 0); } } for (int h = 1; h < box.sizeY(); ++h) { - bluePrint.setBlockId(0, h, 0, BuildCraftFactory.frameBlock.blockID); - bluePrint.setBlockId(0, h, bluePrint.sizeZ - 1, BuildCraftFactory.frameBlock.blockID); - bluePrint.setBlockId(bluePrint.sizeX - 1, h, 0, BuildCraftFactory.frameBlock.blockID); - bluePrint.setBlockId(bluePrint.sizeX - 1, h, bluePrint.sizeZ - 1, BuildCraftFactory.frameBlock.blockID); + blueprint.setBlock(0, h, 0, BuildCraftFactory.frameBlock.blockID, 0); + blueprint.setBlock(0, h, blueprint.sizeZ - 1, BuildCraftFactory.frameBlock.blockID, 0); + blueprint.setBlock(blueprint.sizeX - 1, h, 0, BuildCraftFactory.frameBlock.blockID, 0); + blueprint.setBlock(blueprint.sizeX - 1, h, blueprint.sizeZ - 1, BuildCraftFactory.frameBlock.blockID, 0); } - bluePrintBuilder = new BptBuilderBlueprint(bluePrint, worldObj, box.xMin, yCoord, box.zMin); + blueprintBuilder = new BlueprintBuilder(blueprint, worldObj, box.xMin, yCoord, box.zMin, ForgeDirection.NORTH, null); + blueprintIterator = blueprintBuilder.getBuilders().listIterator(); } @Override @@ -659,11 +660,10 @@ public class TileQuarry extends TileBuildCraft implements IMachine, IPowerRecept public void reinitalize() { builderDone = false; - initializeBluePrintBuilder(); + initializeBlueprintBuilder(); isDigging = true; } - @Override public PowerProvider getPowerProvider(ForgeDirection side) { return powerProvider;