Replaced All Instances of Random With SplittableRandom

SplittableRandom is faster (negligable) than Random and is also able to recursively return new instances of itself for an even more complex pseudo random generator compared to the default Random supplied by Java.
This commit is contained in:
Paldiu
2020-12-25 15:57:10 -05:00
parent dec35f76e4
commit eb9759f2d8
8 changed files with 18 additions and 18 deletions

View File

@ -19,7 +19,7 @@
package me.totalfreedom.totalfreedommod.world;
import java.util.Arrays;
import java.util.Random;
import java.util.SplittableRandom;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Material;
@ -128,7 +128,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
}
@Override
public @NotNull ChunkData generateChunkData(World world, @NotNull Random random, int x, int z, @NotNull BiomeGrid biome)
public @NotNull ChunkData generateChunkData(World world, @NotNull SplittableRandom random, int x, int z, @NotNull BiomeGrid biome)
{
int maxHeight = world.getMaxHeight();
if (materials.length > maxHeight)
@ -150,7 +150,7 @@ public class CleanroomChunkGenerator extends ChunkGenerator
}
@Override
public Location getFixedSpawnLocation(World world, @NotNull Random random)
public Location getFixedSpawnLocation(World world, @NotNull SplittableRandom random)
{
if (!world.isChunkLoaded(0, 0))
{