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
#Change block state when walking over it
1 messages · Page 1 of 1 (latest)
Use onStepOn custom component to change permutation.
What would that look like in practice?
I'm still newer to coding so I don't really know how to apply that
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
- Block Events
- Block Events Migration to Custom Components
- Item Events
- Item Events Migration to Custom Components
MS Docs
Also do I need to make a new model?
You can use bone visibility to hide the spikes.
thank you
I have one more question, sorry, what is the component for bone visibility?
I'm struggling to find it in the articles
Its part of the geometry
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
Yes.
thank you
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
You could give that part a collision since it's only 1px height, it won't affect pathfinding that much and it can trigger the onStepOn

"minecraft:collision_box": {
"origin": [-8, 0, -8],
"size": [16, 1, 16]
}
Like this !
thank you
Incorrect actually. It needs to be y of 4
Spikes are being considered?
Wdym?
The collision needs to be a min height of 4 to trigger on step
O
I see
👓
I wasn't aware of that limitation, is there any reason why is limited to 4 pixels?
