mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-27 06:20:02 +00:00
Should fix?
This commit is contained in:
1 parent
fd38f0d127
commit
a8751c80ab
3 files changed
+39
-12
No files matched your search
+1
-1
@@ -44,7 +44,7 @@ registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins')
|
|||||||
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.19.4/plugins')
|
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.19.4/plugins')
|
||||||
registerCustomOutputTask('CrazyDev22', 'C://Users/Julian/Desktop/server/plugins')
|
registerCustomOutputTask('CrazyDev22', 'C://Users/Julian/Desktop/server/plugins')
|
||||||
registerCustomOutputTask('Pixel', 'D://Iris Dimension Engine/1.20.4 - Development/plugins')
|
registerCustomOutputTask('Pixel', 'D://Iris Dimension Engine/1.20.4 - Development/plugins')
|
||||||
registerCustomOutputTask('PixelFury', 'C://Users/RePixelatedMC/Iris/1.21 - Development-v3/plugins')
|
registerCustomOutputTask('PixelFury', 'D://1.21 - Development-v3/plugins')
|
||||||
// ========================== UNIX ==============================
|
// ========================== UNIX ==============================
|
||||||
registerCustomOutputTaskUnix('CyberpwnLT', '/Users/danielmills/development/server/plugins')
|
registerCustomOutputTaskUnix('CyberpwnLT', '/Users/danielmills/development/server/plugins')
|
||||||
registerCustomOutputTaskUnix('PsychoLT', '/Users/brianfopiano/Developer/RemoteGit/Server/plugins')
|
registerCustomOutputTaskUnix('PsychoLT', '/Users/brianfopiano/Developer/RemoteGit/Server/plugins')
|
||||||
|
|||||||
@@ -3,21 +3,17 @@ package com.volmit.iris.engine.object;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.nms.IMemoryWorld;
|
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.core.nms.container.Pair;
|
|
||||||
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.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;
|
||||||
import com.volmit.iris.util.math.Position2;
|
|
||||||
import com.volmit.iris.util.math.RollingSequence;
|
import com.volmit.iris.util.math.RollingSequence;
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
import com.volmit.iris.util.scheduling.Queue;
|
|
||||||
import com.volmit.iris.util.scheduling.ShurikenQueue;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -31,6 +27,7 @@ import org.bukkit.generator.ChunkGenerator;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@@ -72,11 +69,14 @@ 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<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merges underground from a selected chunk into the corresponding chunk in the outcome world.
|
* Merges underground from a selected chunk into the corresponding chunk in the outcome world.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void generateVanillaUnderground(int cx, int cz, Engine engine) {
|
public void generateVanillaUnderground(int cx, int cz, Chunk ichunk, Engine engine) {
|
||||||
if (engine.getMemoryWorld() == null && useGenerator)
|
if (engine.getMemoryWorld() == null && useGenerator)
|
||||||
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)
|
||||||
@@ -89,7 +89,6 @@ public class IrisMerger {
|
|||||||
World bukkit;
|
World bukkit;
|
||||||
|
|
||||||
if (world.isBlank()) {
|
if (world.isBlank()) {
|
||||||
//throw new UnsupportedOperationException("No.");
|
|
||||||
memoryWorld = engine.getMemoryWorld();
|
memoryWorld = engine.getMemoryWorld();
|
||||||
bukkit = memoryWorld.getBukkit();
|
bukkit = memoryWorld.getBukkit();
|
||||||
} else {
|
} else {
|
||||||
@@ -101,7 +100,9 @@ public class IrisMerger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Chunk chunk = bukkit.getChunkAt(cx, cz);
|
Chunk chunk = bukkit.getChunkAt(cx, cz);
|
||||||
Chunk ichunk = engine.getWorld().realWorld().getChunkAt(cx, cz);
|
lastUse.put(chunk, System.currentTimeMillis());
|
||||||
|
|
||||||
|
// Chunk ichunk = engine.getWorld().realWorld().getChunkAt(cx, cz);
|
||||||
|
|
||||||
if (!chunk.isLoaded())
|
if (!chunk.isLoaded())
|
||||||
J.s(chunk::load);
|
J.s(chunk::load);
|
||||||
@@ -117,7 +118,6 @@ public class IrisMerger {
|
|||||||
var cache = new ChunkedDataCache<>(b, engine.getComplex().getHeightStream(), wX, wZ);
|
var cache = new ChunkedDataCache<>(b, engine.getComplex().getHeightStream(), wX, wZ);
|
||||||
b.complete();
|
b.complete();
|
||||||
|
|
||||||
|
|
||||||
Set<Biome> caveBiomes = new HashSet<>(Arrays.asList(
|
Set<Biome> caveBiomes = new HashSet<>(Arrays.asList(
|
||||||
Biome.DRIPSTONE_CAVES,
|
Biome.DRIPSTONE_CAVES,
|
||||||
Biome.LUSH_CAVES,
|
Biome.LUSH_CAVES,
|
||||||
@@ -168,7 +168,7 @@ public class IrisMerger {
|
|||||||
blockData = dps.createBlockData();
|
blockData = dps.createBlockData();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// not* Handle exception
|
// no Handle exception
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,7 +202,6 @@ public class IrisMerger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
J.s(chunk::unload);
|
|
||||||
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) {
|
||||||
@@ -345,5 +344,33 @@ public class IrisMerger {
|
|||||||
} else {
|
} else {
|
||||||
worldsave = bukkitWorld;
|
worldsave = bukkitWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
Bukkit.getScheduler().runTaskTimer(Iris.instance, this::unloadAndSaveAllChunks, 200L, 20L); // Runs every 10 seconds
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unloadAndSaveAllChunks() {
|
||||||
|
try {
|
||||||
|
if (worldsave == null) {
|
||||||
|
Iris.warn("World was null somehow...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Chunk chunk : new ArrayList<>(lastUse.keySet())) {
|
||||||
|
Long lastUsed = lastUse.get(chunk);
|
||||||
|
if (lastUsed != null && System.currentTimeMillis() - lastUsed >= 10000) { // 10 seconds
|
||||||
|
if (chunk.isLoaded()) {
|
||||||
|
chunk.unload();
|
||||||
|
}
|
||||||
|
lastUse.remove(chunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
worldsave.save();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -387,7 +387,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
|||||||
private void onChunkGeneration(ChunkLoadEvent event) {
|
private void onChunkGeneration(ChunkLoadEvent event) {
|
||||||
if (engine == null ||!event.isNewChunk() || !engine.getWorld().realWorld().equals(event.getWorld()) || !engine.getDimension().isEnableExperimentalMerger())
|
if (engine == null ||!event.isNewChunk() || !engine.getWorld().realWorld().equals(event.getWorld()) || !engine.getDimension().isEnableExperimentalMerger())
|
||||||
return;
|
return;
|
||||||
engine.getMerger().generateVanillaUnderground(event.getChunk().getX(), event.getChunk().getZ(), engine);
|
engine.getMerger().generateVanillaUnderground(event.getChunk().getX(), event.getChunk().getZ(), event.getChunk(), engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in new issue
Block a user