Adjust default config location
Place the config in config/
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"id": "moonrise",
|
"id": "moonrise",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"name": "Moonrise",
|
"name": "Moonrise",
|
||||||
"description": "Optimisation mod for dedicated and integrated server.",
|
"description": "Optimisation mod for the dedicated and integrated server.",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Spottedleaf"
|
"Spottedleaf"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ version = "${version}"
|
|||||||
displayName = "Moonrise"
|
displayName = "Moonrise"
|
||||||
displayURL = "https://github.com/Tuinity/Moonrise"
|
displayURL = "https://github.com/Tuinity/Moonrise"
|
||||||
authors = "Spottedleaf"
|
authors = "Spottedleaf"
|
||||||
description = "Moonrise NeoForge"
|
description = "Optimisation mod for the dedicated and integrated server."
|
||||||
displayTest = "IGNORE_ALL_VERSION"
|
displayTest = "IGNORE_ALL_VERSION"
|
||||||
|
|
||||||
[[dependencies.moonrise]]
|
[[dependencies.moonrise]]
|
||||||
|
|||||||
@@ -84,7 +84,12 @@ public final class YamlConfig<T> {
|
|||||||
throw new IOException("File is a directory");
|
throw new IOException("File is a directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
final File tmp = new File(file.getParentFile(), file.getName() + ".tmp");
|
final File parent = file.getParentFile();
|
||||||
|
if (parent != null) {
|
||||||
|
parent.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
final File tmp = new File(parent, file.getName() + ".tmp");
|
||||||
tmp.delete();
|
tmp.delete();
|
||||||
tmp.createNewFile();
|
tmp.createNewFile();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -162,6 +162,21 @@ public final class MoonriseConfig {
|
|||||||
)
|
)
|
||||||
public int workerThreads = -1;
|
public int workerThreads = -1;
|
||||||
|
|
||||||
|
@Serializable(
|
||||||
|
comment = """
|
||||||
|
Set the number of threads dedicated to RegionFile I/O operations.
|
||||||
|
If the value is <= 0, then the number of threads used is 1. Configuring
|
||||||
|
a higher value than 1 is only recommended on SSDs (HDDs scale negatively)
|
||||||
|
and when you have determined that I/O is the bottleneck for chunk loading/saving.
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
@ClothConfig(
|
||||||
|
tooltip = "tooltip.moonrise.iothreads",
|
||||||
|
fieldKeyName = "option.moonrise.iothreads",
|
||||||
|
section = CHUNK_SYSTEM_SECTION
|
||||||
|
)
|
||||||
|
public int ioThreads = -1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialise() {
|
public void initialise() {
|
||||||
MoonriseCommon.adjustWorkerThreads(this);
|
MoonriseCommon.adjustWorkerThreads(this);
|
||||||
@@ -174,21 +189,6 @@ public final class MoonriseConfig {
|
|||||||
@Adaptable
|
@Adaptable
|
||||||
public static final class ChunkSystem implements InitialiseHook {
|
public static final class ChunkSystem implements InitialiseHook {
|
||||||
|
|
||||||
@Serializable(
|
|
||||||
comment = """
|
|
||||||
Set the number of threads dedicated to RegionFile I/O operations.
|
|
||||||
If the value is <= 0, then the number of threads used is 1. Configuring
|
|
||||||
a higher value than 1 is only recommended on SSDs (HDDs scale negatively)
|
|
||||||
and when you have determined that I/O is the bottleneck for chunk loading/saving.
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
@ClothConfig(
|
|
||||||
tooltip = "tooltip.moonrise.iothreads",
|
|
||||||
fieldKeyName = "option.moonrise.iothreads",
|
|
||||||
section = CHUNK_SYSTEM_SECTION
|
|
||||||
)
|
|
||||||
public int ioThreads = -1;
|
|
||||||
|
|
||||||
@Serializable(
|
@Serializable(
|
||||||
comment = """
|
comment = """
|
||||||
Whether to run generation population in parallel. By default this is set to false,
|
Whether to run generation population in parallel. By default this is set to false,
|
||||||
|
|||||||
@@ -57,7 +57,12 @@ public final class MoonriseCommon {
|
|||||||
workerThreads = defaultWorkerThreads;
|
workerThreads = defaultWorkerThreads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final int ioThreads = Math.max(1, config.ioThreads);
|
||||||
|
|
||||||
WORKER_POOL.adjustThreadCount(workerThreads);
|
WORKER_POOL.adjustThreadCount(workerThreads);
|
||||||
|
IO_POOL.adjustThreadCount(ioThreads);
|
||||||
|
|
||||||
|
LOGGER.info("Moonrise is using " + workerThreads + " worker threads, " + ioThreads + " I/O threads");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final PrioritisedThreadPool IO_POOL = new PrioritisedThreadPool(
|
public static final PrioritisedThreadPool IO_POOL = new PrioritisedThreadPool(
|
||||||
@@ -80,7 +85,7 @@ public final class MoonriseCommon {
|
|||||||
public static final long IO_QUEUE_HOLD_TIME = (long)(100.0e6); // 100ms
|
public static final long IO_QUEUE_HOLD_TIME = (long)(100.0e6); // 100ms
|
||||||
public static final PrioritisedThreadPool.ExecutorGroup SERVER_REGION_IO_GROUP = IO_POOL.createExecutorGroup(SERVER_DIVISION, 0);
|
public static final PrioritisedThreadPool.ExecutorGroup SERVER_REGION_IO_GROUP = IO_POOL.createExecutorGroup(SERVER_DIVISION, 0);
|
||||||
|
|
||||||
private static final File CONFIG_FILE = new File(System.getProperty("Moonrise.ConfigFile", "moonrise.yml"));
|
private static final File CONFIG_FILE = new File(System.getProperty("Moonrise.ConfigFile", "config/moonrise.yml"));
|
||||||
private static final TypeAdapterRegistry CONFIG_ADAPTERS = new TypeAdapterRegistry();
|
private static final TypeAdapterRegistry CONFIG_ADAPTERS = new TypeAdapterRegistry();
|
||||||
private static final YamlConfig<MoonriseConfig> CONFIG;
|
private static final YamlConfig<MoonriseConfig> CONFIG;
|
||||||
static {
|
static {
|
||||||
|
|||||||
@@ -67,17 +67,13 @@ public final class ChunkTaskScheduler {
|
|||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ChunkTaskScheduler.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ChunkTaskScheduler.class);
|
||||||
|
|
||||||
public static void init(final MoonriseConfig.ChunkSystem config) {
|
public static void init(final MoonriseConfig.ChunkSystem config) {
|
||||||
final int newChunkSystemIOThreads = Math.max(1, config.ioThreads);
|
|
||||||
|
|
||||||
final boolean useParallelGen = config.populationGenParallelism;
|
final boolean useParallelGen = config.populationGenParallelism;
|
||||||
|
|
||||||
MoonriseCommon.IO_POOL.adjustThreadCount(newChunkSystemIOThreads);
|
|
||||||
|
|
||||||
for (final PrioritisedThreadPool.ExecutorGroup.ThreadPoolExecutor executor : MoonriseCommon.RADIUS_AWARE_GROUP.getAllExecutors()) {
|
for (final PrioritisedThreadPool.ExecutorGroup.ThreadPoolExecutor executor : MoonriseCommon.RADIUS_AWARE_GROUP.getAllExecutors()) {
|
||||||
executor.setMaxParallelism(useParallelGen ? -1 : 1);
|
executor.setMaxParallelism(useParallelGen ? -1 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("Chunk system is using " + newChunkSystemIOThreads + " I/O threads, " + MoonriseCommon.WORKER_POOL.getCoreThreads().length + " worker threads, population gen parallelism: " + useParallelGen);
|
LOGGER.info("Chunk system is using population gen parallelism: " + useParallelGen);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final TicketType<Long> CHUNK_LOAD = TicketType.create("chunk_system:chunk_load", Long::compareTo);
|
public static final TicketType<Long> CHUNK_LOAD = TicketType.create("chunk_system:chunk_load", Long::compareTo);
|
||||||
@@ -1035,4 +1031,4 @@ public final class ChunkTaskScheduler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import ca.spottedleaf.moonrise.common.util.JsonUtil;
|
|||||||
import ca.spottedleaf.moonrise.common.util.MoonriseCommon;
|
import ca.spottedleaf.moonrise.common.util.MoonriseCommon;
|
||||||
import ca.spottedleaf.moonrise.common.util.MoonriseConstants;
|
import ca.spottedleaf.moonrise.common.util.MoonriseConstants;
|
||||||
import ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel;
|
import ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel;
|
||||||
import ca.spottedleaf.moonrise.patches.chunk_system.player.ChunkSystemServerPlayer;
|
|
||||||
import ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler;
|
import ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler;
|
||||||
import ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder;
|
import ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder;
|
||||||
import ca.spottedleaf.moonrise.patches.starlight.light.StarLightLightingProvider;
|
import ca.spottedleaf.moonrise.patches.starlight.light.StarLightLightingProvider;
|
||||||
@@ -19,7 +18,6 @@ import net.minecraft.commands.CommandSourceStack;
|
|||||||
import net.minecraft.commands.Commands;
|
import net.minecraft.commands.Commands;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import net.minecraft.network.chat.contents.PlainTextContents;
|
import net.minecraft.network.chat.contents.PlainTextContents;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
@@ -29,8 +27,6 @@ import net.minecraft.world.level.chunk.ProtoChunk;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user