Start moving API files to the API sub-project
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package com.seibel.lod.api;
|
||||
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
import com.seibel.lod.core.a7.datatype.full.FullDataSource;
|
||||
|
||||
/**
|
||||
* This holds API methods related to version numbers and other unchanging endpoints.
|
||||
* This shouldn't change between API versions.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-4-27
|
||||
*/
|
||||
public class DhApiMain
|
||||
{
|
||||
/** This version should only be updated when breaking changes are introduced to the DH API */
|
||||
public static int getApiMajorVersion()
|
||||
{
|
||||
return ModInfo.API_MAJOR_VERSION;
|
||||
}
|
||||
/** This version should be updated whenever new methods are added to the DH API */
|
||||
public static int getApiMinorVersion()
|
||||
{
|
||||
return ModInfo.API_MINOR_VERSION;
|
||||
}
|
||||
|
||||
/** Returns the mod's version number in the format: Major.Minor.Patch */
|
||||
public static String getModVersion()
|
||||
{
|
||||
return ModInfo.VERSION;
|
||||
}
|
||||
/** Returns true if the mod is a development version, false if it is a release version. */
|
||||
public static boolean getIsDevVersion()
|
||||
{
|
||||
return ModInfo.IS_DEV_BUILD;
|
||||
}
|
||||
|
||||
/** Returns the network protocol version. */
|
||||
public static int getNetworkProtocolVersion()
|
||||
{
|
||||
return ModInfo.PROTOCOL_VERSION;
|
||||
}
|
||||
/** Returns the LOD file version. */
|
||||
public static int getLodFileFormatVersion()
|
||||
{
|
||||
return FullDataSource.LATEST_VERSION;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.seibel.lod.api;
|
||||
|
||||
public interface PleaseDeleteThisClass {
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
The external api package holds any code that interfaces between Distant Horizons and other mods or projects.
|
||||
@@ -0,0 +1,3 @@
|
||||
The config api package holds objects and methods for getting/setting Distant Horizons' config values.
|
||||
|
||||
The configs are split up into: client, server, and both; depending on whether they are relevant to client only use, server only use, or both client and server use.
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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.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.core.api.implementation.objects.GenericEnumConverter;
|
||||
import com.seibel.lod.core.api.implementation.wrappers.DhApiConfig;
|
||||
import com.seibel.lod.core.config.Config.Client.WorldGenerator;
|
||||
import com.seibel.lod.core.enums.config.EBlocksToAvoid;
|
||||
import com.seibel.lod.core.enums.config.EDistanceGenerationMode;
|
||||
import com.seibel.lod.core.enums.config.EGenerationPriority;
|
||||
import com.seibel.lod.core.enums.config.ELightGenerationMode;
|
||||
|
||||
/**
|
||||
* Distant Horizons' world generation configuration. <br><br>
|
||||
*
|
||||
* Note: Fake chunks are NOT saved in Minecraft's vanilla save system.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-11
|
||||
*/
|
||||
public class DhApiWorldGeneration
|
||||
{
|
||||
|
||||
/**
|
||||
* Defines whether fake chunks will be generated
|
||||
* outside Minecraft's vanilla render distance.
|
||||
*/
|
||||
public static IDhApiConfig<Boolean> getEnableDistantWorldGenerationConfig()
|
||||
{ return new DhApiConfig<Boolean, Boolean>(WorldGenerator.enableDistantGeneration); }
|
||||
|
||||
/** Defines to what level fake chunks will be generated. */
|
||||
public static IDhApiConfig<EDhApiDistanceGenerationMode> getDistantGeneratorDetailLevelConfig()
|
||||
{ return new DhApiConfig<EDistanceGenerationMode, EDhApiDistanceGenerationMode>(WorldGenerator.distanceGenerationMode, new GenericEnumConverter<>(EDistanceGenerationMode.class, EDhApiDistanceGenerationMode.class)); }
|
||||
|
||||
/** Defines how generated fake chunks will be lit. */
|
||||
public static IDhApiConfig<EDhApiLightGenerationMode> getLightingModeConfig()
|
||||
{ return new DhApiConfig<ELightGenerationMode, EDhApiLightGenerationMode>(WorldGenerator.lightGenerationMode, new GenericEnumConverter<>(ELightGenerationMode.class, EDhApiLightGenerationMode.class)); }
|
||||
|
||||
/** Defines the order in which fake chunks will be generated. */
|
||||
public static IDhApiConfig<EDhApiLightGenerationMode> getGenerationPriorityConfig()
|
||||
{ return new DhApiConfig<EGenerationPriority, EDhApiLightGenerationMode>(WorldGenerator.generationPriority, new GenericEnumConverter<>(EGenerationPriority.class, EDhApiLightGenerationMode.class)); }
|
||||
|
||||
/**
|
||||
* Defines what blocks will be ignored when generating LODs.
|
||||
*
|
||||
* TODO if this isn't deprecated before 1.7 it should probably be moved to the graphics tab
|
||||
* @deprecated this method won't be needed once we transition to an ID based save system <br>
|
||||
* (vs the color based system we have currently)
|
||||
*/
|
||||
@Deprecated
|
||||
public static IDhApiConfig<EDhApiBlocksToAvoid> getBlocksToAvoidConfig()
|
||||
{ return new DhApiConfig<EBlocksToAvoid, EDhApiBlocksToAvoid>(WorldGenerator.blocksToAvoid, new GenericEnumConverter<>(EBlocksToAvoid.class, EDhApiBlocksToAvoid.class)); }
|
||||
|
||||
/**
|
||||
* Defines if the color of avoided blocks will color the block below them. <Br>
|
||||
* (IE: if flowers are avoided should they color the grass below them?)
|
||||
*
|
||||
* TODO if this isn't deprecated before 1.7 it should probably be moved to the graphics tab
|
||||
* @deprecated this method won't be needed once we transition to an ID based save system <br>
|
||||
* (vs the color based system we have currently)
|
||||
*/
|
||||
@Deprecated
|
||||
public static IDhApiConfig<Boolean> getTintWithAvoidedBlocksConfig()
|
||||
{ return new DhApiConfig<Boolean, Boolean>(WorldGenerator.tintWithAvoidedBlocks); }
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.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.core.api.implementation.objects.GenericEnumConverter;
|
||||
import com.seibel.lod.core.api.implementation.wrappers.DhApiConfig;
|
||||
import com.seibel.lod.core.config.Config.Client.Advanced.Buffers;
|
||||
import com.seibel.lod.core.enums.config.EGpuUploadMethod;
|
||||
|
||||
/**
|
||||
* Distant Horizons' OpenGL buffer configuration.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-5
|
||||
*/
|
||||
public class DhApiBuffers
|
||||
{
|
||||
|
||||
/** Defines how geometry data is uploaded to the GPU. */
|
||||
public static IDhApiConfig<EDhApiGpuUploadMethod> getGpuUploadMethodConfig()
|
||||
{ return new DhApiConfig<EGpuUploadMethod, EDhApiGpuUploadMethod>(Buffers.gpuUploadMethod, new GenericEnumConverter<>(EGpuUploadMethod.class, EDhApiGpuUploadMethod.class)); }
|
||||
|
||||
/**
|
||||
* Defines how long we should wait after uploading one
|
||||
* Megabyte of geometry data to the GPU before uploading
|
||||
* the next Megabyte of data. <br>
|
||||
* This can be set to a non-zero number to reduce stuttering caused by
|
||||
* uploading buffers to the GPU.
|
||||
*/
|
||||
public static IDhApiConfig<Integer> getBufferUploadTimeoutPerMegabyteInMillisecondsConfig()
|
||||
{ return new DhApiConfig<Integer, Integer>(Buffers.gpuUploadPerMegabyteInMilliseconds); }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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.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.core.api.implementation.objects.GenericEnumConverter;
|
||||
import com.seibel.lod.core.api.implementation.wrappers.DhApiConfig;
|
||||
import com.seibel.lod.core.config.Config.Client.Advanced.Debugging;
|
||||
import com.seibel.lod.core.enums.rendering.EDebugMode;
|
||||
|
||||
/**
|
||||
* Distant Horizons' debug configuration.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-5
|
||||
*/
|
||||
public class DhApiDebugging
|
||||
{
|
||||
/** Can be used to debug the standard fake chunk rendering. */
|
||||
public static IDhApiConfig<EDhApiDebugMode> getDebugRenderModeConfig()
|
||||
{ return new DhApiConfig<EDebugMode, EDhApiDebugMode>(Debugging.debugMode, new GenericEnumConverter<>(EDebugMode.class, EDhApiDebugMode.class)); }
|
||||
|
||||
/** If enabled debug keybindings can be used. */
|
||||
public static IDhApiConfig<Boolean> getEnableDebugKeybindingsConfig()
|
||||
{ return new DhApiConfig<Boolean, Boolean>(Debugging.enableDebugKeybindings); }
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* 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.config.client;
|
||||
|
||||
import com.seibel.lod.core.api.external.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;
|
||||
import com.seibel.lod.core.api.implementation.wrappers.DhApiConfig;
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import com.seibel.lod.core.enums.config.*;
|
||||
import com.seibel.lod.core.enums.rendering.ERendererMode;
|
||||
import com.seibel.lod.core.config.Config.Client.Graphics.Quality;
|
||||
import com.seibel.lod.core.config.Config.Client.Advanced.Debugging;
|
||||
import com.seibel.lod.core.config.Config.Client.Graphics.AdvancedGraphics;
|
||||
|
||||
/**
|
||||
* Distant Horizons' graphics/rendering configuration.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-11
|
||||
*/
|
||||
public class DhApiGraphics
|
||||
{
|
||||
|
||||
//========================//
|
||||
// basic graphic settings //
|
||||
//========================//
|
||||
|
||||
/** The distance is the radius measured in chunks. */
|
||||
public static IDhApiConfig<Integer> getChunkRenderDistanceConfig()
|
||||
{ return new DhApiConfig<Integer, Integer>(Quality.lodChunkRenderDistance); }
|
||||
|
||||
/**
|
||||
* Simplified version of {@link DhApiGraphics#getRenderingModeConfig()}
|
||||
* that only enables/disables the fake chunk rendering. <br><br>
|
||||
*
|
||||
* Changing this config also changes {@link DhApiGraphics#getRenderingModeConfig()}'s value.
|
||||
*/
|
||||
public static IDhApiConfig<Boolean> getRenderingEnabledConfig()
|
||||
{ return new DhApiConfig<ERendererMode, Boolean>(Debugging.rendererMode, new RenderModeEnabledConverter()); }
|
||||
|
||||
/**
|
||||
* Can be used to enable/disable fake chunk rendering or enable the debug renderer. <br><br>
|
||||
*
|
||||
* The debug renderer is used to confirm rendering is working at and will draw
|
||||
* a single multicolor rhombus on the screen in skybox space (AKA behind MC's rendering). <br><br>
|
||||
*
|
||||
* Changing this config also changes {@link DhApiGraphics#getRenderingEnabledConfig()}'s value.
|
||||
*/
|
||||
public static IDhApiConfig<EDhApiRendererMode> getRenderingModeConfig()
|
||||
{ return new DhApiConfig<ERendererMode, EDhApiRendererMode>(Debugging.rendererMode, new GenericEnumConverter<>(ERendererMode.class, EDhApiRendererMode.class)); }
|
||||
|
||||
|
||||
|
||||
//==================//
|
||||
// graphic settings //
|
||||
//==================//
|
||||
|
||||
/** Defines how detailed fake chunks are in the horizontal direction */
|
||||
public static IDhApiConfig<EDhApiHorizontalResolution> getMaxDetailLevelConfig()
|
||||
{ return new DhApiConfig<EHorizontalResolution, EDhApiHorizontalResolution>(Quality.drawResolution, new GenericEnumConverter<>(EHorizontalResolution.class, EDhApiHorizontalResolution.class)); }
|
||||
|
||||
/** Defines how detailed fake chunks are in the vertical direction */
|
||||
public static IDhApiConfig<EDhApiVerticalQuality> getVerticalQualityConfig()
|
||||
{ return new DhApiConfig<EVerticalQuality, EDhApiVerticalQuality>(Quality.verticalQuality, new GenericEnumConverter<>(EVerticalQuality.class, EDhApiVerticalQuality.class)); }
|
||||
|
||||
/** Modifies the quadratic function fake chunks use for horizontal quality drop-off. */
|
||||
public static IDhApiConfig<EDhApiHorizontalQuality> getHorizontalQualityDropoffConfig()
|
||||
{ return new DhApiConfig<EHorizontalQuality, EDhApiHorizontalQuality>(Quality.horizontalQuality, new GenericEnumConverter<>(EHorizontalQuality.class, EDhApiHorizontalQuality.class)); }
|
||||
|
||||
/**
|
||||
* Defines how fake chunks drop off in quality. <br><br>
|
||||
*
|
||||
* Higher quality settings require fake chunk geometry data to be
|
||||
* rebuilt more often when moving but make quality drop-off less noticeable.
|
||||
* */
|
||||
public static IDhApiConfig<EDhApiDropoffQuality> getHorizontalQualityDropoffMethodConfig()
|
||||
{ return new DhApiConfig<EDropoffQuality, EDhApiDropoffQuality>(Quality.dropoffQuality, new GenericEnumConverter<>(EDropoffQuality.class, EDhApiDropoffQuality.class)); }
|
||||
|
||||
/**
|
||||
* The same as vanilla Minecraft's biome blending. <br><br>
|
||||
*
|
||||
* 0 = blending of 1x1 aka off <br>
|
||||
* 1 = blending of 3x3 <br>
|
||||
* 2 = blending of 5x5 <br>
|
||||
* ... <br>
|
||||
*/
|
||||
public static IDhApiConfig<Integer> getBiomeBlendingConfig()
|
||||
{ return new DhApiConfig<Integer, Integer>(Quality.lodBiomeBlending); }
|
||||
|
||||
|
||||
|
||||
//===========================//
|
||||
// advanced graphic settings //
|
||||
//===========================//
|
||||
|
||||
/** If directional culling is disabled fake chunks will be rendered behind the camera. */
|
||||
public static IDhApiConfig<Boolean> getDisableDirectionalCullingConfig()
|
||||
{ return new DhApiConfig<Boolean, Boolean>(AdvancedGraphics.disableDirectionalCulling); }
|
||||
|
||||
/** Determines how fake chunks are rendered in comparison to vanilla MC's chunks. */
|
||||
public static IDhApiConfig<EDhApiVanillaOverdraw> getVanillaOverdrawConfig()
|
||||
{ return new DhApiConfig<EVanillaOverdraw, EDhApiVanillaOverdraw>(AdvancedGraphics.vanillaOverdraw, new GenericEnumConverter<>(EVanillaOverdraw.class, EDhApiVanillaOverdraw.class)); }
|
||||
|
||||
/** Modifies how far the vanilla overdraw is rendered in chunks. */
|
||||
public static IDhApiConfig<Integer> getVanillaOverdrawOffsetConfig()
|
||||
{ return new DhApiConfig<Integer, Integer>(AdvancedGraphics.overdrawOffset); }
|
||||
|
||||
/**
|
||||
* If enabled the near clip plane is extended to reduce
|
||||
* overdraw and improve Z-fighting at extreme render distances. <br>
|
||||
* Disabling this reduces holes in the world due to the near clip plane
|
||||
* being too close to the camera and the terrain not being covered by vanilla terrain.
|
||||
*/
|
||||
public static IDhApiConfig<Boolean> getUseExtendedNearClipPlaneConfig()
|
||||
{ return new DhApiConfig<Boolean, Boolean>(AdvancedGraphics.useExtendedNearClipPlane); }
|
||||
|
||||
/**
|
||||
* Modifies how bright fake chunks are. <br>
|
||||
* This is done when generating the vertex data and is applied before any shaders.
|
||||
*/
|
||||
public static IDhApiConfig<Double> getBrightnessMultiplierConfig()
|
||||
{ return new DhApiConfig<Double, Double>(AdvancedGraphics.brightnessMultiplier); }
|
||||
|
||||
/**
|
||||
* Modifies how saturated fake chunks are. <br>
|
||||
* This is done when generating the vertex data and is applied before any shaders.
|
||||
*/
|
||||
public static IDhApiConfig<Double> getSaturationMultiplierConfig()
|
||||
{ return new DhApiConfig<Double, Double>(AdvancedGraphics.saturationMultiplier); }
|
||||
|
||||
/** Defines if Distant Horizons should attempt to cull fake chunk cave geometry. */
|
||||
public static IDhApiConfig<Boolean> getCaveCullingEnabledConfig()
|
||||
{ return new DhApiConfig<Boolean, Boolean>(AdvancedGraphics.enableCaveCulling); }
|
||||
|
||||
/** Defines what height cave culling should be used below if enabled. */
|
||||
public static IDhApiConfig<Integer> getCaveCullingHeightConfig()
|
||||
{ return new DhApiConfig<Integer, Integer>(AdvancedGraphics.caveCullingHeight); }
|
||||
|
||||
/** This ratio is relative to Earth's real world curvature. */
|
||||
public static IDhApiConfig<Integer> getEarthCurvatureRatioConfig()
|
||||
{ return new DhApiConfig<Integer, Integer>(AdvancedGraphics.earthCurveRatio); }
|
||||
|
||||
/** If enabled vanilla chunk rendering is disabled and only fake chunks are rendered. */
|
||||
public static IDhApiConfig<Boolean> getEnableLodOnlyModeConfig()
|
||||
{ return new DhApiConfig<Boolean, Boolean>(Config.Client.Advanced.lodOnlyMode); }
|
||||
|
||||
/** Defines how often the geometry should be rebuilt when the player moves. */
|
||||
public static IDhApiConfig<EDhApiBufferRebuildTimes> getGeometryRebuildFrequencyConfig()
|
||||
{ return new DhApiConfig<EBufferRebuildTimes, EDhApiBufferRebuildTimes>(Config.Client.Advanced.Buffers.rebuildTimes, new GenericEnumConverter<>(EBufferRebuildTimes.class, EDhApiBufferRebuildTimes.class)); }
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* 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.config.client;
|
||||
|
||||
import com.seibel.lod.core.api.external.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;
|
||||
import com.seibel.lod.core.enums.rendering.*;
|
||||
import com.seibel.lod.core.config.Config.Client.Graphics.FogQuality;
|
||||
|
||||
/**
|
||||
* Distant Horizons' fog configuration. <br><br>
|
||||
*
|
||||
* Note: unless an option explicitly states that it modifies
|
||||
* Minecraft's vanilla rendering (like DisableVanillaFog)
|
||||
* these settings will only affect Distant horizons' fog.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-11
|
||||
*/
|
||||
public class DhApiGraphicsFog
|
||||
{
|
||||
|
||||
//====================//
|
||||
// basic fog settings //
|
||||
//====================//
|
||||
|
||||
/** Defines at what distance fog is rendered on fake chunks. */
|
||||
public static IDhApiConfig<EDhApiFogDistance> getFogDistanceConfig()
|
||||
{ return new DhApiConfig<EFogDistance, EDhApiFogDistance>(FogQuality.fogDistance, new GenericEnumConverter<>(EFogDistance.class, EDhApiFogDistance.class)); }
|
||||
|
||||
/** Should be used to enable/disable fog rendering. */
|
||||
public static IDhApiConfig<EDhApiFogDrawMode> getFogRenderConfig()
|
||||
{ return new DhApiConfig<EFogDrawMode, EDhApiFogDrawMode>(FogQuality.fogDrawMode, new GenericEnumConverter<>(EFogDrawMode.class, EDhApiFogDrawMode.class)); }
|
||||
|
||||
/** Can be used to enable support with mods that change vanilla MC's fog color. */
|
||||
public static IDhApiConfig<EDhApiFogColorMode> getFogColorConfig()
|
||||
{ return new DhApiConfig<EFogColorMode, EDhApiFogColorMode>(FogQuality.fogColorMode, new GenericEnumConverter<>(EFogColorMode.class, EDhApiFogColorMode.class)); }
|
||||
|
||||
/**
|
||||
* If enabled attempts to disable vanilla MC's fog on real chunks. <br>
|
||||
* May not play nice with other fog editing mods.
|
||||
*/
|
||||
public static IDhApiConfig<Boolean> getDisableVanillaFogConfig()
|
||||
{ return new DhApiConfig<Boolean, Boolean>(FogQuality.disableVanillaFog); }
|
||||
|
||||
|
||||
//=======================//
|
||||
// advanced fog settings //
|
||||
//=======================//
|
||||
|
||||
/**
|
||||
* Defines where the fog starts as a percent of the
|
||||
* fake chunks render distance radius. <br>
|
||||
* Can be greater than the fog end distance to invert the fog direction. <br> <br>
|
||||
*
|
||||
* 0.0 = fog starts at the camera <br>
|
||||
* 1.0 = fog starts at the edge of the fake chunk render distance <br>
|
||||
*/
|
||||
public static IDhApiConfig<Double> getFogStartDistanceConfig()
|
||||
{ return new DhApiConfig<Double, Double>(FogQuality.AdvancedFog.farFogStart); }
|
||||
|
||||
/**
|
||||
* Defines where the fog ends as a percent of the radius
|
||||
* of the fake chunks render distance. <br>
|
||||
* Can be less than the fog start distance to invert the fog direction. <br> <br>
|
||||
*
|
||||
* 0.0 = fog ends at the camera <br>
|
||||
* 1.0 = fog ends at the edge of the fake chunk render distance <br>
|
||||
*/
|
||||
public static IDhApiConfig<Double> getFogEndDistanceConfig()
|
||||
{ return new DhApiConfig<Double, Double>(FogQuality.AdvancedFog.farFogEnd); }
|
||||
|
||||
/** Defines how opaque the fog is at its thinnest point. */
|
||||
public static IDhApiConfig<Double> getFogMinThicknessConfig()
|
||||
{ return new DhApiConfig<Double, Double>(FogQuality.AdvancedFog.farFogMin); }
|
||||
|
||||
/** Defines how opaque the fog is at its thickest point. */
|
||||
public static IDhApiConfig<Double> getFogMaxThicknessConfig()
|
||||
{ return new DhApiConfig<Double, Double>(FogQuality.AdvancedFog.farFogMax); }
|
||||
|
||||
/** Defines how the fog changes in thickness. */
|
||||
public static IDhApiConfig<EDhApiFogFalloff> getFogFalloffConfig()
|
||||
{ return new DhApiConfig<EFogFalloff, EDhApiFogFalloff>(FogQuality.AdvancedFog.farFogType, new GenericEnumConverter<>(EFogFalloff.class, EDhApiFogFalloff.class)); }
|
||||
|
||||
/** Defines the fog density. */
|
||||
public static IDhApiConfig<Double> getFogDensityConfig()
|
||||
{ return new DhApiConfig<Double, Double>(FogQuality.AdvancedFog.farFogDensity); }
|
||||
|
||||
|
||||
//=====================//
|
||||
// height fog settings //
|
||||
//=====================//
|
||||
|
||||
/** Defines how the height fog mixes. */
|
||||
public static IDhApiConfig<EDhApiHeightFogMixMode> getHeightFogMixModeConfig()
|
||||
{ return new DhApiConfig<EHeightFogMixMode, EDhApiHeightFogMixMode>(FogQuality.AdvancedFog.HeightFog.heightFogMixMode, new GenericEnumConverter<>(EHeightFogMixMode.class, EDhApiHeightFogMixMode.class)); }
|
||||
|
||||
/** Defines how the height fog is drawn relative to the camera or world. */
|
||||
public static IDhApiConfig<EDhApiHeightFogMode> getHeightFogModeConfig()
|
||||
{ return new DhApiConfig<EHeightFogMode, EDhApiHeightFogMode>(FogQuality.AdvancedFog.HeightFog.heightFogMode, new GenericEnumConverter<>(EHeightFogMode.class, EDhApiHeightFogMode.class)); }
|
||||
|
||||
/**
|
||||
* Defines the height fog's base height if {@link DhApiGraphicsFog#getHeightFogModeConfig()}
|
||||
* is set to use a specific height.
|
||||
*/
|
||||
public static IDhApiConfig<Double> getHeightFogBaseHeightConfig()
|
||||
{ return new DhApiConfig<Double, Double>(FogQuality.AdvancedFog.HeightFog.heightFogHeight); }
|
||||
|
||||
/** Defines the height fog's starting height as a percent of the world height. */
|
||||
public static IDhApiConfig<Double> getHeightFogStartingHeightPercentConfig()
|
||||
{ return new DhApiConfig<Double, Double>(FogQuality.AdvancedFog.HeightFog.heightFogStart); }
|
||||
|
||||
/** Defines the height fog's ending height as a percent of the world height. */
|
||||
public static IDhApiConfig<Double> getHeightFogEndingHeightPercentConfig()
|
||||
{ return new DhApiConfig<Double, Double>(FogQuality.AdvancedFog.HeightFog.heightFogEnd); }
|
||||
|
||||
/** Defines how opaque the height fog is at its thinnest point. */
|
||||
public static IDhApiConfig<Double> getHeightFogMinThicknessConfig()
|
||||
{ return new DhApiConfig<Double, Double>(FogQuality.AdvancedFog.HeightFog.heightFogMin); }
|
||||
|
||||
/** Defines how opaque the height fog is at its thickest point. */
|
||||
public static IDhApiConfig<Double> getHeightFogMaxThicknessConfig()
|
||||
{ return new DhApiConfig<Double, Double>(FogQuality.AdvancedFog.HeightFog.heightFogMax); }
|
||||
|
||||
/** Defines how the height fog changes in thickness. */
|
||||
public static IDhApiConfig<EDhApiFogFalloff> getHeightFogFalloffConfig()
|
||||
{ return new DhApiConfig<EFogFalloff, EDhApiFogFalloff>(FogQuality.AdvancedFog.HeightFog.heightFogType, new GenericEnumConverter<>(EFogFalloff.class, EDhApiFogFalloff.class)); }
|
||||
|
||||
/** Defines the height fog's density. */
|
||||
public static IDhApiConfig<Double> getHeightFogDensityConfig()
|
||||
{ return new DhApiConfig<Double, Double>(FogQuality.AdvancedFog.HeightFog.heightFogDensity); }
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.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.core.api.implementation.objects.GenericEnumConverter;
|
||||
import com.seibel.lod.core.api.implementation.wrappers.DhApiConfig;
|
||||
import com.seibel.lod.core.config.Config.Client.Multiplayer;
|
||||
import com.seibel.lod.core.enums.config.EServerFolderNameMode;
|
||||
|
||||
/**
|
||||
* Distant Horizons' client-side multiplayer configuration.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-5
|
||||
*/
|
||||
public class DhApiMultiplayer
|
||||
{
|
||||
|
||||
/**
|
||||
* Defines how multiplayer server folders are named. <br>
|
||||
* Note: Changing this while connected to a multiplayer world will cause undefined behavior!
|
||||
*/
|
||||
public static IDhApiConfig<EDhApiServerFolderNameMode> getFolderSavingModeConfig()
|
||||
{ return new DhApiConfig<EServerFolderNameMode, EDhApiServerFolderNameMode>(Multiplayer.serverFolderNameMode, new GenericEnumConverter<>(EServerFolderNameMode.class, EDhApiServerFolderNameMode.class)); }
|
||||
|
||||
/**
|
||||
* Defines the necessary similarity (as a percent) that two potential levels
|
||||
* need in order to be considered the same. <br> <br>
|
||||
*
|
||||
* Setting this to zero causes every level of a specific dimension type to be consider
|
||||
* the same level. <br>
|
||||
* Setting this to a non-zero value allows for usage in servers that user Multiverse
|
||||
* or similar mods.
|
||||
*/
|
||||
public static IDhApiConfig<Double> getMultiverseSimilarityRequirementConfig()
|
||||
{ return new DhApiConfig<Double, Double>(Multiplayer.multiDimensionRequiredSimilarity); }
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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.config.client;
|
||||
|
||||
import com.seibel.lod.core.api.external.items.interfaces.config.IDhApiConfig;
|
||||
import com.seibel.lod.core.api.implementation.wrappers.DhApiConfig;
|
||||
import com.seibel.lod.core.config.Config.Client.Advanced.Threading;
|
||||
|
||||
/**
|
||||
* Distant Horizons' threading configuration.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-5
|
||||
*/
|
||||
public class DhApiThreading
|
||||
{
|
||||
|
||||
/**
|
||||
* Defines how many world generator threads are used to generate
|
||||
* terrain outside Minecraf's vanilla render distance. <br>
|
||||
* <br>
|
||||
* If the number of threads is less than 1 it will be treated as a percentage
|
||||
* representing how often the single thread will actively generate terrain. <br> <br>
|
||||
*
|
||||
* 0.1 = 1 thread active 10% of the time <br>
|
||||
* 0.5 = 1 thread active 50% of the time <br>
|
||||
* 1.0 = 1 thread active 100% of the time <br>
|
||||
* 1.5 = 2 threads active 100% of the time (partial values are rounded up) <br>
|
||||
* 2.0 = 2 threads active 100% of the time <br>
|
||||
*
|
||||
* @deprecated this (and the related config) should be replaced with an int
|
||||
* count of threads and then a double percent active config.
|
||||
*/
|
||||
@Deprecated
|
||||
public static IDhApiConfig<Double> getWorldGeneratorThreadConfig()
|
||||
{ return new DhApiConfig<Double, Double>(Threading.numberOfWorldGenerationThreads); }
|
||||
|
||||
// TODO the above should be replaced with these
|
||||
// public static IDhApiConfig<Integer> getWorldGeneratorThreadConfig()
|
||||
// { return new DhApiConfig<>(Threading.numberOfWorldGenerationThreads); }
|
||||
|
||||
// public static IDhApiConfig<Double> getWorldGeneratorThreadActivePercentConfig()
|
||||
// { return new DhApiConfig<>(Threading.ToBeDetermined); }
|
||||
|
||||
|
||||
/** Defines how many buffer (GPU Terrain data) builder threads are used. */
|
||||
public static IDhApiConfig<Integer> getBufferBuilderThreadConfig()
|
||||
{ return new DhApiConfig<Integer, Integer>(Threading.numberOfBufferBuilderThreads); }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.seibel.lod.api.data;
|
||||
|
||||
import com.seibel.lod.core.api.external.items.objects.DhApiResult;
|
||||
import com.seibel.lod.core.api.external.items.objects.data.DhApiTerrainDataPoint;
|
||||
|
||||
|
||||
/**
|
||||
* Allows getting and setting any terrain data Distant Horizons has stored.
|
||||
*
|
||||
* TODO once 1.7's data refactor is complete ask Leetom and/or Leonardo for help on setting these up
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-12
|
||||
*/
|
||||
public class DhApiTerrainDataRepo
|
||||
{
|
||||
/**
|
||||
* Returns the terrain data at the given block position.
|
||||
* Null if the position hasn't been generated.
|
||||
*/
|
||||
public static DhApiTerrainDataPoint getDataAtBlockPos(int blockPosX, int blockPosY, int blockPosZ)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
/** Sets the terrain data at the given block position. */
|
||||
public static DhApiResult setDataAtBlockPos(int blockPosX, int blockPosY, int blockPosZ, DhApiTerrainDataPoint newData)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the average color for the chunk at the given chunk position.
|
||||
* Returns null if the position hasn't been generated.
|
||||
*/
|
||||
public static DhApiTerrainDataPoint getDataAtChunkPos(int chunkPosX, int chunkPosZ)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
/** Sets the terrain data at the given chunk position. */
|
||||
public static DhApiResult setDataAtChunkPos(int chunkPosX, int chunkPosZ, DhApiTerrainDataPoint newData)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the average color for the chunk at the given chunk position.
|
||||
* May return inaccurate data if the whole region hasn't been generated yet.
|
||||
* Returns null if the position hasn't been generated.
|
||||
*/
|
||||
public static DhApiTerrainDataPoint getDataAtRegionPos(int regionPosX, int regionPosZ)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
/** Sets the terrain data at the given chunk position. */
|
||||
public static DhApiResult setDataAtRegionPos(int regionPosX, int regionPosZ, DhApiTerrainDataPoint newData)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the average color for the chunk at the given chunk position.
|
||||
* May return inaccurate data if the whole region hasn't been generated yet.
|
||||
* Returns null if the position hasn't been generated.
|
||||
*/
|
||||
public static DhApiTerrainDataPoint getDataAtDetailLevelAndPos(short detailLevel, int relativePosX, int relativePosY, int relativePosZ)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
/** Sets the terrain data at the given chunk position. */
|
||||
public static DhApiResult setDataAtRegionPos(short detailLevel, int relativePosX, int relativePosY, int relativePosZ, DhApiTerrainDataPoint newData)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
The data api package holds objects and methods for getting/setting data stored by Distant Horizons.
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
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.core.api.external.items.objects.DhApiResult;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.WorldGeneratorInjector;
|
||||
|
||||
/**
|
||||
* Handles adding world generator overrides.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-8-15
|
||||
*/
|
||||
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)
|
||||
{
|
||||
try
|
||||
{
|
||||
WorldGeneratorInjector.INSTANCE.bind(worldGenerator);
|
||||
return DhApiResult.createSuccess();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return DhApiResult.createFail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
try
|
||||
{
|
||||
WorldGeneratorInjector.INSTANCE.bind(levelWrapper, worldGenerator);
|
||||
return DhApiResult.createSuccess();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return DhApiResult.createFail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
The overide api package holds objects and methods for overriding Distant Horizons' backend systems, so they can be replaced and improved.
|
||||
Reference in New Issue
Block a user