Execute something on block bump, then destroy block
Posted: Thu Dec 08, 2022 3:48 pm
by dochalkos
Feels like this should be braindead simple to do but I'm looking through example scripts and youtube tutorials and can't find the answer. I'm trying to get a custom block to work like the POW item, but in block form: you bump it from below (or otherwise activate it), it does the POW thing, and it's destroyed in the process. I've gathered "misc.doPOW()" is what I need for the effect itself, but what do I put to get this to execute when the block is bumped?
Re: Execute something on block bump, then destroy block
Posted: Thu Dec 08, 2022 4:56 pm
by deice
i believe you'd want to put it inside the "onPostBlockHit" event. something to note about this event is that even when you register it inside your custom block's lua script, it will still execute for
every block that gets hit, which means you have to compare the hit block's id to the id of your custom block before running any of the code (this is outlined within the
documentation, but not within the example block script itself even though it maybe ought to be).