#How to create Left & Right Click Animation Controller

1 messages · Page 1 of 1 (latest)

spring abyss
#

My goal is

When a player left clicks a specific custom item it sets their scoreboard value to zero

When a player right clicks a specific custom item it sets their scoreboard value to zero

    "format_version": "1.10.0",
    "animation_controllers": {
        "variable.attack_time": {
            "initial_state": "false",
            "states": {
                "false": {
                    "on_entry": ["/scoreboard players set @s leftClick 0"],
                    "transitions": [
                        {
                            "true": "variable.attack_time"
                        }
                    ]
                },
                "true": {
                    "on_entry": ["/scoreboard players set @s leftClick 1"],
                    "transitions": [
                        {
                            "false": "!variable.attack_time"
                        }
                    ]
                }
            }
        },
        "is_using_item": {
            "initial_state": "false",
            "states": {
                "false": {
                    "on_entry": ["/scoreboard players set @s rightClick 0"],
                    "transitions": [
                        {
                            "true": "q.is_using_item"
                        }
                    ]
                },
                "true": {
                    "on_entry": ["/scoreboard players set @s rightClick 1"],
                    "transitions": [
                        {
                            "false": "!q.is_using_item"
                        }
                    ]
                }
            }
        }
    }
}```


It's my first time using Animation Controllers, I'm not sure if I'm missing something else
hoary ingot
#

Sadly, v.attack_time is only available on the resource pack iirc. And to detect using the item with an animation controller, it needs to be a usable item (like a food), just with a really high use duration

#

If you want to detect attacking with the item to reset the scoreboard, you'd need to use custom componentns

spring abyss
hoary ingot
#

I don't think so

spring abyss
#

Alright thank you

spring abyss
hoary ingot
#

Yeah

spring abyss
# hoary ingot Yeah

Would this work? I don't want to food to disappear from eating it, that's why it didn't make it one, or do I have to make it one?

"minecraft:icon": "to_grimoire", 
"minecraft:allow_off_hand": true, 
"minecraft:use_modifiers": { 
"use_duration": 0.1 
}, 
"minecraft:use_animation": "eat" 
}```
hoary ingot
#

You need to make it either a food or throwable item. But, what you can do is set the use duration to 9999999 so that they never complete using it

#

As all the query looks for js jd they're in the process of using jt

spring abyss
somber depot
#

you can use it behavior side, this is how people check for left click detection.