Skip to content

Commit d2bd1f3

Browse files
authored
Merge pull request #31 from FTBTeam/1.20.1/dev
fix: fix threading issue for JEI loot crate integration
2 parents bb6d28e + ff4ecce commit d2bd1f3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Diff for: common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/jei/LootCrateRecipeManagerPlugin.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import mezz.jei.api.recipe.RecipeType;
1010
import mezz.jei.api.recipe.advanced.IRecipeManagerPlugin;
1111
import mezz.jei.api.recipe.category.IRecipeCategory;
12+
import net.minecraft.client.Minecraft;
1213
import net.minecraft.world.item.ItemStack;
1314

1415
import java.util.List;
@@ -19,12 +20,16 @@ public enum LootCrateRecipeManagerPlugin implements IRecipeManagerPlugin {
1920
private final WrappedLootCrateCache cache = new WrappedLootCrateCache(
2021
crates -> {
2122
if (FTBQuestsJEIIntegration.runtime != null && !crates.isEmpty()) {
22-
FTBQuestsJEIIntegration.runtime.getIngredientManager().removeIngredientsAtRuntime(VanillaTypes.ITEM_STACK, crates);
23+
Minecraft.getInstance().tell(() ->
24+
FTBQuestsJEIIntegration.runtime.getIngredientManager().removeIngredientsAtRuntime(VanillaTypes.ITEM_STACK, crates)
25+
);
2326
}
2427
},
2528
crates -> {
2629
if (FTBQuestsJEIIntegration.runtime != null && !crates.isEmpty()) {
27-
FTBQuestsJEIIntegration.runtime.getIngredientManager().addIngredientsAtRuntime(VanillaTypes.ITEM_STACK, crates);
30+
Minecraft.getInstance().tell(() ->
31+
FTBQuestsJEIIntegration.runtime.getIngredientManager().addIngredientsAtRuntime(VanillaTypes.ITEM_STACK, crates)
32+
);
2833
}
2934
}
3035
);

Diff for: common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/recipemod_common/WrappedLootCrateCache.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public List<WrappedLootCrate> getWrappedLootCrates() {
3434
}
3535

3636
private void rebuildWrappedLootCrateCache() {
37-
preRebuild.accept(crateStacks);
37+
preRebuild.accept(List.copyOf(crateStacks));
3838

3939
wrappedLootCratesCache.clear();
4040
crateStacks.clear();
@@ -49,7 +49,7 @@ private void rebuildWrappedLootCrateCache() {
4949
}
5050
}
5151

52-
postRebuild.accept(crateStacks);
52+
postRebuild.accept(List.copyOf(crateStacks));
5353
}
5454

5555
public void refresh() {

0 commit comments

Comments
 (0)