GregTechCEu Modern

GregTechCEu Modern

6M Downloads

EMI does not show multiblock structure previews that have been defined by KubeJS, and it doesn't show any recipes, whether native to GTCEuM or custom

AncientShotgun opened this issue ยท 4 comments

commented

Checked for existing issues

  • I have checked for existing issues, and have found none.

Tested latest version

  • I have checked that this occurs on the latest version.

GregTech CEu Version

1.4.4

Minecraft Version

1.20.1

Recipe Viewer Installed

EMI

Environment

Singleplayer

Cross-Mod Interaction

Yes

Other Installed Mods

Tweaked instance of Sky Greg

Expected Behavior

All multiblock structure previews should be shown in EMI, whether native or custom. All recipes should be shown in EMI, whether native or custom.

Actual Behavior

As per emilyploszaj/emi#728 (comment), EMI does not display Multiblock structure previews of custom KubeJS multiblocks, but can still display structure previews of native multiblocks. Additionally, it does not display machine processing recipes, whether native or custom.
All recipes can be executed and multiblocks can form without issue; they are simply not displayed.
Relevant mod versions, as well as a log recording the issue, can be found in the issue ticket mentioned above.
If required, I can provide an example multiblock and recipe definition to test against.

Steps to Reproduce

  1. The issue arises spontaneously as EMI collects recipe information upon logging into a world: logging into a world with the listed mods at the listed versions causes this issue.

Additional Information

EMI's repo owner has already determined that this is a GTCEuM issue, not an EMI one.

commented

Could you share your kjs files? This can happen when an invalid multiblock is attempted to be registered. Specifically the one in CUSTOM MULTIBLOCKS.js around L141.

commented

Of course, here you go:
CUSTOM MULTIBLOCKS_tweaked.zip
It could be that the error is happening because I am calling two different versions of .autoAbilites() in sequence for a single .where(), first the one that specifies the input and output buses/hatches according to the assigned recipe types and then the one that specifies muffler, maintenance and parallel hatches; native multiblock definitions do that too, however, so it likely isn't the problem.
This theory also doesn't explain why EMI isn't displaying any machine processing recipes, custom or native.

commented

Yes, actually, that is the problem, somewhat. In KubeJS scripts, it seems you have to explicitly use
.or(Predicates.abilities(PartAbility.PARALLEL_HATCH).setMaxGlobalLimited(1))
This is because JavaScript is a fun language where types are imaginary.

When you try to call the 3 boolean overload of Predicates#autoAbilities(bool, bool, bool), it seems to coerce the true, false, true into a set of varargs of type GTRecipeType and calls the Predications#autoAbiltiies(GTRecipeType...) method.

This throws an exception, which EMI catches. When EMI catches an exception from a plugin, it stops processing the plugin and skips it. This is what causes the entirety of GT's recipe book to not show.

commented

robloxoof.ogg
So it's gonna be either a disambiguated call or a method chain with .or()...
Screw those square brackets, not like filesize is at a premium these days.
Many thanks for your help! ๐Ÿ‘
Issue resolved.