EMI

EMI

1M Downloads

[Neoforge 1.21] Creative search does not work

medsal15 opened this issue ยท 6 comments

commented

Using EMI 1.1.7+1.21-neoforge, neoforge 21.0.14-beta.

Opening the creative menu, going in the search tab, and typing anything empties it.

commented

I can also confirm the same issue in Fabric 1.21. This error is spamming my logs whenever I try and search.

[13:06:15] [Thread-115/ERROR]: [EMI] java.lang.Thread.run(Thread.java:1583)

[13:06:15] [Thread-115/ERROR]: [EMI] Exception thrown when parsing EMI recipe (no ID available)
[13:06:15] [Thread-115/INFO]: [STDERR]: java.lang.NullPointerException: Cannot invoke "net.minecraft.class_2960.method_12836()" because "id" is null
[13:06:15] [Thread-115/INFO]: [STDERR]: 	at dev.emi.emi.EmiUtil.subId(EmiUtil.java:43)
[13:06:15] [Thread-115/INFO]: [STDERR]: 	at dev.emi.emi.VanillaPlugin.lambda$addRepair$44(VanillaPlugin.java:557)
[13:06:15] [Thread-115/INFO]: [STDERR]: 	at dev.emi.emi.VanillaPlugin.addRecipeSafe(VanillaPlugin.java:838)
[13:06:15] [Thread-115/INFO]: [STDERR]: 	at dev.emi.emi.VanillaPlugin.addRepair(VanillaPlugin.java:556)
[13:06:15] [Thread-115/INFO]: [STDERR]: 	at dev.emi.emi.VanillaPlugin.lambda$register$28(VanillaPlugin.java:462)
[13:06:15] [Thread-115/INFO]: [STDERR]: 	at dev.emi.emi.VanillaPlugin.safely(VanillaPlugin.java:829)
[13:06:15] [Thread-115/INFO]: [STDERR]: 	at dev.emi.emi.VanillaPlugin.register(VanillaPlugin.java:462)
[13:06:15] [Thread-115/INFO]: [STDERR]: 	at dev.emi.emi.runtime.EmiReloadManager$ReloadWorker.run(EmiReloadManager.java:185)
[13:06:15] [Thread-115/INFO]: [STDERR]: 	at java.base/java.lang.Thread.run(Thread.java:1583)
[13:06:15] [Thread-115/ERROR]: [EMI] java.lang.NullPointerException: Cannot invoke "net.minecraft.class_2960.method_12836()" because "id" is null
	at dev.emi.emi.EmiUtil.subId(EmiUtil.java:43)
	at dev.emi.emi.VanillaPlugin.lambda$addRepair$44(VanillaPlugin.java:557)
commented

To add additional context to this, I dug into this because it was suspected to potentially be a NeoForge issue and found that this is caused by EMI's reload process calling CreativeModeTabs.tryRebuildTabContents() from EmiStackList.reload(). When opening the creative inventory without EMI for the first time after loading a world or reloading data, the following happens:

  1. The CreativeModeInventoryScreen constructor calls CreativeModeInventoryScreen#tryRebuildTabContents()
  2. This calls CreativeModeTabs.tryRebuildTabContents(), which refreshes the actual tab contents and returns true
  3. The search trees are updated via SessionSearchTrees#updateCreativeTooltips() and SessionSearchTrees#updateCreativeTags() (this looks slightly different on NeoForge due to it allowing mods to add search to their creative tabs, but the principle is the same)

When EMI is installed, this breaks down at step two because CreativeModeTabs.tryRebuildTabContents() returns false due to the built tab contents still being valid after EMI's earlier call to that method, leading to the search trees never getting updated.

NeoForge: 21.0.14-beta
EMI: 1.1.7+1.21


While debugging this, I also ran into the recipe ID logspam issue mentioned above, as far as I can tell it's completely separate from the search issue though and happens when you load a world, leave the world and then load a world again (the same or a different one doesn't make a difference).

commented

Same on Fabric

commented

Also experiencing this on Fabric with EMI 1.17+1.21.

commented

This should have been resolved in 1.1.8

commented

I am also experiencing this issue on Fabric 1.21 0.15.11 with EMI 1.1.7+1.21