Enqueue a task in JEI so it does not error from wrong thread
@@ -379,10 +379,8 @@ public class JEIPlugin implements IModPlugin {
private static class MaterialReloadListener implements Runnable {
private IIngredientManager manager;
- @Override
- public void run() {
- // note this does not remove old tool parts from the previous materials list, though that is only an issue if the reload command is used
- if (manager != null && !MaterialRegistry.getMaterials().isEmpty()) {
+ /** Run on the main thread when ready */
+ private void deferredRun() {
NonNullList<ItemStack> newStacks = NonNullList.create();
for (Item item : TinkerTags.Items.TOOL_PARTS.getAllElements()) {
item.fillItemGroup(ItemGroup.SEARCH, newStacks);
@@ -394,6 +392,13 @@ public class JEIPlugin implements IModPlugin {
manager.addIngredientsAtRuntime(VanillaTypes.ITEM, newStacks);
}
}
+
+ @Override
+ public void run() {
+ // note this does not remove old tool parts from the previous materials list, though that is only an issue if the reload command is used
+ if (manager != null && !MaterialRegistry.getMaterials().isEmpty()) {
+ Minecraft.getInstance().execute(this::deferredRun);
+ }
}
}
}
