Closed EliteAsian123 closed 5 years ago
Hi - the way I do this is to use custom block events to track when cactus blocks are added to or removed from the world, and then run a tick handler to occasionally update existing blocks.
E.g.:
noa.registry.registerBlock( cactusID, {
// block settings, material, opacity, etc...
onSet: addCactus,
onLoad: addCactus,
onUnset: removeCactus,
onUnload: removeCactus,
})
function addCactus(x,y,z) { // remember there's a cactus at (x,y,z)...
function removeCactus(x,y,z) { // forget there's a cactus at (x,y,z)...
noa.on('tick', function() { // do something with all current cactus blocks...
Block event meanings are explained here, hope that helps.
Thanks for the answer! Sorry for asking a lot of questions!
Not at all, please assume every question is something I've forgotten to document! Thanks!
Is there a block update function? So every tick, each block calls a function or something similar. In this case I want to make my cactus grow every once in a while.