s integer overflow, unsafe cast

This commit is contained in:
Nikita Edel
2026-03-11 16:10:48 +01:00
parent a24f9f5a5e
commit ed13020cf3
7 changed files with 28 additions and 23 deletions

View File

@@ -375,7 +375,8 @@ void TheEndLevelRandomLevelSource::postProcess(ChunkSource *parent, int xt, int
pprandom->setSeed(level->getSeed());
__int64 xScale = pprandom->nextLong() / 2 * 2 + 1;
__int64 zScale = pprandom->nextLong() / 2 * 2 + 1;
pprandom->setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed());
// 4jcraft added cast to higher int and unsigned
pprandom->setSeed((((uint64_t)xt * xScale) + ((uint64_t)zt * zScale)) ^ level->getSeed());
Biome *biome = level->getBiome(xo + 16, zo + 16);
biome->decorate(level, pprandom, xo, zo); // 4J - passing pprandom rather than level->random here to make this consistent with our parallel world generation