Use GJRAND64 for enormous placement
This commit is contained in:
parent
326490b73c
commit
84ca0c2a24
@ -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.PlacementModifier
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType
|
import net.minecraft.world.level.levelgen.placement.PlacementModifierType
|
||||||
import ru.dbotthepony.kommons.util.XXHash64
|
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.core.util.PCG32RandomSource
|
||||||
import ru.dbotthepony.mc.otm.data.codec.minRange
|
import ru.dbotthepony.mc.otm.data.codec.minRange
|
||||||
import ru.dbotthepony.mc.otm.registry.data.MPlacementModifiers
|
import ru.dbotthepony.mc.otm.registry.data.MPlacementModifiers
|
||||||
@ -89,7 +90,6 @@ class EnormousPlacement(
|
|||||||
val bytes = FastByteArrayOutputStream()
|
val bytes = FastByteArrayOutputStream()
|
||||||
val dataStream = DataOutputStream(bytes)
|
val dataStream = DataOutputStream(bytes)
|
||||||
|
|
||||||
dataStream.writeLong(context.level.seed)
|
|
||||||
dataStream.writeLong(seedMix)
|
dataStream.writeLong(seedMix)
|
||||||
dataStream.writeInt(pos.x)
|
dataStream.writeInt(pos.x)
|
||||||
dataStream.writeInt(pos.z)
|
dataStream.writeInt(pos.z)
|
||||||
@ -97,7 +97,7 @@ class EnormousPlacement(
|
|||||||
val hash = XXHash64()
|
val hash = XXHash64()
|
||||||
hash.update(bytes.array, 0, bytes.length)
|
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))
|
var stream = Stream.of(BlockPos(pos.minBlockX, 0, pos.minBlockZ))
|
||||||
children.forEach { modifier -> stream = stream.flatMap { modifier.getPositions(context, random, it).sequential() } }
|
children.forEach { modifier -> stream = stream.flatMap { modifier.getPositions(context, random, it).sequential() } }
|
||||||
return GeneratedChunk(stream)
|
return GeneratedChunk(stream)
|
||||||
|
Loading…
Reference in New Issue
Block a user