mojira.dev
MCPE-182991

ItemComponentUseOnEvent make the item start to cooldown without overlay

If custom item is registered to onUse it automatically starts to cooldown with no overlay indicating the item is in cooldown, it's on cooldown in background without visually seeing it. But it will have an overlay if ItemCooldownComponent.startCooldown is called in this event. Because of this behavior we cannot conditionally make the item to start to cooldown, hence it automatically starts to cooldown without calling startCooldown.

Additionally, this event cannot be trigger while item is on cooldown, preventing us to do something while it's on cooldown. It limits us to create a complex behavior.

Expectable Behavior:

  • It won't automatically start to cooldown.

  • The item will only start to cooldown when startCooldown is called.

  • The onUse event can be triggered even the item is currently on cooldown. As long as the player use it, it will call this function.

The pack below is the sample to test the said behavior, it includes comments in the script. I programmed this to display the cooldown time remaining in player's hotbar of the player's item in mainhand to visually see item is actually on cooldown.

Attachments

Comments 1

Unknown

(Unassigned)

1252839

Confirmed

Multiple

Android 13, Windows 10

1.21.10.23 Preview, 1.21.0

Retrieved