From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com> Date: Tue, 9 Nov 2077 00:00:00 +0800 Subject: [PATCH] Faster Random Generator This patch replaces LegacyRandomSource with FasterRandomSource by default, which is faster in general. Benchmark results (10,000,000 iterations) (GraalVM 21) SimpleRandom (Moonrise): 80ms FasterRandomSource (Leaf) (Backed by Xoroshiro128PlusPlus): 35ms LegacyRandomSource (Vanilla): 200ms XoroshiroRandomSource (Vanilla): 47ms diff --git a/net/minecraft/util/RandomSource.java b/net/minecraft/util/RandomSource.java index 98a54bc4de251014342cda6d0951b7fea79ce553..6d56134cc9ed9d73104ae77b1a0baa5a0a45759c 100644 --- a/net/minecraft/util/RandomSource.java +++ b/net/minecraft/util/RandomSource.java @@ -15,18 +15,32 @@ public interface RandomSource { return create(RandomSupport.generateUniqueSeed()); } + // Leaf start - Faster random generator @Deprecated static RandomSource createThreadSafe() { - return new ThreadSafeLegacyRandomSource(RandomSupport.generateUniqueSeed()); + return org.dreeam.leaf.config.modules.opt.FastRNG.enabled + ? new org.dreeam.leaf.util.math.random.FasterRandomSource(RandomSupport.generateUniqueSeed()) + : new ThreadSafeLegacyRandomSource(RandomSupport.generateUniqueSeed()); } static RandomSource create(long seed) { - return new LegacyRandomSource(seed); + return org.dreeam.leaf.config.modules.opt.FastRNG.enabled + ? new org.dreeam.leaf.util.math.random.FasterRandomSource(seed) + : new LegacyRandomSource(seed); + } + + static RandomSource createForSlimeChunk(long seed) { + return org.dreeam.leaf.config.modules.opt.FastRNG.enabled && !org.dreeam.leaf.config.modules.opt.FastRNG.useLegacyForSlimeChunk + ? new org.dreeam.leaf.util.math.random.FasterRandomSource(seed) + : new LegacyRandomSource(seed); } static RandomSource createNewThreadLocalInstance() { - return new SingleThreadedRandomSource(ThreadLocalRandom.current().nextLong()); + return org.dreeam.leaf.config.modules.opt.FastRNG.enabled + ? new org.dreeam.leaf.util.math.random.FasterRandomSource(RandomSupport.generateUniqueSeed()) + : new SingleThreadedRandomSource(ThreadLocalRandom.current().nextLong()); } + // Leaf end - Faster random generator RandomSource fork(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java index 3e1a5ef63d97e2ad43d98c5736a185ade7afb4bd..f7f330758dce7c38e0e0e8ba420df4d83f765cf1 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -143,7 +143,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // Paper start - Share random for entities to make them more random - public static RandomSource SHARED_RANDOM = new RandomRandomSource(); + public static RandomSource SHARED_RANDOM = org.dreeam.leaf.config.modules.opt.FastRNG.enabled ? org.dreeam.leaf.util.math.random.FasterRandomSource.SHARED_INSTANCE : new RandomRandomSource(); // Leaf - Faster random generator // Paper start - replace random private static final class RandomRandomSource extends ca.spottedleaf.moonrise.common.util.ThreadUnsafeRandom { public RandomRandomSource() { diff --git a/net/minecraft/world/level/biome/Biome.java b/net/minecraft/world/level/biome/Biome.java index f44461f92a10cbfdb8fcdbc3a2442e526b9d3d33..b4c5eea26e87ee6f466c53a6dd0867909df7e848 100644 --- a/net/minecraft/world/level/biome/Biome.java +++ b/net/minecraft/world/level/biome/Biome.java @@ -54,14 +54,14 @@ public final class Biome { ); public static final Codec> CODEC = RegistryFileCodec.create(Registries.BIOME, DIRECT_CODEC); public static final Codec> LIST_CODEC = RegistryCodecs.homogeneousList(Registries.BIOME, DIRECT_CODEC); - private static final PerlinSimplexNoise TEMPERATURE_NOISE = new PerlinSimplexNoise(new WorldgenRandom(new LegacyRandomSource(1234L)), ImmutableList.of(0)); + private static final PerlinSimplexNoise TEMPERATURE_NOISE = new PerlinSimplexNoise(new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(1234L) : new LegacyRandomSource(1234L)), ImmutableList.of(0)); // Leaf - Faster random generator static final PerlinSimplexNoise FROZEN_TEMPERATURE_NOISE = new PerlinSimplexNoise( - new WorldgenRandom(new LegacyRandomSource(3456L)), ImmutableList.of(-2, -1, 0) + new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(3456L) : new LegacyRandomSource(3456L)), ImmutableList.of(-2, -1, 0) // Leaf - Faster random generator ); @Deprecated( forRemoval = true ) - public static final PerlinSimplexNoise BIOME_INFO_NOISE = new PerlinSimplexNoise(new WorldgenRandom(new LegacyRandomSource(2345L)), ImmutableList.of(0)); + public static final PerlinSimplexNoise BIOME_INFO_NOISE = new PerlinSimplexNoise(new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(2345L) : new LegacyRandomSource(2345L)), ImmutableList.of(0)); // Leaf - Faster random generator private static final int TEMPERATURE_CACHE_SIZE = 1024; public final Biome.ClimateSettings climateSettings; private final BiomeGenerationSettings generationSettings; diff --git a/net/minecraft/world/level/chunk/ChunkGenerator.java b/net/minecraft/world/level/chunk/ChunkGenerator.java index 2b19e989b4475e905d77bf9d47403c724b81fccd..472105a1e392f2e1b080483f3038de4f303919ce 100644 --- a/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/net/minecraft/world/level/chunk/ChunkGenerator.java @@ -458,7 +458,7 @@ public abstract class ChunkGenerator { int x = chunk.getPos().x; int z = chunk.getPos().z; for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) { - WorldgenRandom seededrandom = new WorldgenRandom(new net.minecraft.world.level.levelgen.LegacyRandomSource(level.getSeed())); + WorldgenRandom seededrandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(level.getSeed()) : new net.minecraft.world.level.levelgen.LegacyRandomSource(level.getSeed())); // Leaf - Faster random generator seededrandom.setDecorationSeed(level.getSeed(), x, z); populator.populate(world, new org.bukkit.craftbukkit.util.RandomSourceWrapper.RandomWrapper(seededrandom), x, z, limitedRegion); } @@ -567,7 +567,7 @@ public abstract class ChunkGenerator { pos.x, pos.z, su.plo.matter.Globals.Salt.GENERATE_FEATURE, 0 ); } else { - worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); + worldgenRandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(0L) : new LegacyRandomSource(0L)); // Leaf - Faster random generator worldgenRandom.setLargeFeatureSeed(structureState.getLevelSeed(), pos.x, pos.z); } // Leaf end - Matter - Feature Secure Seed diff --git a/net/minecraft/world/level/levelgen/DensityFunctions.java b/net/minecraft/world/level/levelgen/DensityFunctions.java index 04527a5c65ad630f794fed9071d485aedd02257a..15fc39f9c77fdd03a0ca4a39d173c851b9454f08 100644 --- a/net/minecraft/world/level/levelgen/DensityFunctions.java +++ b/net/minecraft/world/level/levelgen/DensityFunctions.java @@ -518,7 +518,7 @@ public final class DensityFunctions { // Paper end - Perf: Optimize end generation public EndIslandDensityFunction(long seed) { - RandomSource randomSource = new LegacyRandomSource(seed); + RandomSource randomSource = org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(seed) : new LegacyRandomSource(seed); // Leaf - Faster random generator randomSource.consumeCount(17292); this.islandNoise = new SimplexNoise(randomSource); } diff --git a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java index 65728ef17e63d71833677fdcbd5bb90794b4822b..57ae4aaf1431021daf77c5638038d4910a358155 100644 --- a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java @@ -254,7 +254,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { WorldGenRegion level, long seed, RandomState random, BiomeManager biomeManager, StructureManager structureManager, ChunkAccess chunk ) { BiomeManager biomeManager1 = biomeManager.withDifferentSource((x, y, z) -> this.biomeSource.getNoiseBiome(x, y, z, random.sampler())); - WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(RandomSupport.generateUniqueSeed())); + WorldgenRandom worldgenRandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(RandomSupport.generateUniqueSeed()) : new LegacyRandomSource(RandomSupport.generateUniqueSeed())); // Leaf - Faster random generator int i = 8; ChunkPos pos = chunk.getPos(); NoiseChunk noiseChunk = chunk.getOrCreateNoiseChunk(chunkAccess -> this.createNoiseChunk(chunkAccess, structureManager, Blender.of(level), random)); @@ -420,7 +420,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { if (!this.settings.value().disableMobGeneration()) { ChunkPos center = level.getCenter(); Holder biome = level.getBiome(center.getWorldPosition().atY(level.getMaxY())); - WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(RandomSupport.generateUniqueSeed())); + WorldgenRandom worldgenRandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(RandomSupport.generateUniqueSeed()) : new LegacyRandomSource(RandomSupport.generateUniqueSeed())); // Leaf - Faster random generator worldgenRandom.setDecorationSeed(level.getSeed(), center.getMinBlockX(), center.getMinBlockZ()); NaturalSpawner.spawnMobsForChunkGeneration(level, biome, center, worldgenRandom); } diff --git a/net/minecraft/world/level/levelgen/WorldgenRandom.java b/net/minecraft/world/level/levelgen/WorldgenRandom.java index c2d7cd788071e25b8ba2503c30ae80c7a9f353ed..08cf526ae87dd2560fcb50d5786701701e34ec00 100644 --- a/net/minecraft/world/level/levelgen/WorldgenRandom.java +++ b/net/minecraft/world/level/levelgen/WorldgenRandom.java @@ -69,7 +69,7 @@ public class WorldgenRandom extends LegacyRandomSource { } public static RandomSource seedSlimeChunk(int chunkX, int chunkZ, long levelSeed, long salt) { - return RandomSource.create(levelSeed + chunkX * chunkX * 4987142 + chunkX * 5947611 + chunkZ * chunkZ * 4392871L + chunkZ * 389711 ^ salt); + return RandomSource.createForSlimeChunk(levelSeed + chunkX * chunkX * 4987142 + chunkX * 5947611 + chunkZ * chunkZ * 4392871L + chunkZ * 389711 ^ salt); // Leaf - Faster RNG } public static enum Algorithm { diff --git a/net/minecraft/world/level/levelgen/feature/GeodeFeature.java b/net/minecraft/world/level/levelgen/feature/GeodeFeature.java index e416b27c7f6604349766d44284ee004d5f62d9b2..1d27550bb5f29b6bfe8e0ad4fc4c9d39a9d7b29e 100644 --- a/net/minecraft/world/level/levelgen/feature/GeodeFeature.java +++ b/net/minecraft/world/level/levelgen/feature/GeodeFeature.java @@ -44,7 +44,7 @@ public class GeodeFeature extends Feature { // Leaf start - Matter - Feature Secure Seed WorldgenRandom worldgenRandom = org.dreeam.leaf.config.modules.misc.SecureSeed.enabled ? new su.plo.matter.WorldgenCryptoRandom(0, 0, su.plo.matter.Globals.Salt.GEODE_FEATURE, 0) - : new WorldgenRandom(new LegacyRandomSource(worldGenLevel.getSeed())); + : new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(worldGenLevel.getSeed()) : new LegacyRandomSource(worldGenLevel.getSeed())); // Leaf - Faster random generator // Leaf end - Matter - Feature Secure Seed NormalNoise normalNoise = NormalNoise.create(worldgenRandom, -4, 1.0); List list1 = Lists.newLinkedList(); diff --git a/net/minecraft/world/level/levelgen/feature/stateproviders/DualNoiseProvider.java b/net/minecraft/world/level/levelgen/feature/stateproviders/DualNoiseProvider.java index 48ab8a568d97052fe205e6a1f89862ee23d65abb..a190b5e890cf34dd1aa46cb9e283f05154fbe3e5 100644 --- a/net/minecraft/world/level/levelgen/feature/stateproviders/DualNoiseProvider.java +++ b/net/minecraft/world/level/levelgen/feature/stateproviders/DualNoiseProvider.java @@ -43,7 +43,7 @@ public class DualNoiseProvider extends NoiseProvider { this.variety = variety; this.slowNoiseParameters = slowNoiseParameters; this.slowScale = slowScale; - this.slowNoise = NormalNoise.create(new WorldgenRandom(new LegacyRandomSource(seed)), slowNoiseParameters); + this.slowNoise = NormalNoise.create(new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(seed) : new LegacyRandomSource(seed)), slowNoiseParameters); // Leaf - Faster random generator } @Override diff --git a/net/minecraft/world/level/levelgen/feature/stateproviders/NoiseBasedStateProvider.java b/net/minecraft/world/level/levelgen/feature/stateproviders/NoiseBasedStateProvider.java index f685372a39976f823202f2d9015c14f835b94a0c..bdd1b4ab758fc653df4adad7633ef430ebb89dbe 100644 --- a/net/minecraft/world/level/levelgen/feature/stateproviders/NoiseBasedStateProvider.java +++ b/net/minecraft/world/level/levelgen/feature/stateproviders/NoiseBasedStateProvider.java @@ -28,7 +28,7 @@ public abstract class NoiseBasedStateProvider extends BlockStateProvider { this.seed = seed; this.parameters = parameters; this.scale = scale; - this.noise = NormalNoise.create(new WorldgenRandom(new LegacyRandomSource(seed)), parameters); + this.noise = NormalNoise.create(new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(seed) : new LegacyRandomSource(seed)), parameters); // Leaf - Faster random generator } protected double getNoiseValue(BlockPos pos, double delta) { diff --git a/net/minecraft/world/level/levelgen/structure/Structure.java b/net/minecraft/world/level/levelgen/structure/Structure.java index 533dc888e4c1febe4e4b71bd6e1c1affbeb492a9..7f8293497912532fd6b83a0962a722b0e6267721 100644 --- a/net/minecraft/world/level/levelgen/structure/Structure.java +++ b/net/minecraft/world/level/levelgen/structure/Structure.java @@ -256,7 +256,7 @@ public abstract class Structure { ); } // Leaf end - Matter - Feature Secure Seed - WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); + WorldgenRandom worldgenRandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(0L) : new LegacyRandomSource(0L)); // Leaf - Faster random generator worldgenRandom.setLargeFeatureSeed(seed, chunkPos.x, chunkPos.z); return worldgenRandom; } diff --git a/net/minecraft/world/level/levelgen/structure/placement/RandomSpreadStructurePlacement.java b/net/minecraft/world/level/levelgen/structure/placement/RandomSpreadStructurePlacement.java index d7040165f2b5bb8c60bf32c7bd57ddc0b49faec8..ebba2592726356eb837b733c36148f444c2d7f13 100644 --- a/net/minecraft/world/level/levelgen/structure/placement/RandomSpreadStructurePlacement.java +++ b/net/minecraft/world/level/levelgen/structure/placement/RandomSpreadStructurePlacement.java @@ -74,7 +74,7 @@ public class RandomSpreadStructurePlacement extends StructurePlacement { i, i1, su.plo.matter.Globals.Salt.POTENTIONAL_FEATURE, this.salt ); } else { - worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); + worldgenRandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(0L) : new LegacyRandomSource(0L)); // Leaf - Faster random generator worldgenRandom.setLargeFeatureWithSalt(seed, i, i1, this.salt()); } // Leaf end - Matter - Feature Secure Seed diff --git a/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java b/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java index 03247c55e0448cabc24ff281e2d1c7df527161da..2a9f66ac0fe8f664d404c68df7414be6b0396082 100644 --- a/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java +++ b/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java @@ -125,7 +125,7 @@ public abstract class StructurePlacement { regionX, regionZ, su.plo.matter.Globals.Salt.UNDEFINED, salt ); } else { - worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); + worldgenRandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(0L) : new LegacyRandomSource(0L)); // Leaf - Faster random generator worldgenRandom.setLargeFeatureWithSalt(levelSeed, salt, regionX, regionZ); } // Leaf end - Matter - Feature Secure Seed @@ -134,7 +134,7 @@ public abstract class StructurePlacement { } private static boolean legacyProbabilityReducerWithDouble(long baseSeed, int salt, int chunkX, int chunkZ, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs - WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); + WorldgenRandom worldgenRandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(0L) : new LegacyRandomSource(0L)); // Leaf - Faster random generator if (saltOverride == null) { // Paper - Add missing structure set seed configs worldgenRandom.setLargeFeatureSeed(baseSeed, chunkX, chunkZ); // Paper start - Add missing structure set seed configs @@ -146,7 +146,7 @@ public abstract class StructurePlacement { } private static boolean legacyArbitrarySaltProbabilityReducer(long levelSeed, int salt, int regionX, int regionZ, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs - WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); + WorldgenRandom worldgenRandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(0L) : new LegacyRandomSource(0L)); // Leaf - Faster random generator worldgenRandom.setLargeFeatureWithSalt(levelSeed, regionX, regionZ, saltOverride != null ? saltOverride : HIGHLY_ARBITRARY_RANDOM_SALT); // Paper - Add missing structure set seed configs return worldgenRandom.nextFloat() < probability; } @@ -154,7 +154,7 @@ public abstract class StructurePlacement { private static boolean legacyPillagerOutpostReducer(long levelSeed, int salt, int regionX, int regionZ, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs; ignore here int i = regionX >> 4; int i1 = regionZ >> 4; - WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); + WorldgenRandom worldgenRandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(0L) : new LegacyRandomSource(0L)); // Leaf - Faster random generator worldgenRandom.setSeed(i ^ i1 << 4 ^ levelSeed); worldgenRandom.nextInt(); return worldgenRandom.nextInt((int)(1.0F / probability)) == 0; diff --git a/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentStructure.java b/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentStructure.java index 6941b2c89df8a7c77166e3fb76150cbc852371d9..661c26c4b981d504988c7498be45a5ddacaf90d8 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentStructure.java +++ b/net/minecraft/world/level/levelgen/structure/structures/OceanMonumentStructure.java @@ -56,7 +56,7 @@ public class OceanMonumentStructure extends Structure { if (piecesContainer.isEmpty()) { return piecesContainer; } else { - WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(RandomSupport.generateUniqueSeed())); + WorldgenRandom worldgenRandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(RandomSupport.generateUniqueSeed()) : new LegacyRandomSource(RandomSupport.generateUniqueSeed())); // Leaf - Faster random generator worldgenRandom.setLargeFeatureSeed(seed, chunkPos.x, chunkPos.z); StructurePiece structurePiece = piecesContainer.pieces().get(0); BoundingBox boundingBox = structurePiece.getBoundingBox(); diff --git a/net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.java b/net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.java index 434e72fd770a259d67e5e7f110f49b09bab6c54e..720098d50ecefeff25e8f032e33742ad6bd6ab21 100644 --- a/net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.java +++ b/net/minecraft/world/level/levelgen/synth/PerlinSimplexNoise.java @@ -43,7 +43,7 @@ public class PerlinSimplexNoise { if (i1 > 0) { long l = (long)(simplexNoise.getValue(simplexNoise.xo, simplexNoise.yo, simplexNoise.zo) * 9.223372E18F); - RandomSource randomSource = new WorldgenRandom(new LegacyRandomSource(l)); + RandomSource randomSource = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(l) : new LegacyRandomSource(l)); // Leaf - Faster random generator for (int i5 = i3 - 1; i5 >= 0; i5--) { if (i5 < i2 && octaves.contains(i3 - i5)) {