Casimir wrote:You can move the get_content_id out of the functions, so you only get them once. That makes it slightly faster.
Can you explain how this works? You seem to try a very different attempt then my mod.
Hi, i'm following hmmmm's advice to get content ids as locals within the ongen function. As i understand him it is actually more efficient this way.
Hehe this is a complex method for a few small pools, i'll try to explain ...
After a chunk is generated the mod makes 81 attempts to form a pool, each attempt is centered on a particular XZ column and these are spread through the chunk in a grid, spaced 8 nodes apart.
For each 'attempt':
Working downwards through the column grass is searched for to find ground level, the mod then works on the XZ plane of nodes just above ground level, this will be the pool surface.
The mod then checks if the central node just above ground is surrounded on all sides by nodes (at any distance within the chunk), in order to contain water: from the central node just above ground the mod searches outwards in the 4 NESW horizontal directions, if any of these searches reaches a chunk border without hitting a node the current 'attempt' is aborted.
Passing that test water is then placed in the central node just above ground level, and then the water is spread horizontally through that 1 node high XZ plane: each water node creates 8 water nodes around it. If the water finds a way to leak out to the chunk border all water in the plane is erased and the 'attempt' aborted.
Finally, having passed all those tests water is allowed to flow downwards from the 1 node high XZ plane to fill any air gaps below.