CleanroomMC / GroovyScript

A scripting mod for Minecraft without the issues of other scripting mods.
GNU Lesser General Public License v3.0
41 stars 28 forks source link

Cannot create basic aspect of Thaumcraft #228

Closed EdwinYoungSteve closed 1 month ago

EdwinYoungSteve commented 3 months ago

If I don't fill in any sub-aspects, debugging will show an array out-of-bounds exception.

kappa-maintainer commented 3 months ago

Post full debug log

EdwinYoungSteve commented 3 months ago

============ GroovyLog ==== 27.08.2024 ============ GroovyScript version: 1.1.3 [16:19:56] [CLIENT/INFO] [greedycraft]: Running scripts in loader 'preInit' [16:20:44] [CLIENT/INFO] [greedycraft]: Running scripts in loader 'init' [16:20:45] [CLIENT/INFO] [greedycraft]: - running init.thaumcraft [16:20:45] [CLIENT/ERROR] [greedycraft]: An exception occurred while running scripts. Look at latest.log for a full stacktrace: java.lang.ArrayIndexOutOfBoundsException: 0 at thaumcraft.api.aspects.Aspect.<init>(Aspect.java:48) at com.cleanroommc.groovyscript.compat.mods.thaumcraft.aspect.Aspect$AspectBuilder.register(Aspect.java:120) at init.thaumcraft.run(thaumcraft.groovy:15) at com.cleanroommc.groovyscript.sandbox.GroovySandbox.runScript(GroovySandbox.java:167) at com.cleanroommc.groovyscript.sandbox.GroovyScriptSandbox.runScript(GroovyScriptSandbox.java:181) at com.cleanroommc.groovyscript.sandbox.GroovySandbox.loadScripts(GroovySandbox.java:140) [16:20:50] [CLIENT/INFO] [greedycraft]: Running scripts in loader 'postInit' image

brachy84 commented 3 months ago

thats not the debug log. Thats the groovy log

WaitingIdly commented 3 months ago

pretty sure this is the issue, line 120 in Aspect.java

https://github.com/CleanroomMC/GroovyScript/blob/master/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/Aspect.java#L120-L120

-                thaumcraft.api.aspects.Aspect aspect = new thaumcraft.api.aspects.Aspect(tag, chatColor, components.getAspects(), image, blend);
+                thaumcraft.api.aspects.Aspect aspect = new thaumcraft.api.aspects.Aspect(tag, chatColor, components.size() == 0 ? null : components.getAspects(), image, blend);
EdwinYoungSteve commented 3 months ago

java.lang.ArrayIndexOutOfBoundsException: 0 at thaumcraft.api.aspects.Aspect.(Aspect.java:48) ~[Aspect.class:?] at com.cleanroommc.groovyscript.compat.mods.thaumcraft.aspect.Aspect$AspectBuilder.register(Aspect.java:120) ~[Aspect$AspectBuilder.class:?] at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321) ~[IndyInterface.class:?] at init.thaumcraft.run(thaumcraft.groovy:15) ~[?:?] at com.cleanroommc.groovyscript.sandbox.GroovySandbox.runScript(GroovySandbox.java:167) ~[GroovySandbox.class:?] at com.cleanroommc.groovyscript.sandbox.GroovyScriptSandbox.runScript(GroovyScriptSandbox.java:181) ~[GroovyScriptSandbox.class:?] at com.cleanroommc.groovyscript.sandbox.GroovySandbox.loadScripts(GroovySandbox.java:140) ~[GroovySandbox.class:?] at com.cleanroommc.groovyscript.sandbox.GroovySandbox.load(GroovySandbox.java:121) ~[GroovySandbox.class:?] at com.cleanroommc.groovyscript.sandbox.GroovySandbox.load(GroovySandbox.java:109) ~[GroovySandbox.class:?] at com.cleanroommc.groovyscript.sandbox.GroovyScriptSandbox.run(GroovyScriptSandbox.java:164) [GroovyScriptSandbox.class:?] at com.cleanroommc.groovyscript.GroovyScript.runGroovyScriptsInLoader(GroovyScript.java:188) [GroovyScript.class:?] at net.minecraftforge.fml.common.LoadController.handler$zzi000$preInit(LoadController.java:1021) [LoadController.class:?] at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java) [LoadController.class:?] at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:754) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:336) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:535) [bib.class:?] at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:378) [bib.class:?] at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_421] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_421] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_421] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_421] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] [16:20:45] [Client thread/INFO]: Running Groovy scripts during init took 1821 ms

EdwinYoungSteve commented 3 months ago

很确定这就是问题所在,第 120 行Aspect.java

https://github.com/CleanroomMC/GroovyScript/blob/master/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/aspect/Aspect.java#L120-L120

-                thaumcraft.api.aspects.Aspect aspect = new thaumcraft.api.aspects.Aspect(tag, chatColor, components.getAspects(), image, blend);
+                thaumcraft.api.aspects.Aspect aspect = new thaumcraft.api.aspects.Aspect(tag, chatColor, components.size() == 0 ? null : components.getAspects(), image, blend);

so……can u fix this bug? plz