diff --git a/CHANGELOG.md b/CHANGELOG.md index 20828888..97b9c3c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,5 @@ ### Tweaks -* Re-enabled stack batching for 1.21 -* Query creative group contents on thread. This may cause slight notable performance dips but will significantly improve compatibility -* Redundant JEI initialization will not be performed on mods with dedicated EMI integration, increasing performance in those situations +* Tweaked JEI/EMI compatibility disabling to not load plugins earlier than previously expected ### Fixes -* Various fixes to modern JEI compatibility -* Fix recipe filling behavior having incorrect behavior with edge case slot interactions -* Fixed invisible slots having rendered overlays when they should not #654 -* Fixed handling for extra mouse button binds #645 +* Fixed regression in item group querying causing errors to cascade outside of single groups diff --git a/fabric/src/main/java/dev/emi/emi/platform/fabric/EmiAgnosFabric.java b/fabric/src/main/java/dev/emi/emi/platform/fabric/EmiAgnosFabric.java index c188fec5..1332be0b 100644 --- a/fabric/src/main/java/dev/emi/emi/platform/fabric/EmiAgnosFabric.java +++ b/fabric/src/main/java/dev/emi/emi/platform/fabric/EmiAgnosFabric.java @@ -107,6 +107,21 @@ protected List getAllModAuthorsAgnos() { .map(p -> p.getName()).distinct().toList(); } + @Override + protected List getModsWithPluginsAgnos() { + List list = Lists.newArrayList(); + for (EntrypointContainer container : FabricLoader.getInstance().getEntrypointContainers("emi", EmiPlugin.class)) { + try { + list.add(container.getProvider().getMetadata().getId()); + } catch (Throwable t) { + EmiLog.error("Critical exception thrown when reading EMI Plugin from mod " + container.getProvider().getMetadata().getId()); + EmiLog.error(t); + } + } + return list; + } + + @Override protected List getPluginsAgnos() { List list = Lists.newArrayList(); diff --git a/gradle.properties b/gradle.properties index 487fbec5..4c1eba6d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ minecraft_version=1.20.4 enabled_platforms=fabric,neoforge archives_base_name=emi -mod_version=1.1.11 +mod_version=1.1.12 maven_group=dev.emi architectury_version=4.9.83 diff --git a/neoforge/src/main/java/dev/emi/emi/platform/neoforge/EmiAgnosNeoForge.java b/neoforge/src/main/java/dev/emi/emi/platform/neoforge/EmiAgnosNeoForge.java index 8cbc657b..6a354e52 100644 --- a/neoforge/src/main/java/dev/emi/emi/platform/neoforge/EmiAgnosNeoForge.java +++ b/neoforge/src/main/java/dev/emi/emi/platform/neoforge/EmiAgnosNeoForge.java @@ -108,6 +108,25 @@ protected List getAllModNamesAgnos() { return ModList.get().getMods().stream().map(m -> m.getDisplayName()).toList(); } + @Override + protected List getModsWithPluginsAgnos() { + List mods = Lists.newArrayList(); + Type entrypointType = Type.getType(EmiEntrypoint.class); + for (ModFileScanData data : ModList.get().getAllScanData()) { + for (ModFileScanData.AnnotationData annot : data.getAnnotations()) { + try { + if (entrypointType.equals(annot.annotationType())) { + mods.add(data.getIModInfoData().get(0).getMods().get(0).getModId()); + } + } catch (Throwable t) { + EmiLog.error("Exception constructing entrypoint:"); + t.printStackTrace(); + } + } + } + return mods; + } + @Override protected List getPluginsAgnos() { List containers = Lists.newArrayList(); diff --git a/xplat/src/main/java/dev/emi/emi/jemi/JemiUtil.java b/xplat/src/main/java/dev/emi/emi/jemi/JemiUtil.java index 10dca4c0..43149600 100644 --- a/xplat/src/main/java/dev/emi/emi/jemi/JemiUtil.java +++ b/xplat/src/main/java/dev/emi/emi/jemi/JemiUtil.java @@ -89,8 +89,8 @@ public static IIngredientType getFluidType() { public static Set getHandledMods() { Set set = Sets.newHashSet(); - for (EmiPluginContainer plugin : EmiAgnos.getPlugins()) { - set.add(plugin.id()); + for (String mod : EmiAgnos.getModsWithPlugins()) { + set.add(mod); } return set; } diff --git a/xplat/src/main/java/dev/emi/emi/platform/EmiAgnos.java b/xplat/src/main/java/dev/emi/emi/platform/EmiAgnos.java index b9532c8f..0a3186d5 100644 --- a/xplat/src/main/java/dev/emi/emi/platform/EmiAgnos.java +++ b/xplat/src/main/java/dev/emi/emi/platform/EmiAgnos.java @@ -76,6 +76,12 @@ public static List getAllModAuthors() { protected abstract List getAllModAuthorsAgnos(); + public static List getModsWithPlugins() { + return delegate.getModsWithPluginsAgnos(); + } + + protected abstract List getModsWithPluginsAgnos(); + public static List getPlugins() { return delegate.getPluginsAgnos(); } diff --git a/xplat/src/main/java/dev/emi/emi/registry/EmiStackList.java b/xplat/src/main/java/dev/emi/emi/registry/EmiStackList.java index aa5f3390..4205ad67 100644 --- a/xplat/src/main/java/dev/emi/emi/registry/EmiStackList.java +++ b/xplat/src/main/java/dev/emi/emi/registry/EmiStackList.java @@ -81,8 +81,15 @@ public static void reload() { Map> itemGroupToStacksMap = client.submit(() -> { Map> map = new Reference2ReferenceOpenHashMap<>(); for (ItemGroup group : ItemGroups.getGroups()) { - group.updateEntries(context); - map.put(group, group.getSearchTabStacks()); + String groupName = "null"; + try { + groupName = group.getDisplayName().toString(); + group.updateEntries(context); + map.put(group, group.getSearchTabStacks()); + } catch(Exception e) { + EmiLog.error("Creative item group " + groupName + " threw while EMI was attempting to construct the index, items may be missing."); + EmiLog.error(e); + } } return map; }).join();