rename EDistanceGenerationMode -> EDhApiDistantGeneratorMode

This includes moving it into the API and renaming NONE -> PRE_EXISTING_ONLY
This commit is contained in:
James Seibel
2022-12-10 22:07:54 -06:00
parent bf698ad7b9
commit 0ab0aeeec6
8 changed files with 98 additions and 88 deletions
@@ -17,10 +17,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.seibel.lod.api.enums.config;
package com.seibel.lod.api.enums.worldGeneration;
/**
* NONE <br>
* PRE_EXISTING_ONLY <br>
* BIOME_ONLY <br>
* BIOME_ONLY_SIMULATE_HEIGHT <br>
* SURFACE <br>
@@ -31,17 +31,17 @@ package com.seibel.lod.api.enums.config;
*
* @author James Seibel
* @author Leonardo Amato
* @version 2022-7-1
* @version 2022-12-10
*/
public enum EDistanceGenerationMode
public enum EDhApiDistantGeneratorMode
{
// Reminder:
// when adding items up the API minor version
// when removing items up the API major version
/** Don't generate anything except already existing chunks */
NONE((byte) 1),
/** Don't generate any new terrain, just generate LODs for already generated chunks. */
PRE_EXISTING_ONLY((byte) 1),
/**
* Only generate the biomes and use biome
@@ -85,53 +85,58 @@ public enum EDistanceGenerationMode
*/
FULL((byte) 6);
public static EDistanceGenerationMode RENDERABLE = EDistanceGenerationMode.BIOME_ONLY;
/**
* The higher the number the more complete the generation is.
*/
public static final EDhApiDistantGeneratorMode RENDERABLE = EDhApiDistantGeneratorMode.BIOME_ONLY;
/** The higher the number the more complete the generation is. */
public final byte complexity;
EDistanceGenerationMode(byte complexity)
EDhApiDistantGeneratorMode(byte complexity) { this.complexity = complexity; }
/** returns null if out of range */
public static EDhApiDistantGeneratorMode previous(EDhApiDistantGeneratorMode mode)
{
this.complexity = complexity;
}
// Note: return null if out of range
public static EDistanceGenerationMode previous(EDistanceGenerationMode mode) {
switch (mode) {
case FULL:
return EDistanceGenerationMode.FEATURES;
case FEATURES:
return EDistanceGenerationMode.SURFACE;
case SURFACE:
return EDistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT;
case BIOME_ONLY_SIMULATE_HEIGHT:
return EDistanceGenerationMode.BIOME_ONLY;
case BIOME_ONLY:
return EDistanceGenerationMode.NONE;
case NONE:
default:
return null;
switch (mode)
{
case FULL:
return EDhApiDistantGeneratorMode.FEATURES;
case FEATURES:
return EDhApiDistantGeneratorMode.SURFACE;
case SURFACE:
return EDhApiDistantGeneratorMode.BIOME_ONLY_SIMULATE_HEIGHT;
case BIOME_ONLY_SIMULATE_HEIGHT:
return EDhApiDistantGeneratorMode.BIOME_ONLY;
case BIOME_ONLY:
return EDhApiDistantGeneratorMode.PRE_EXISTING_ONLY;
case PRE_EXISTING_ONLY:
default:
return null;
}
}
// Note: return null if out of range
public static EDistanceGenerationMode next(EDistanceGenerationMode mode) {
switch (mode) {
case FEATURES:
return EDistanceGenerationMode.FULL;
case SURFACE:
return EDistanceGenerationMode.FEATURES;
case BIOME_ONLY_SIMULATE_HEIGHT:
return EDistanceGenerationMode.SURFACE;
case BIOME_ONLY:
return EDistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT;
case NONE:
return EDistanceGenerationMode.BIOME_ONLY;
case FULL:
default:
return null;
/** returns null if out of range */
public static EDhApiDistantGeneratorMode next(EDhApiDistantGeneratorMode mode)
{
switch (mode)
{
case FEATURES:
return EDhApiDistantGeneratorMode.FULL;
case SURFACE:
return EDhApiDistantGeneratorMode.FEATURES;
case BIOME_ONLY_SIMULATE_HEIGHT:
return EDhApiDistantGeneratorMode.SURFACE;
case BIOME_ONLY:
return EDhApiDistantGeneratorMode.BIOME_ONLY_SIMULATE_HEIGHT;
case PRE_EXISTING_ONLY:
return EDhApiDistantGeneratorMode.BIOME_ONLY;
case FULL:
default:
return null;
}
}
}
@@ -20,7 +20,7 @@
package com.seibel.lod.api.interfaces.config.both;
import com.seibel.lod.api.enums.config.EBlocksToAvoid;
import com.seibel.lod.api.enums.config.EDistanceGenerationMode;
import com.seibel.lod.api.enums.worldGeneration.EDhApiDistantGeneratorMode;
import com.seibel.lod.api.enums.config.EGenerationPriority;
import com.seibel.lod.api.interfaces.config.IDhApiConfigValue;
import com.seibel.lod.api.enums.config.ELightGenerationMode;
@@ -44,7 +44,7 @@ public interface IDhApiWorldGenerationConfig extends IDhApiConfigGroup
IDhApiConfigValue<Boolean> getEnableDistantWorldGeneration();
/** Defines to what level fake chunks will be generated. */
IDhApiConfigValue<EDistanceGenerationMode> getDistantGeneratorDetailLevel();
IDhApiConfigValue<EDhApiDistantGeneratorMode> getDistantGeneratorMode();
/** Defines how generated fake chunks will be lit. */
IDhApiConfigValue<ELightGenerationMode> getLightingMode();
@@ -1,7 +1,7 @@
package com.seibel.lod.api.interfaces.override;
import com.seibel.lod.api.enums.worldGeneration.EDhApiDistantGeneratorMode;
import com.seibel.lod.api.interfaces.world.IDhApiLevelWrapper;
import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenerationStep;
import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenThreadMode;
import com.seibel.lod.api.interfaces.world.IDhApiChunkWrapper;
@@ -19,9 +19,9 @@ public abstract class AbstractDhApiWorldGenerator implements IDhApiOverrideable
return this.getThreadingMode();
}
public abstract IDhApiChunkWrapper generateChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiWorldGenerationStep maxStepToGenerate);
public abstract IDhApiChunkWrapper generateChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiDistantGeneratorMode maxStepToGenerate);
public final IDhApiChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiWorldGenerationStep maxStepToGenerate)
public final IDhApiChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiDistantGeneratorMode maxStepToGenerate)
{
// TODO probably need to change the return type
return null; //generateChunk(chunkPosX, chunkPosZ, null, generationStepEnumConverter.convertToApiType(maxStepToGenerate));