Fixed autocrafting not giving back byproducts, fixes #390

This commit is contained in:
Raoul Van den Berge
2016-09-27 17:08:41 +02:00
parent b4fe9164c3
commit fe8de80ca3
4 changed files with 16 additions and 0 deletions

View File

@@ -33,6 +33,11 @@ public interface ICraftingPattern {
*/
List<ItemStack> getOutputs();
/**
* @return the byproducts
*/
List<ItemStack> getByproducts();
/**
* @return the id of the factory that creates a crafting task for this pattern, as defined in the registry
*/

View File

@@ -91,6 +91,11 @@ public class CraftingPattern implements ICraftingPattern {
return outputs;
}
@Override
public List<ItemStack> getByproducts() {
return byproducts;
}
@Override
public String getId() {
return ItemPattern.isProcessing(stack) ? CraftingTaskFactoryProcessing.ID : CraftingTaskFactoryNormal.ID;

View File

@@ -45,6 +45,11 @@ public class CraftingTaskNormal extends CraftingTask {
network.insertItem(output, output.stackSize, false);
}
for (ItemStack byproduct : pattern.getByproducts()) {
// @TODO: Handle remainder
network.insertItem(byproduct, byproduct.stackSize, false);
}
return true;
}