add RF power support to Auto Workbenches
This commit is contained in:
parent
bcb2a40fa5
commit
0a20b53c6d
2 changed files with 31 additions and 4 deletions
|
@ -5,6 +5,7 @@ Additions:
|
||||||
* Blueprint Library renamed to Electronic Library, supports copying books - and soon other things! (asie)
|
* 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!
|
* 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!
|
* **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:
|
* Items:
|
||||||
* Paintbrush for dyeing pipes and other supported blocks (asie)
|
* Paintbrush for dyeing pipes and other supported blocks (asie)
|
||||||
* Debugger for developer use (asie)
|
* Debugger for developer use (asie)
|
||||||
|
|
|
@ -24,7 +24,9 @@ import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import buildcraft.api.core.IInvSlot;
|
import buildcraft.api.core.IInvSlot;
|
||||||
|
import buildcraft.api.power.IRedstoneEngineReceiver;
|
||||||
import buildcraft.api.tiles.IHasWork;
|
import buildcraft.api.tiles.IHasWork;
|
||||||
|
import buildcraft.core.lib.RFBattery;
|
||||||
import buildcraft.core.lib.block.TileBuildCraft;
|
import buildcraft.core.lib.block.TileBuildCraft;
|
||||||
import buildcraft.core.lib.inventory.InvUtils;
|
import buildcraft.core.lib.inventory.InvUtils;
|
||||||
import buildcraft.core.lib.inventory.InventoryConcatenator;
|
import buildcraft.core.lib.inventory.InventoryConcatenator;
|
||||||
|
@ -35,7 +37,7 @@ import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.core.lib.utils.CraftingUtils;
|
import buildcraft.core.lib.utils.CraftingUtils;
|
||||||
import buildcraft.core.lib.utils.Utils;
|
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 SLOT_RESULT = 0;
|
||||||
public static final int CRAFT_TIME = 256;
|
public static final int CRAFT_TIME = 256;
|
||||||
|
@ -65,11 +67,21 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory
|
||||||
private IRecipe currentRecipe;
|
private IRecipe currentRecipe;
|
||||||
private boolean hasWork = false;
|
private boolean hasWork = false;
|
||||||
|
|
||||||
|
public TileAutoWorkbench() {
|
||||||
|
super();
|
||||||
|
this.setBattery(new RFBattery(16, 16, 0));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasWork() {
|
public boolean hasWork() {
|
||||||
return !isJammed && hasWork;
|
return !isJammed && hasWork;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canConnectRedstoneEngine(ForgeDirection side) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private class LocalInventoryCrafting extends InventoryCrafting {
|
private class LocalInventoryCrafting extends InventoryCrafting {
|
||||||
|
|
||||||
public LocalInventoryCrafting() {
|
public LocalInventoryCrafting() {
|
||||||
|
@ -244,10 +256,24 @@ public class TileAutoWorkbench extends TileBuildCraft implements ISidedInventory
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
update++;
|
int updatesLeft = getBattery().getEnergyStored() + 1;
|
||||||
if (update % UPDATE_TIME == 0) {
|
|
||||||
updateCrafting();
|
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) {
|
public int getProgressScaled(int i) {
|
||||||
|
|
Loading…
Reference in a new issue