From b5eb094566a680b30648383d8817dc48524522b0 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Fri, 16 Jul 2021 02:39:37 -0400 Subject: [PATCH] Performance Improvements --- src/main/java/com/volmit/iris/Iris.java | 5 --- .../engine/data/chunk/LinkedTerrainChunk.java | 33 ++----------------- .../engine/modifier/IrisPostModifier.java | 6 +--- 3 files changed, 4 insertions(+), 40 deletions(-) diff --git a/src/main/java/com/volmit/iris/Iris.java b/src/main/java/com/volmit/iris/Iris.java index 95d9584e6..52e599e15 100644 --- a/src/main/java/com/volmit/iris/Iris.java +++ b/src/main/java/com/volmit/iris/Iris.java @@ -75,7 +75,6 @@ public class Iris extends VolmitPlugin implements Listener { private static final Queue 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."); } diff --git a/src/main/java/com/volmit/iris/engine/data/chunk/LinkedTerrainChunk.java b/src/main/java/com/volmit/iris/engine/data/chunk/LinkedTerrainChunk.java index 479ba635a..92ca2792e 100644 --- a/src/main/java/com/volmit/iris/engine/data/chunk/LinkedTerrainChunk.java +++ b/src/main/java/com/volmit/iris/engine/data/chunk/LinkedTerrainChunk.java @@ -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); } } diff --git a/src/main/java/com/volmit/iris/engine/modifier/IrisPostModifier.java b/src/main/java/com/volmit/iris/engine/modifier/IrisPostModifier.java index 2c5babee0..e0a262b3f 100644 --- a/src/main/java/com/volmit/iris/engine/modifier/IrisPostModifier.java +++ b/src/main/java/com/volmit/iris/engine/modifier/IrisPostModifier.java @@ -48,16 +48,12 @@ public class IrisPostModifier extends EngineAssignedModifier { @Override public void onModify(int x, int z, Hunk 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()); }