diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-12-13 00:13:01 +0100 |
---|---|---|
committer | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-12-13 00:13:01 +0100 |
commit | 05ea5eb862d44e695cf71d7f0c4c718ba72023c7 (patch) | |
tree | ebca1e95aaf7d0422edfb7a597cb422bbb6e9c6d /src/main | |
parent | 8c35bce9a6b7f1d917778243047a16eba791c5d9 (diff) | |
download | GT5-Unofficial-05ea5eb862d44e695cf71d7f0c4c718ba72023c7.tar.gz GT5-Unofficial-05ea5eb862d44e695cf71d7f0c4c718ba72023c7.tar.bz2 GT5-Unofficial-05ea5eb862d44e695cf71d7f0c4c718ba72023c7.zip |
removed index of call
+ by using an iterator instead of functional call
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
Former-commit-id: 9ff73dc8b87c91fc8cf41c63f6d8a4664af7d68e
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/github/bartimaeusnek/ASM/BWCoreStaticReplacementMethodes.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreStaticReplacementMethodes.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreStaticReplacementMethodes.java index 9552528acf..3f692c176a 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreStaticReplacementMethodes.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreStaticReplacementMethodes.java @@ -29,6 +29,7 @@ import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.World; +import java.util.Iterator; import java.util.LinkedList; import java.util.Optional; @@ -78,10 +79,17 @@ public class BWCoreStaticReplacementMethodes { return new ItemStack(itemstack.getItem(), 1, i1); } else { - Optional<IRecipe> iPossibleRecipe = RECENTLYUSEDRECIPES.stream().filter(r -> r.matches(inventoryCrafting, world)).findFirst(); + Optional<IRecipe> iPossibleRecipe = Optional.empty(); + int index = 0; + for (Iterator<IRecipe> iterator = RECENTLYUSEDRECIPES.iterator(); iterator.hasNext(); ++index) { + IRecipe RECENTLYUSEDRECIPE = iterator.next(); + if (RECENTLYUSEDRECIPE.matches(inventoryCrafting, world)) { + iPossibleRecipe = Optional.of(RECENTLYUSEDRECIPE); + break; + } + } if (iPossibleRecipe.isPresent()) { - int index = RECENTLYUSEDRECIPES.indexOf(iPossibleRecipe.get()); if (index != 0) { --index; RECENTLYUSEDRECIPES.remove(iPossibleRecipe.get()); |