Fixes #4508: Correctly construct the sparse lists. (#4511)

* Fixes #4508: Correctly construct the sparse lists.

Also renamed all uncondensed getters to sparse and all condensed to the simple ones.

* Apply suggestions from code review

Co-authored-by: shartte <shartte@users.noreply.github.com>

* Streamlined collapsing the sparse lists

* Extracted helper to condense stacks

* Sort lists desc by stack size

Co-authored-by: shartte <shartte@users.noreply.github.com>
This commit is contained in:
yueh
2020-07-27 11:21:06 +02:00
committed by GitHub
parent 6cb6c21495
commit 662dbca3e1
8 changed files with 152 additions and 136 deletions
@@ -113,13 +113,13 @@ public class PatternTerminalPart extends AbstractTerminalPart {
this.setCraftingRecipe(details.isCraftable());
this.setSubstitution(details.canSubstitute());
for (int x = 0; x < this.crafting.getSlots() && x < details.getInputs().length; x++) {
final IAEItemStack item = details.getInputs()[x];
for (int x = 0; x < this.crafting.getSlots() && x < details.getSparseInputs().length; x++) {
final IAEItemStack item = details.getSparseInputs()[x];
this.crafting.setStackInSlot(x, item == null ? ItemStack.EMPTY : item.createItemStack());
}
for (int x = 0; x < this.output.getSlots() && x < details.getOutputs().length; x++) {
final IAEItemStack item = details.getOutputs()[x];
for (int x = 0; x < this.output.getSlots() && x < details.getSparseOutputs().length; x++) {
final IAEItemStack item = details.getSparseOutputs()[x];
this.output.setStackInSlot(x, item == null ? ItemStack.EMPTY : item.createItemStack());
}
}