Move API Interfaces into the API sub-project

This commit is contained in:
James Seibel
2022-09-05 19:18:33 -05:00
parent 89a46ae5e1
commit eaadd6fc71
29 changed files with 47 additions and 51 deletions
@@ -22,7 +22,7 @@ package com.seibel.lod.api.config.both;
import com.seibel.lod.core.api.external.items.enums.config.EDhApiDistanceGenerationMode;
import com.seibel.lod.core.api.external.items.enums.config.EDhApiBlocksToAvoid;
import com.seibel.lod.core.api.external.items.enums.config.EDhApiLightGenerationMode;
import com.seibel.lod.core.api.external.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.core.api.implementation.objects.GenericEnumConverter;
import com.seibel.lod.core.api.implementation.wrappers.DhApiConfig;
import com.seibel.lod.core.config.Config.Client.WorldGenerator;
@@ -20,7 +20,7 @@
package com.seibel.lod.api.config.client;
import com.seibel.lod.core.api.external.items.enums.config.EDhApiGpuUploadMethod;
import com.seibel.lod.core.api.external.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.core.api.implementation.objects.GenericEnumConverter;
import com.seibel.lod.core.api.implementation.wrappers.DhApiConfig;
import com.seibel.lod.core.config.Config.Client.Advanced.Buffers;
@@ -20,7 +20,7 @@
package com.seibel.lod.api.config.client;
import com.seibel.lod.core.api.external.items.enums.config.EDhApiDebugMode;
import com.seibel.lod.core.api.external.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.core.api.implementation.objects.GenericEnumConverter;
import com.seibel.lod.core.api.implementation.wrappers.DhApiConfig;
import com.seibel.lod.core.config.Config.Client.Advanced.Debugging;
@@ -19,7 +19,7 @@
package com.seibel.lod.api.config.client;
import com.seibel.lod.core.api.external.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.core.api.external.items.enums.config.*;
import com.seibel.lod.core.api.implementation.objects.GenericEnumConverter;
import com.seibel.lod.core.api.implementation.objects.RenderModeEnabledConverter;
@@ -19,7 +19,7 @@
package com.seibel.lod.api.config.client;
import com.seibel.lod.core.api.external.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.core.api.external.items.enums.config.*;
import com.seibel.lod.core.api.implementation.objects.GenericEnumConverter;
import com.seibel.lod.core.api.implementation.wrappers.DhApiConfig;
@@ -20,7 +20,7 @@
package com.seibel.lod.api.config.client;
import com.seibel.lod.core.api.external.items.enums.config.EDhApiServerFolderNameMode;
import com.seibel.lod.core.api.external.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.core.api.implementation.objects.GenericEnumConverter;
import com.seibel.lod.core.api.implementation.wrappers.DhApiConfig;
import com.seibel.lod.core.config.Config.Client.Multiplayer;
@@ -19,7 +19,7 @@
package com.seibel.lod.api.config.client;
import com.seibel.lod.core.api.external.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
import com.seibel.lod.core.api.implementation.wrappers.DhApiConfig;
import com.seibel.lod.core.config.Config.Client.Advanced.Threading;
@@ -0,0 +1,25 @@
package com.seibel.lod.api.items.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
{
/**
* Teturns the Minecraft object this wrapper contains. <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
* the specific version of Minecraft you are developing for.
*/
public Object getWrappedMcObject_UNSAFE();
}
@@ -0,0 +1,49 @@
package com.seibel.lod.api.items.interfaces.config;
/**
* An interface for Distant Horizon's Config.
*
* @param <T> The internal data type of this config.
* @author James Seibel
* @version 2022-6-13
*/
public interface IDhApiConfig<T>
{
/**
* Returns the active value for this config. <br>
* Returns the True value if either the config cannot be overridden by
* the API or if it hasn't been set by the API.
*/
public T getValue();
/**
* Returns the value held by this config. <br>
* This is the value stored in the config file.
*/
public T getTrueValue();
/**
* Returns the value of the config if it was set by the API.
* Returns null if the config wasn't set by the API.
*/
public T getApiValue();
/**
* Sets the config's value. <br>
* If the newValue is set to null then the config
* will revert to using the True Value.<br>
* If the config cannot be set via the API this method will return false.
*
* @return true if the value was set, false otherwise.
*/
public boolean setValue(T newValue);
/** Returns true if this config can be set via the API, false otherwise. */
public boolean getCanBeOverrodeByApi();
/** Returns the default value for this config. */
public T getDefaultValue();
/** Returns the max value for this config, null if there is no max. */
public T getMaxValue();
/** Returns the min value for this config, null if there is no min. */
public T getMinValue();
}
@@ -0,0 +1,20 @@
package com.seibel.lod.api.items.interfaces.override;
import com.seibel.lod.core.api.external.items.enums.override.EDhApiOverridePriority;
import com.seibel.lod.core.handlers.dependencyInjection.IBindable;
/**
* Implemented by all DhApi objects that can be overridden.
*
* @author James Seibel
* @version 2022-7-18
*/
public interface IDhApiOverrideable extends IBindable
{
/**
* Returns when this Override should be used. <br>
* For most developers this can be left at the default.
*/
default EDhApiOverridePriority getOverrideType() { return EDhApiOverridePriority.PRIMARY; }
}
@@ -0,0 +1,19 @@
package com.seibel.lod.api.items.interfaces.override;
import com.seibel.lod.core.api.external.items.enums.worldGeneration.EDhApiWorldGenerationStep;
import com.seibel.lod.core.api.external.items.enums.worldGeneration.EDhApiWorldGenThreadMode;
import com.seibel.lod.api.items.interfaces.world.IDhApiChunkWrapper;
import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper;
/**
* @author James Seibel
* @version 2022-7-26
*/
public interface IDhApiWorldGenerator extends IDhApiOverrideable
{
/** Returns which thread chunk generation requests can be created on. */
EDhApiWorldGenThreadMode getThreadingMode();
IDhApiChunkWrapper generateChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiWorldGenerationStep maxStepToGenerate);
}
@@ -0,0 +1,68 @@
/*
* 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.api.items.interfaces.world;
import com.seibel.lod.api.items.interfaces.IDhApiUnsafeWrapper;
/**
* @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);
}
@@ -0,0 +1,35 @@
/*
* 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.api.items.interfaces.world;
import com.seibel.lod.api.items.interfaces.IDhApiUnsafeWrapper;
/**
* @author James Seibel
* @version 2022-7-14
*/
public interface IDhApiDimensionTypeWrapper extends IDhApiUnsafeWrapper
{
String getDimensionName();
boolean hasCeiling();
boolean hasSkyLight();
}
@@ -0,0 +1,48 @@
/*
* 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.api.items.interfaces.world;
import com.seibel.lod.api.items.interfaces.IDhApiUnsafeWrapper;
import com.seibel.lod.core.api.external.items.enums.worldGeneration.EDhApiLevelType;
/**
* Can be either a Server or Client level.
*
* @author James Seibel
* @version 2022-7-14
*/
public interface IDhApiLevelWrapper extends IDhApiUnsafeWrapper
{
IDhApiDimensionTypeWrapper getDimensionType();
EDhApiLevelType getLevelType();
boolean hasCeiling();
boolean hasSkyLight();
int getHeight();
default int getMinHeight()
{
return 0;
}
}
@@ -1,7 +1,7 @@
package com.seibel.lod.api.override;
import com.seibel.lod.core.api.external.items.interfaces.override.IDhApiWorldGenerator;
import com.seibel.lod.core.api.external.items.interfaces.world.IDhApiLevelWrapper;
import com.seibel.lod.api.items.interfaces.override.IDhApiWorldGenerator;
import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper;
import com.seibel.lod.api.items.objects.DhApiResult;
import com.seibel.lod.core.handlers.dependencyInjection.WorldGeneratorInjector;