Fix scheduleCraftingTask
This commit is contained in:
@@ -51,8 +51,8 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
deobfCompile "mezz.jei:jei_1.10.2:3.13.2.349:api"
|
deobfCompile "mezz.jei:jei_1.10.2:3.13.2.353:api"
|
||||||
runtime "mezz.jei:jei_1.10.2:3.13.2.349"
|
runtime "mezz.jei:jei_1.10.2:3.13.2.353"
|
||||||
compile "net.darkhax.tesla:Tesla:1.10.2-1.2.1.49"
|
compile "net.darkhax.tesla:Tesla:1.10.2-1.2.1.49"
|
||||||
compile "net.industrial-craft:industrialcraft-2:2.6.98-ex110:api"
|
compile "net.industrial-craft:industrialcraft-2:2.6.98-ex110:api"
|
||||||
deobfCompile "MCMultiPart:MCMultiPart:1.3.0:universal"
|
deobfCompile "MCMultiPart:MCMultiPart:1.3.0:universal"
|
||||||
|
|||||||
@@ -463,36 +463,28 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduleCraftingTask(ItemStack stack, int toSchedule, int compare) {
|
public void scheduleCraftingTask(ItemStack stack, int toSchedule, int compare) {
|
||||||
int alreadyScheduled = 0;
|
|
||||||
|
|
||||||
for (ICraftingTask task : getCraftingTasks()) {
|
for (ICraftingTask task : getCraftingTasks()) {
|
||||||
for (ItemStack output : task.getPattern().getOutputs()) {
|
for (ItemStack output : task.getPattern().getOutputs()) {
|
||||||
if (API.instance().getComparer().isEqual(output, stack, compare)) {
|
if (API.instance().getComparer().isEqual(output, stack, compare)) {
|
||||||
alreadyScheduled++;
|
toSchedule -= output.stackSize * task.getQuantity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean scheduled = false;
|
if (toSchedule > 0) {
|
||||||
|
|
||||||
for (int i = 0; i < toSchedule - alreadyScheduled; ++i) {
|
|
||||||
ICraftingPattern pattern = getPattern(stack, compare);
|
ICraftingPattern pattern = getPattern(stack, compare);
|
||||||
|
|
||||||
if (pattern != null) {
|
if (pattern != null) {
|
||||||
ICraftingTask task = createCraftingTask(stack, pattern, 1);
|
ICraftingTask task = createCraftingTask(stack, pattern, toSchedule);
|
||||||
|
|
||||||
task.calculate();
|
task.calculate();
|
||||||
task.getMissing().clear();
|
task.getMissing().clear();
|
||||||
|
|
||||||
addCraftingTask(task);
|
addCraftingTask(task);
|
||||||
|
|
||||||
scheduled = true;
|
markCraftingMonitorForUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scheduled) {
|
|
||||||
markCraftingMonitorForUpdate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user