clean up ore dict improvements

This commit is contained in:
way2muchnoise
2016-11-02 21:04:25 +01:00
parent feff746431
commit 60bf5fc336
2 changed files with 9 additions and 4 deletions

View File

@@ -56,8 +56,7 @@ public class CraftingPattern implements ICraftingPattern {
Object[] inputs = new Object[0]; Object[] inputs = new Object[0];
if (shapedOre) { if (shapedOre) {
inputs = ((ShapedOreRecipe) recipe).getInput(); inputs = ((ShapedOreRecipe) recipe).getInput();
} } else {
else {
try { try {
inputs = (Object[]) recipe.getClass().getMethod("getInput").invoke(recipe); inputs = (Object[]) recipe.getClass().getMethod("getInput").invoke(recipe);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
@@ -67,8 +66,7 @@ public class CraftingPattern implements ICraftingPattern {
for (Object input : inputs) { for (Object input : inputs) {
if (input == null) { if (input == null) {
oreInputs.add(Collections.emptyList()); oreInputs.add(Collections.emptyList());
} } else if (input instanceof ItemStack) {
if (input instanceof ItemStack) {
oreInputs.add(Collections.singletonList((ItemStack) input)); oreInputs.add(Collections.singletonList((ItemStack) input));
} else { } else {
oreInputs.add((List<ItemStack>)input); oreInputs.add((List<ItemStack>)input);

View File

@@ -76,6 +76,13 @@ public class CraftingStepCraft extends CraftingStep {
IItemStackList actualInputs = API.instance().createItemStackList(); IItemStackList actualInputs = API.instance().createItemStackList();
int compare = CraftingTask.DEFAULT_COMPARE | (getPattern().isOredict() ? IComparer.COMPARE_OREDICT : 0); int compare = CraftingTask.DEFAULT_COMPARE | (getPattern().isOredict() ? IComparer.COMPARE_OREDICT : 0);
for (ItemStack insertStack : getToInsert()) { for (ItemStack insertStack : getToInsert()) {
// This will be a tool, like a hammer
if (insertStack.isItemStackDamageable()) {
compare &= ~IComparer.COMPARE_DAMAGE;
} else {
compare |= IComparer.COMPARE_DAMAGE;
}
FluidStack fluidInItem = RSUtils.getFluidFromStack(insertStack, true); FluidStack fluidInItem = RSUtils.getFluidFromStack(insertStack, true);
if (fluidInItem != null) { if (fluidInItem != null) {
network.extractFluid(fluidInItem, fluidInItem.amount, compare); network.extractFluid(fluidInItem, fluidInItem.amount, compare);