Made sure alternator was semi-multithread safe.

This commit is contained in:
Harrison Deng 2020-04-21 17:01:53 -05:00
parent 533a758799
commit 66673e2f52

View File

@ -21,11 +21,10 @@ public class IslandWorldGeneratorAlternator {
this.islandBiomeGenerator = biomeGenerator; this.islandBiomeGenerator = biomeGenerator;
} }
public IslandWorldGenerator getIslandChunkGeneratorSystemForWorld(World world, Random random) { public synchronized IslandWorldGenerator getIslandChunkGeneratorSystemForWorld(World world, Random random) {
if (!chunkGenerator.containsKey(world.getUID())) { if (!chunkGenerator.containsKey(world.getUID())) {
chunkGenerator.put(world.getUID(), new IslandWorldGenerator(world, islandBiomeGenerator.getInstance(), random)); chunkGenerator.put(world.getUID(), new IslandWorldGenerator(world, islandBiomeGenerator.getInstance(), random));
} }
return chunkGenerator.get(world.getUID()); return chunkGenerator.get(world.getUID());
} }
} }