How would I script a working system for flowing blocky water (like in Minecraft)?

I’m working on a game kinda similar to Minecraft in the whole “blocky sandbox game” aspect, and right now I’m kinda stuck with how to make fluids like water or lava work.

When you place down a bucket of water in Minecraft, it starts to spread in either a specific direction, if it’s close to a cliff or the edge of a block, or in all directions if it’s in a flat place.

I’ve searched for existing posts about this, but I’ve only found ~4 and none really have a lot of details on what to do, so I figured I should make my own post on this

Also here’s an example of how it looks like flowing down some blocks;

Might be raycasting to detect if it hit the floor or not, and probably some kind of block detection to make the water spread.