9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-27 19:19:07 +00:00

Cave Biomes

This commit is contained in:
Daniel Mills
2020-07-28 03:13:33 -04:00
parent 45dd039c53
commit bccb4e154d
12 changed files with 479 additions and 106 deletions

View File

@@ -16,6 +16,12 @@ public enum InferredType
@DontObfuscate
CAVE,
@DontObfuscate
ISLAND,
@DontObfuscate
SKYLAND,
@DontObfuscate
DEFER;
}

View File

@@ -135,9 +135,12 @@ public class IrisObject extends IrisRegistrant
int y = yv < 0 ? placer.getHighest(x, z, config.isUnderwater()) + config.getRotation().rotate(new BlockVector(0, getCenter().getBlockY(), 0), yf, xf, spinx, spiny, spinz).getBlockY() : yv;
KMap<ChunkPosition, Integer> heightmap = config.getSnow() > 0 ? new KMap<>() : null;
if(!config.isUnderwater() && !config.isOnwater() && placer.isUnderwater(x, z))
if(yv < 0)
{
return;
if(!config.isUnderwater() && !config.isOnwater() && placer.isUnderwater(x, z))
{
return;
}
}
for(BlockVector g : blocks.k())

View File

@@ -39,6 +39,30 @@ public class IrisRegion extends IrisRegistrant
@Desc("The varience of the shore height")
private double shoreHeightZoom = 3.14;
@DontObfuscate
@Desc("How large land biomes are in this region")
private double landBiomeZoom = 1;
@DontObfuscate
@Desc("How large shore biomes are in this region")
private double shoreBiomeZoom = 1;
@DontObfuscate
@Desc("How large sea biomes are in this region")
private double seaBiomeZoom = 1;
@DontObfuscate
@Desc("How large island biomes are in this region")
private double islandBiomeZoom = 1;
@DontObfuscate
@Desc("How large cave biomes are in this region")
private double caveBiomeZoom = 1;
@DontObfuscate
@Desc("How large skyland biomes are in this region")
private double skylandBiomeZoom = 1;
@DontObfuscate
@Desc("The biome implosion ratio, how much to implode biomes into children (chance)")
private double biomeImplosionRatio = 0.4;
@@ -55,6 +79,18 @@ public class IrisRegion extends IrisRegistrant
@Desc("A list of root-level biomes in this region. Don't specify child biomes of other biomes here. Just the root parents.")
private KList<String> shoreBiomes = new KList<>();
@DontObfuscate
@Desc("A list of root-level biomes in this region. Don't specify child biomes of other biomes here. Just the root parents.")
private KList<String> caveBiomes = new KList<>();
@DontObfuscate
@Desc("A list of root-level biomes in this region. Don't specify child biomes of other biomes here. Just the root parents.")
private KList<String> islandBiomes = new KList<>();
@DontObfuscate
@Desc("A list of root-level biomes in this region. Don't specify child biomes of other biomes here. Just the root parents.")
private KList<String> skylandBiomes = new KList<>();
@DontObfuscate
@Desc("Ridge biomes create a vein-like network like rivers through this region")
private KList<IrisRegionRidge> ridgeBiomes = new KList<>();
@@ -71,14 +107,39 @@ public class IrisRegion extends IrisRegistrant
private transient CNG shoreHeightGenerator;
private transient ReentrantLock lock = new ReentrantLock();
public double getBiomeZoom(InferredType t)
{
switch(t)
{
case CAVE:
return caveBiomeZoom;
case ISLAND:
return islandBiomeZoom;
case LAND:
return landBiomeZoom;
case SEA:
return seaBiomeZoom;
case SHORE:
return shoreBiomeZoom;
case SKYLAND:
return skylandBiomeZoom;
default:
break;
}
return 1;
}
public KList<String> getRidgeBiomeKeys()
{
lock.lock();
if(cacheRidge == null)
{
cacheRidge = new KList<String>();
ridgeBiomes.forEach((i) -> cacheRidge.add(i.getBiome()));
}
lock.unlock();
return cacheRidge;
@@ -87,11 +148,13 @@ public class IrisRegion extends IrisRegistrant
public KList<String> getSpotBiomeKeys()
{
lock.lock();
if(cacheSpot == null)
{
cacheSpot = new KList<String>();
spotBiomes.forEach((i) -> cacheSpot.add(i.getBiome()));
}
lock.unlock();
return cacheSpot;
@@ -138,4 +201,39 @@ public class IrisRegion extends IrisRegistrant
return b.v();
}
public KList<String> getBiomes(InferredType type)
{
if(type.equals(InferredType.LAND))
{
return getLandBiomes();
}
else if(type.equals(InferredType.SEA))
{
return getSeaBiomes();
}
else if(type.equals(InferredType.SHORE))
{
return getShoreBiomes();
}
else if(type.equals(InferredType.CAVE))
{
return getCaveBiomes();
}
else if(type.equals(InferredType.ISLAND))
{
return getIslandBiomes();
}
else if(type.equals(InferredType.SKYLAND))
{
return getSkylandBiomes();
}
return new KList<>();
}
}

View File

@@ -10,6 +10,7 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
import org.bukkit.generator.ChunkGenerator.ChunkData;
import com.volmit.iris.object.IrisBiome;
import com.volmit.iris.util.BlockDataTools;
import com.volmit.iris.util.HeightMap;
import com.volmit.iris.util.KMap;
@@ -21,6 +22,7 @@ public class AtomicSliver
{
public static final BlockData AIR = BlockDataTools.getBlockData("AIR");
private KMap<Integer, BlockData> block;
private KMap<Integer, IrisBiome> truebiome;
private KMap<Integer, Biome> biome;
private int highestBlock = 0;
private int highestBiome = 0;
@@ -33,6 +35,7 @@ public class AtomicSliver
this.z = z;
this.block = new KMap<>();
this.biome = new KMap<>();
this.truebiome = new KMap<>();
}
public Material getType(int h)
@@ -78,12 +81,27 @@ public class AtomicSliver
return getType(h).isSolid();
}
public Biome getBiome(int h)
{
return biome.containsKey(h) ? biome.get(h) : Biome.THE_VOID;
}
public IrisBiome getTrueBiome(int h)
{
return truebiome.get(h);
}
public void set(int h, Biome d)
{
biome.put(h, d);
highestBiome = h > highestBiome ? h : highestBiome;
}
public void set(int h, IrisBiome d)
{
truebiome.put(h, d);
}
public void write(ChunkData d)
{
for(int i = 0; i <= highestBlock; i++)