mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Performance Improvements
This commit is contained in:
parent
cd07f29038
commit
f1e3210c7a
2
pom.xml
2
pom.xml
@ -120,12 +120,14 @@
|
|||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!-- Spigot API -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
<version>1.16.1-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Utilities -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
|
@ -74,6 +74,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
KList<Runnable> surfaces = new KList<>();
|
||||||
int highestPlaced = 0;
|
int highestPlaced = 0;
|
||||||
BlockData block;
|
BlockData block;
|
||||||
int fluidHeight = getDimension().getFluidHeight();
|
int fluidHeight = getDimension().getFluidHeight();
|
||||||
@ -82,11 +83,11 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
|||||||
double wx = getZoomed(ox);
|
double wx = getZoomed(ox);
|
||||||
double wz = getZoomed(oz);
|
double wz = getZoomed(oz);
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
double noise = getNoiseHeight(rx, rz);
|
double noise = getNoiseHeight(rx, rz) + fluidHeight;
|
||||||
int height = (int) Math.round(noise) + fluidHeight;
|
int height = (int) Math.round(noise);
|
||||||
boolean carvable = getDimension().isCarving() && height > getDimension().getCarvingMin();
|
boolean carvable = getDimension().isCarving() && height > getDimension().getCarvingMin();
|
||||||
IrisRegion region = sampleRegion(rx, rz);
|
IrisRegion region = sampleRegion(rx, rz);
|
||||||
BiomeResult biomeResult = sampleTrueBiome(rx, rz);
|
BiomeResult biomeResult = sampleTrueBiome(rx, rz, noise);
|
||||||
IrisBiome biome = biomeResult.getBiome();
|
IrisBiome biome = biomeResult.getBiome();
|
||||||
double airReversal = biomeResult.getHeightOffset();
|
double airReversal = biomeResult.getHeightOffset();
|
||||||
|
|
||||||
@ -206,13 +207,12 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
|||||||
|
|
||||||
sliver.set(k, block);
|
sliver.set(k, block);
|
||||||
highestPlaced = Math.max(highestPlaced, k);
|
highestPlaced = Math.max(highestPlaced, k);
|
||||||
|
|
||||||
if(!cavernSurface && (k == height && block.getMaterial().isSolid() && k < fluidHeight))
|
if(!cavernSurface && (k == height && block.getMaterial().isSolid() && k < fluidHeight))
|
||||||
{
|
{
|
||||||
decorateUnderwater(biome, sliver, wx, k, wz, rx, rz, block);
|
decorateUnderwater(biome, sliver, wx, k, wz, rx, rz, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((carvable && cavernSurface) || (k == Math.max(height, fluidHeight) && block.getMaterial().isSolid() && k < 255 && k >= fluidHeight))
|
if((carvable && cavernSurface) && !(k == Math.max(height, fluidHeight) && block.getMaterial().isSolid() && k < 255 && k >= fluidHeight))
|
||||||
{
|
{
|
||||||
decorateLand(biome, sliver, wx, k, wz, rx, rz, block);
|
decorateLand(biome, sliver, wx, k, wz, rx, rz, block);
|
||||||
}
|
}
|
||||||
@ -256,10 +256,22 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
block = sliver.get(Math.max(height, fluidHeight));
|
||||||
|
|
||||||
|
if(block.getMaterial().isSolid())
|
||||||
|
{
|
||||||
|
decorateLand(biome, sliver, wx, Math.max(height, fluidHeight), wz, rx, rz, block);
|
||||||
|
}
|
||||||
|
|
||||||
if(!sampled && cachingAllowed && highestPlaced < height)
|
if(!sampled && cachingAllowed && highestPlaced < height)
|
||||||
{
|
{
|
||||||
cacheHeightMap[(z << 4) | x] = highestPlaced;
|
cacheHeightMap[(z << 4) | x] = highestPlaced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(Runnable i : surfaces)
|
||||||
|
{
|
||||||
|
i.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(Throwable e)
|
catch(Throwable e)
|
||||||
@ -502,7 +514,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
|||||||
return getBiomeHeight(wx, wz, rx, rz);
|
return getBiomeHeight(wx, wz, rx, rz);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BiomeResult sampleTrueBiomeBase(int x, int z)
|
public BiomeResult sampleTrueBiomeBase(int x, int z, int height)
|
||||||
{
|
{
|
||||||
if(!getDimension().getFocus().equals(""))
|
if(!getDimension().getFocus().equals(""))
|
||||||
{
|
{
|
||||||
@ -512,7 +524,6 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
|||||||
double wx = getModifiedX(x, z);
|
double wx = getModifiedX(x, z);
|
||||||
double wz = getModifiedZ(x, z);
|
double wz = getModifiedZ(x, z);
|
||||||
IrisRegion region = sampleRegion(x, z);
|
IrisRegion region = sampleRegion(x, z);
|
||||||
int height = (int) Math.round(getTerrainHeight(x, z));
|
|
||||||
double sh = region.getShoreHeight(wx, wz);
|
double sh = region.getShoreHeight(wx, wz);
|
||||||
IrisBiome current = sampleBiome(x, z).getBiome();
|
IrisBiome current = sampleBiome(x, z).getBiome();
|
||||||
|
|
||||||
@ -569,6 +580,11 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BiomeResult sampleTrueBiome(int x, int z)
|
public BiomeResult sampleTrueBiome(int x, int z)
|
||||||
|
{
|
||||||
|
return sampleTrueBiome(x, z, getTerrainHeight(x, z));
|
||||||
|
}
|
||||||
|
|
||||||
|
public BiomeResult sampleTrueBiome(int x, int z, double noise)
|
||||||
{
|
{
|
||||||
if(!getDimension().getFocus().equals(""))
|
if(!getDimension().getFocus().equals(""))
|
||||||
{
|
{
|
||||||
@ -583,9 +599,9 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
|||||||
double wx = getModifiedX(x, z);
|
double wx = getModifiedX(x, z);
|
||||||
double wz = getModifiedZ(x, z);
|
double wz = getModifiedZ(x, z);
|
||||||
IrisRegion region = sampleRegion(x, z);
|
IrisRegion region = sampleRegion(x, z);
|
||||||
int height = sampleHeight(x, z);
|
int height = (int) Math.round(noise);
|
||||||
double sh = region.getShoreHeight(wx, wz);
|
double sh = region.getShoreHeight(wx, wz);
|
||||||
BiomeResult res = sampleTrueBiomeBase(x, z);
|
BiomeResult res = sampleTrueBiomeBase(x, z, height);
|
||||||
IrisBiome current = res.getBiome();
|
IrisBiome current = res.getBiome();
|
||||||
|
|
||||||
if(current.isSea() && height > getDimension().getFluidHeight() - sh)
|
if(current.isSea() && height > getDimension().getFluidHeight() - sh)
|
||||||
|
@ -119,11 +119,11 @@ public class GenLayerBiome extends GenLayer
|
|||||||
|
|
||||||
public InferredType getType(double bx, double bz, IrisRegion regionData)
|
public InferredType getType(double bx, double bz, IrisRegion regionData)
|
||||||
{
|
{
|
||||||
bridgeGenerator.setShuffle(0);
|
bridgeGenerator.setShuffle(47);
|
||||||
bridgeGenerator.setCellScale(0.33 / iris.getDimension().getContinentZoom());
|
bridgeGenerator.setCellScale(0.33 / iris.getDimension().getContinentZoom());
|
||||||
double x = bx / iris.getDimension().getBiomeZoom();
|
double x = bx / iris.getDimension().getBiomeZoom();
|
||||||
double z = bz / iris.getDimension().getBiomeZoom();
|
double z = bz / iris.getDimension().getBiomeZoom();
|
||||||
return bridgeGenerator.getIndex(x, z, 2) == 1 ? InferredType.SEA : InferredType.LAND;
|
return bridgeGenerator.getIndex(x, z, 2) == 1 ? InferredType.LAND : InferredType.SEA;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BiomeResult generateBiomeData(double bx, double bz, IrisRegion regionData, RarityCellGenerator cell, KList<IrisBiome> biomes, InferredType inferredType)
|
public BiomeResult generateBiomeData(double bx, double bz, IrisRegion regionData, RarityCellGenerator cell, KList<IrisBiome> biomes, InferredType inferredType)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user