Set up the world generator interface for use with the API
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
package testItems.worldGeneratorInjection.objects;
|
||||
|
||||
import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenThreadMode;
|
||||
import com.seibel.lod.api.interfaces.override.worldGenerator.IDhApiWorldGenerator;
|
||||
import com.seibel.lod.core.DependencyInjection.OverrideInjector;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Dummy test implementation object for world generator injection unit tests.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-12-5
|
||||
*/
|
||||
public class TestWorldGenerator implements IDhApiWorldGenerator
|
||||
{
|
||||
public static EDhApiWorldGenThreadMode THREAD_MODE = EDhApiWorldGenThreadMode.SINGLE_THREADED;
|
||||
|
||||
|
||||
// testable methods //
|
||||
|
||||
@Override
|
||||
public int getPriority() { return OverrideInjector.CORE_PRIORITY; }
|
||||
|
||||
@Override
|
||||
public EDhApiWorldGenThreadMode getThreadingMode() { return THREAD_MODE; }
|
||||
|
||||
|
||||
|
||||
|
||||
// not used when unit testing //
|
||||
|
||||
//======================//
|
||||
// generator parameters //
|
||||
//======================//
|
||||
|
||||
@Override
|
||||
public byte getMinDataDetailLevel() { return LodUtil.BLOCK_DETAIL_LEVEL; }
|
||||
|
||||
@Override
|
||||
public byte getMaxDataDetailLevel() { return LodUtil.BLOCK_DETAIL_LEVEL; }
|
||||
|
||||
@Override
|
||||
public byte getMinGenerationGranularity() { return LodUtil.CHUNK_DETAIL_LEVEL; }
|
||||
|
||||
@Override
|
||||
public byte getMaxGenerationGranularity() { return LodUtil.CHUNK_DETAIL_LEVEL + 2; }
|
||||
|
||||
|
||||
//===================//
|
||||
// generator methods //
|
||||
//===================//
|
||||
|
||||
@Override
|
||||
public void close() { }
|
||||
|
||||
@Override
|
||||
public boolean isBusy() { return false; }
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> generateChunks(int chunkPosMinX, int chunkPosMinZ, byte granularity, byte targetDataDetail, Consumer<Object[]> resultConsumer) { return null; }
|
||||
|
||||
@Override
|
||||
public void preGeneratorTaskStart() { }
|
||||
|
||||
|
||||
}
|
||||
|
||||
+5
-31
@@ -1,49 +1,23 @@
|
||||
package testItems.worldGeneratorInjection.objects;
|
||||
|
||||
import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenThreadMode;
|
||||
import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenerationStep;
|
||||
import com.seibel.lod.api.interfaces.override.worldGenerator.IDhApiWorldGenerator;
|
||||
import com.seibel.lod.api.interfaces.world.IDhApiChunkWrapper;
|
||||
import com.seibel.lod.api.interfaces.world.IDhApiLevelWrapper;
|
||||
import com.seibel.lod.core.DependencyInjection.OverrideInjector;
|
||||
|
||||
/**
|
||||
* Dummy test implementation object for world generator injection unit tests.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-26
|
||||
* @version 2022-12-5
|
||||
*/
|
||||
public class WorldGeneratorTestCore implements IDhApiWorldGenerator
|
||||
public class WorldGeneratorTestCore extends TestWorldGenerator
|
||||
{
|
||||
public static int PRIORITY = OverrideInjector.CORE_PRIORITY;
|
||||
public static EDhApiWorldGenThreadMode THREAD_MODE = EDhApiWorldGenThreadMode.SINGLE_THREADED;
|
||||
|
||||
|
||||
//==============//
|
||||
// IOverridable //
|
||||
//==============//
|
||||
|
||||
@Override
|
||||
public int getPriority() { return OverrideInjector.CORE_PRIORITY; }
|
||||
|
||||
|
||||
|
||||
//======================//
|
||||
// IDhApiWorldGenerator //
|
||||
//======================//
|
||||
|
||||
|
||||
/** Returns which thread chunk generation requests can be created on. */
|
||||
@Override
|
||||
public EDhApiWorldGenThreadMode getThreadingMode()
|
||||
{
|
||||
return THREAD_MODE;
|
||||
}
|
||||
public int getPriority() { return PRIORITY; }
|
||||
|
||||
@Override
|
||||
public IDhApiChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiWorldGenerationStep maxStepToGenerate)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public EDhApiWorldGenThreadMode getThreadingMode() { return THREAD_MODE; }
|
||||
|
||||
}
|
||||
|
||||
+4
-19
@@ -11,34 +11,19 @@ import com.seibel.lod.core.DependencyInjection.OverrideInjector;
|
||||
* Dummy test implementation object for world generator injection unit tests.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-8-9
|
||||
* @version 2022-12-5
|
||||
*/
|
||||
public class WorldGeneratorTestPrimary implements IDhApiWorldGenerator
|
||||
public class WorldGeneratorTestPrimary extends TestWorldGenerator
|
||||
{
|
||||
public static int PRIORITY = OverrideInjector.DEFAULT_NON_CORE_OVERRIDE_PRIORITY + 5;
|
||||
public static EDhApiWorldGenThreadMode THREAD_MODE = EDhApiWorldGenThreadMode.MULTI_THREADED;
|
||||
|
||||
|
||||
//==============//
|
||||
// IOverridable //
|
||||
//==============//
|
||||
|
||||
|
||||
@Override
|
||||
public int getPriority() { return PRIORITY; }
|
||||
|
||||
|
||||
|
||||
//======================//
|
||||
// IDhApiWorldGenerator //
|
||||
//======================//
|
||||
|
||||
|
||||
@Override
|
||||
public EDhApiWorldGenThreadMode getThreadingMode() { return THREAD_MODE; }
|
||||
|
||||
@Override
|
||||
public IDhApiChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiWorldGenerationStep maxStepToGenerate)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-20
@@ -11,34 +11,18 @@ import com.seibel.lod.core.DependencyInjection.OverrideInjector;
|
||||
* Dummy test implementation object for world generator injection unit tests.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-8-9
|
||||
* @version 2022-12-5
|
||||
*/
|
||||
public class WorldGeneratorTestSecondary implements IDhApiWorldGenerator
|
||||
public class WorldGeneratorTestSecondary extends TestWorldGenerator
|
||||
{
|
||||
public static int PRIORITY = OverrideInjector.DEFAULT_NON_CORE_OVERRIDE_PRIORITY;
|
||||
public static EDhApiWorldGenThreadMode THREAD_MODE = EDhApiWorldGenThreadMode.SERVER_THREAD;
|
||||
|
||||
|
||||
//==============//
|
||||
// IOverridable //
|
||||
//==============//
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getPriority() { return PRIORITY; }
|
||||
|
||||
|
||||
|
||||
//======================//
|
||||
// IDhApiWorldGenerator //
|
||||
//======================//
|
||||
|
||||
@Override
|
||||
public EDhApiWorldGenThreadMode getThreadingMode() { return THREAD_MODE; }
|
||||
|
||||
@Override
|
||||
public IDhApiChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiWorldGenerationStep maxStepToGenerate)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user