endCityFailChance fix (another approach)

This commit is contained in:
Necrontyr 2022-10-15 20:33:49 +02:00
parent 54f1100e22
commit 1992fbd988

View file

@ -22,11 +22,9 @@ public class EndCityFeatureMixin {
Structure.GenerationContext context, Structure.GenerationContext context,
CallbackInfoReturnable<Optional<Structure.GenerationStub>> info CallbackInfoReturnable<Optional<Structure.GenerationStub>> info
) { ) {
final ChunkPos pos = context.chunkPos();
WorldgenRandom chunkRandom = new WorldgenRandom(new XoroshiroRandomSource(pos.x, pos.z));
chunkRandom.consumeCount(1);
if (GeneratorOptions.useNewGenerator()) { if (GeneratorOptions.useNewGenerator()) {
final ChunkPos pos = context.chunkPos();
WorldgenRandom chunkRandom = new WorldgenRandom(new XoroshiroRandomSource(context.seed() * pos.x, context.seed() * pos.z));
int chance = GeneratorOptions.getEndCityFailChance(); int chance = GeneratorOptions.getEndCityFailChance();
if (chance > 0 && chunkRandom.nextInt(chance) != 0) { if (chance > 0 && chunkRandom.nextInt(chance) != 0) {
info.setReturnValue(Optional.empty()); info.setReturnValue(Optional.empty());