From 04f0b454eb64f0c748e2177647666a8369eea9be Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 13 Dec 2024 07:26:49 -0600 Subject: [PATCH] re-add full (server) distant generator mode --- .../EDhApiDistantGeneratorMode.java | 17 ++++++++++++++--- .../distanthorizons/core/config/Config.java | 14 ++++++++------ .../core/generation/BatchGenerator.java | 3 +++ 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/api/src/main/java/com/seibel/distanthorizons/api/enums/worldGeneration/EDhApiDistantGeneratorMode.java b/api/src/main/java/com/seibel/distanthorizons/api/enums/worldGeneration/EDhApiDistantGeneratorMode.java index e1f7e61a2..bea57ff9a 100644 --- a/api/src/main/java/com/seibel/distanthorizons/api/enums/worldGeneration/EDhApiDistantGeneratorMode.java +++ b/api/src/main/java/com/seibel/distanthorizons/api/enums/worldGeneration/EDhApiDistantGeneratorMode.java @@ -22,13 +22,14 @@ package com.seibel.distanthorizons.api.enums.worldGeneration; /** * PRE_EXISTING_ONLY
* SURFACE
- * FEATURES

+ * FEATURES
+ * FULL

* * In order of fastest to slowest. * * @author James Seibel * @author Leonardo Amato - * @version 2022-12-10 + * @version 2024-12-13 * @since API 1.0.0 */ public enum EDhApiDistantGeneratorMode @@ -73,7 +74,17 @@ public enum EDhApiDistantGeneratorMode * NOTE: This may cause world generation bugs or instability, * since some features can cause concurrentModification exceptions. */ - FEATURES((byte) 5); + FEATURES((byte) 5), + + /** + * Ask the server to generate/load each chunk. + * This is the most compatible and will generate structures correctly, + * but will cause server/simulation lag.

+ * + * Unlike other modes this option DOES save generated chunks to + * Minecraft's region files. + */ + FULL((byte) 7); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java index 02f9658a0..b8cce9b40 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java @@ -1169,12 +1169,14 @@ public class Config + EDhApiDistantGeneratorMode.FEATURES + " \n" + "Generate everything except structures. \n" + "WARNING: This may cause world generator bugs or instability when paired with certain world generator mods. \n" - //not currently implemented - //+ "\n" - //+ EDhApiDistantGeneratorMode.FULL + " \n" - //+ "Ask the local server to generate/load each chunk. \n" - //+ "This is the most compatible, but will cause server/simulation lag. \n" - //+ "- Slow (15-50 ms, with spikes up to 200 ms) \n" + + "\n" + + EDhApiDistantGeneratorMode.FULL + " \n" + + "Ask the local server to generate/load each chunk. \n" + + "This is the most compatible and will generate structures correctly, \n" + + "but will cause server/simulation lag. \n" + + "Note: unlike other modes this option DOES save generated chunks to \n" + + "Minecraft's region files. \n" + + "- Slow (15-50 ms, with spikes up to 200 ms) \n" + "") .build(); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/generation/BatchGenerator.java b/core/src/main/java/com/seibel/distanthorizons/core/generation/BatchGenerator.java index c82376609..0dbecf6bc 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/generation/BatchGenerator.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/generation/BatchGenerator.java @@ -111,6 +111,9 @@ public class BatchGenerator implements IDhApiWorldGenerator case FEATURES: targetStep = EDhApiWorldGenerationStep.FEATURES; break; + case FULL: + targetStep = EDhApiWorldGenerationStep.LIGHT; // TODO using something other than LIGHT would be good for clarity + break; } // the consumer needs to be wrapped like this because the API can't use DH core objects (and IChunkWrapper can't be easily put into the API project)