[Scarpet] Tracking scheduled ticks and random chunk ticks
Guimoute opened this issue ยท 2 comments
Hello,
I think it would be interesting to have new events to track random/block/fluid ticks in Scarpet:
__on_random_tick(x, y, z)
would trigger once for each of therandomTickSpeed
blocks randomly selected per chunk tick. This would allow scripters to change things like plant growth, ice formation, etc.__on_block_tick(x, y, z)
for scheduled block ticks.__on_fluid_tick(x, y, z)
for scheduled fluid ticks. This would make it possible to override what happens when lava/water flows.
For context, those came to mind because I wanted to extend the behavior of renewableBlackstone
and renewableDeepslate
from Carpet and add a system to create easily any lava + water + <block1> = <block2>
recipes. It is not doable with __on_tick()
. Such a script would be based on the __on_fluid_tick
event only, but I still suggested the two other events because they fall into the same "world action" event category.
I would make the events take a single block
argument which is the block being ticked. This allows the usage of block-based functions directly on the block passed in instead of having to do block(x, y, z)
on the three coordinate arguments.
Furthermore, the event should allow cancelling vanilla behavior by returning 'cancel'
.
This can be used for example to stop water/lava flowing or to simulate a fractional value for the randomTickSpeed
gamerule.
@James103 Very good points. We can add more examples of use cases:
Fluid ticks:
- you could make infinite lava sources in the overworld.
- lava encountering water next to a specific "seed" block would generate the same type of block (my initial mod idea).
Random ticks:
- speed up/slow down plant growth depending on the neighbouring plants and blocks.
- have mature plants "go to seed" and propagate to nearby valid blocks.
- spreading fire to new blocks, spreading blue fire.
- water source surrounded by enough blue ice freezes regardless of the biome temperature.
Block ticks:
- spreading fire in a predictable pattern on a specific block that would behave like a wick.