Skip to content

Commit

Permalink
Fixrec (#774)
Browse files Browse the repository at this point in the history
* Remove all recipes

* Fix + apply on all removals

---------

Co-authored-by: kuba6000 <kuba.123123.6000@gmail.com>
  • Loading branch information
Dream-Master and kuba6000 authored Dec 7, 2023
1 parent 3e7c477 commit 4942fdb
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/main/java/com/dreammaster/forestry/ForestryHelper.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.dreammaster.forestry;

import java.util.stream.Collectors;

import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;

Expand All @@ -9,31 +11,29 @@
public class ForestryHelper {

public static void removeCarpenterRecipe(ItemStack output) {
RecipeManagers.carpenterManager.removeRecipe(
RecipeManagers.carpenterManager.recipes().stream().filter(
r -> GT_Utility.areStacksEqual(r.getCraftingGridRecipe().getRecipeOutput(), output, true))
.findFirst().orElse(null));
RecipeManagers.carpenterManager.recipes().stream()
.filter(r -> GT_Utility.areStacksEqual(r.getCraftingGridRecipe().getRecipeOutput(), output, true))
.collect(Collectors.toList()).forEach(r -> RecipeManagers.carpenterManager.removeRecipe(r));
}

public static void removeCentrifugeRecipe(ItemStack input) {
RecipeManagers.centrifugeManager.removeRecipe(
RecipeManagers.centrifugeManager.recipes().stream()
.filter(r -> GT_Utility.areStacksEqual(r.getInput(), input, true)).findFirst().orElse(null));
RecipeManagers.centrifugeManager.recipes().stream()
.filter(r -> GT_Utility.areStacksEqual(r.getInput(), input, true)).collect(Collectors.toList())
.forEach(r -> RecipeManagers.centrifugeManager.removeRecipe(r));
}

public static void removeSqueezerRecipe(FluidStack output, ItemStack... inputs) {
RecipeManagers.squeezerManager.removeRecipe(RecipeManagers.squeezerManager.recipes().stream().filter(r -> {
RecipeManagers.squeezerManager.recipes().stream().filter(r -> {
if (!GT_Utility.areFluidsEqual(r.getFluidOutput(), output, true)) return false;
for (int i = 0, inputsLength = inputs.length; i < inputsLength; i++)
if (!GT_Utility.areStacksEqual(r.getResources()[i], inputs[i], true)) return false;
return true;
}).findFirst().orElse(null));
}).collect(Collectors.toList()).forEach(r -> RecipeManagers.squeezerManager.removeRecipe(r));
}

public static void removeFabricatorRecipe(ItemStack output) {
RecipeManagers.fabricatorManager.removeRecipe(
RecipeManagers.fabricatorManager.recipes().stream()
.filter(r -> GT_Utility.areStacksEqual(r.getRecipeOutput(), output, true)).findFirst()
.orElse(null));
RecipeManagers.fabricatorManager.recipes().stream()
.filter(r -> GT_Utility.areStacksEqual(r.getRecipeOutput(), output, true)).collect(Collectors.toList())
.forEach(r -> RecipeManagers.fabricatorManager.removeRecipe(r));
}
}

0 comments on commit 4942fdb

Please sign in to comment.