#Change a state using a timer

1 messages · Page 1 of 1 (latest)

fallen marsh
#

How can I change a block's state after a cooldown.
Exemple: the button when I click on it, the state become "clicked" and then after 40 ticks it become "click able".

oak mason
#

You need to use custom components, then use onPlayerInteract and onTick event.

fallen marsh
#

Thanks

fallen marsh
#

How do you make the timer?

oak mason
# fallen marsh How do you make the timer?

Here's how it work.
Let's have a 2 different states for block. In state1 add a custom component that has onPlayerInteract event, when click, set the state of block to state2.
The state2 has minecraft:tick component and set interval_range to how long the timer you like. And of course you need to use onTick event which will set the state to state1.

#

So when you click it, the block state will switch to state2, then when on state2 after some time, it will set back to state1.

fallen marsh
#

Ok I'll try