#Tick Component For Block
1 messages · Page 1 of 1 (latest)
import { world, system} from "@minecraft/server";
world.beforeEvents.worldInitialize.subscribe((data) => {
const {itemComponentRegistry, blockComponentRegistry} = data
blockComponentRegistry.registerCustomComponent("npatch:dynamic_light", {
onTick: (data) => {
const block = data.block
const { x, y, z } = block.location
const dimension = data.dimension
system.run(() => {
block.setType("minecraft:air");
})
}
})
})
the block
this is the code from the block defining the tick and the custom component
"minecraft:custom_components": ["npatch:dynamic_light"],
"minecraft:tick": {
"interval_range": [1, 1],
"looping": true
}
```
What is your question?