#Change block state when walking over it

1 messages · Page 1 of 1 (latest)

full dragon
#

I have a block that I'm trying to make change its state when a player touches it.
The block is spikes, and I'd like them to retract.
Is there any way to do this? What all do I need to do?
Do I need to make a seperate model for the retracted variant? Or can I just animate the spikes into the ground somehow?
I'm using block wizard and vsc if it helps

silver sequoia
full dragon
#

What would that look like in practice?

#

I'm still newer to coding so I don't really know how to apply that

cyan flaxBOT
#
HCF Removal and Custom Components

The Holiday Creator Features experimental toggle has been removed. Along with it includes JSON block and item events. This functionality has been replaced with custom components.

Please take a look at the following links to learn more about custom components:

Bedrock Wiki

MS Docs

full dragon
#

Also do I need to make a new model?

silver sequoia
#

You can use bone visibility to hide the spikes.

full dragon
#

thank you

full dragon
#

I'm struggling to find it in the articles

silver sequoia
full dragon
#

Will it return once I've stepped off the block?

#

Or do I need to code that in as well

#

Would that be onStepOff?

#

or would I need to check state every few ticks

silver sequoia
full dragon
#

thank you

full dragon
#

i tried to apply all the states but there's an issue

#

my block doesnt have collisions since it's meant to be walked through

#

so onStepOn and onStepOff don't work

junior sphinx
#
"minecraft:collision_box": {
    "origin": [-8, 0, -8],
    "size": [16, 1, 16]
}
#

Like this !

full dragon
#

thank you

silver sequoia
junior sphinx
#

Spikes are being considered?

silver sequoia
#

The collision needs to be a min height of 4 to trigger on step

junior sphinx
#

I think it would be weird to be 4 pixels if you're mean to step over them

junior sphinx
#

I see

#

👓

#

I wasn't aware of that limitation, is there any reason why is limited to 4 pixels?

full dragon
#

hmm

#

is there any way to do what i want though

#

i cant use onStepOn or onStepOff