mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-30 12:29:20 +00:00
Rivers & Lakes
This commit is contained in:
@@ -16,6 +16,12 @@ public enum InferredType
|
||||
@DontObfuscate
|
||||
CAVE,
|
||||
|
||||
@DontObfuscate
|
||||
RIVER,
|
||||
|
||||
@DontObfuscate
|
||||
LAKE,
|
||||
|
||||
@DontObfuscate
|
||||
DEFER;
|
||||
}
|
||||
|
||||
@@ -438,6 +438,29 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
return inferredType.equals(InferredType.SEA);
|
||||
}
|
||||
|
||||
public boolean isLake()
|
||||
{
|
||||
if(inferredType == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return inferredType.equals(InferredType.LAKE);
|
||||
}
|
||||
|
||||
public boolean isRiver()
|
||||
{
|
||||
if(inferredType == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return inferredType.equals(InferredType.RIVER);
|
||||
}
|
||||
|
||||
public boolean isAquatic()
|
||||
{
|
||||
return isSea() || isLake() || isRiver();
|
||||
}
|
||||
|
||||
public boolean isShore()
|
||||
{
|
||||
if(inferredType == null)
|
||||
|
||||
@@ -101,6 +101,14 @@ public class IrisDimension extends IrisRegistrant
|
||||
@Desc("The placement style of biomes")
|
||||
private IrisGeneratorStyle caveBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The placement style of biomes")
|
||||
private IrisGeneratorStyle riverBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The placement style of biomes")
|
||||
private IrisGeneratorStyle lakeBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The placement style of biomes")
|
||||
private IrisGeneratorStyle islandBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
||||
@@ -755,6 +763,10 @@ public class IrisDimension extends IrisRegistrant
|
||||
{
|
||||
case CAVE:
|
||||
return caveBiomeStyle;
|
||||
case LAKE:
|
||||
return lakeBiomeStyle;
|
||||
case RIVER:
|
||||
return riverBiomeStyle;
|
||||
case LAND:
|
||||
return landBiomeStyle;
|
||||
case SEA:
|
||||
|
||||
@@ -15,7 +15,6 @@ import lombok.Data;
|
||||
@Data
|
||||
public class IrisGeneratorStyle
|
||||
{
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The chance is 1 in CHANCE per interval")
|
||||
@@ -53,6 +52,12 @@ public class IrisGeneratorStyle
|
||||
this.style = s;
|
||||
}
|
||||
|
||||
public IrisGeneratorStyle zoomed(double z)
|
||||
{
|
||||
this.zoom = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CNG create(RNG rng)
|
||||
{
|
||||
return cng.aquire(() ->
|
||||
|
||||
@@ -322,7 +322,7 @@ public class IrisObject extends IrisRegistrant
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(config.isBore() && !config.getMode().equals(ObjectPlaceMode.PAINT))
|
||||
if(config.isBore())
|
||||
{
|
||||
for(int i = x - Math.floorDiv(w, 2); i <= x + Math.floorDiv(w, 2) - (w % 2 == 0 ? 1 : 0); i++)
|
||||
{
|
||||
@@ -330,10 +330,7 @@ public class IrisObject extends IrisRegistrant
|
||||
{
|
||||
for(int k = z - Math.floorDiv(d, 2); k <= z + Math.floorDiv(d, 2) - (d % 2 == 0 ? 1 : 0); k++)
|
||||
{
|
||||
if(!B.isAir(placer.get(i, j, k)))
|
||||
{
|
||||
placer.set(i, j, k, AIR);
|
||||
}
|
||||
placer.set(i, j, k, AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class IrisRegion extends IrisRegistrant implements IRare
|
||||
@Desc("Place text on terrain")
|
||||
@ArrayType(min = 1, type = IrisTextPlacement.class)
|
||||
private KList<IrisTextPlacement> text = new KList<>();
|
||||
|
||||
|
||||
@ArrayType(min = 1, type = IrisBlockDrops.class)
|
||||
@DontObfuscate
|
||||
@Desc("Define custom block drops for this region")
|
||||
@@ -87,6 +87,16 @@ public class IrisRegion extends IrisRegistrant implements IRare
|
||||
@Desc("How large shore biomes are in this region")
|
||||
private double shoreBiomeZoom = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("How large lake biomes are in this region")
|
||||
private double lakeBiomeZoom = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("How large river biomes are in this region")
|
||||
private double riverBiomeZoom = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("How large sea biomes are in this region")
|
||||
@@ -129,6 +139,18 @@ public class IrisRegion extends IrisRegistrant implements IRare
|
||||
@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<>();
|
||||
|
||||
@RegistryListBiome
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@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> riverBiomes = new KList<>();
|
||||
|
||||
@RegistryListBiome
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@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> lakeBiomes = new KList<>();
|
||||
|
||||
@RegistryListBiome
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@@ -149,13 +171,99 @@ public class IrisRegion extends IrisRegistrant implements IRare
|
||||
@Desc("Define regional deposit generators that add onto the global deposit generators")
|
||||
private KList<IrisDepositGenerator> deposits = new KList<>();
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The style of rivers")
|
||||
private IrisGeneratorStyle riverStyle = NoiseStyle.VASCULAR_THIN.style().zoomed(7.77);
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The style of lakes")
|
||||
private IrisGeneratorStyle lakeStyle = NoiseStyle.CELLULAR_IRIS_THICK.style();
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The style of river chances")
|
||||
private IrisGeneratorStyle riverChanceStyle = NoiseStyle.SIMPLEX.style().zoomed(4);
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Generate lakes in this region")
|
||||
private boolean lakes = true;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Generate rivers in this region")
|
||||
private boolean rivers = true;
|
||||
|
||||
@MinNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("Generate lakes in this region")
|
||||
private int lakeRarity = 22;
|
||||
|
||||
@MinNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("Generate rivers in this region")
|
||||
private int riverRarity = 3;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("Generate rivers in this region")
|
||||
private double riverThickness = 0.1;
|
||||
|
||||
private transient AtomicCache<KList<String>> cacheRidge = new AtomicCache<>();
|
||||
private transient AtomicCache<KList<String>> cacheSpot = new AtomicCache<>();
|
||||
private transient AtomicCache<CNG> shoreHeightGenerator = new AtomicCache<>();
|
||||
private transient AtomicCache<KList<IrisBiome>> realLandBiomes = new AtomicCache<>();
|
||||
private transient AtomicCache<KList<IrisBiome>> realLakeBiomes = new AtomicCache<>();
|
||||
private transient AtomicCache<KList<IrisBiome>> realRiverBiomes = new AtomicCache<>();
|
||||
private transient AtomicCache<KList<IrisBiome>> realSeaBiomes = new AtomicCache<>();
|
||||
private transient AtomicCache<KList<IrisBiome>> realShoreBiomes = new AtomicCache<>();
|
||||
private transient AtomicCache<KList<IrisBiome>> realCaveBiomes = new AtomicCache<>();
|
||||
private transient AtomicCache<CNG> lakeGen = new AtomicCache<>();
|
||||
private transient AtomicCache<CNG> riverGen = new AtomicCache<>();
|
||||
private transient AtomicCache<CNG> riverChanceGen = new AtomicCache<>();
|
||||
|
||||
public boolean isRiver(RNG rng, double x, double z)
|
||||
{
|
||||
if(!isRivers())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getRiverBiomes().isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getRiverChanceGen().aquire(() -> getRiverChanceStyle().create(rng)).fit(1, getRiverRarity(), x, z) != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getRiverGen().aquire(() -> getRiverStyle().create(rng)).fitDouble(0, 1, x, z) < getRiverThickness())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isLake(RNG rng, double x, double z)
|
||||
{
|
||||
if(!isLakes())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getLakeBiomes().isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getLakeGen().aquire(() -> getLakeStyle().create(rng)).fit(1, getLakeRarity(), x, z) == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public double getBiomeZoom(InferredType t)
|
||||
{
|
||||
@@ -163,6 +271,10 @@ public class IrisRegion extends IrisRegistrant implements IRare
|
||||
{
|
||||
case CAVE:
|
||||
return caveBiomeZoom;
|
||||
case LAKE:
|
||||
return lakeBiomeZoom;
|
||||
case RIVER:
|
||||
return riverBiomeZoom;
|
||||
case LAND:
|
||||
return landBiomeZoom;
|
||||
case SEA:
|
||||
@@ -263,6 +375,16 @@ public class IrisRegion extends IrisRegistrant implements IRare
|
||||
return getRealCaveBiomes(g);
|
||||
}
|
||||
|
||||
else if(type.equals(InferredType.LAKE))
|
||||
{
|
||||
return getRealLakeBiomes(g);
|
||||
}
|
||||
|
||||
else if(type.equals(InferredType.RIVER))
|
||||
{
|
||||
return getRealRiverBiomes(g);
|
||||
}
|
||||
|
||||
return new KList<>();
|
||||
}
|
||||
|
||||
@@ -281,6 +403,36 @@ public class IrisRegion extends IrisRegistrant implements IRare
|
||||
});
|
||||
}
|
||||
|
||||
public KList<IrisBiome> getRealLakeBiomes(ContextualChunkGenerator g)
|
||||
{
|
||||
return realLakeBiomes.aquire(() ->
|
||||
{
|
||||
KList<IrisBiome> realLakeBiomes = new KList<>();
|
||||
|
||||
for(String i : getLakeBiomes())
|
||||
{
|
||||
realLakeBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
|
||||
}
|
||||
|
||||
return realLakeBiomes;
|
||||
});
|
||||
}
|
||||
|
||||
public KList<IrisBiome> getRealRiverBiomes(ContextualChunkGenerator g)
|
||||
{
|
||||
return realRiverBiomes.aquire(() ->
|
||||
{
|
||||
KList<IrisBiome> realRiverBiomes = new KList<>();
|
||||
|
||||
for(String i : getRiverBiomes())
|
||||
{
|
||||
realRiverBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
|
||||
}
|
||||
|
||||
return realRiverBiomes;
|
||||
});
|
||||
}
|
||||
|
||||
public KList<IrisBiome> getRealShoreBiomes(ContextualChunkGenerator g)
|
||||
{
|
||||
return realShoreBiomes.aquire(() ->
|
||||
|
||||
@@ -130,11 +130,6 @@ public class IrisStructurePlacement
|
||||
|
||||
if(t != null)
|
||||
{
|
||||
if(height >= 0)
|
||||
{
|
||||
t.getPlacement().setBore(true);
|
||||
}
|
||||
|
||||
IrisObject o = null;
|
||||
|
||||
for(IrisRareObject l : t.getTile().getRareObjects())
|
||||
|
||||
@@ -26,7 +26,7 @@ public class IrisStructureTile
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The place mode for this tile")
|
||||
private ObjectPlaceMode placeMode = ObjectPlaceMode.PAINT;
|
||||
private ObjectPlaceMode placeMode = ObjectPlaceMode.CENTER_HEIGHT;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
|
||||
Reference in New Issue
Block a user