Fix crafting upgrade not working anymore, fixes #514

This commit is contained in:
Raoul Van den Berge
2016-10-25 18:54:21 +02:00
parent aeeac1cc1e
commit e94e8dec7f
5 changed files with 11 additions and 6 deletions

View File

@@ -166,7 +166,7 @@ public interface INetworkMaster {
* @param toSchedule the amount of tasks to schedule * @param toSchedule the amount of tasks to schedule
* @param compare the compare value to find patterns * @param compare the compare value to find patterns
*/ */
default void scheduleCraftingTaskIfUnscheduled(ItemStack stack, int toSchedule, int compare) { default void scheduleCraftingTask(ItemStack stack, int toSchedule, int compare) {
int alreadyScheduled = 0; int alreadyScheduled = 0;
for (ICraftingTask task : getCraftingTasks()) { for (ICraftingTask task : getCraftingTasks()) {
@@ -181,7 +181,12 @@ public interface INetworkMaster {
ICraftingPattern pattern = getPattern(stack, compare); ICraftingPattern pattern = getPattern(stack, compare);
if (pattern != null) { if (pattern != null) {
addCraftingTask(createCraftingTask(stack, pattern, 1)); ICraftingTask task = createCraftingTask(stack, pattern, 1);
task.calculate();
// @TODO: Only schedule when there are no items missing?
addCraftingTask(task);
} }
} }
} }

View File

@@ -180,7 +180,7 @@ public class TileConstructor extends TileMultipartNode implements IComparable, I
} else if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) { } else if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) {
ItemStack craft = itemFilters.getStackInSlot(0); ItemStack craft = itemFilters.getStackInSlot(0);
network.scheduleCraftingTaskIfUnscheduled(craft, 1, compare); network.scheduleCraftingTask(craft, 1, compare);
} }
} }
} }

View File

@@ -110,7 +110,7 @@ public class TileCrafter extends TileNode implements ICraftingPatternContainer {
if (triggeredAutocrafting && worldObj.isBlockPowered(pos)) { if (triggeredAutocrafting && worldObj.isBlockPowered(pos)) {
for (ICraftingPattern pattern : actualPatterns) { for (ICraftingPattern pattern : actualPatterns) {
for (ItemStack output : pattern.getOutputs()) { for (ItemStack output : pattern.getOutputs()) {
network.scheduleCraftingTaskIfUnscheduled(output, 1, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT); network.scheduleCraftingTask(output, 1, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT);
} }
} }
} }

View File

@@ -72,7 +72,7 @@ public class TileExporter extends TileMultipartNode implements IComparable, ITyp
network.insertItem(remainder, remainder.stackSize, false); network.insertItem(remainder, remainder.stackSize, false);
} }
} else if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) { } else if (upgrades.hasUpgrade(ItemUpgrade.TYPE_CRAFTING)) {
network.scheduleCraftingTaskIfUnscheduled(slot, 1, compare); network.scheduleCraftingTask(slot, 1, compare);
} }
} }
} }

View File

@@ -90,7 +90,7 @@ public class TileInterface extends TileNode implements IComparable {
exportItems.getStackInSlot(i).stackSize += result.stackSize; exportItems.getStackInSlot(i).stackSize += result.stackSize;
} }
} else { } else {
network.scheduleCraftingTaskIfUnscheduled(wanted, delta, compare); network.scheduleCraftingTask(wanted, delta, compare);
} }
} else if (delta < 0) { } else if (delta < 0) {
ItemStack remainder = network.insertItem(got, Math.abs(delta), false); ItemStack remainder = network.insertItem(got, Math.abs(delta), false);