diff options
author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2022-06-26 21:17:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-26 21:17:47 +0200 |
commit | 746f08dacdbf6be5e239e9ce1856395a1bcef7ec (patch) | |
tree | a279e50ec670deadf39c3347aaec0f8456001ff2 /src/main | |
parent | acc30659db177dddc62d591050e9294361282492 (diff) | |
download | GT5-Unofficial-746f08dacdbf6be5e239e9ce1856395a1bcef7ec.tar.gz GT5-Unofficial-746f08dacdbf6be5e239e9ce1856395a1bcef7ec.tar.bz2 GT5-Unofficial-746f08dacdbf6be5e239e9ce1856395a1bcef7ec.zip |
Fix Concurrent Modification Exception (#146)
Former-commit-id: 168fc321d252ea1526cb076b15213c1e1454fc01
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java index 2988df6b7f..50f5f4f685 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/RecipeFinderForParallel.java @@ -8,6 +8,7 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; /** * Handle the parallel more efficient. @@ -90,14 +91,15 @@ public class RecipeFinderForParallel { /*OreDict Stuff*/ /*Wildcard Stuff*/ - for (int tItem : tCompressedItemRecipe.keySet()) { + for (Iterator<Integer> i = tCompressedItemRecipe.keySet().iterator(); i.hasNext();) { + int tItem = i.next(); if (tItem >> 16 == Short.MAX_VALUE) { for (ItemStack tInputItem : aItemStacks) { int InputID = GT_Utility.stackToInt(tInputItem); if ((InputID & 0xffff) == (tItem & 0xffff)) { if (tInputItem.stackSize >= tCompressedItemRecipe.get(tItem)) { tInputItem.stackSize -= tCompressedItemRecipe.get(tItem); - tCompressedItemRecipe.remove(tItem); + i.remove(); break; } else { @@ -118,7 +120,7 @@ public class RecipeFinderForParallel { input.stackSize -= d; } if (tTargetAmount == 0) { - tCompressedItemRecipe.remove(tItem); + i.remove(); break; } } |