mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-27 06:20:02 +00:00
Fix mem leak and further improvements
This commit is contained in:
1 parent
a8751c80ab
commit
eb80ae62b1
3 files changed
+25
-10
No files matched your search
+1
-1
@@ -53,7 +53,7 @@ registerCustomOutputTaskUnix('CrazyDev22LT', '/home/julian/Desktop/server/plugin
|
|||||||
// ==============================================================
|
// ==============================================================
|
||||||
|
|
||||||
def NMS_BINDINGS = Map.of(
|
def NMS_BINDINGS = Map.of(
|
||||||
"v1_21_R1", "1.21-R0.1-SNAPSHOT",
|
"v1_21_R1", "1.21.1-R0.1-SNAPSHOT",
|
||||||
"v1_20_R4", "1.20.6-R0.1-SNAPSHOT",
|
"v1_20_R4", "1.20.6-R0.1-SNAPSHOT",
|
||||||
"v1_20_R3", "1.20.4-R0.1-SNAPSHOT",
|
"v1_20_R3", "1.20.4-R0.1-SNAPSHOT",
|
||||||
"v1_20_R2", "1.20.2-R0.1-SNAPSHOT",
|
"v1_20_R2", "1.20.2-R0.1-SNAPSHOT",
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ public class IrisEngine implements Engine {
|
|||||||
|
|
||||||
private void updateMemoryWorld() {
|
private void updateMemoryWorld() {
|
||||||
try {
|
try {
|
||||||
if(!merger.isUseGenerator() || merger.getGenerator().isEmpty())
|
if(!merger.isUseMemoryWorld() || merger.getGenerator().isEmpty())
|
||||||
return;
|
return;
|
||||||
merger = getDimension().getMerger();
|
merger = getDimension().getMerger();
|
||||||
if (!getDimension().isEnableExperimentalMerger()) return;
|
if (!getDimension().isEnableExperimentalMerger()) return;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.volmit.iris.core.nms.IMemoryWorld;
|
|||||||
import com.volmit.iris.core.nms.INMS;
|
import com.volmit.iris.core.nms.INMS;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.annotations.Desc;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
|
||||||
import com.volmit.iris.util.context.ChunkedDataCache;
|
import com.volmit.iris.util.context.ChunkedDataCache;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
@@ -46,7 +45,10 @@ public class IrisMerger {
|
|||||||
private String generator;
|
private String generator;
|
||||||
|
|
||||||
@Desc("Use Generator")
|
@Desc("Use Generator")
|
||||||
private boolean useGenerator = false;
|
private boolean useMemoryWorld = false;
|
||||||
|
|
||||||
|
@Desc("Allows to gen chunks on the mergers world")
|
||||||
|
private boolean allowGenChunks = false;
|
||||||
|
|
||||||
@Desc("Uses a world instead of a generator")
|
@Desc("Uses a world instead of a generator")
|
||||||
private String world;
|
private String world;
|
||||||
@@ -69,7 +71,6 @@ public class IrisMerger {
|
|||||||
@Desc("If it should translate iris deposits/ores to their deepslate variant")
|
@Desc("If it should translate iris deposits/ores to their deepslate variant")
|
||||||
private boolean deepslateTranslator = true;
|
private boolean deepslateTranslator = true;
|
||||||
|
|
||||||
// Map to keep track of last use time for chunks
|
|
||||||
private final Map<Chunk, Long> lastUse = new ConcurrentHashMap<>();
|
private final Map<Chunk, Long> lastUse = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,11 +78,16 @@ public class IrisMerger {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void generateVanillaUnderground(int cx, int cz, Chunk ichunk, Engine engine) {
|
public void generateVanillaUnderground(int cx, int cz, Chunk ichunk, Engine engine) {
|
||||||
if (engine.getMemoryWorld() == null && useGenerator)
|
if (engine.getMemoryWorld() == null && useMemoryWorld)
|
||||||
throw new IllegalStateException("MemoryWorld is null. Ensure that it has been initialized.");
|
throw new IllegalStateException("MemoryWorld is null. Ensure that it has been initialized.");
|
||||||
if (engine.getWorld().realWorld() == null)
|
if (engine.getWorld().realWorld() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (world == null) {
|
||||||
|
Iris.error("World merger is null! cant generate chunks FALLBACK!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
|
|
||||||
@@ -99,10 +105,17 @@ public class IrisMerger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Chunk chunk = bukkit.getChunkAt(cx, cz);
|
Chunk chunk;
|
||||||
lastUse.put(chunk, System.currentTimeMillis());
|
if (allowGenChunks) {
|
||||||
|
chunk = bukkit.getChunkAt(cx, cz, true);
|
||||||
|
} else {
|
||||||
|
chunk = bukkit.getChunkAt(cx, cz, false);
|
||||||
|
if (!chunk.isGenerated()) {
|
||||||
|
throw new IllegalStateException("Chunk " + cx + ", " + cz + " not found. OUT OF BOUNDS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Chunk ichunk = engine.getWorld().realWorld().getChunkAt(cx, cz);
|
// Chunk ichunk = engine.getWorld().realWorld().getChunkAt(cx, cz);
|
||||||
|
|
||||||
if (!chunk.isLoaded())
|
if (!chunk.isLoaded())
|
||||||
J.s(chunk::load);
|
J.s(chunk::load);
|
||||||
@@ -202,6 +215,7 @@ public class IrisMerger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
lastUse.put(chunk, System.currentTimeMillis());
|
||||||
mergeDuration.put(p.getMilliseconds());
|
mergeDuration.put(p.getMilliseconds());
|
||||||
Iris.info("Vanilla merge average in: " + Form.duration(mergeDuration.getAverage(), 8));
|
Iris.info("Vanilla merge average in: " + Form.duration(mergeDuration.getAverage(), 8));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -325,7 +339,8 @@ public class IrisMerger {
|
|||||||
|
|
||||||
World bukkitWorld = Bukkit.getWorld(world);
|
World bukkitWorld = Bukkit.getWorld(world);
|
||||||
if (!new File(Bukkit.getWorldContainer(), world).exists())
|
if (!new File(Bukkit.getWorldContainer(), world).exists())
|
||||||
throw new IllegalStateException("World does not exist!");
|
Iris.warn("World does not exist disabled merger generation for: " + engine.getWorld().name());
|
||||||
|
//throw new IllegalStateException("World does not exist!");
|
||||||
if (bukkitWorld == null) {
|
if (bukkitWorld == null) {
|
||||||
Iris.info("World " + world + " is not loaded yet, creating it.");
|
Iris.info("World " + world + " is not loaded yet, creating it.");
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user