-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The config is stored under `moonrise.yaml` in the working directory. Comments document each option.
- Loading branch information
1 parent
23f201e
commit fff73cf
Showing
28 changed files
with
1,325 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
159 changes: 159 additions & 0 deletions
159
src/main/java/ca/spottedleaf/moonrise/common/config/MoonriseConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
package ca.spottedleaf.moonrise.common.config; | ||
|
||
import ca.spottedleaf.moonrise.common.config.adapter.TypeAdapterRegistry; | ||
import ca.spottedleaf.moonrise.common.config.annotation.Adaptable; | ||
import ca.spottedleaf.moonrise.common.config.annotation.Serializable; | ||
import ca.spottedleaf.moonrise.common.config.type.Duration; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
@Adaptable | ||
public final class MoonriseConfig { | ||
|
||
@Serializable( | ||
comment = """ | ||
Do not change, used internally. | ||
""" | ||
) | ||
public int version = 1; | ||
|
||
@Serializable | ||
public ChunkLoading chunkLoading = new ChunkLoading(); | ||
|
||
@Adaptable | ||
public static final class ChunkLoading { | ||
|
||
@Serializable( | ||
comment = """ | ||
Chunk loading/generation/sending rate targets for the chunk system. These values are the | ||
maximum rates at which the player chunk loader will attempt to load/generate/send chunks to | ||
players. Actual resulting rates will depend on hardware. | ||
""" | ||
) | ||
public Basic basic = new Basic(); | ||
|
||
|
||
@Adaptable | ||
public static final class Basic { | ||
@Serializable( | ||
comment = """ | ||
The maximum number of chunks to send to any given player, per second. | ||
""" | ||
) | ||
public double playerMaxSendRate = -1.0; | ||
|
||
@Serializable( | ||
comment = """ | ||
The maximum number of chunks to load from disk for any given player, per second. | ||
""" | ||
) | ||
public double playerMaxLoadRate = -1.0; | ||
|
||
@Serializable( | ||
comment = """ | ||
The maximum number of chunks to generate for any given player, per second. | ||
""" | ||
) | ||
public double playerMaxGenRate = -1.0; | ||
} | ||
|
||
@Serializable( | ||
comment = """ | ||
Advanced configuration options for player chunk loading. You shouldn't be touching these | ||
unless you have a reason. | ||
""" | ||
) | ||
public Advanced advanced = new Advanced(); | ||
|
||
@Adaptable | ||
public static final class Advanced { | ||
|
||
@Serializable( | ||
comment = """ | ||
Whether to avoid sending chunks to players who have a view distance | ||
configured lower than the server's. | ||
""" | ||
) | ||
public boolean autoConfigSendDistance = true; | ||
|
||
@Serializable( | ||
comment = """ | ||
The maximum amount of pending chunk loads per player. If | ||
this value is less-than 1, then the player chunk loader will | ||
automatically determine a value. | ||
This value should be used to tune the saturation of the chunk system. | ||
""" | ||
) | ||
public int playerMaxConcurrentChunkLoads = 0; | ||
|
||
@Serializable( | ||
comment = """ | ||
The maximum amount of pending chunk generations per player. If | ||
this value is less-than 1, then the player chunk loader will | ||
automatically determine a value. | ||
This value should be used to tune the saturation of the chunk system. | ||
""" | ||
) | ||
public int playerMaxConcurrentChunkGenerates = 0; | ||
} | ||
} | ||
|
||
@Serializable | ||
public ChunkSaving chunkSaving = new ChunkSaving(); | ||
|
||
@Adaptable | ||
public static final class ChunkSaving { | ||
|
||
@Serializable( | ||
comment = """ | ||
The interval at which chunks should be incrementally autosaved. | ||
""" | ||
) | ||
public Duration autoSaveInterval = Duration.parse("5m"); | ||
|
||
@Serializable( | ||
comment = """ | ||
The maximum number of chunks to incrementally autosave each tick. If | ||
the value is <= 0, then no chunks will be incrementally saved. | ||
""" | ||
) | ||
public int maxAutoSaveChunksPerTick = 12; | ||
} | ||
|
||
@Serializable( | ||
comment = """ | ||
Set the number of shared worker threads to be used by chunk rendering, | ||
chunk loading, chunk generation. If the value is <= 0, then the number | ||
of threads will automatically be determined. | ||
""" | ||
) | ||
public int workerThreads = -1; | ||
|
||
@Serializable | ||
public ChunkSystem chunkSystem = new ChunkSystem(); | ||
|
||
@Adaptable | ||
public static final class ChunkSystem { | ||
|
||
@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. | ||
""" | ||
) | ||
public int ioThreads = -1; | ||
|
||
@Serializable( | ||
comment = """ | ||
Whether to run generation population in parallel. By default this is set to false, | ||
as mods affecting world gen are not safe to run in parallel. If you have no mods affecting | ||
gen and are saturating the population generation (~10 threads of the worker pool generating | ||
chunks), you may set this to true to possibly increase generation speed. | ||
""" | ||
) | ||
public boolean populationGenParallelism = false; | ||
} | ||
} |
21 changes: 0 additions & 21 deletions
21
src/main/java/ca/spottedleaf/moonrise/common/config/PlaceholderConfig.java
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
src/main/java/ca/spottedleaf/moonrise/common/config/adapter/TypeAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ca.spottedleaf.moonrise.common.config.adapter; | ||
|
||
import java.lang.reflect.Type; | ||
|
||
public abstract class TypeAdapter<T, S> { | ||
|
||
public abstract T deserialize(final TypeAdapterRegistry registry, final Object input, final Type type); | ||
|
||
public abstract S serialize(final TypeAdapterRegistry registry, final T value, final Type type); | ||
|
||
} |
Oops, something went wrong.