9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-30 04:29:05 +00:00
This commit is contained in:
Daniel Mills
2020-08-17 00:26:21 -04:00
parent af22751210
commit 8a7bc3c17d
8 changed files with 103 additions and 75 deletions

View File

@@ -21,7 +21,6 @@ import com.volmit.iris.object.IrisRegion;
import com.volmit.iris.util.BiomeResult;
import com.volmit.iris.util.Form;
import com.volmit.iris.util.Function2;
import com.volmit.iris.util.IrisLock;
import com.volmit.iris.util.KMap;
import com.volmit.iris.util.RNG;
@@ -33,7 +32,6 @@ import lombok.EqualsAndHashCode;
public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisContext
{
private Method initLighting;
private IrisLock lock;
private IrisBiome hb = null;
private IrisRegion hr = null;
private KMap<Player, IrisBiome> b = new KMap<>();
@@ -41,19 +39,16 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
public IrisChunkGenerator(String dimensionName, int threads)
{
super(dimensionName, threads);
lock = new IrisLock("IrisChunkGenerator");
}
public IrisChunkGenerator(String dimensionName)
{
super(dimensionName, 16);
lock = new IrisLock("IrisChunkGenerator");
}
public IrisChunkGenerator(int tc)
{
super("", tc);
lock = new IrisLock("IrisChunkGenerator");
}
public void hotload()
@@ -73,9 +68,7 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
@Override
protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid)
{
lock.lock();
super.onGenerate(random, x, z, data, grid);
lock.unlock();
}
public void onInit(World world, RNG rng)

View File

@@ -697,7 +697,6 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
return i.getMax();
}
}
}
catch(Throwable e)

View File

@@ -16,9 +16,6 @@ public class AtomicMulticache
private final KMap<Long, BiomeResult> biome;
private final KMap<Long, BiomeResult> rawBiome;
private final KMap<Long, IrisRegion> region;
private int r = 0;
private int w = 0;
private int m = 0;
public AtomicMulticache()
{
@@ -34,9 +31,6 @@ public class AtomicMulticache
{
this.x.set(x);
this.z.set(z);
r = 0;
w = 0;
m = 0;
if(!IrisSettings.get().sharedCaching || getSize() > 42000)
{
@@ -46,70 +40,58 @@ public class AtomicMulticache
public double getHeight(int x, int z, Supplier<Double> g)
{
return height.compute(pos(x, z), (k, v) ->
Long pos = pos(x, z);
Double r = height.get(pos);
if(r == null)
{
if(v == null)
{
m++;
w++;
return g.get();
}
r = g.get();
height.put(pos, r);
}
r++;
return v;
});
return r;
}
public IrisRegion getRegion(int x, int z, Supplier<IrisRegion> g)
{
return region.compute(pos(x, z), (k, v) ->
Long pos = pos(x, z);
IrisRegion r = region.get(pos);
if(r == null)
{
if(v == null)
{
m++;
w++;
return g.get();
}
r = g.get();
region.put(pos, r);
}
r++;
return v;
});
return r;
}
public BiomeResult getBiome(int x, int z, Supplier<BiomeResult> g)
{
return biome.compute(pos(x, z), (k, v) ->
Long pos = pos(x, z);
BiomeResult r = biome.get(pos);
if(r == null)
{
if(v == null)
{
m++;
w++;
return g.get();
}
r = g.get();
biome.put(pos, r);
}
r++;
return v;
});
return r;
}
public BiomeResult getRawBiome(int x, int z, Supplier<BiomeResult> g)
{
return rawBiome.compute(pos(x, z), (k, v) ->
Long pos = pos(x, z);
BiomeResult r = rawBiome.get(pos);
if(r == null)
{
if(v == null)
{
m++;
w++;
return g.get();
}
r = g.get();
rawBiome.put(pos, r);
}
r++;
return v;
});
return r;
}
private long pos(int x, int z)

View File

@@ -178,7 +178,7 @@ public class GenLayerCave extends GenLayer
public boolean canAir(Material m)
{
return (m.isSolid() || (B.isDecorant(m)) || m.equals(Material.AIR) || m.equals(B.mat("CAVE_AIR"))) && !m.equals(Material.BEDROCK);
return (B.isSolid(m) || (B.isDecorant(m)) || m.equals(Material.AIR) || m.equals(B.mat("CAVE_AIR"))) && !m.equals(Material.BEDROCK);
}
public boolean canWater(Material m)
@@ -188,7 +188,7 @@ public class GenLayerCave extends GenLayer
public boolean can(Material m)
{
return m.isSolid() && !m.equals(Material.BEDROCK);
return B.isSolid(m) && !m.equals(Material.BEDROCK);
}
@Override