Cubitect / cubiomes

C library that mimics the Minecraft biome generation.
MIT License
556 stars 98 forks source link

getSpawn Spiral Iterator Fix + Include Frozen Oceans in findServerSpawn Check #97

Closed Nel-S closed 1 year ago

Nel-S commented 1 year ago

Cubitect/cubiomes-viewer#219 brought my attention to getSpawn's spiral iterator, which I checked against the actual 1.19 Java code; the actual code only runs for 121 iterations ( = a 11x11 area), not for 1024 ( = a 32x32 area), which may explain part of (though not all of) the discrepancies. The then-fixed if condition to determine whether to subsequently call findServerSpawn would also always return true as well, so I removed it.

In addition, I added frozen oceans and deep frozen oceans as valid spawn biomes in findServerSpawn; since the game itself only checks for solid non-waterlogged surface blocks, I've found in practice that one usually ends up spawning on an ice floe/iced-over ocean as opposed to the game dropping the player on the nearest mainland, which is where the Cubiomes algorithm would set the spawnpoint otherwise.

Cubitect commented 1 year ago

Thanks, but the iteration to 1024 was correct for 1.13-1.17, so this is actually new code for 1.18+. When I first updated getSpawn() to 1.18, we were still in the snapshots and I hadn't revisited it since.

I have now corrected getSpawn() and included the suggestion to assume frozen oceans as viable.