Skip to content

Make trying to run a animation that doesn't exist not crash the game #110

@ZigyTheBird

Description

@ZigyTheBird

Here is a what happens when I try to run an animation that doesn't exist:

**Logs**
java.lang.IllegalArgumentException: Animation can not be null at dev.kosmx.playerAnim.api.layered.KeyframeAnimationPlayer.(KeyframeAnimationPlayer.java:78) ~[7619843248939383443.jar:?] at dev.kosmx.playerAnim.api.layered.KeyframeAnimationPlayer.(KeyframeAnimationPlayer.java:99) ~[7619843248939383443.jar:?] at dev.kosmx.playerAnim.api.layered.KeyframeAnimationPlayer.(KeyframeAnimationPlayer.java:103) ~[7619843248939383443.jar:?] at net.minecraft.world.item.Item.handler$zno000$playeranimator$playAnimation(Item.java:2035) ~[minecraft-merged-519c7931cd-1.21-loom.mappings.1_21.layered+hash.40359-v2.jar:?] at net.minecraft.world.item.Item.use(Item.java) ~[minecraft-merged-519c7931cd-1.21-loom.mappings.1_21.layered+hash.40359-v2.jar:?] at net.minecraft.world.item.ItemStack.use(ItemStack.java:364) ~[minecraft-merged-519c7931cd-1.21-loom.mappings.1_21.layered+hash.40359-v2.jar:?] at net.minecraft.client.multiplayer.MultiPlayerGameMode.method_41929(MultiPlayerGameMode.java:355) ~[minecraft-merged-519c7931cd-1.21-loom.mappings.1_21.layered+hash.40359-v2.jar:?] at net.minecraft.client.multiplayer.MultiPlayerGameMode.startPrediction(MultiPlayerGameMode.java:254) ~[minecraft-merged-519c7931cd-1.21-loom.mappings.1_21.layered+hash.40359-v2.jar:?] at net.minecraft.client.multiplayer.MultiPlayerGameMode.useItem(MultiPlayerGameMode.java:348) ~[minecraft-merged-519c7931cd-1.21-loom.mappings.1_21.layered+hash.40359-v2.jar:?] at net.minecraft.client.Minecraft.startUseItem(Minecraft.java:1715) ~[minecraft-merged-519c7931cd-1.21-loom.mappings.1_21.layered+hash.40359-v2.jar:?] at net.minecraft.client.Minecraft.handleKeybinds(Minecraft.java:1965) ~[minecraft-merged-519c7931cd-1.21-loom.mappings.1_21.layered+hash.40359-v2.jar:?] at net.minecraft.client.Minecraft.tick(Minecraft.java:1784) ~[minecraft-merged-519c7931cd-1.21-loom.mappings.1_21.layered+hash.40359-v2.jar:?] at net.minecraft.client.Minecraft.runTick(Minecraft.java:1134) ~[minecraft-merged-519c7931cd-1.21-loom.mappings.1_21.layered+hash.40359-v2.jar:?] at net.minecraft.client.Minecraft.run(Minecraft.java:791) [minecraft-merged-519c7931cd-1.21-loom.mappings.1_21.layered+hash.40359-v2.jar:?] at net.minecraft.client.main.Main.main(Main.java:227) [minecraft-merged-519c7931cd-1.21-loom.mappings.1_21.layered+hash.40359-v2.jar:?] at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) [fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) [fabric-loader-0.15.11.jar:?] at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) [fabric-loader-0.15.11.jar:?] at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) [dev-launch-injector-0.2.1+build.8.jar:?] at dev.architectury.transformer.TransformerRuntime.main(TransformerRuntime.java:220) [architectury-transformer-5.2.87-runtime.jar:5.2.87]

IIRC this didn't happen on previous version and in my opinion the game literally crashing in the middle of playtesting because of the dev misspelling an animation name or smth like that is inconvinient
Just make it like before where it threw an error but maybe instead of "Animation can not be null" you could have it throw an easier to understand error for less knowledgable modders like "Could not find animation" or "Animation does not exist"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions