Fixes issue #189
This commit is contained in:
@@ -90,14 +90,16 @@ public class ProcessingCraftingTask implements ICraftingTask {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onInserted(ItemStack inserted) {
|
||||
public boolean onInserted(ItemStack item) {
|
||||
for (int i = 0; i < pattern.getOutputs().length; ++i) {
|
||||
if (!satisfied[i] && RefinedStorageUtils.compareStackNoQuantity(inserted, pattern.getOutputs()[i])) {
|
||||
if (!satisfied[i] && RefinedStorageUtils.compareStackNoQuantity(item, pattern.getOutputs()[i])) {
|
||||
satisfied[i] = true;
|
||||
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -168,19 +168,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
|
||||
craftingTasksToAddAsLast.clear();
|
||||
|
||||
if (!craftingTasks.empty()) {
|
||||
markDirty();
|
||||
|
||||
ICraftingTask top = craftingTasks.peek();
|
||||
|
||||
ICraftingPatternContainer container = top.getPattern().getContainer(worldObj);
|
||||
|
||||
if (container != null && (ticks % container.getSpeed()) == 0 && top.update(worldObj, this)) {
|
||||
top.onDone(this);
|
||||
|
||||
craftingTasks.pop();
|
||||
}
|
||||
}
|
||||
updateTopCraftingTask(true);
|
||||
}
|
||||
|
||||
wirelessGridHandler.update();
|
||||
@@ -219,6 +207,22 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
super.update();
|
||||
}
|
||||
|
||||
private void updateTopCraftingTask(boolean withSpeed) {
|
||||
if (!craftingTasks.empty()) {
|
||||
markDirty();
|
||||
|
||||
ICraftingTask top = craftingTasks.peek();
|
||||
|
||||
ICraftingPatternContainer container = top.getPattern().getContainer(worldObj);
|
||||
|
||||
if (container != null && (!withSpeed || (ticks % container.getSpeed()) == 0) && top.update(worldObj, this)) {
|
||||
top.onDone(this);
|
||||
|
||||
craftingTasks.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void disconnectAll() {
|
||||
for (INetworkNode node : nodes) {
|
||||
if (node.isConnected()) {
|
||||
@@ -507,11 +511,9 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
|
||||
if (!simulate && inserted > 0) {
|
||||
for (int i = 0; i < inserted; ++i) {
|
||||
if (!craftingTasks.empty()) {
|
||||
ICraftingTask top = craftingTasks.peek();
|
||||
|
||||
if (top instanceof ProcessingCraftingTask) {
|
||||
((ProcessingCraftingTask) top).onInserted(stack);
|
||||
if (!craftingTasks.empty() && craftingTasks.peek() instanceof ProcessingCraftingTask) {
|
||||
if (((ProcessingCraftingTask) craftingTasks.peek()).onInserted(stack)) {
|
||||
updateTopCraftingTask(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user