Support Getters instead of fields

This commit is contained in:
Daniel Mills 2020-09-04 03:24:52 -04:00
parent b8f58b9cc7
commit dd4edb8ba5
7 changed files with 131 additions and 153 deletions

View File

@ -59,22 +59,22 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
private BlockPosition allowLoot;
private AtomicMulticache cache;
private IrisDataManager data;
protected boolean failing;
protected int task;
protected boolean dev;
protected boolean initialized;
protected RNG masterRandom;
protected ChronoLatch perSecond;
protected ChronoLatch tickLatch;
protected ChronoLatch pushLatch;
private boolean failing;
private int task;
private boolean dev;
private boolean initialized;
private RNG masterRandom;
private ChronoLatch perSecond;
private ChronoLatch tickLatch;
private ChronoLatch pushLatch;
private AtomicCache<IrisDimension> dimCache;
protected IrisMetrics metrics;
protected World world;
protected int generated;
protected int ticks;
protected long hlast;
private IrisMetrics metrics;
private World world;
private int generated;
private int ticks;
private long hlast;
private boolean fastPregen = false;
protected boolean pregenDone;
private boolean pregenDone;
private volatile boolean hotloadable = false;
public ContextualChunkGenerator()
@ -137,7 +137,7 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
public IrisDimension loadDimension(String i)
{
return dimCache.aquire(() -> (getData() == null ? Iris.globaldata : getData()).getDimensionLoader().load(i));
return getDimCache().aquire(() -> (getData() == null ? Iris.globaldata : getData()).getDimensionLoader().load(i));
}
public IrisGenerator loadGenerator(String i)
@ -158,40 +158,40 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
}
this.world = world;
data = new IrisDataManager(getWorld().getWorldFolder());
this.masterRandom = new RNG(world.getSeed());
metrics = new IrisMetrics(128);
initialized = true;
setData(new IrisDataManager(getWorld().getWorldFolder()));
setMasterRandom(new RNG(world.getSeed()));
setMetrics(new IrisMetrics(128));
setInitialized(true);
setTask(Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, this::tick, 0, 0));
Bukkit.getServer().getPluginManager().registerEvents(this, Iris.instance);
task = Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, this::tick, 0, 0);
onInit(world, masterRandom);
setHotloadable(true);
}
private void tick()
{
if(dev)
if(isDev())
{
if(perSecond.flip())
if(getPerSecond().flip())
{
if(generated > (fastPregen ? 1950 : 770))
if(getGenerated() > (isFastPregen() ? 1950 : 770))
{
pregenDone = true;
setPregenDone(true);
}
if(pregenDone)
if(isPregenDone())
{
metrics.getPerSecond().put(generated);
generated = 0;
getMetrics().getPerSecond().put(generated);
setGenerated(0);
}
checkHotload();
if(noLoot.size() > 1024)
if(getNoLoot().size() > 1024)
{
for(int i = 0; i < 64; i++)
{
noLoot.remove(0);
getNoLoot().remove(0);
}
}
}
@ -199,8 +199,8 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
else
{
pregenDone = true;
fastPregen = false;
setPregenDone(true);
setFastPregen(false);
}
onTick(ticks++);
@ -243,7 +243,7 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
return;
}
noLoot.addIfMissing(new BlockPosition(e.getBlock().getX(), e.getBlock().getY(), e.getBlock().getZ()));
getNoLoot().addIfMissing(new BlockPosition(e.getBlock().getX(), e.getBlock().getY(), e.getBlock().getZ()));
}
@EventHandler(priority = EventPriority.MONITOR)
@ -333,8 +333,8 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
public void close()
{
noLoot.clear();
noLoot.trimToSize();
getNoLoot().clear();
getNoLoot().trimToSize();
HandlerList.unregisterAll(this);
Bukkit.getScheduler().cancelTask(getTask());
onClose();
@ -400,10 +400,10 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
public ChunkData generateChunkData(World world, Random no, int x, int z, BiomeGrid biomeGrid)
{
setHotloadable(false);
if(!dev)
if(!isDev())
{
pregenDone = true;
fastPregen = false;
setPregenDone(true);
setFastPregen(false);
}
if(failing)
@ -447,14 +447,14 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
public void checkHotload()
{
if(M.ms() - hlast < 1000)
if(M.ms() - getHlast() < 1000)
{
return;
}
if(world != null)
if(getWorld() != null)
{
checkHotload(world);
checkHotload(getWorld());
}
}
@ -465,11 +465,11 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
return;
}
if(pushLatch.flip())
if(getPushLatch().flip())
{
if(this.world == null)
if(getWorld() == null)
{
this.world = world;
setWorld(world);
}
Iris.hotloader.check((IrisContext) this);
@ -483,18 +483,18 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
public void onHotload()
{
hlast = M.ms();
dimCache.reset();
setHlast(M.ms());
getDimCache().reset();
}
protected void fail(Throwable e)
{
if(failing)
if(isFailing())
{
return;
}
failing = true;
setFailing(true);
e.printStackTrace();
J.a(() ->

View File

@ -22,7 +22,7 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = false)
public abstract class DimensionChunkGenerator extends ContextualChunkGenerator
{
protected String dimensionName;
private String dimensionName;
protected static final BlockData AIR = Material.AIR.createBlockData();
protected static final BlockData CAVE_AIR = B.get("CAVE_AIR");
protected static final BlockData BEDROCK = Material.BEDROCK.createBlockData();
@ -31,7 +31,7 @@ public abstract class DimensionChunkGenerator extends ContextualChunkGenerator
public DimensionChunkGenerator(String dimensionName)
{
super();
this.dimensionName = dimensionName;
setDimensionName(dimensionName);
}
public void onPlayerLeft(Player p)
@ -46,14 +46,14 @@ public abstract class DimensionChunkGenerator extends ContextualChunkGenerator
public void onInit(World world, RNG masterRandom)
{
if(dimensionName.isEmpty())
if(getDimensionName().isEmpty())
{
File folder = new File(world.getWorldFolder(), "iris/dimensions");
if(!folder.exists())
{
Iris.error("Missing World iris/dimensions folder!");
dimensionName = "error-missing-dimension";
setDimensionName("error-missing-dimension");
return;
}
@ -61,13 +61,13 @@ public abstract class DimensionChunkGenerator extends ContextualChunkGenerator
{
if(i.isFile() && i.getName().endsWith(".json"))
{
dimensionName = i.getName().replaceAll("\\Q.json\\E", "");
setDimensionName(i.getName().replaceAll("\\Q.json\\E", ""));
return;
}
}
Iris.error("Missing World iris/dimensions/<dimension-name>.json file. Assuming overworld!");
dimensionName = "error-missing-dimension";
setDimensionName("error-missing-dimension");
fail(new RuntimeException("Missing dimension folder/file in " + folder.getAbsolutePath()));
}
@ -76,11 +76,11 @@ public abstract class DimensionChunkGenerator extends ContextualChunkGenerator
public IrisDimension getDimension()
{
IrisDimension d = loadDimension(dimensionName);
IrisDimension d = loadDimension(getDimensionName());
if(d == null)
{
Iris.error("Can't find dimension: " + dimensionName);
Iris.error("Can't find dimension: " + getDimensionName());
}
return d;
@ -118,16 +118,12 @@ public abstract class DimensionChunkGenerator extends ContextualChunkGenerator
public double getModifiedX(int rx, int rz)
{
return (getDimension().cosRotate() * rx) + (-getDimension().sinRotate() * rz) +
getDimension().getCoordFracture(masterRandom, 39392).fitDouble(-getDimension().getCoordFractureDistance() / 2, getDimension().getCoordFractureDistance() / 2, rx, rz);
return (getDimension().cosRotate() * rx) + (-getDimension().sinRotate() * rz) + getDimension().getCoordFracture(getMasterRandom(), 39392).fitDouble(-getDimension().getCoordFractureDistance() / 2, getDimension().getCoordFractureDistance() / 2, rx, rz);
}
public double getModifiedZ(int rx, int rz)
{
return (getDimension().sinRotate() * rx) + (getDimension().cosRotate() * rz) +
getDimension().getCoordFracture(masterRandom, 39392).fitDouble(-getDimension().getCoordFractureDistance() / 2, getDimension().getCoordFractureDistance() / 2, rx, rz);
return (getDimension().sinRotate() * rx) + (getDimension().cosRotate() * rz) + getDimension().getCoordFracture(getMasterRandom(), 39392).fitDouble(-getDimension().getCoordFractureDistance() / 2, getDimension().getCoordFractureDistance() / 2, rx, rz);
}
public double getZoomed(double modified)

View File

@ -2,7 +2,6 @@ package com.volmit.iris.gen;
import java.awt.Color;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Random;
import org.bukkit.Bukkit;
@ -30,7 +29,6 @@ import com.volmit.iris.object.IrisRegion;
import com.volmit.iris.util.Form;
import com.volmit.iris.util.IrisStructureResult;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.KMap;
import com.volmit.iris.util.PrecisionStopwatch;
import com.volmit.iris.util.RNG;
@ -41,10 +39,8 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = false)
public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisContext
{
private Method initLighting;
private IrisBiome hb = null;
private IrisRegion hr = null;
private KMap<Player, IrisBiome> b = new KMap<>();
private boolean spawnable = false;
public IrisChunkGenerator(String dimensionName, int threads)
@ -69,9 +65,9 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
public void retry()
{
if(failing)
if(isFailing())
{
failing = false;
setFailing(false);
hotload();
}
}
@ -82,7 +78,7 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
PrecisionStopwatch s = PrecisionStopwatch.start();
ChunkData c = super.generateChunkData(world, no, x, z, biomeGrid);
s.end();
metrics.getTotal().put(s.getMilliseconds());
getMetrics().getTotal().put(s.getMilliseconds());
return c;
}
@ -153,9 +149,9 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
try
{
parallaxMap.saveAll();
parallaxMap.getLoadedChunks().clear();
parallaxMap.getLoadedRegions().clear();
getParallaxMap().saveAll();
getParallaxMap().getLoadedChunks().clear();
getParallaxMap().getLoadedRegions().clear();
}
catch(IOException e)
@ -222,17 +218,17 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
{
long bytes = 1024 * 1024 * (8 + (getThreads() / 3));
for(AtomicRegionData i : parallaxMap.getLoadedRegions().values())
for(AtomicRegionData i : getParallaxMap().getLoadedRegions().values())
{
bytes += i.guessMemoryUsage();
}
bytes += getCache().getSize() * 65;
bytes += parallaxMap.getLoadedChunks().size() * 256 * 4 * 460;
bytes += getParallaxMap().getLoadedChunks().size() * 256 * 4 * 460;
bytes += getSliverBuffer() * 220;
bytes += 823 * getData().getObjectLoader().getTotalStorage();
return bytes;
return bytes / 2;
}
@Override
@ -314,6 +310,7 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
{
getParallaxMap().saveAll();
}
catch(IOException e)
{
e.printStackTrace();
@ -438,7 +435,7 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
@Override
protected void onSpawn(EntitySpawnEvent e)
{
if(spawnable)
if(isSpawnable())
{
int x = e.getEntity().getLocation().getBlockX();
int y = e.getEntity().getLocation().getBlockY();
@ -500,7 +497,7 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
{
for(IrisEntitySpawn i : s)
{
spawnable = false;
setSpawnable(false);
if(i.on(this, e.getLocation(), e.getEntityType(), e) != null)
{
@ -511,7 +508,7 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
else
{
spawnable = true;
setSpawnable(true);
}
}

View File

@ -39,8 +39,8 @@ import lombok.EqualsAndHashCode;
public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator implements IObjectPlacer
{
private short cacheID = 0;
protected KMap<ChunkPosition, AtomicSliver> sliverCache;
protected AtomicWorldData parallaxMap;
private KMap<ChunkPosition, AtomicSliver> sliverCache;
private AtomicWorldData parallaxMap;
private MasterLock masterLock;
private IrisLock flock = new IrisLock("ParallaxLock");
private IrisLock lock = new IrisLock("ParallaxLock");
@ -51,21 +51,17 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
public ParallaxChunkGenerator(String dimensionName, int threads)
{
super(dimensionName, threads);
sliverCache = new KMap<>();
sliverBuffer = 0;
masterLock = new MasterLock();
setSliverCache(new KMap<>());
setSliverBuffer(sliverBuffer);
setMasterLock(new MasterLock());
}
public void onInit(World world, RNG rng)
{
super.onInit(world, rng);
parallaxMap = new AtomicWorldData(world);
glText = new GenLayerText(this, rng.nextParallelRNG(32485));
}
protected KMap<ChunkPosition, AtomicSliver> getSliverCache()
{
return sliverCache;
setParallaxMap(new AtomicWorldData(world));
setGlText(new GenLayerText(this, rng.nextParallelRNG(32485)));
setGlUpdate(null);
}
protected void onClose()
@ -74,7 +70,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
try
{
parallaxMap.unloadAll(true);
getParallaxMap().unloadAll(true);
}
catch(IOException e)
@ -94,7 +90,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
{
getData().preferFolder(getDimension().getLoadFile().getParentFile().getParentFile().getName());
super.onHotload();
cacheID = RNG.r.simax();
setCacheID(RNG.r.simax());
}
@Override
@ -144,11 +140,6 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
return getParallaxChunk(x, z).isWorldGenerated();
}
public AtomicWorldData getParallaxMap()
{
return parallaxMap;
}
public AtomicSliverMap getParallaxChunk(int x, int z)
{
try
@ -169,12 +160,12 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
{
List<BlockPopulator> g = super.getDefaultPopulators(world);
if(glUpdate == null)
if(getGlUpdate() == null)
{
glUpdate = new GenLayerUpdate(this, world);
setGlUpdate(new GenLayerUpdate(this, world));
}
g.add(glUpdate);
g.add(getGlUpdate());
return g;
}
@ -199,11 +190,10 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
setSliverBuffer(getSliverCache().size());
getParallaxChunk(x, z).setWorldGenerated(true);
getMasterLock().clear();
p.end();
getMetrics().getParallax().put(p.getMilliseconds());
super.onPostParallaxPostGenerate(random, x, z, data, grid, height, biomeMap, map);
getParallaxMap().clean(ticks);
getParallaxMap().clean(getTicks());
getData().getObjectLoader().clean();
}

View File

@ -20,32 +20,29 @@ public abstract class ParallelChunkGenerator extends DimensionChunkGenerator
{
private GroupedExecutor accelerant;
private int threads;
protected int cacheX;
protected int cacheZ;
protected boolean cachingAllowed;
private boolean cachingAllowed;
public ParallelChunkGenerator(String dimensionName, int threads)
{
super(dimensionName);
cacheX = 0;
cacheZ = 0;
this.threads = threads;
cachingAllowed = false;
setThreads(threads);
setCachingAllowed(false);
}
public void changeThreadCount(int tc)
{
threads = tc;
GroupedExecutor e = accelerant;
accelerant = new GroupedExecutor(threads, Thread.MAX_PRIORITY, "Iris Generator - " + world.getName());
Iris.executors.add(accelerant);
setThreads(tc);
GroupedExecutor e = getAccelerant();
setAccelerant(new GroupedExecutor(threads, Thread.MAX_PRIORITY, "Iris Generator - " + getWorld().getName()));
;
Iris.executors.add(getAccelerant());
if(e != null)
{
e.close();
}
Iris.info("Thread Count changed to " + tc);
Iris.info("Thread Count changed to " + getThreads());
}
protected abstract void onGenerateColumn(int cx, int cz, int wx, int wz, int x, int z, AtomicSliver sliver, BiomeMap biomeMap, boolean sampled);
@ -68,9 +65,7 @@ public abstract class ParallelChunkGenerator extends DimensionChunkGenerator
protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid)
{
cacheX = x;
cacheZ = z;
getCache().targetChunk(cacheX, cacheZ);
getCache().targetChunk(x, z);
PrecisionStopwatch p = PrecisionStopwatch.start();
AtomicSliverMap map = new AtomicSliverMap();
HeightMap height = new HeightMap();
@ -114,14 +109,14 @@ public abstract class ParallelChunkGenerator extends DimensionChunkGenerator
protected void onClose()
{
accelerant.close();
getAccelerant().close();
Iris.executors.remove(accelerant);
}
public void onInit(World world, RNG rng)
{
super.onInit(world, rng);
changeThreadCount(threads);
changeThreadCount(getThreads());
}
@Override

View File

@ -26,15 +26,15 @@ import lombok.EqualsAndHashCode;
public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator implements IPostBlockAccess
{
private String postKey;
private IrisLock lock;
private IrisLock postLock;
private int minPhase;
private int maxPhase;
public PostBlockChunkGenerator(String dimensionName, int threads)
{
super(dimensionName, threads);
postKey = "post-" + dimensionName;
lock = new IrisLock("PostChunkGenerator");
setPostKey("post-" + dimensionName);
setPostLock(new IrisLock("PostChunkGenerator"));
}
public void onInit(World world, RNG rng)
@ -156,9 +156,9 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
{
if(x >> 4 == currentPostX && z >> 4 == currentPostZ)
{
lock.lock();
getPostLock().lock();
BlockData d = currentData.getBlockData(x & 15, y, z & 15);
lock.unlock();
getPostLock().unlock();
return d == null ? AIR : d;
}
@ -170,9 +170,9 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
{
if(x >> 4 == currentPostX && z >> 4 == currentPostZ)
{
lock.lock();
getPostLock().lock();
currentData.setBlock(x & 15, y, z & 15, d);
lock.unlock();
getPostLock().unlock();
}
else

View File

@ -45,18 +45,18 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
private long lastChunkLoad = M.ms();
private GenLayerCave glCave;
private GenLayerCarve glCarve;
protected GenLayerBiome glBiome;
private GenLayerBiome glBiome;
private RNG rockRandom;
protected IrisLock regLock;
private IrisLock regionLock;
private KMap<String, IrisGenerator> generators;
protected CNG masterFracture;
protected ChronoLatch cwarn = new ChronoLatch(1000);
private CNG masterFracture;
private ChronoLatch cwarn = new ChronoLatch(1000);
public TerrainChunkGenerator(String dimensionName, int threads)
{
super(dimensionName, threads);
generators = new KMap<>();
regLock = new IrisLock("BiomeChunkGenerator");
setGenerators(new KMap<>());
setRegionLock(new IrisLock("BiomeChunkGenerator"));
}
@Override
@ -64,16 +64,16 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
{
super.onInit(world, rng);
loadGenerators();
buildGenLayers(masterRandom);
buildGenLayers(getMasterRandom());
}
private void buildGenLayers(RNG rng)
{
glBiome = new GenLayerBiome(this, rng.nextParallelRNG(24671));
masterFracture = CNG.signature(rng.nextParallelRNG(13)).scale(0.12);
rockRandom = getMasterRandom().nextParallelRNG(2858678);
glCave = new GenLayerCave(this, rng.nextParallelRNG(238948));
glCarve = new GenLayerCarve(this, rng.nextParallelRNG(968346576));
setGlBiome(new GenLayerBiome(this, rng.nextParallelRNG(24671)));
setMasterFracture(CNG.signature(rng.nextParallelRNG(13)).scale(0.12));
setRockRandom(getMasterRandom().nextParallelRNG(2858678));
setGlCave(new GenLayerCave(this, rng.nextParallelRNG(238948)));
setGlCarve(new GenLayerCarve(this, rng.nextParallelRNG(968346576)));
}
public int getCarvedHeight(int x, int z, boolean ignoreFluid)
@ -144,9 +144,9 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
throw new RuntimeException("Null Biome!");
}
KList<BlockData> layers = biome.generateLayers(rx, rz, masterRandom, height, height - getFluidHeight());
KList<BlockData> layers = biome.generateLayers(rx, rz, getMasterRandom(), height, height - getFluidHeight());
KList<BlockData> cavernLayers = null;
KList<BlockData> seaLayers = biome.isAquatic() || biome.isShore() ? biome.generateSeaLayers(rx, rz, masterRandom, fluidHeight - height) : new KList<>();
KList<BlockData> seaLayers = biome.isAquatic() || biome.isShore() ? biome.generateSeaLayers(rx, rz, getMasterRandom(), fluidHeight - height) : new KList<>();
boolean caverning = false;
KList<Integer> cavernHeights = new KList<>();
int lastCavernHeight = -1;
@ -174,13 +174,13 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
}
// Carving
if(carvable && glCarve.isCarved(rx, k, rz))
if(carvable && getGlCarve().isCarved(rx, k, rz))
{
if(biomeMap != null)
{
if(landBiome == null)
{
landBiome = glBiome.generateData(InferredType.LAND, x, z, x, z, region);
landBiome = getGlBiome().generateData(InferredType.LAND, x, z, x, z, region);
}
sliver.set(k, landBiome.getDerivative());
@ -204,19 +204,19 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
if(!biomeAssigned && biomeMap != null)
{
biomeAssigned = true;
sliver.set(k, biome.getGroundBiome(masterRandom, rz, k, rx));
sliver.set(k, biome.getGroundBiome(getMasterRandom(), rz, k, rx));
biomeMap.setBiome(x, z, biome);
for(int kv = max; kv < biomeMax; kv++)
{
Biome skyBiome = biome.getSkyBiome(masterRandom, rz, kv, rx);
Biome skyBiome = biome.getSkyBiome(getMasterRandom(), rz, kv, rx);
sliver.set(kv, skyBiome);
}
}
if(k <= Math.max(height, fluidHeight))
{
sliver.set(k, biome.getGroundBiome(masterRandom, rz, k, rx));
sliver.set(k, biome.getGroundBiome(getMasterRandom(), rz, k, rx));
}
// Set Sea Material (water/lava)
@ -230,12 +230,12 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
{
if(landBiome == null)
{
landBiome = glBiome.generateData(InferredType.LAND, x, z, x, z, region);
landBiome = getGlBiome().generateData(InferredType.LAND, x, z, x, z, region);
}
if(cavernLayers == null)
{
cavernLayers = landBiome.generateLayers(rx, rz, masterRandom, 5, height - getFluidHeight());
cavernLayers = landBiome.generateLayers(rx, rz, getMasterRandom(), 5, height - getFluidHeight());
}
block = cavernLayers.get(lastCavernHeight - k);
@ -262,7 +262,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
{
if(landBiome == null)
{
landBiome = glBiome.generateData(InferredType.LAND, z, x, x, z, region);
landBiome = getGlBiome().generateData(InferredType.LAND, z, x, x, z, region);
}
decorateLand(landBiome, sliver, wx, k, wz, rx, rz, block);
@ -281,7 +281,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
for(int j = i.getFloor(); j <= i.getCeiling(); j++)
{
sliver.set(j, caveBiome);
sliver.set(j, caveBiome.getGroundBiome(masterRandom, rz, j, rx));
sliver.set(j, caveBiome.getGroundBiome(getMasterRandom(), rz, j, rx));
}
KList<BlockData> floor = caveBiome.generateLayers(wx, wz, rockRandom, i.getFloor() - 2, i.getFloor() - 2);
@ -700,21 +700,21 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
super.onHotload();
getData().preferFolder(getDimension().getLoadFile().getParentFile().getParentFile().getName());
loadGenerators();
buildGenLayers(masterRandom);
buildGenLayers(getMasterRandom());
}
public void registerGenerator(IrisGenerator g, IrisDimension dim)
{
KMap<String, IrisGenerator> generators = this.generators;
regLock.lock();
getRegionLock().lock();
if(g.getLoadKey() == null || generators.containsKey(g.getLoadKey()))
{
regLock.unlock();
getRegionLock().unlock();
return;
}
regLock.unlock();
getRegionLock().unlock();
generators.put(g.getLoadKey(), g);
}
@ -793,7 +793,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
return 0;
});
return M.lerp(lo, hi, gen.getHeight(rx, rz, world.getSeed() + 239945));
return M.lerp(lo, hi, gen.getHeight(rx, rz, getWorld().getSeed() + 239945));
}
protected void loadGenerators()