Use GJRAND64 for enormous placement

This commit is contained in:
DBotThePony 2025-03-09 21:47:17 +07:00
parent 326490b73c
commit 84ca0c2a24
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -18,6 +18,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementContext
import net.minecraft.world.level.levelgen.placement.PlacementModifier
import net.minecraft.world.level.levelgen.placement.PlacementModifierType
import ru.dbotthepony.kommons.util.XXHash64
import ru.dbotthepony.mc.otm.core.util.GJRAND64RandomSource
import ru.dbotthepony.mc.otm.core.util.PCG32RandomSource
import ru.dbotthepony.mc.otm.data.codec.minRange
import ru.dbotthepony.mc.otm.registry.data.MPlacementModifiers
@ -89,7 +90,6 @@ class EnormousPlacement(
val bytes = FastByteArrayOutputStream()
val dataStream = DataOutputStream(bytes)
dataStream.writeLong(context.level.seed)
dataStream.writeLong(seedMix)
dataStream.writeInt(pos.x)
dataStream.writeInt(pos.z)
@ -97,7 +97,7 @@ class EnormousPlacement(
val hash = XXHash64()
hash.update(bytes.array, 0, bytes.length)
val random = PCG32RandomSource(hash.digestAsLong())
val random = GJRAND64RandomSource(context.level.seed, hash.digestAsLong())
var stream = Stream.of(BlockPos(pos.minBlockX, 0, pos.minBlockZ))
children.forEach { modifier -> stream = stream.flatMap { modifier.getPositions(context, random, it).sequential() } }
return GeneratedChunk(stream)