SpongeAPI
SpongeAPI copied to clipboard
Add event for creating scheduled updates
I'm talking about World#scheduleUpdate. This event will allow plugins to change delay of liquid/fire spreading, blocks falling, buttons, pressure plates, redstone torches, tripwires, rail detectors. Or even stop them from ticking at all (for something like one-time use buttons or static liquids)
We already have this, https://jd.spongepowered.org/4.1.0/org/spongepowered/api/event/block/TickBlockEvent.html
Ticks arn't necessarily scheduled block updates. I believe Meegooo was asked to create this issue by someone.
And I was told on IRC that TickBlockEvent fires for random ticks (growth and stuff), not scheduled ones.
There used to be a sub event for scheduled, it appears to be gone
Isn't this just ScheduledBlockUpdate?
https://github.com/SpongePowered/SpongeAPI/blob/44b5f5ecc6bf3751ef81b1ff6321fbe3f08099fc/src/main/java/org/spongepowered/api/world/extent/Extent.java#L333-L395
@simon816 This is for an event to listen, rather than create - from what I can tell
You can't really use those methods the way event could be used.
I mean, in case of stopping water from spreading (although you can just cancel ChangeBlockEvent.Place for flowing water) you could do something like this:
Listen for ChangeBlockEvent.Place for water and after 1 tick change scheduled updates at that location (and around it).
But that is quite hacky and might not work for scheduled updates with 1 tick delay. (scheduled updates are created after ChangeBlockEvent is fired, right?)
PS. I just realized. ScheduledBlockUpdate doesn't have information about future block inside it. So you can't really tell what will happen after that update occurs. Looks like it just ticks whatever is located at Location. World#scheduleUpdate, from what I can tell, is used to place/change blocks