Performance Improvements

This commit is contained in:
Daniel Mills 2021-07-16 02:39:37 -04:00
parent 71140381e0
commit b5eb094566
3 changed files with 4 additions and 40 deletions

View File

@ -75,7 +75,6 @@ public class Iris extends VolmitPlugin implements Listener {
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
public static boolean customModels = doesSupportCustomModels();
public static boolean awareEntities = doesSupportAwareness();
public static boolean biome3d = doesSupport3DBiomes();
public static boolean lowMemoryMode = false;
public static IrisCompat compat;
public static FileWatcher configWatcher;
@ -478,10 +477,6 @@ public class Iris extends VolmitPlugin implements Listener {
Iris.verbose("* Low Memory mode Activated! For better performance, allocate 4gb or more to this server.");
}
if (!biome3d) {
Iris.verbose("* This version of minecraft does not support 3D biomes (1.15 and up). Iris will generate as normal, but biome colors will not vary underground & in the sky.");
}
if (!customModels) {
Iris.verbose("* This version of minecraft does not support custom model data in loot items (1.14 and up). Iris will generate as normal, but loot will not have custom models.");
}

View File

@ -34,7 +34,6 @@ import org.jetbrains.annotations.NotNull;
@SuppressWarnings("deprecation")
public class LinkedTerrainChunk implements TerrainChunk {
private final Biome[] biome2D;
private final IrisBiomeStorage biome3D;
private ChunkData rawChunkData;
private final BiomeGrid storage;
@ -46,15 +45,13 @@ public class LinkedTerrainChunk implements TerrainChunk {
public LinkedTerrainChunk(BiomeGrid storage, ChunkData data) {
this.storage = storage;
rawChunkData = data;
biome2D = storage != null ? null : Iris.biome3d ? null : new Biome[256];
biome3D = storage != null ? null : Iris.biome3d ? new IrisBiomeStorage() : null;
biome3D = storage != null ? null : new IrisBiomeStorage();
}
public LinkedTerrainChunk(BiomeGrid storage, int maxHeight) {
this.storage = storage;
rawChunkData = createChunkData(maxHeight);
biome2D = storage != null ? null : Iris.biome3d ? null : new Biome[256];
biome3D = storage != null ? null : Iris.biome3d ? new IrisBiomeStorage() : null;
biome3D = storage != null ? null : new IrisBiomeStorage();
}
private ChunkData createChunkData(int maxHeight) {
@ -80,10 +77,6 @@ public class LinkedTerrainChunk implements TerrainChunk {
return storage.getBiome(x, z);
}
if (biome2D != null) {
return biome2D[(z << 4) | x];
}
return biome3D.getBiome(x, 0, z);
}
@ -94,10 +87,6 @@ public class LinkedTerrainChunk implements TerrainChunk {
return storage.getBiome(x, y, z);
}
if (biome2D != null) {
return biome2D[(z << 4) | x];
}
return biome3D.getBiome(x, y, z);
}
@ -108,11 +97,6 @@ public class LinkedTerrainChunk implements TerrainChunk {
return;
}
if (biome2D != null) {
biome2D[(z << 4) | x] = bio;
return;
}
biome3D.setBiome(x, 0, z, bio);
}
@ -127,11 +111,6 @@ public class LinkedTerrainChunk implements TerrainChunk {
return;
}
if (biome2D != null) {
biome2D[(z << 4) | x] = bio;
return;
}
biome3D.setBiome(x, y, z, bio);
}
@ -217,13 +196,7 @@ public class LinkedTerrainChunk implements TerrainChunk {
@Override
public void inject(BiomeGrid biome) {
if (biome2D != null) {
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
biome.setBiome(i, j, getBiome(i, j));
}
}
} else if (biome3D != null) {
if (biome3D != null) {
biome3D.inject(biome);
}
}

View File

@ -48,16 +48,12 @@ public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
@Override
public void onModify(int x, int z, Hunk<BlockData> output) {
PrecisionStopwatch p = PrecisionStopwatch.start();
BurstExecutor b = MultiBurst.burst.burst(output.getWidth() * output.getDepth());
int i, j;
for (i = 0; i < output.getWidth(); i++) {
int ii = i;
for (j = 0; j < output.getDepth(); j++) {
int jj = j;
b.queue(() -> post(ii, jj, output, ii + x, jj + z));
post(i, j, output, i + x, j + z);
}
}
b.complete();
getEngine().getMetrics().getPost().put(p.getMilliseconds());
}