bernie-g / geckolib

GeckoLib is an animation engine for Minecraft mods, with support for complex 3D keyframe-based animations, numerous easings, concurrent animation support, sound and particle keyframes, event keyframes, math-based animations, and more. Available for all major modloaders.
https://geckolib.com
MIT License
609 stars 127 forks source link

Animations not being parsed correctly #598

Closed Scouter456 closed 3 months ago

Scouter456 commented 3 months ago

Animations are not being parsed correctly even though they were before. https://pastebin.com/Fb741ziu Links with lines of anims that are breaking. https://github.com/Scouter456/Nether_Depths_Upgrade/blob/be2af7a030b618cf0530df953de1be124b115074/src/main/resources/assets/netherdepthsupgrade/animations/entity/blazefish.animation.json#L10

https://github.com/Scouter456/Nether_Depths_Upgrade/blob/be2af7a030b618cf0530df953de1be124b115074/src/main/resources/assets/netherdepthsupgrade/animations/entity/obsidianfish.animation.json#L11

https://github.com/Scouter456/Nether_Depths_Upgrade/blob/be2af7a030b618cf0530df953de1be124b115074/src/main/resources/assets/netherdepthsupgrade/animations/entity/lavapufferfish.animation.json#L14

https://github.com/Scouter456/Nether_Depths_Upgrade/blob/be2af7a030b618cf0530df953de1be124b115074/src/main/resources/assets/netherdepthsupgrade/animations/entity/soulsucker.animation.json#L15

https://github.com/Scouter456/Nether_Depths_Upgrade/blob/be2af7a030b618cf0530df953de1be124b115074/src/main/resources/assets/netherdepthsupgrade/animations/entity/searing_cod.animation.json#L30

And there were a few more but I think this should suffice. Most of the times it looks like its something to do with math.clamp

baileyholl commented 3 months ago

Also experiencing this with nested usages of math.lerp

Geckolib.CompoundException: Unable to parse animation: create_glyph2
    -> Failed to parse expression 'math.lerp(math.lerp(0, 12, query.anim_time*0.75), math.lerp(12, 6, query.anim_time*0.75), query.anim_time*0.75)'
        -> Unable to parse compiled symbols from expression: [Left[math.lerp], Left[00]]
    at TRANSFORMER/geckolib@4.5.6/software.bernie.geckolib.loading.math.MathParser.parseSymbols(MathParser.java:377)
    at TRANSFORMER/geckolib@4.5.6/software.bernie.geckolib.loading.math.MathParser.compileSymbols(MathParser.java:325)
    at TRANSFORMER/geckolib@4.5.6/software.bernie.geckolib.loading.math.MathParser.compileExpression(MathParser.java:225)
    at TRANSFORMER/geckolib@4.5.6/software.bernie.geckolib.loading.math.MathParser.compileMolang(MathParser.java:217)
    at TRANSFORMER/geckolib@4.5.6/software.bernie.geckolib.loading.math.MathParser.parseJson(MathParser.java:179)
    at TRANSFORMER/geckolib@4.5.6/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.buildKeyframeStack(BakedAnimationsAdapter.java:164)
    at TRANSFORMER/geckolib@4.5.6/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.bakeBoneAnimations(BakedAnimationsAdapter.java:74)
    at TRANSFORMER/geckolib@4.5.6/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.bakeAnimation(BakedAnimationsAdapter.java:58)
    at TRANSFORMER/geckolib@4.5.6/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.deserialize(BakedAnimationsAdapter.java:38)
    at TRANSFORMER/geckolib@4.5.6/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.deserialize(BakedAnimationsAdapter.java:30)
    at MC-BOOTSTRAP/com.google.gson@2.10.1/com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76)
    at MC-BOOTSTRAP/com.google.gson@2.10.1/com.google.gson.Gson.fromJson(Gson.java:1227)
    at MC-BOOTSTRAP/com.google.gson@2.10.1/com.google.gson.Gson.fromJson(Gson.java:1329)
    at MC-BOOTSTRAP/com.google.gson@2.10.1/com.google.gson.Gson.fromJson(Gson.java:1271)
    at TRANSFORMER/geckolib@4.5.6/software.bernie.geckolib.loading.FileLoader.loadAnimationsFile(FileLoader.java:36)
    at TRANSFORMER/geckolib@4.5.6/software.bernie.geckolib.cache.GeckoLibCache.lambda$loadAnimations$1(GeckoLibCache.java:76)
    at TRANSFORMER/geckolib@4.5.6/software.bernie.geckolib.cache.GeckoLibCache.lambda$loadResources$5(GeckoLibCache.java:113)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run$$$capture(CompletableFuture.java:1768)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760)
    at java.base/java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:507)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1491)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:2073)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2035)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)

https://github.com/baileyholl/Ars-Nouveau/blob/1.21.x/src/main/resources/assets/ars_nouveau/animations/scribes_table_animations.json

Replacing the lerp calls inside the lerp with constants compiles fine. Seems to be anything that involves a function inside a function.

Tslat commented 3 months ago

Excellent error finding, thanks