diff --git a/buildcraft_resources/changelog/7.0.0 b/buildcraft_resources/changelog/7.0.0 index 9801fbf5be..2e15aa1344 100644 --- a/buildcraft_resources/changelog/7.0.0 +++ b/buildcraft_resources/changelog/7.0.0 @@ -5,6 +5,7 @@ Additions: * Blueprint Library renamed to Electronic Library, supports copying books - and soon other things! (asie) * Rewritten Zone Planner map system - should have much less lag and take up less disk space! * **Note** - all existing zone planner previews will disappear. To reload them, simply break and place the zone planner! + * You can now apply RF power (or a redstone engine) to an Auto Workbench to speed it up (asie - thanks KingTriaxx!) * Items: * Paintbrush for dyeing pipes and other supported blocks (asie) * Debugger for developer use (asie) diff --git a/common/buildcraft/factory/TileAutoWorkbench.java b/common/buildcraft/factory/TileAutoWorkbench.java index 80785291d7..e273d5f0bd 100644 --- a/common/buildcraft/factory/TileAutoWorkbench.java +++ b/common/buildcraft/factory/TileAutoWorkbench.java @@ -24,7 +24,9 @@ import net.minecraftforge.common.util.ForgeDirection; import buildcraft.api.core.IInvSlot; +import buildcraft.api.power.IRedstoneEngineReceiver; import buildcraft.api.tiles.IHasWork; +import buildcraft.core.lib.RFBattery; import buildcraft.core.lib.block.TileBuildCraft; import buildcraft.core.lib.inventory.InvUtils; import buildcraft.core.lib.inventory.InventoryConcatenator; @@ -35,7 +37,7 @@ import buildcraft.core.lib.utils.CraftingUtils; import buildcraft.core.lib.utils.Utils; -public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory, IHasWork { +public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory, IHasWork, IRedstoneEngineReceiver { public static final int SLOT_RESULT = 0; public static final int CRAFT_TIME = 256; @@ -65,11 +67,21 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory private IRecipe currentRecipe; private boolean hasWork = false; + public TileAutoWorkbench() { + super(); + this.setBattery(new RFBattery(16, 16, 0)); + } + @Override public boolean hasWork() { return !isJammed && hasWork; } + @Override + public boolean canConnectRedstoneEngine(ForgeDirection side) { + return true; + } + private class LocalInventoryCrafting extends InventoryCrafting { public LocalInventoryCrafting() { @@ -244,10 +256,24 @@ public void updateEntity() { return; } - update++; - if (update % UPDATE_TIME == 0) { - updateCrafting(); + int updatesLeft = getBattery().getEnergyStored() + 1; + + while (updatesLeft > 0) { + update++; + + if (update % UPDATE_TIME == 0) { + updateCrafting(); + + if (isJammed || !hasWork || resultInv.getStackInSlot(SLOT_RESULT) != null) { + progress = 0; + break; + } + } + + updatesLeft--; + } + getBattery().setEnergy(0); } public int getProgressScaled(int i) {