mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-14 01:04:12 +00:00
Merge pull request #815 from bdew/fix-squeezer-od
Fixes to OreDictionary support in squeezer recipes
This commit is contained in:
commit
eef67a43ac
2 files changed
+14
-7
No files matched your search
@@ -386,6 +386,14 @@ public class MachineSqueezer extends TilePowered implements ISocketable, ISidedI
|
||||
}
|
||||
|
||||
public static ISqueezerRecipe findMatchingRecipe(ItemStack[] items) {
|
||||
// First try to match a specific recipe (without OD)
|
||||
for (ISqueezerRecipe recipe : recipes) {
|
||||
if (StackUtils.containsSets(recipe.getResources(), items, false, false) > 0) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
||||
// If that fails - try again with oredict support enabled
|
||||
for (ISqueezerRecipe recipe : recipes) {
|
||||
if (StackUtils.containsSets(recipe.getResources(), items, true, false) > 0) {
|
||||
return recipe;
|
||||
@@ -400,7 +408,7 @@ public class MachineSqueezer extends TilePowered implements ISocketable, ISidedI
|
||||
return true;
|
||||
}
|
||||
for (ItemStack recipeInput : recipeInputs) {
|
||||
if (StackUtils.isCraftingEquivalent(recipeInput, itemStack)) {
|
||||
if (StackUtils.isCraftingEquivalent(recipeInput, itemStack, true, false)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,13 +157,12 @@ public class NEIHandlerSqueezer extends RecipeHandlerBase {
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingred) {
|
||||
for (ISqueezerRecipe recipe : MachineSqueezer.RecipeManager.recipes) {
|
||||
ISqueezerRecipe recipe = MachineSqueezer.RecipeManager.findMatchingRecipe(new ItemStack[]{ingred});
|
||||
if (recipe != null) {
|
||||
CachedSqueezerRecipe crecipe = new CachedSqueezerRecipe(recipe);
|
||||
if (crecipe.inputs != null && crecipe.contains(crecipe.inputs, ingred)) {
|
||||
crecipe.generatePermutations();
|
||||
crecipe.setIngredientPermutation(crecipe.inputs, ingred);
|
||||
this.arecipes.add(crecipe);
|
||||
}
|
||||
// Override recipe to show the right input in case it's OD
|
||||
crecipe.setIngredients(new ItemStack[]{ingred});
|
||||
this.arecipes.add(crecipe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user