Start setting up the DhApi world generator overriding
This commit is contained in:
@@ -32,5 +32,4 @@ public class DhApiEventRegister
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Vendored
+70
@@ -0,0 +1,70 @@
|
||||
package com.seibel.lod.core.api.external.override;
|
||||
|
||||
import com.seibel.lod.core.api.external.override.interfaces.IDhApiWorldGenerator;
|
||||
import com.seibel.lod.core.api.external.shared.interfaces.IDhApiLevelWrapper;
|
||||
import com.seibel.lod.core.api.external.shared.objects.DhApiResult;
|
||||
|
||||
/**
|
||||
* Handles adding/removing world generator overrides.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-14
|
||||
*/
|
||||
public class DhApiWorldGeneratorOverrideRegister
|
||||
{
|
||||
/**
|
||||
* Registers the given world generator. <Br> <Br>
|
||||
*
|
||||
* This registers a backup world generator for all levels and will be overridden if there
|
||||
* is a world generator for the specific level. <Br>
|
||||
* If another world generator has already been registered, DhApiResult will return
|
||||
* the name of the previously registered generator and success = false.
|
||||
*/
|
||||
public static DhApiResult RegisterWorldGeneratorOverride(IDhApiWorldGenerator worldGenerator)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the given world generator for the given level. <Br> <Br>
|
||||
*
|
||||
* Only one world generator can be registered for a specific level at a given time. <Br>
|
||||
* If another world generator has already been registered, DhApiResult will return
|
||||
* the name of the previously registered generator and success = false.
|
||||
*/
|
||||
public static DhApiResult RegisterWorldGeneratorOverride(IDhApiLevelWrapper levelWrapper, IDhApiWorldGenerator worldGenerator)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Removes the given world generator for the given level if it has been registered. <br>
|
||||
* If the world generator wasn't registered, the result will return success = false.
|
||||
*/
|
||||
public static DhApiResult UnRegisterWorldGeneratorOverride(IDhApiLevelWrapper levelWrapper, IDhApiWorldGenerator worldGenerator)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the registered world generator for the given level if one has been registered. <br>
|
||||
* If no world generator was registered, the result will return success = false.
|
||||
*/
|
||||
public static DhApiResult UnRegisterWorldGeneratorOverride(IDhApiLevelWrapper levelWrapper)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the registered world generator for each level it was registered. <br>
|
||||
* If this world generator wasn't registered for any level, the result will return success = false.
|
||||
*/
|
||||
public static DhApiResult UnRegisterWorldGeneratorOverride(IDhApiWorldGenerator worldGenerator)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
package com.seibel.lod.core.api.external.override.enums;
|
||||
|
||||
/**
|
||||
* EMPTY, <br>
|
||||
* STRUCTURE_START, <br>
|
||||
* STRUCTURE_REFERENCE, <br>
|
||||
* BIOMES, <br>
|
||||
* NOISE, <br>
|
||||
* SURFACE, <br>
|
||||
* CARVERS, <br>
|
||||
* LIQUID_CARVERS, <br>
|
||||
* FEATURES, <br>
|
||||
* LIGHT, <br>
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-14
|
||||
*/
|
||||
public enum EDhApiWorldGenerationStep
|
||||
{
|
||||
EMPTY,
|
||||
STRUCTURE_START,
|
||||
STRUCTURE_REFERENCE,
|
||||
BIOMES,
|
||||
NOISE,
|
||||
SURFACE,
|
||||
CARVERS,
|
||||
LIQUID_CARVERS,
|
||||
FEATURES,
|
||||
LIGHT,
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.seibel.lod.core.api.external.override.interfaces;
|
||||
|
||||
/**
|
||||
* Implemented by all DhApi objects that can be overridden.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-14
|
||||
*/
|
||||
public interface IDhApiOverrideable
|
||||
{
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
package com.seibel.lod.core.api.external.override.interfaces;
|
||||
|
||||
import com.seibel.lod.core.api.external.override.enums.EDhApiWorldGenerationStep;
|
||||
import com.seibel.lod.core.api.external.shared.enums.EDhApiWorldGenThreadMode;
|
||||
import com.seibel.lod.core.api.external.shared.interfaces.IDhApiChunkWrapper;
|
||||
import com.seibel.lod.core.api.external.shared.interfaces.IDhApiLevelWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-7-14
|
||||
*/
|
||||
public interface IDhApiWorldGenerator extends IDhApiOverrideable
|
||||
{
|
||||
/** Returns where chunk generation requests can be generated. */
|
||||
EDhApiWorldGenThreadMode getThreadingMode();
|
||||
|
||||
IDhApiChunkWrapper generateChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiWorldGenerationStep maxStepToGenerate);
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.seibel.lod.core.api.external.shared.enums;
|
||||
|
||||
/**
|
||||
* MULTI_THREADED, <br>
|
||||
* SINGLE_THREADED, <br>
|
||||
* SERVER_THREAD, <br>
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 7-14-2022
|
||||
*/
|
||||
public enum EDhApiWorldGenThreadMode
|
||||
{
|
||||
/**
|
||||
* This world generator can be run on an unlimited number
|
||||
* of concurrent threads.
|
||||
*/
|
||||
MULTI_THREADED,
|
||||
|
||||
/**
|
||||
* This world generator can only be run on one thread at
|
||||
* a time, however that thread can run concurrently
|
||||
* to Minecraft's server thread.
|
||||
*/
|
||||
SINGLE_THREADED,
|
||||
|
||||
/**
|
||||
* This world generator can only be run on Minecraft's
|
||||
* server thread.
|
||||
*/
|
||||
SERVER_THREAD,
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2022 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.api.external.shared.interfaces;
|
||||
|
||||
import com.seibel.lod.core.enums.ELodDirection;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.IBindable;
|
||||
import com.seibel.lod.core.objects.DHChunkPos;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockDetailWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-7-14
|
||||
*/
|
||||
public interface IDhApiChunkWrapper extends IDhApiUnsafeWrapper
|
||||
{
|
||||
/** Returns the absolute Y coordinate of the highest block for the given relative X and Z coordinates. */
|
||||
int getMaxY(int relativeX, int relativeZ);
|
||||
/** Returns the maximum absolute block position in the X direction. */
|
||||
int getMaxX();
|
||||
/** Returns the maximum absolute block position in the Z direction. */
|
||||
int getMaxZ();
|
||||
|
||||
/** Returns the absolute Y coordinate of the lowest block for the given relative X and Z coordinates. */
|
||||
int getMinY(int relativeX, int relativeZ);
|
||||
/** Returns the minimum absolute block position in the X direction. */
|
||||
int getMinX();
|
||||
/** Returns the minimum absolute block position in the Z direction. */
|
||||
int getMinZ();
|
||||
|
||||
/**
|
||||
* Returns true if this chunk's lighting has been built. <br>
|
||||
* Note: for some versions of Minecraft this value may be unreliable.
|
||||
*/
|
||||
boolean isLightCorrect();
|
||||
|
||||
/** TODO what side of the block should this return the light for? */
|
||||
default int getBlockLight(int x, int y, int z) {return -1;}
|
||||
/** TODO what side of the block should this return the light for? */
|
||||
default int getSkyLight(int x, int y, int z) {return -1;}
|
||||
|
||||
/**
|
||||
* Returns true if chunks exist in all 4 cardinal and 4 ordinal directions
|
||||
* relative to this chunk. <br>
|
||||
* IE: returns true if there are chunks to the North, South, East, West, NE, SE, SW, and NW
|
||||
* of this chunk.
|
||||
*/
|
||||
boolean doNearbyChunksExist();
|
||||
|
||||
|
||||
// TODO these will probably need replacing once 1.7's ID system is done
|
||||
//IBlockStateWrapper getBlockState(int x, int y, int z);
|
||||
//IBiomeWrapper getBiome(int x, int y, int z);
|
||||
|
||||
}
|
||||
Vendored
+2
-2
@@ -21,9 +21,9 @@ package com.seibel.lod.core.api.external.shared.interfaces;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-7-13
|
||||
* @version 2022-7-14
|
||||
*/
|
||||
public interface IDhApiDimensionTypeWrapper
|
||||
public interface IDhApiDimensionTypeWrapper extends IDhApiUnsafeWrapper
|
||||
{
|
||||
String getDimensionName();
|
||||
|
||||
|
||||
+2
-2
@@ -25,9 +25,9 @@ import com.seibel.lod.core.api.external.shared.enums.EDhApiLevelType;
|
||||
* Can be either a Server or Client level.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-13
|
||||
* @version 2022-7-14
|
||||
*/
|
||||
public interface IDhApiLevelWrapper
|
||||
public interface IDhApiLevelWrapper extends IDhApiUnsafeWrapper
|
||||
{
|
||||
IDhApiDimensionTypeWrapper getDimensionType();
|
||||
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.seibel.lod.core.api.external.shared.interfaces;
|
||||
|
||||
/**
|
||||
* The Distant Horizons' API objects can't cover
|
||||
* every potential use case. Sometimes developers just need
|
||||
* the base Minecraft Objects.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-14
|
||||
*/
|
||||
public interface IDhApiUnsafeWrapper
|
||||
{
|
||||
/**
|
||||
* This returns the Minecraft object this wrapper is containing. <br>
|
||||
* <strong>Warning</strong>: This object will be Minecraft
|
||||
* version dependent and may change without notice. <br> <br>
|
||||
*
|
||||
* In order to cast this object to something usable, you may want
|
||||
* to use <code>obj.getClass()</code> when in your IDE
|
||||
* in order to determine what object this method returns for
|
||||
* specific version of Minecraft you are developing for.
|
||||
*/
|
||||
public Object getWrappedMcObject_UNSAFE();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user