TerraFirmaCraft

TerraFirmaCraft

2M Downloads

Likely mistake in PlateBoundaryLayer

bipentihexium opened this issue ยท 1 comments

commented

While digging through the biome generation code, I found this inside PlateBoundaryLayer.java (lines 43-71):

if (!north.equals(center))
{
    boundaryCount++;
    boundary = north;
}
if (!west.equals(center))
{
    boundaryCount++;
    if (boundary == null || context.random().nextInt(boundaryCount) == 0)
    {
        boundary = west;
    }
}
if (!south.equals(center))
{
    boundaryCount++;
    if (boundary != null || context.random().nextInt(boundaryCount) == 0)
    {
        boundary = south;
    }
}
if (!east.equals(center))
{
    boundaryCount++;
    if (boundary != null || context.random().nextInt(boundaryCount) == 0)
    {
        boundary = east;
    }
}

It compares adjacent plates and choses which will be used as a boundary. In the south and east "parts", it checks if boundary != null - so when it found a boundary already, it'll overwrite it. Then it generates a random int to decide if it should overwrite it, but since there must not have been another boundary, the bound for random is 1 and it's overwritten anyways.
This way the random number generation there is useless and east and south boundaries have priority. To me it seems that south and east should behave the same as west, which overwrites boundary when it's null or the chosen random number is 0.

commented

This is a mistake, yes, which would cause some directional bias in biome generation. However that bias seems to be barely visible, and the effect of fixing this, would cause (just as rare) broken biome borders. Given the class in question has been removed as of 3772632 for 1.20, this is not getting fixed as the price for fixing it is not worth the actual fix in question.


Before:
biomes_40km_old

After:
biomes_40km_new

Difference:
biomes_diff