minecraft:use_modifiers for you with a switch.Get GodCraftOverview
minecraft:use_modifiers is an item component: it goes in the components object of a custom item. Controls holding the use button: how long one use takes and how slow the player walks meanwhile. Food, potions and bows need this.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
start_using | StartUsing | "if_first" | Whether using starts only if nothing else has ("if_first") or restarts every time ("always"). |
use_duration | number | 0 | Seconds the item takes to finish using, like the time to eat.Range: 0 to … |
emit_vibrations | boolean | true | When true, starting and stopping use make vibrations that sculk sensors can hear. |
start_sound | LevelSoundEvent | none | Sound played when the player starts using the item. |
movement_modifier | number | none | Walk speed while using: 1 is normal speed, 0.35 is the slow walk of eating.Range: 0 to 1 |
Example
Inside the components object of BP/items/<name>.json (values are the defaults or placeholders):
BP/items/<name>.json
{
"minecraft:use_modifiers": {
"start_using": "if_first",
"use_duration": 0,
"emit_vibrations": true,
"start_sound": {},
"movement_modifier": 0
}
}