GeckoLib

GeckoLib

155M Downloads

Issues with molang

aaronhowser1 opened this issue ยท 1 comments

commented

This is on a 1.21 dev environment using GeckoLib 4.5.8 (previously 4.5.6 but I updated to check if these issues were fixed)

I'll just be editing the first segment of my worm to showcase each error.

for x

v.t= query.anim_time - 1;
math.sin((v.t) * 200)

exports as

					"position": {
						"vector": ["v.t= query.anim_time - 1;math.sin((v.t) * 200)", 0, 0]
					}
Blockbench_L1SC0wDC9j.mp4
[20:04:58] [Worker-Main-1/ERROR] [GeckoLib/]: Unable to parse animation: animation.stringworm.slither
	-> Failed to parse expression 'v.t= query.anim_time - 1;math.sin((v.t) * 200)'
		-> Invalid characters found in expression: 'v.t= query.anim_time - 1;math.sin((v.t) * 200)'
Geckolib.CompoundException: Unable to parse animation: animation.stringworm.slither
	-> Failed to parse expression 'v.t= query.anim_time - 1;math.sin((v.t) * 200)'
		-> Invalid characters found in expression: 'v.t= query.anim_time - 1;math.sin((v.t) * 200)'
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.decomposeExpression(MathParser.java:237)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.compileExpression(MathParser.java:225)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.compileMolang(MathParser.java:217)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.parseJson(MathParser.java:179)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.buildKeyframeStack(BakedAnimationsAdapter.java:163)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.bakeBoneAnimations(BakedAnimationsAdapter.java:74)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.bakeAnimation(BakedAnimationsAdapter.java:58)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.deserialize(BakedAnimationsAdapter.java:38)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.deserialize(BakedAnimationsAdapter.java:30)
	at MC-BOOTSTRAP/[email protected]/com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76)
	at MC-BOOTSTRAP/[email protected]/com.google.gson.Gson.fromJson(Gson.java:1227)
	at MC-BOOTSTRAP/[email protected]/com.google.gson.Gson.fromJson(Gson.java:1329)
	at MC-BOOTSTRAP/[email protected]/com.google.gson.Gson.fromJson(Gson.java:1271)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.FileLoader.loadAnimationsFile(FileLoader.java:36)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.cache.GeckoLibCache.lambda$loadAnimations$1(GeckoLibCache.java:76)
	at TRANSFORMER/[email protected]/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:387)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

for y

v.t=math.mod(q.anim_time, 2);
v.hop=0.6;
v.t >= v.hop ? 0 : math.sin(math.mod(v.t, v.hop) / v.hop * 180)

exports as

					"position": {
						"vector": [0, "v.t=math.mod(q.anim_time, 2);v.hop=0.6;v.t >= v.hop ? 0 : math.sin(math.mod(v.t, v.hop) / v.hop * 180)", 0]
					}
Blockbench_utJubxWTfJ.mp4
[20:09:56] [Worker-Main-1/ERROR] [GeckoLib/]: Unable to parse animation: animation.stringworm.slither
	-> Failed to parse expression 'v.t=math.mod(q.anim_time, 2);v.hop=0.6;v.t >= v.hop ? 0 : math.sin(math.mod(v.t, v.hop) / v.hop * 180)'
		-> Invalid characters found in expression: 'v.t=math.mod(q.anim_time, 2);v.hop=0.6;v.t >= v.hop ? 0 : math.sin(math.mod(v.t, v.hop) / v.hop * 180)'
[20:09:56] [Worker-Main-9/INFO] [minecraft/UnihexProvider]: Found unifont_jp_patch-15.1.05.hex, loading
Geckolib.CompoundException: Unable to parse animation: animation.stringworm.slither
	-> Failed to parse expression 'v.t=math.mod(q.anim_time, 2);v.hop=0.6;v.t >= v.hop ? 0 : math.sin(math.mod(v.t, v.hop) / v.hop * 180)'
		-> Invalid characters found in expression: 'v.t=math.mod(q.anim_time, 2);v.hop=0.6;v.t >= v.hop ? 0 : math.sin(math.mod(v.t, v.hop) / v.hop * 180)'
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.decomposeExpression(MathParser.java:237)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.compileExpression(MathParser.java:225)

I think both of those are from the semicolon? Here's a basic ternary

for y

(math.mod(query.anim_time, 2) >= 1) ? 0 : 1

exports as

					"position": {
						"vector": [0, "(math.mod(query.anim_time, 2) >= 1) ? 0 : 1", 0]
					}
Blockbench_9fwvsZq2QQ.mp4
[20:12:55] [Worker-Main-2/ERROR] [GeckoLib/]: Unable to parse animation: animation.stringworm.slither
	-> Failed to parse expression '(math.mod(query.anim_time, 2) >= 1) ? 0 : 1'
		-> Unable to parse compiled symbols from expression: []
[20:12:55] [Worker-Main-18/DEBUG] [mixin/]: Mixing client.HumanoidArmorLayerMixin from geckolib.mixins.json into net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer
[20:12:55] [Worker-Main-18/DEBUG] [mixin/]: geckolib.mixins.json:client.HumanoidArmorLayerMixin from mod geckolib: Class version 65 required is higher than the class version supported by the current version of Mixin (JAVA_17 supports class version 61)
[20:12:55] [Worker-Main-18/DEBUG] [mixin/]: geckolib.mixins.json:client.HumanoidArmorLayerMixin from mod geckolib->@Inject::geckolib$renderGeckoLibModel(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/world/entity/EquipmentSlot;ILnet/minecraft/client/model/HumanoidModel;Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;)V does use it's CallbackInfo
Geckolib.CompoundException: Unable to parse animation: animation.stringworm.slither
	-> Failed to parse expression '(math.mod(query.anim_time, 2) >= 1) ? 0 : 1'
		-> Unable to parse compiled symbols from expression: []
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.parseSymbols(MathParser.java:377)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.compileCalculation(MathParser.java:464)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.compileValue(MathParser.java:396)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.parseSymbols(MathParser.java:372)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.compileCalculation(MathParser.java:464)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.compileValue(MathParser.java:396)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.parseSymbols(MathParser.java:372)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.compileSymbols(MathParser.java:333)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.compileExpression(MathParser.java:225)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.compileMolang(MathParser.java:217)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.math.MathParser.parseJson(MathParser.java:179)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.buildKeyframeStack(BakedAnimationsAdapter.java:164)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.bakeBoneAnimations(BakedAnimationsAdapter.java:74)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.bakeAnimation(BakedAnimationsAdapter.java:58)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.deserialize(BakedAnimationsAdapter.java:38)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.json.typeadapter.BakedAnimationsAdapter.deserialize(BakedAnimationsAdapter.java:30)
	at MC-BOOTSTRAP/[email protected]/com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76)
	at MC-BOOTSTRAP/[email protected]/com.google.gson.Gson.fromJson(Gson.java:1227)
	at MC-BOOTSTRAP/[email protected]/com.google.gson.Gson.fromJson(Gson.java:1329)
	at MC-BOOTSTRAP/[email protected]/com.google.gson.Gson.fromJson(Gson.java:1271)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.loading.FileLoader.loadAnimationsFile(FileLoader.java:36)
	at TRANSFORMER/[email protected]/software.bernie.geckolib.cache.GeckoLibCache.lambda$loadAnimations$1(GeckoLibCache.java:76)
	at TRANSFORMER/[email protected]/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:387)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

Additionally, it looks like aliases don't work. You can't do q.anim_time, you have to do query.anim_time. This doesn't error in the log, and the animation loads properly, but that bone doesn't animate.

			"bones": {
				"one": {
					"position": {
						"vector": [0, "math.sin(q.anim_time * 360)", 0]
					}
				},
				"two": {
					"position": {
						"vector": ["math.sin((query.anim_time - 0.1) * 200)", "math.max(0, math.sin((query.anim_time * 5 - 0.75)*90) * 2.5)", 0]
					}
				},
Blockbench_eFPqqIwfcu.mp4
java_rqeu3TTqaG.mp4

And finally, while this isn't technically a bug, it would be nice to have all the other query functions available, rather than just the small list in software.bernie.geckolib.loading.math.MolangQueries. I spent quite a while using query.modified_distance_moved before finding out it didn't work.

commented

Here's my current animation json which works in-game, but doesn't use any of the fancy things that don't work.

{
	"format_version": "1.8.0",
	"animations": {
		"animation.stringworm.slither": {
			"loop": true,
			"bones": {
				"one": {
					"position": {
						"vector": ["math.sin((query.anim_time) * 200)", "math.max(0, math.sin((query.anim_time * 5)*90) * 1.5)", 0]
					}
				},
				"two": {
					"position": {
						"vector": ["math.sin((query.anim_time - 0.1) * 200)", "math.max(0, math.sin((query.anim_time * 5 - 0.75)*90) * 2.5)", 0]
					}
				},
				"three": {
					"position": {
						"vector": ["math.sin((query.anim_time - 0.2) * 200)", "math.max(0, math.sin((query.anim_time * 5 - 1.5)*90) * 2.5)", 0]
					}
				},
				"four": {
					"position": {
						"vector": ["math.sin((query.anim_time - 0.3) * 200)", "math.max(0, math.sin((query.anim_time * 5 - 2.25)*90) * 1.5)", 0]
					}
				},
				"five": {
					"position": {
						"vector": ["math.sin((query.anim_time - 0.4) * 200)", "math.max(0, math.sin((query.anim_time * 5 - 3)*90) * 1.5)", 0]
					}
				}
			}
		}
	},
	"geckolib_format_version": 2
}