GregTechCEu Modern

GregTechCEu Modern

6M Downloads

Declaring KubeJS recipes through event.custom results in crashes

Xefyr0 opened this issue ยท 2 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.6

Minecraft Version

1.20.1

Recipe Viewer Installed

EMI

Environment

Singleplayer

Cross-Mod Interaction

Yes

Other Installed Mods

KubeJS, EMI, and all relevant dependencies

Expected Behavior

Declaring a recipe using KubeJS in event.custom according to the JSON format Gregtech: Modern uses would result in the recipe being created, or nothing would occur if it wasn't an intended feature.

Actual Behavior

Declaring a GT recipe in event.custom causes a crash if the recipe is in server_scripts when loading in to a world.
If the player starts in-game and then uses /reload to trigger the script after the fact, errors appear in the logs that contradict the in-game text notifications:
no_errors_my_ass

Steps to Reproduce

  1. Make a new instance.
  2. Copy the zipped example.js into KubeJS' server_scripts folder.
  3. Launch the game.
  4. Try to load into a world, triggering the script.
  5. Crash.
    example.zip

Additional Information

logs.zip is an archive of the game's logs when the script is in the game from the start.
logs-reload.zip is an archive of the game's logs when the player loads in to the world before adding the script, then uses /reload.
logs.zip
logs-reload.zip

commented

Is there an adequate amount of user QoL incentive available for the devs to consider fixing this error? The docs say to use an event.recipes.gtceu.<machine_name>() call, which returns a RecipeBuilder for the scripter to fill in. GTCEuM even uses RecipeBuilders in it's own code, and I can't see any pre-pickled .json recipe files in the codebase...They're all directly registered at runtime from RecipeBuilders, as far as I can tell, and never even approach a JSON serializer or deserializer.
Where did you get that JSON recipe structure, anyway? Is there a file like it in the compiled .jar that I can reference?

commented

yeap I had to just convert json to item stacks to achieve this, see here