Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
Fix recipe removal code
Browse files Browse the repository at this point in the history
  • Loading branch information
miozune committed Dec 1, 2023
1 parent 7a79940 commit ac8baaf
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -137,23 +136,22 @@ public static void unificationRecipeEnforcer() {
|| replacement.getItem() == null)
continue;
for (RecipeMap<?> map : RecipeMap.ALL_RECIPE_MAPS.values()) {
nextRecipe: for (Iterator<GT_Recipe> iterator = map.getAllRecipes().iterator(); iterator
.hasNext();) {
GT_Recipe recipe = iterator.next();
List<GT_Recipe> toRemove = new ArrayList<>();
nextRecipe: for (GT_Recipe recipe : map.getAllRecipes()) {
boolean removal = map.equals(RecipeMaps.fluidExtractionRecipes)
|| map.equals(RecipeMaps.fluidSolidifierRecipes);
for (int i = 0; i < recipe.mInputs.length; i++) {
if (!GT_Utility.areStacksEqual(recipe.mInputs[i], toReplace)) continue;
if (removal) {
iterator.remove();
toRemove.add(recipe);
continue nextRecipe;
}
recipe.mInputs[i] = GT_Utility.copyAmount(recipe.mInputs[i].stackSize, replacement);
}
for (int i = 0; i < recipe.mOutputs.length; i++) {
if (!GT_Utility.areStacksEqual(recipe.mOutputs[i], toReplace)) continue;
if (removal) {
iterator.remove();
toRemove.add(recipe);
continue nextRecipe;
}
recipe.mOutputs[i] = GT_Utility
Expand All @@ -162,13 +160,14 @@ public static void unificationRecipeEnforcer() {
if (recipe.mSpecialItems instanceof ItemStack specialItemStack) {
if (!GT_Utility.areStacksEqual(specialItemStack, toReplace)) continue;
if (removal) {
iterator.remove();
toRemove.add(recipe);
continue nextRecipe;
}
recipe.mSpecialItems = GT_Utility
.copyAmount(specialItemStack.stackSize, replacement);
}
}
map.getBackend().removeRecipes(toRemove);
}
}
}
Expand Down

0 comments on commit ac8baaf

Please sign in to comment.