1.5.27 - Fixed non-oredict patterns not consuming resources, fixes #1570

This commit is contained in:
raoulvdberge
2017-12-09 17:06:31 +01:00
parent 50eaa4f4ce
commit 020e92c6a1
5 changed files with 31 additions and 28 deletions

View File

@@ -23,7 +23,7 @@ public final class RS {
}
public static final String ID = "refinedstorage";
public static final String VERSION = "1.5.26";
public static final String VERSION = "1.5.27";
public static final String DEPENDENCIES = "required-after:forge@[14.21.0.2363,);after:mcmultipart@[2.2.1,);after:storagedrawers@[1.12-5.2.2,);";
public static final String GUI_FACTORY = "com.raoulvdberge.refinedstorage.gui.config.ModGuiFactory";
public static final String UPDATE_JSON = "https://refinedstorage.raoulvdberge.com/update";

View File

@@ -96,33 +96,33 @@ public class CraftingPattern implements ICraftingPattern {
}
} else {
outputs = ItemPattern.getOutputs(stack);
}
if (oreInputs.isEmpty()) {
for (ItemStack input : inputs) {
if (input == null || input.isEmpty()) {
oreInputs.add(Collections.emptyList());
if (oreInputs.isEmpty()) {
for (ItemStack input : inputs) {
if (input == null || input.isEmpty()) {
oreInputs.add(Collections.emptyList());
} else {
int[] ids = OreDictionary.getOreIDs(input);
if (ids.length == 0) {
oreInputs.add(Collections.singletonList(Comparer.stripTags(input)));
} else if (isOredict()) {
List<ItemStack> oredictInputs = Arrays.stream(ids)
.mapToObj(OreDictionary::getOreName)
.map(OreDictionary::getOres)
.flatMap(List::stream)
.map(ItemStack::copy)
.map(Comparer::stripTags)
.peek(s -> s.setCount(input.getCount()))
.collect(Collectors.toList());
// Add original stack as first, should prevent some issues
oredictInputs.add(0, Comparer.stripTags(input.copy()));
oreInputs.add(oredictInputs);
} else {
int[] ids = OreDictionary.getOreIDs(input);
if (ids.length == 0) {
oreInputs.add(Collections.singletonList(Comparer.stripTags(input)));
} else if (isOredict()) {
List<ItemStack> oredictInputs = Arrays.stream(ids)
.mapToObj(OreDictionary::getOreName)
.map(OreDictionary::getOres)
.flatMap(List::stream)
.map(ItemStack::copy)
.map(Comparer::stripTags)
.peek(s -> s.setCount(input.getCount()))
.collect(Collectors.toList());
// Add original stack as first, should prevent some issues
oredictInputs.add(0, Comparer.stripTags(input.copy()));
oreInputs.add(oredictInputs);
} else {
oreInputs.add(Collections.singletonList(Comparer.stripTags(input)));
}
oreInputs.add(Collections.singletonList(Comparer.stripTags(input)));
}
}
}