GregTechCEu / GregTech-Modern

GregTech CE Unofficial for modern versions
GNU Lesser General Public License v3.0
291 stars 172 forks source link

Rhino throws errors when attempting to add more than 1 recipe modifier to a custom multiblock via a KubeJS script #1894

Closed AncientShotgun closed 2 months ago

AncientShotgun commented 2 months ago

Checked for existing issues

Tested latest version

GregTech CEu Version

v1.4.0

Minecraft Version

1.20.1

Recipe Viewer Installed

EMI

Environment

Singleplayer

Cross-Mod Interaction

Yes

Other Installed Mods

Modpack is lightly modified instance of Sky Greg v1.25, in which I have updated GTCEu Modern from v1.1.4a to 1.4.0 Relevant mod versions are: Rhino 2001.2.3-build.6 KubeJS 2001.6.5-build.14

Expected Behavior

Expected behaviour: No error is thrown when more than one recipe modifier is given as input in the .recipeModifiers() method of the MultiblockBuilder of a multiblock machine I am customizing.

Actual Behavior

Actual behaviour: Rhino errors are thrown to the Minecraft console stating that Rhino cannot find a method in com.gregtechceu.gtceu.api.registry.registrate.MultiblockMachineBuilder called .recipeModifiers that takes input parameters of type com.gregtechceu.gtceu.common.data.GTRecipeModifiers$$Lambda$18211/0x00000195a15db398 (corresponds to the GTRecipeModifers.PARALLEL_HATCH modifier) and com.gregtechceu.gtceu.common.data.GTRecipeModifiers$ElectricOverclockModifier (corresponds to GTRecipeModifiers.ELECTRIC_OVERCLOCK with OverclockingLogic.PERFECT_OVERCLOCK or OverclockingLogic.NON_PERFECT_OVERCLOCK applied). These errors are fatal and cause Minecraft to crash to desktop with exit code -1.

Steps to Reproduce

1) Using the mods listed above at their listed versions, define in a KubeJS script an arbitrary custom multiblock via a builder, using the step-by-step instructions given in the GTCEu Modern documentation, making sure to add more than one recipe modifer to it via the .recipeModifiers() method of the builder. 2) Attempt to launch Minecraft. 3) After the Mod Gather stage is completed, Rhino will immediately throw the relevant errors and crash Minecraft to desktop.

Additional Information

Here is the script I am modifying that Rhino throws the errors on: CUSTOM MULTIBLOCKS.zip I placed it in the minecraft/kubejs/startup_scripts folder, as instructed. For privacy reasons, I am unable to supply any crash logs.

screret commented 2 months ago

For privacy reasons, I am unable to supply any crash logs. without crash logs It'll be harder to help you.

AncientShotgun commented 2 months ago

Apologies for any inconvenience; I have obfuscated all personal information: latest.log crash-2024-09-04_14.48.48-client.txt

screret commented 2 months ago

the attached script doesn't match the log you've sent.

screret commented 2 months ago

anyway, try putting the recipe modifiers in the call in [] like this: .recipeModifiers([GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)])

AncientShotgun commented 2 months ago

Oh, I see. Make the input an array, which might match better to the varargs collection type the method takes as input. I will try this and report back.

AncientShotgun commented 2 months ago

Test results are positive! MInecraft launches successfully and loads my singleplayer world correctly. I will soon create a new issue in your documentation repository asking for this fix to be reflected in your documentation, but at this point this issue is solved; I will close it.