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