Some more fixes.
This commit is contained in:
@@ -51,13 +51,13 @@ public interface ICraftingPattern {
|
|||||||
ItemStack getOutput(NonNullList<ItemStack> took);
|
ItemStack getOutput(NonNullList<ItemStack> took);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the outputs
|
* @return the byproducts
|
||||||
*/
|
*/
|
||||||
NonNullList<ItemStack> getByproducts();
|
NonNullList<ItemStack> getByproducts();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param took the items took per slot
|
* @param took the items took per slot
|
||||||
* @return the outputs based on the items took
|
* @return the byproducts based on the items took
|
||||||
*/
|
*/
|
||||||
NonNullList<ItemStack> getByproducts(NonNullList<ItemStack> took);
|
NonNullList<ItemStack> getByproducts(NonNullList<ItemStack> took);
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ public class CraftingPattern implements ICraftingPattern {
|
|||||||
|
|
||||||
public ItemStack getOutput(NonNullList<ItemStack> took) {
|
public ItemStack getOutput(NonNullList<ItemStack> took) {
|
||||||
if (processing) {
|
if (processing) {
|
||||||
throw new IllegalStateException("Cannot get crafting outputs from processing pattern");
|
throw new IllegalStateException("Cannot get crafting output from processing pattern");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (took.size() != inputs.size()) {
|
if (took.size() != inputs.size()) {
|
||||||
@@ -148,13 +148,17 @@ public class CraftingPattern implements ICraftingPattern {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NonNullList<ItemStack> getByproducts() {
|
public NonNullList<ItemStack> getByproducts() {
|
||||||
|
if (processing) {
|
||||||
|
throw new IllegalStateException("Cannot get byproduct outputs from processing pattern");
|
||||||
|
}
|
||||||
|
|
||||||
return byproducts;
|
return byproducts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NonNullList<ItemStack> getByproducts(NonNullList<ItemStack> took) {
|
public NonNullList<ItemStack> getByproducts(NonNullList<ItemStack> took) {
|
||||||
if (processing) {
|
if (processing) {
|
||||||
throw new IllegalStateException("Cannot get crafting outputs from processing pattern");
|
throw new IllegalStateException("Cannot get byproduct outputs from processing pattern");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (took.size() != inputs.size()) {
|
if (took.size() != inputs.size()) {
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ public class CraftingExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
status.set(i, CraftingExtractorItemStatus.EXTRACTED);
|
status.set(i, CraftingExtractorItemStatus.EXTRACTED);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
|
|
||||||
ItemStack fromSelf = results.get(possibleInput);
|
ItemStack fromSelf = results.get(possibleInput);
|
||||||
if (fromSelf != null) {
|
if (fromSelf != null) {
|
||||||
int toExtractFromSelf = fromSelf.getCount();
|
int toExtractFromSelf = Math.min(possibleInput.getCount(), fromSelf.getCount());
|
||||||
|
|
||||||
results.remove(fromSelf, Math.min(possibleInput.getCount(), toExtractFromSelf));
|
results.remove(possibleInput, toExtractFromSelf);
|
||||||
|
|
||||||
toExtract -= toExtractFromSelf;
|
toExtract -= toExtractFromSelf;
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
this.toCraft.add(possibleInput, missing);
|
this.toCraft.add(possibleInput, missing);
|
||||||
|
|
||||||
while (missing > 0) {
|
while (missing > 0) {
|
||||||
this.steps.add(calculateInternal(mutatedStorage, results, subPattern));
|
this.steps.add(calculateInternal(mutatedStorage, results, subPattern)); // TODO: eating from itself?
|
||||||
|
|
||||||
missing -= getQuantityPerCraft(subPattern, possibleInput);
|
missing -= getQuantityPerCraft(subPattern, possibleInput);
|
||||||
}
|
}
|
||||||
@@ -119,10 +119,6 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
for (ItemStack output : pattern.getOutputs()) {
|
for (ItemStack output : pattern.getOutputs()) {
|
||||||
results.add(output);
|
results.add(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ItemStack byproduct : pattern.getByproducts()) {
|
|
||||||
results.add(byproduct);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
results.add(pattern.getOutput(took));
|
results.add(pattern.getOutput(took));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user