Flip API -> Core dependency to Core -> API
Very rough, a decent amount of the API isn't hooked up to anything.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.seibel.lod.api;
|
||||
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
import com.seibel.lod.core.datatype.full.FullDataSource;
|
||||
|
||||
/**
|
||||
* This holds API methods related to version numbers and other unchanging endpoints.
|
||||
@@ -39,10 +38,5 @@ public class DhApiMain
|
||||
{
|
||||
return ModInfo.PROTOCOL_VERSION;
|
||||
}
|
||||
/** Returns the LOD file version. */
|
||||
public static int getLodFileFormatVersion()
|
||||
{
|
||||
return FullDataSource.LATEST_VERSION;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* 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.enums;
|
||||
|
||||
import com.seibel.lod.api.items.enums.config.DhApiConfigEnumAssembly;
|
||||
import com.seibel.lod.api.items.enums.worldGeneration.DhApiWorldGenerationEnumAssembly;
|
||||
|
||||
/**
|
||||
* Assembly classes are used to reference the package they are in.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-18
|
||||
*/
|
||||
public class DhApiEnumAssembly
|
||||
{
|
||||
// These variables are added in order to load each package into the JVM's class loader.
|
||||
// This is done so they can be found via reflection.
|
||||
private static final DhApiWorldGenerationEnumAssembly worldGenerationAssembly = new DhApiWorldGenerationEnumAssembly();
|
||||
private static final DhApiConfigEnumAssembly configAssembly = new DhApiConfigEnumAssembly();
|
||||
|
||||
/** All DH API enums should have this prefix */
|
||||
public static final String API_ENUM_PREFIX = "EDhApi";
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* Assembly classes are used to reference the package they are in.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-13
|
||||
*/
|
||||
public class DhApiConfigEnumAssembly
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* NONE, <br>
|
||||
* NON_FULL, <br>
|
||||
* NO_COLLISION, <br>
|
||||
* BOTH, <br>
|
||||
*
|
||||
* @author Leonardo Amato
|
||||
* @version 2022-7-1
|
||||
*/
|
||||
public enum EDhApiBlocksToAvoid
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
NONE(false, false),
|
||||
|
||||
NON_FULL(true, false),
|
||||
|
||||
NO_COLLISION(false, true),
|
||||
|
||||
BOTH(true, true);
|
||||
|
||||
public final boolean nonFull;
|
||||
public final boolean noCollision;
|
||||
|
||||
EDhApiBlocksToAvoid(boolean nonFull, boolean noCollision)
|
||||
{
|
||||
this.nonFull = nonFull;
|
||||
this.noCollision = noCollision;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* CONSTANT <br>
|
||||
* FREQUENT <br>
|
||||
* NORMAL <br>
|
||||
* RARE <br> <br>
|
||||
*
|
||||
* Determines how fast the buffers should be regenerated
|
||||
*
|
||||
* @author Leonardo Amato
|
||||
* @version 9-25-2021
|
||||
*/
|
||||
public enum EDhApiBufferRebuildTimes
|
||||
{
|
||||
CONSTANT,
|
||||
FREQUENT,
|
||||
NORMAL,
|
||||
RARE;
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* OFF, <br>
|
||||
* SHOW_WIREFRAME, <br>
|
||||
* SHOW_DETAIL, <br>
|
||||
* SHOW_DETAIL_WIREFRAME, <br>
|
||||
* SHOW_GENMODE, <br>
|
||||
* SHOW_GENMODE_WIREFRAME, <br>
|
||||
* SHOW_OVERLAPPING_QUADS, <br>
|
||||
* SHOW_OVERLAPPING_QUADS_WIREFRAME, <br>
|
||||
*
|
||||
* @author Leetom
|
||||
* @author James Seibel
|
||||
* @version 2022-7-2
|
||||
*/
|
||||
public enum EDhApiDebugMode
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
|
||||
/** LODs are rendered normally */
|
||||
OFF,
|
||||
|
||||
/** LOD draws in wireframe. */
|
||||
SHOW_WIREFRAME,
|
||||
|
||||
/** LOD colors are based on their detail */
|
||||
SHOW_DETAIL,
|
||||
|
||||
/** LOD colors are based on their detail, and draws in wireframe. */
|
||||
SHOW_DETAIL_WIREFRAME,
|
||||
|
||||
/** LOD colors are based on their gen mode. */
|
||||
SHOW_GENMODE,
|
||||
|
||||
/** LOD colors are based on their gen mode, and draws in wireframe. */
|
||||
SHOW_GENMODE_WIREFRAME,
|
||||
|
||||
/** Only draw overlapping LOD quads. */
|
||||
SHOW_OVERLAPPING_QUADS,
|
||||
|
||||
/** Only draw overlapping LOD quads, and draws in wireframe. */
|
||||
SHOW_OVERLAPPING_QUADS_WIREFRAME;
|
||||
|
||||
}
|
||||
-88
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* NONE <br>
|
||||
* BIOME_ONLY <br>
|
||||
* BIOME_ONLY_SIMULATE_HEIGHT <br>
|
||||
* SURFACE <br>
|
||||
* FEATURES <br>
|
||||
* FULL <br><br>
|
||||
*
|
||||
* In order of fastest to slowest.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @author Leonardo Amato
|
||||
* @version 2022-7-1
|
||||
*/
|
||||
public enum EDhApiDistanceGenerationMode
|
||||
{
|
||||
// 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,
|
||||
|
||||
/**
|
||||
* Only generate the biomes and use biome
|
||||
* grass/foliage color, water color, or ice color
|
||||
* to generate the color. <br>
|
||||
* Doesn't generate height, everything is shown at sea level. <br>
|
||||
* Multithreaded - Fastest (2-5 ms)
|
||||
*/
|
||||
BIOME_ONLY,
|
||||
|
||||
/**
|
||||
* Same as BIOME_ONLY, except instead
|
||||
* of always using sea level as the LOD height
|
||||
* different biome types (mountain, ocean, forest, etc.)
|
||||
* use predetermined heights to simulate having height data.
|
||||
*/
|
||||
BIOME_ONLY_SIMULATE_HEIGHT,
|
||||
|
||||
/**
|
||||
* Generate the world surface,
|
||||
* this does NOT include caves, trees,
|
||||
* or structures. <br>
|
||||
* Multithreaded - Faster (10-20 ms)
|
||||
*/
|
||||
SURFACE,
|
||||
|
||||
/**
|
||||
* Generate including structures.
|
||||
* NOTE: This may cause world generation bugs or instability,
|
||||
* since some features can cause concurrentModification exceptions. <br>
|
||||
* Multithreaded - Fast (15-20 ms)
|
||||
*/
|
||||
FEATURES,
|
||||
|
||||
/**
|
||||
* Ask the server to generate/load each chunk.
|
||||
* This is the most compatible, but causes server/simulation lag.
|
||||
* This will also show player made structures if you
|
||||
* are adding the mod on a pre-existing world. <br>
|
||||
* Single-threaded - Slow (15-50 ms, with spikes up to 200 ms)
|
||||
*/
|
||||
FULL;
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2022 Tom Lee (TomTheFurry)
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* AUTO <br>
|
||||
* SMOOTH_DROPOFF <br>
|
||||
* PERFORMANCE_FOCUSED <br> <br>
|
||||
*
|
||||
* Determines how lod level drop off should be done
|
||||
*
|
||||
* @author Tom Lee
|
||||
* @version 7-1-2022
|
||||
*/
|
||||
public enum EDhApiDropoffQuality
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
|
||||
/** SMOOTH_DROPOFF when <128 lod view distance, or PERFORMANCE_FOCUSED otherwise */
|
||||
AUTO(-1),
|
||||
|
||||
SMOOTH_DROPOFF(10),
|
||||
|
||||
PERFORMANCE_FOCUSED(0);
|
||||
|
||||
public final int fastModeSwitch;
|
||||
|
||||
EDhApiDropoffQuality(int fastModeSwitch) {
|
||||
this.fastModeSwitch = fastModeSwitch;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* USE_DEFAULT_FOG_COLOR, <br>
|
||||
* USE_SKY_COLOR, <br>
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-6-9
|
||||
*/
|
||||
public enum EDhApiFogColorMode
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
/** Fog uses Minecraft's fog color. */
|
||||
USE_WORLD_FOG_COLOR,
|
||||
|
||||
/**
|
||||
* Replicates the effect of the clear sky mod.
|
||||
* Making the fog blend in with the sky better
|
||||
* For it to look good you need one of the following mods:
|
||||
* https://www.curseforge.com/minecraft/mc-mods/clear-skies
|
||||
* https://www.curseforge.com/minecraft/mc-mods/clear-skies-forge-port
|
||||
*/
|
||||
USE_SKY_COLOR,
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* NEAR, <br>
|
||||
* FAR, <br>
|
||||
* NEAR_AND_FAR <br>
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-6-2
|
||||
*/
|
||||
public enum EDhApiFogDistance
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
NEAR,
|
||||
FAR,
|
||||
NEAR_AND_FAR
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* USE_OPTIFINE_FOG_SETTING, <br>
|
||||
* FOG_ENABLED, <br>
|
||||
* FOG_DISABLED <br>
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-6-2
|
||||
*/
|
||||
public enum EDhApiFogDrawMode
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
|
||||
/**
|
||||
* Use whatever Fog setting optifine is using.
|
||||
* If optifine isn't installed this defaults to FOG_ENABLED.
|
||||
*/
|
||||
USE_OPTIFINE_SETTING,
|
||||
|
||||
FOG_ENABLED,
|
||||
FOG_DISABLED;
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.seibel.lod.api.items.enums.config;
|
||||
|
||||
/**
|
||||
* LINEAR, <br>
|
||||
* EXPONENTIAL, <br>
|
||||
* EXPONENTIAL_SQUARED <br>
|
||||
*
|
||||
* @author Leetom
|
||||
* @version 2022-6-30
|
||||
*/
|
||||
public enum EDhApiFogFalloff
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
|
||||
LINEAR,
|
||||
EXPONENTIAL,
|
||||
EXPONENTIAL_SQUARED,
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* AUTO <br>
|
||||
* Near_First <br>
|
||||
* Far_First <br> <br>
|
||||
*
|
||||
* Determines which LODs should have priority when generating
|
||||
* outside the normal view distance.
|
||||
*
|
||||
* @author Leonardo Amato
|
||||
* @version 12-1-2021
|
||||
*/
|
||||
public enum EDhApiGenerationPriority
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
/** NEAR_FIRST when connected to servers and BALANCED when on single player */
|
||||
AUTO,
|
||||
|
||||
NEAR_FIRST,
|
||||
|
||||
BALANCED,
|
||||
|
||||
FAR_FIRST
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* AUTO, <br>
|
||||
* BUFFER_STORAGE, <br>
|
||||
* SUB_DATA, <br>
|
||||
* BUFFER_MAPPING, <br>
|
||||
* DATA <br>
|
||||
*
|
||||
* @author Leetom
|
||||
* @author James Seibel
|
||||
* @version 2022-7-2
|
||||
*/
|
||||
public enum EDhApiGpuUploadMethod
|
||||
{
|
||||
/** Picks the best option based on the GPU the user has. */
|
||||
AUTO,
|
||||
|
||||
/**
|
||||
* Default for NVIDIA if OpenGL 4.5 is supported. <br>
|
||||
* Fast rendering, no stuttering.
|
||||
*/
|
||||
BUFFER_STORAGE,
|
||||
|
||||
/**
|
||||
* Backup option for NVIDIA. <br>
|
||||
* Fast rendering but may stutter when uploading.
|
||||
*/
|
||||
SUB_DATA,
|
||||
|
||||
/**
|
||||
* Default option for AMD/Intel. <br>
|
||||
* May end up storing buffers in System memory. <br>
|
||||
* Fast rending if in GPU memory, slow if in system memory, <br>
|
||||
* but won't stutter when uploading.
|
||||
*/
|
||||
BUFFER_MAPPING,
|
||||
|
||||
/**
|
||||
* Backup option for AMD/Intel. <br>
|
||||
* Fast rendering but may stutter when uploading.
|
||||
*/
|
||||
DATA;
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* BASIC <br>
|
||||
* IGNORE_HEIGHT <br>
|
||||
* ADDITION <br>
|
||||
* MAX <br>
|
||||
* MULTIPLY <br>
|
||||
* INVERSE_MULTIPLY <br>
|
||||
* LIMITED_ADDITION <br>
|
||||
* MULTIPLY_ADDITION <br>
|
||||
* INVERSE_MULTIPLY_ADDITION <br>
|
||||
* AVERAGE <br>
|
||||
*
|
||||
* @author Leetom
|
||||
* @version 2022-4-14
|
||||
*/
|
||||
public enum EDhApiHeightFogMixMode
|
||||
{
|
||||
BASIC,
|
||||
IGNORE_HEIGHT,
|
||||
ADDITION,
|
||||
MAX,
|
||||
MULTIPLY,
|
||||
INVERSE_MULTIPLY,
|
||||
LIMITED_ADDITION,
|
||||
MULTIPLY_ADDITION,
|
||||
INVERSE_MULTIPLY_ADDITION,
|
||||
AVERAGE,
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* ABOVE_CAMERA, <br>
|
||||
* BELOW_CAMERA, <br>
|
||||
* ABOVE_AND_BELOW_CAMERA, <br>
|
||||
* ABOVE_SET_HEIGHT, <br>
|
||||
* BELOW_SET_HEIGHT, <br>
|
||||
* ABOVE_AND_BELOW_SET_HEIGHT, <br>
|
||||
*
|
||||
* @author Leetom
|
||||
* @version 6-30-2022
|
||||
*/
|
||||
public enum EDhApiHeightFogMode
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
|
||||
ABOVE_CAMERA(true, true, false),
|
||||
BELOW_CAMERA(true, false, true),
|
||||
ABOVE_AND_BELOW_CAMERA(true, true, true),
|
||||
ABOVE_SET_HEIGHT(false, true, false),
|
||||
BELOW_SET_HEIGHT(false, false, true),
|
||||
ABOVE_AND_BELOW_SET_HEIGHT(false, true, true);
|
||||
|
||||
public final boolean basedOnCamera;
|
||||
public final boolean above;
|
||||
public final boolean below;
|
||||
|
||||
EDhApiHeightFogMode(boolean basedOnCamera, boolean above, boolean below)
|
||||
{
|
||||
this.basedOnCamera = basedOnCamera;
|
||||
this.above = above;
|
||||
this.below = below;
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* LOWEST <br>
|
||||
* LOW <br>
|
||||
* MEDIUM <br>
|
||||
* HIGH <br> <br>
|
||||
*
|
||||
* this indicates the base of the quadratic function we use for the quality drop-off
|
||||
*
|
||||
* @author Leonardo Amato
|
||||
* @version 9-29-2021
|
||||
*/
|
||||
public enum EDhApiHorizontalQuality
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
|
||||
/** 1.0 AKA Linear */
|
||||
LOWEST(1.0f),
|
||||
|
||||
/** exponent 1.5 */
|
||||
LOW(1.5f),
|
||||
|
||||
/** exponent 2.0 */
|
||||
MEDIUM(2.0f),
|
||||
|
||||
/** exponent 2.2 */
|
||||
HIGH(2.2f);
|
||||
|
||||
public final double quadraticBase;
|
||||
|
||||
EDhApiHorizontalQuality(double distanceUnit)
|
||||
{
|
||||
this.quadraticBase = distanceUnit;
|
||||
}
|
||||
}
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* BLOCK <Br>
|
||||
* TWO_BLOCKS <Br>
|
||||
* FOUR_BLOCKS <br>
|
||||
* HALF_CHUNK <Br>
|
||||
* CHUNK <br>
|
||||
*
|
||||
* @author James Seibel
|
||||
* @author Leonardo Amato
|
||||
* @version 2022-7-5
|
||||
*/
|
||||
public enum EDhApiHorizontalResolution
|
||||
{
|
||||
/** render 256 LODs for each chunk */
|
||||
BLOCK,
|
||||
|
||||
/** render 64 LODs for each chunk */
|
||||
TWO_BLOCKS,
|
||||
|
||||
/** render 16 LODs for each chunk */
|
||||
FOUR_BLOCKS,
|
||||
|
||||
/** render 4 LODs for each chunk */
|
||||
HALF_CHUNK,
|
||||
|
||||
/** render 1 LOD for each chunk */
|
||||
CHUNK;
|
||||
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* FAST, <br>
|
||||
* FANCY,
|
||||
*
|
||||
* @author Leetom
|
||||
* @version 2022-7-1
|
||||
*/
|
||||
public enum EDhApiLightGenerationMode
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
/** Fake light values using a height map */
|
||||
FAST,
|
||||
|
||||
/** Run the lighting engine though the chunk to generate proper light values */
|
||||
FANCY
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* DEFAULT, <br>
|
||||
* DEBUG, <br>
|
||||
* DISABLED, <br>
|
||||
*
|
||||
* @version 2022-6-2
|
||||
*/
|
||||
public enum EDhApiRendererMode
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
DEFAULT,
|
||||
DEBUG,
|
||||
DISABLED;
|
||||
|
||||
}
|
||||
-72
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2022 Tom Lee (TomTheFurry)
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* AUTO, <br>
|
||||
* NAME_ONLY, <br>
|
||||
* NAME_IP, <br>
|
||||
* NAME_IP_PORT, <br> <br>
|
||||
*
|
||||
* Determines how the multiplayer folders should be named.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-1
|
||||
*/
|
||||
public enum EDhApiServerFolderNameMode
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
|
||||
/**
|
||||
* NAME_IP for LAN connections <Br>
|
||||
* NAME_IP_PORT for all others
|
||||
*/
|
||||
AUTO,
|
||||
|
||||
/** Only use the server name */
|
||||
NAME_ONLY,
|
||||
|
||||
/**
|
||||
* {SERVER_NAME} IP {IP} <br>
|
||||
* Example: Minecraft Server IP 192.168.1.40
|
||||
*/
|
||||
NAME_IP,
|
||||
|
||||
/**
|
||||
* {SERVER_NAME} IP {IP}:{PORT} <br>
|
||||
* Example: Minecraft Server IP 192.168.1.40:25565
|
||||
*/
|
||||
NAME_IP_PORT,
|
||||
|
||||
/**
|
||||
* {SERVER_NAME} IP {IP} <br>
|
||||
* Example: Minecraft Server IP 192.168.1.40:25565 GameVersion 1.16.5 <Br> <br>
|
||||
*
|
||||
* Not normally recommended, since the game version can change if the
|
||||
* server installs paper or some other jar. <br>
|
||||
* This is just here to provide backwards compatibility.
|
||||
*/
|
||||
NAME_IP_PORT_MC_VERSION;
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* NEVER, <br>
|
||||
* DYNAMIC, <br>
|
||||
* ALWAYS <br> <br>
|
||||
*
|
||||
* This represents how far the LODs should overlap with
|
||||
* the vanilla Minecraft terrain.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-6-30
|
||||
*/
|
||||
public enum EDhApiVanillaOverdraw
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
|
||||
/**
|
||||
* Don't draw LODs where a minecraft chunk could be.
|
||||
* Use Overdraw Offset to tweak the border thickness.
|
||||
*/
|
||||
NEVER,
|
||||
|
||||
/**
|
||||
* Draw LODs over the farther minecraft chunks.
|
||||
* Dynamically decides the border thickness
|
||||
*/
|
||||
DYNAMIC,
|
||||
|
||||
/** Draw LODs over all minecraft chunks. */
|
||||
ALWAYS,
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* 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.enums.config;
|
||||
|
||||
/**
|
||||
* LOW, <br>
|
||||
* MEDIUM, <br>
|
||||
* HIGH, <br>
|
||||
* ULTRA <br>
|
||||
*
|
||||
* @author Leonardo Amato
|
||||
* @version 2022-6-9
|
||||
*/
|
||||
public enum EDhApiVerticalQuality
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items: up the API minor version
|
||||
// when removing items: up the API major version
|
||||
|
||||
LOW,
|
||||
MEDIUM,
|
||||
HIGH,
|
||||
ULTRA
|
||||
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.enums.rendering;
|
||||
package com.seibel.lod.api.items.enums.rendering;
|
||||
|
||||
/**
|
||||
* Default
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* 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.enums.worldGeneration;
|
||||
|
||||
/**
|
||||
* Assembly classes are used to reference the package they are in.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-7-14
|
||||
*/
|
||||
public class DhApiWorldGenerationEnumAssembly
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.seibel.lod.api.items.interfaces;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.ICoreDhApiUnsafeWrapper;
|
||||
|
||||
/**
|
||||
* The Distant Horizons' API objects can't cover
|
||||
* every potential use case. Sometimes developers just need
|
||||
@@ -10,7 +8,7 @@ import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public interface IDhApiUnsafeWrapper extends ICoreDhApiUnsafeWrapper
|
||||
public interface IDhApiUnsafeWrapper
|
||||
{
|
||||
/**
|
||||
* Returns the Minecraft object this wrapper contains. <br>
|
||||
@@ -22,7 +20,6 @@ public interface IDhApiUnsafeWrapper extends ICoreDhApiUnsafeWrapper
|
||||
* in order to determine what object this method returns for
|
||||
* the specific version of Minecraft you are developing for.
|
||||
*/
|
||||
@Override
|
||||
public Object getWrappedMcObject_UNSAFE();
|
||||
|
||||
}
|
||||
|
||||
+5
-18
@@ -4,37 +4,24 @@ import com.seibel.lod.api.items.enums.worldGeneration.EDhApiWorldGenerationStep;
|
||||
import com.seibel.lod.api.items.enums.worldGeneration.EDhApiWorldGenThreadMode;
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiChunkWrapper;
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.override.worldGenerator.ICoreDhApiWorldGenerator;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.world.ICoreDhApiLevelWrapper;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.converters.GenericEnumConverter;
|
||||
import com.seibel.lod.core.enums.worldGeneration.EWorldGenThreadMode;
|
||||
import com.seibel.lod.core.enums.worldGeneration.EWorldGenerationStep;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-8
|
||||
*/
|
||||
public abstract class AbstractDhApiWorldGenerator implements ICoreDhApiWorldGenerator, IDhApiOverrideable
|
||||
{
|
||||
private final GenericEnumConverter<EWorldGenThreadMode, EDhApiWorldGenThreadMode> threadModeEnumConverter = new GenericEnumConverter<>(EWorldGenThreadMode.class, EDhApiWorldGenThreadMode.class);
|
||||
private final GenericEnumConverter<EWorldGenerationStep, EDhApiWorldGenerationStep> generationStepEnumConverter = new GenericEnumConverter<>(EWorldGenerationStep.class, EDhApiWorldGenerationStep.class);
|
||||
|
||||
|
||||
public abstract class AbstractDhApiWorldGenerator implements IDhApiOverrideable
|
||||
{
|
||||
/** Returns which thread chunk generation requests can be created on. */
|
||||
public abstract EDhApiWorldGenThreadMode getThreadingMode();
|
||||
|
||||
@Override
|
||||
public EWorldGenThreadMode getCoreThreadingMode()
|
||||
public EDhApiWorldGenThreadMode getCoreThreadingMode()
|
||||
{
|
||||
return threadModeEnumConverter.convertToCoreType(this.getThreadingMode());
|
||||
return this.getThreadingMode();
|
||||
}
|
||||
|
||||
public abstract IDhApiChunkWrapper generateChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiWorldGenerationStep maxStepToGenerate);
|
||||
|
||||
@Override
|
||||
public final IChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, ICoreDhApiLevelWrapper serverLevelWrapper, EWorldGenerationStep maxStepToGenerate)
|
||||
public final IDhApiChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiWorldGenerationStep maxStepToGenerate)
|
||||
{
|
||||
// TODO probably need to change the return type
|
||||
return null; //generateChunk(chunkPosX, chunkPosZ, null, generationStepEnumConverter.convertToApiType(maxStepToGenerate));
|
||||
|
||||
+3
-5
@@ -1,8 +1,7 @@
|
||||
package com.seibel.lod.api.items.interfaces.override;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.override.ICoreDhApiOverrideable;
|
||||
import com.seibel.lod.core.dependencyInjection.IBindable;
|
||||
import com.seibel.lod.core.dependencyInjection.OverrideInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.IOverrideInjector;
|
||||
|
||||
/**
|
||||
* Implemented by all DhApi objects that can be overridden.
|
||||
@@ -10,13 +9,12 @@ import com.seibel.lod.core.dependencyInjection.OverrideInjector;
|
||||
* @author James Seibel
|
||||
* @version 2022-9-5
|
||||
*/
|
||||
public interface IDhApiOverrideable extends ICoreDhApiOverrideable, IBindable
|
||||
public interface IDhApiOverrideable extends IBindable
|
||||
{
|
||||
/**
|
||||
* Returns when this Override should be used. <br>
|
||||
* For most developers this can be left at the default.
|
||||
*/
|
||||
@Override
|
||||
default int getPriority() { return OverrideInjector.DEFAULT_NON_CORE_OVERRIDE_PRIORITY; }
|
||||
default int getPriority() { return IOverrideInjector.DEFAULT_NON_CORE_OVERRIDE_PRIORITY; }
|
||||
|
||||
}
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.seibel.lod.api.items.interfaces.override.worldGenerator;
|
||||
|
||||
import com.seibel.lod.api.items.enums.worldGeneration.EDhApiWorldGenThreadMode;
|
||||
import com.seibel.lod.api.items.enums.worldGeneration.EDhApiWorldGenerationStep;
|
||||
import com.seibel.lod.api.items.interfaces.override.IDhApiOverrideable;
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiChunkWrapper;
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-8
|
||||
*/
|
||||
public interface IDhApiWorldGenerator extends IDhApiOverrideable
|
||||
{
|
||||
/** Returns which thread chunk generation requests can be created on. */
|
||||
EDhApiWorldGenThreadMode getCoreThreadingMode();
|
||||
|
||||
IDhApiChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiWorldGenerationStep maxStepToGenerate);
|
||||
|
||||
}
|
||||
+1
-5
@@ -20,20 +20,16 @@
|
||||
package com.seibel.lod.api.items.interfaces.world;
|
||||
|
||||
import com.seibel.lod.api.items.interfaces.IDhApiUnsafeWrapper;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.world.ICoreDhApiDimensionTypeWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-7-14
|
||||
*/
|
||||
public interface IDhApiDimensionTypeWrapper extends ICoreDhApiDimensionTypeWrapper, IDhApiUnsafeWrapper
|
||||
public interface IDhApiDimensionTypeWrapper extends IDhApiUnsafeWrapper
|
||||
{
|
||||
@Override
|
||||
String getDimensionName();
|
||||
|
||||
@Override
|
||||
boolean hasCeiling();
|
||||
|
||||
@Override
|
||||
boolean hasSkyLight();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.seibel.lod.api.items.interfaces.world;
|
||||
|
||||
import com.seibel.lod.api.items.interfaces.IDhApiUnsafeWrapper;
|
||||
import com.seibel.lod.api.items.enums.worldGeneration.EDhApiLevelType;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.world.ICoreDhApiLevelWrapper;
|
||||
|
||||
/**
|
||||
* Can be either a Server or Client level.
|
||||
@@ -29,22 +28,18 @@ import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.
|
||||
* @author James Seibel
|
||||
* @version 2022-7-14
|
||||
*/
|
||||
public interface IDhApiLevelWrapper extends ICoreDhApiLevelWrapper, IDhApiUnsafeWrapper
|
||||
public interface IDhApiLevelWrapper extends IDhApiUnsafeWrapper
|
||||
{
|
||||
IDhApiDimensionTypeWrapper getDimensionType();
|
||||
|
||||
EDhApiLevelType getLevelType();
|
||||
|
||||
@Override
|
||||
boolean hasCeiling();
|
||||
|
||||
@Override
|
||||
boolean hasSkyLight();
|
||||
|
||||
@Override
|
||||
int getHeight();
|
||||
|
||||
@Override
|
||||
default int getMinHeight() { return 0; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
/*
|
||||
* 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.objects.math;
|
||||
|
||||
import com.seibel.lod.core.util.math.Mat4f;
|
||||
|
||||
/**
|
||||
* A simple way to store a 4x4 array
|
||||
* of floats without having to worry
|
||||
* about remembering which array is columns
|
||||
* and which one is rows.
|
||||
* <br>
|
||||
* Based on Minecraft 1.16's implementation
|
||||
* of a 4x4 matrix.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-8-21
|
||||
*/
|
||||
public class DhApiMat4f
|
||||
{
|
||||
private float m00;
|
||||
private float m01;
|
||||
private float m02;
|
||||
private float m03;
|
||||
private float m10;
|
||||
private float m11;
|
||||
private float m12;
|
||||
private float m13;
|
||||
private float m20;
|
||||
private float m21;
|
||||
private float m22;
|
||||
private float m23;
|
||||
private float m30;
|
||||
private float m31;
|
||||
private float m32;
|
||||
private float m33;
|
||||
|
||||
|
||||
public DhApiMat4f()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DhApiMat4f(DhApiMat4f sourceMatrix)
|
||||
{
|
||||
this.m00 = sourceMatrix.m00;
|
||||
this.m01 = sourceMatrix.m01;
|
||||
this.m02 = sourceMatrix.m02;
|
||||
this.m03 = sourceMatrix.m03;
|
||||
this.m10 = sourceMatrix.m10;
|
||||
this.m11 = sourceMatrix.m11;
|
||||
this.m12 = sourceMatrix.m12;
|
||||
this.m13 = sourceMatrix.m13;
|
||||
this.m20 = sourceMatrix.m20;
|
||||
this.m21 = sourceMatrix.m21;
|
||||
this.m22 = sourceMatrix.m22;
|
||||
this.m23 = sourceMatrix.m23;
|
||||
this.m30 = sourceMatrix.m30;
|
||||
this.m31 = sourceMatrix.m31;
|
||||
this.m32 = sourceMatrix.m32;
|
||||
this.m33 = sourceMatrix.m33;
|
||||
}
|
||||
|
||||
public DhApiMat4f(float[] values)
|
||||
{
|
||||
m00 = values[0];
|
||||
m01 = values[1];
|
||||
m02 = values[2];
|
||||
m03 = values[3];
|
||||
m10 = values[4];
|
||||
m11 = values[5];
|
||||
m12 = values[6];
|
||||
m13 = values[7];
|
||||
m20 = values[8];
|
||||
m21 = values[9];
|
||||
m22 = values[10];
|
||||
m23 = values[11];
|
||||
m30 = values[12];
|
||||
m31 = values[13];
|
||||
m32 = values[14];
|
||||
m33 = values[15];
|
||||
}
|
||||
|
||||
public DhApiMat4f(Mat4f sourceMatrix)
|
||||
{
|
||||
this(sourceMatrix.getValuesAsArray());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Returns the values of this matrix in row major order (AKA rows then columns) */
|
||||
private float[] getValuesAsArray()
|
||||
{
|
||||
return new float[] {
|
||||
this.m00,
|
||||
this.m01,
|
||||
this.m02,
|
||||
this.m03,
|
||||
|
||||
this.m10,
|
||||
this.m11,
|
||||
this.m12,
|
||||
this.m13,
|
||||
|
||||
this.m20,
|
||||
this.m21,
|
||||
this.m22,
|
||||
this.m23,
|
||||
|
||||
this.m30,
|
||||
this.m31,
|
||||
this.m32,
|
||||
this.m33,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (obj != null && this.getClass() == obj.getClass())
|
||||
{
|
||||
DhApiMat4f otherMatrix = (DhApiMat4f) obj;
|
||||
return Float.compare(otherMatrix.m00, this.m00) == 0
|
||||
&& Float.compare(otherMatrix.m01, this.m01) == 0
|
||||
&& Float.compare(otherMatrix.m02, this.m02) == 0
|
||||
&& Float.compare(otherMatrix.m03, this.m03) == 0
|
||||
&& Float.compare(otherMatrix.m10, this.m10) == 0
|
||||
&& Float.compare(otherMatrix.m11, this.m11) == 0
|
||||
&& Float.compare(otherMatrix.m12, this.m12) == 0
|
||||
&& Float.compare(otherMatrix.m13, this.m13) == 0
|
||||
&& Float.compare(otherMatrix.m20, this.m20) == 0
|
||||
&& Float.compare(otherMatrix.m21, this.m21) == 0
|
||||
&& Float.compare(otherMatrix.m22, this.m22) == 0
|
||||
&& Float.compare(otherMatrix.m23, this.m23) == 0
|
||||
&& Float.compare(otherMatrix.m30, this.m30) == 0
|
||||
&& Float.compare(otherMatrix.m31, this.m31) == 0
|
||||
&& Float.compare(otherMatrix.m32, this.m32) == 0
|
||||
&& Float.compare(otherMatrix.m33, this.m33) == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int i = this.m00 != 0.0F ? Float.floatToIntBits(this.m00) : 0;
|
||||
i = 31 * i + (this.m01 != 0.0F ? Float.floatToIntBits(this.m01) : 0);
|
||||
i = 31 * i + (this.m02 != 0.0F ? Float.floatToIntBits(this.m02) : 0);
|
||||
i = 31 * i + (this.m03 != 0.0F ? Float.floatToIntBits(this.m03) : 0);
|
||||
i = 31 * i + (this.m10 != 0.0F ? Float.floatToIntBits(this.m10) : 0);
|
||||
i = 31 * i + (this.m11 != 0.0F ? Float.floatToIntBits(this.m11) : 0);
|
||||
i = 31 * i + (this.m12 != 0.0F ? Float.floatToIntBits(this.m12) : 0);
|
||||
i = 31 * i + (this.m13 != 0.0F ? Float.floatToIntBits(this.m13) : 0);
|
||||
i = 31 * i + (this.m20 != 0.0F ? Float.floatToIntBits(this.m20) : 0);
|
||||
i = 31 * i + (this.m21 != 0.0F ? Float.floatToIntBits(this.m21) : 0);
|
||||
i = 31 * i + (this.m22 != 0.0F ? Float.floatToIntBits(this.m22) : 0);
|
||||
i = 31 * i + (this.m23 != 0.0F ? Float.floatToIntBits(this.m23) : 0);
|
||||
i = 31 * i + (this.m30 != 0.0F ? Float.floatToIntBits(this.m30) : 0);
|
||||
i = 31 * i + (this.m31 != 0.0F ? Float.floatToIntBits(this.m31) : 0);
|
||||
i = 31 * i + (this.m32 != 0.0F ? Float.floatToIntBits(this.m32) : 0);
|
||||
return 31 * i + (this.m33 != 0.0F ? Float.floatToIntBits(this.m33) : 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Matrix4f:\n" +
|
||||
this.m00 + " " + this.m01 + " " + this.m02 + " " + this.m03 + "\n" +
|
||||
this.m10 + " " + this.m11 + " " + this.m12 + " " + this.m13 + "\n" +
|
||||
this.m20 + " " + this.m21 + " " + this.m22 + " " + this.m23 + "\n" +
|
||||
this.m30 + " " + this.m31 + " " + this.m32 + " " + this.m33 + "\n";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* 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.objects.wrappers;
|
||||
|
||||
import com.seibel.lod.api.items.interfaces.IDhApiUnsafeWrapper;
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiDimensionTypeWrapper;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.ICoreDhApiUnsafeWrapper;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.world.ICoreDhApiDimensionTypeWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IDimensionTypeWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-8
|
||||
*/
|
||||
public class DhApiDimensionTypeWrapper implements IDhApiDimensionTypeWrapper
|
||||
{
|
||||
private final IDimensionTypeWrapper dimensionTypeWrapper;
|
||||
|
||||
|
||||
public DhApiDimensionTypeWrapper(IDimensionTypeWrapper newDimensionTypeWrapper)
|
||||
{
|
||||
this.dimensionTypeWrapper = newDimensionTypeWrapper;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getDimensionName() { return this.dimensionTypeWrapper.getDimensionName(); }
|
||||
|
||||
@Override
|
||||
public boolean hasCeiling() { return this.dimensionTypeWrapper.hasCeiling(); }
|
||||
|
||||
@Override
|
||||
public boolean hasSkyLight() { return this.dimensionTypeWrapper.hasSkyLight(); }
|
||||
|
||||
|
||||
@Override
|
||||
public Object getWrappedMcObject_UNSAFE() { return this.dimensionTypeWrapper.getWrappedMcObject(); }
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* 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.objects.wrappers;
|
||||
|
||||
import com.seibel.lod.api.items.enums.worldGeneration.EDhApiLevelType;
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiDimensionTypeWrapper;
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IDimensionTypeWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IServerLevelWrapper;
|
||||
|
||||
/**
|
||||
* Can be either a Server or Client level.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-9-10
|
||||
*/
|
||||
public class DhApiLevelWrapper implements IDhApiLevelWrapper
|
||||
{
|
||||
private final ILevelWrapper coreLevelWrapper;
|
||||
private final IDimensionTypeWrapper coreDimensionTypeWrapper;
|
||||
|
||||
|
||||
public DhApiLevelWrapper(ILevelWrapper newLevelWrapper)
|
||||
{
|
||||
this.coreLevelWrapper = newLevelWrapper;
|
||||
this.coreDimensionTypeWrapper = this.coreLevelWrapper.getDimensionType();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IDhApiDimensionTypeWrapper getDimensionType() { return new DhApiDimensionTypeWrapper(this.coreDimensionTypeWrapper); }
|
||||
|
||||
@Override
|
||||
public EDhApiLevelType getLevelType()
|
||||
{
|
||||
if (this.coreLevelWrapper.getClass().isAssignableFrom(IClientLevelWrapper.class))
|
||||
{
|
||||
return EDhApiLevelType.CLIENT_LEVEL;
|
||||
}
|
||||
else if (this.coreLevelWrapper.getClass().isAssignableFrom(IServerLevelWrapper.class))
|
||||
{
|
||||
return EDhApiLevelType.CLIENT_LEVEL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// shouldn't normally happen, but just in case
|
||||
return EDhApiLevelType.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCeiling() { return this.coreLevelWrapper.hasCeiling(); }
|
||||
|
||||
@Override
|
||||
public boolean hasSkyLight() { return this.coreLevelWrapper.hasSkyLight(); }
|
||||
|
||||
@Override
|
||||
public int getHeight() { return this.coreLevelWrapper.getHeight(); }
|
||||
|
||||
@Override
|
||||
public int getMinHeight() { return this.coreLevelWrapper.getMinHeight(); }
|
||||
|
||||
|
||||
@Override
|
||||
public Object getWrappedMcObject_UNSAFE() { return this.coreLevelWrapper.unwrapLevel(); }
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.seibel.lod.api.methods.config;
|
||||
|
||||
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.config.IConverter;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.converters.DefaultConverter;
|
||||
import com.seibel.lod.core.config.types.ConfigEntry;
|
||||
import com.seibel.lod.core.interfaces.config.IConfigEntry;
|
||||
import com.seibel.lod.core.interfaces.config.IConverter;
|
||||
import com.seibel.lod.core.interfaces.config.converters.DefaultConverter;
|
||||
|
||||
/**
|
||||
* A wrapper used to interface with Distant Horizon's Config.
|
||||
@@ -18,7 +18,7 @@ import com.seibel.lod.core.config.types.ConfigEntry;
|
||||
*/
|
||||
public class DhApiConfig<coreType, apiType> implements IDhApiConfig<apiType>
|
||||
{
|
||||
private final ConfigEntry<coreType> configEntry;
|
||||
private final IConfigEntry<coreType> configEntry;
|
||||
|
||||
private final IConverter<coreType, apiType> configConverter;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class DhApiConfig<coreType, apiType> implements IDhApiConfig<apiType>
|
||||
* Uses the default object converter, this requires coreType and apiType to be the same.
|
||||
*/
|
||||
@SuppressWarnings("unchecked") // DefaultConverter's cast is safe
|
||||
public DhApiConfig(ConfigEntry<coreType> newConfigEntry)
|
||||
public DhApiConfig(IConfigEntry<coreType> newConfigEntry)
|
||||
{
|
||||
this.configEntry = newConfigEntry;
|
||||
this.configConverter = (IConverter<coreType, apiType>) new DefaultConverter<coreType>();
|
||||
@@ -40,7 +40,7 @@ public class DhApiConfig<coreType, apiType> implements IDhApiConfig<apiType>
|
||||
* This constructor should only be called internally. <br>
|
||||
* There is no reason for API users to create this object. <br><br>
|
||||
*/
|
||||
public DhApiConfig(ConfigEntry<coreType> newConfigEntry, IConverter<coreType, apiType> newConverter)
|
||||
public DhApiConfig(IConfigEntry<coreType> newConfigEntry, IConverter<coreType, apiType> newConverter)
|
||||
{
|
||||
this.configEntry = newConfigEntry;
|
||||
this.configConverter = newConverter;
|
||||
@@ -53,7 +53,7 @@ public class DhApiConfig<coreType, apiType> implements IDhApiConfig<apiType>
|
||||
|
||||
public boolean setValue(apiType newValue)
|
||||
{
|
||||
if (this.configEntry.allowApiOverride)
|
||||
if (this.configEntry.getAllowApiOverride())
|
||||
{
|
||||
this.configEntry.setApiValue(this.configConverter.convertToCoreType(newValue));
|
||||
return true;
|
||||
@@ -64,7 +64,7 @@ public class DhApiConfig<coreType, apiType> implements IDhApiConfig<apiType>
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getCanBeOverrodeByApi() { return this.configEntry.allowApiOverride; }
|
||||
public boolean getCanBeOverrodeByApi() { return this.configEntry.getAllowApiOverride(); }
|
||||
|
||||
public apiType getDefaultValue() { return this.configConverter.convertToApiType(configEntry.getDefaultValue()); }
|
||||
public apiType getMaxValue() { return this.configConverter.convertToApiType(this.configEntry.getMax()); }
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.seibel.lod.api.methods.events;
|
||||
|
||||
import com.seibel.lod.api.items.objects.DhApiResult;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
import com.seibel.lod.core.dependencyInjection.DhApiEventInjector;
|
||||
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
|
||||
|
||||
/**
|
||||
* Handles adding/removing event handlers.
|
||||
@@ -18,11 +17,11 @@ public class DhApiEventRegister
|
||||
* If multiple of the same eventHandler are added DhApiResult will return
|
||||
* the name of the already added handler and success = false.
|
||||
*/
|
||||
public static DhApiResult on(Class<? extends ICoreDhApiEvent> eventInterface, ICoreDhApiEvent eventHandlerImplementation)
|
||||
public static DhApiResult on(Class<? extends IDhApiEvent> eventInterface, IDhApiEvent eventHandlerImplementation)
|
||||
{
|
||||
try
|
||||
{
|
||||
DhApiEventInjector.INSTANCE.bind(eventInterface, eventHandlerImplementation);
|
||||
// DhApiEventInjector.INSTANCE.bind(eventInterface, eventHandlerImplementation);
|
||||
return DhApiResult.createSuccess();
|
||||
}
|
||||
catch (IllegalStateException e)
|
||||
@@ -36,16 +35,16 @@ public class DhApiEventRegister
|
||||
* If no eventHandler of the given class has been registered the result will return
|
||||
* success = false.
|
||||
*/
|
||||
public static DhApiResult off(Class<? extends ICoreDhApiEvent> eventInterface, Class<ICoreDhApiEvent> eventHandlerClass)
|
||||
public static DhApiResult off(Class<? extends IDhApiEvent> eventInterface, Class<IDhApiEvent> eventHandlerClass)
|
||||
{
|
||||
if (DhApiEventInjector.INSTANCE.unbind(eventInterface, eventHandlerClass))
|
||||
{
|
||||
return DhApiResult.createSuccess();
|
||||
}
|
||||
else
|
||||
{
|
||||
// if (DhApiEventInjector.INSTANCE.unbind(eventInterface, eventHandlerClass))
|
||||
// {
|
||||
// return DhApiResult.createSuccess();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
return DhApiResult.createFail("No event handler [" + eventHandlerClass.getSimpleName() + "] was bound for the event [" + eventInterface.getSimpleName() + "].");
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-3
@@ -1,15 +1,13 @@
|
||||
package com.seibel.lod.api.methods.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents.CoreDhApiAfterDhInitEvent;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public abstract class DhApiAfterDhInitEvent
|
||||
extends CoreDhApiAfterDhInitEvent
|
||||
implements IDhApiEvent<Void, Void>
|
||||
implements IDhApiEvent<Void>
|
||||
{
|
||||
/** Fired after Distant Horizons finishes its initial setup on Minecraft startup. */
|
||||
public abstract void afterDistantHorizonsInit();
|
||||
|
||||
+8
-6
@@ -2,15 +2,14 @@ package com.seibel.lod.api.methods.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
|
||||
import com.seibel.lod.api.methods.events.sharedParameterObjects.DhApiRenderParam;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents.CoreDhApiAfterRenderEvent;
|
||||
import com.seibel.lod.core.util.math.Mat4f;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public abstract class DhApiAfterRenderEvent
|
||||
extends CoreDhApiAfterRenderEvent
|
||||
implements IDhApiEvent<DhApiAfterRenderEvent.EventParam, CoreDhApiAfterRenderEvent.CoreEventParam>
|
||||
implements IDhApiEvent<DhApiAfterRenderEvent.EventParam>
|
||||
{
|
||||
/** Fired after Distant Horizons finishes rendering fake chunks. */
|
||||
public abstract void afterRender(EventParam input);
|
||||
@@ -21,9 +20,9 @@ public abstract class DhApiAfterRenderEvent
|
||||
//=========================//
|
||||
|
||||
@Override
|
||||
public final boolean fireEvent(CoreEventParam input)
|
||||
public final boolean fireEvent(EventParam input)
|
||||
{
|
||||
afterRender(new EventParam(input));
|
||||
afterRender(input);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -37,7 +36,10 @@ public abstract class DhApiAfterRenderEvent
|
||||
|
||||
public static class EventParam extends DhApiRenderParam
|
||||
{
|
||||
public EventParam(CoreEventParam dhApiRenderParam) { super(dhApiRenderParam); }
|
||||
public EventParam(DhApiRenderParam parent)
|
||||
{
|
||||
super(parent.mcProjectionMatrix, parent.mcModelViewMatrix, parent.dhProjectionMatrix, parent.dhModelViewMatrix, parent.partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+1
-3
@@ -3,15 +3,13 @@ package com.seibel.lod.api.methods.events.abstractEvents;
|
||||
|
||||
|
||||
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents.CoreDhApiBeforeDhInitEvent;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public abstract class DhApiBeforeDhInitEvent
|
||||
extends CoreDhApiBeforeDhInitEvent
|
||||
implements IDhApiEvent<Void, Void>
|
||||
implements IDhApiEvent<Void>
|
||||
{
|
||||
/** Fired before Distant Horizons starts its initial setup on Minecraft startup. */
|
||||
public abstract void beforeDistantHorizonsInit();
|
||||
|
||||
+7
-5
@@ -2,15 +2,14 @@ package com.seibel.lod.api.methods.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
|
||||
import com.seibel.lod.api.methods.events.sharedParameterObjects.DhApiRenderParam;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents.CoreDhApiBeforeRenderEvent;
|
||||
import com.seibel.lod.core.util.math.Mat4f;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public abstract class DhApiBeforeRenderEvent
|
||||
extends CoreDhApiBeforeRenderEvent
|
||||
implements IDhApiEvent<DhApiBeforeRenderEvent.EventParam, CoreDhApiBeforeRenderEvent.CoreEventParam>
|
||||
implements IDhApiEvent<DhApiBeforeRenderEvent.EventParam>
|
||||
{
|
||||
/**
|
||||
* Fired before Distant Horizons renders fake chunks.
|
||||
@@ -25,7 +24,7 @@ public abstract class DhApiBeforeRenderEvent
|
||||
//=========================//
|
||||
|
||||
@Override
|
||||
public final boolean fireEvent(CoreEventParam input) { return beforeRender(new EventParam(input)); }
|
||||
public final boolean fireEvent(EventParam input) { return beforeRender(input); }
|
||||
|
||||
@Override
|
||||
public final boolean getCancelable() { return true; }
|
||||
@@ -37,7 +36,10 @@ public abstract class DhApiBeforeRenderEvent
|
||||
|
||||
public static class EventParam extends DhApiRenderParam
|
||||
{
|
||||
public EventParam(CoreEventParam dhApiRenderParam) { super(dhApiRenderParam); }
|
||||
public EventParam(DhApiRenderParam parent)
|
||||
{
|
||||
super(parent.mcProjectionMatrix, parent.mcModelViewMatrix, parent.dhProjectionMatrix, parent.dhModelViewMatrix, parent.partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+4
-8
@@ -1,18 +1,14 @@
|
||||
package com.seibel.lod.api.methods.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper;
|
||||
import com.seibel.lod.api.items.objects.wrappers.DhApiLevelWrapper;
|
||||
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents.CoreDhApiLevelLoadEvent;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-10
|
||||
*/
|
||||
public abstract class DhApiLevelLoadEvent
|
||||
extends CoreDhApiLevelLoadEvent
|
||||
implements IDhApiEvent<DhApiLevelLoadEvent.EventParam, CoreDhApiLevelLoadEvent.CoreEventParam>
|
||||
implements IDhApiEvent<DhApiLevelLoadEvent.EventParam>
|
||||
{
|
||||
/** Fired after Distant Horizons loads a new level. */
|
||||
public abstract void onLevelLoad(EventParam input);
|
||||
@@ -23,9 +19,9 @@ public abstract class DhApiLevelLoadEvent
|
||||
//=========================//
|
||||
|
||||
@Override
|
||||
public final boolean fireEvent(CoreEventParam input)
|
||||
public final boolean fireEvent(EventParam input)
|
||||
{
|
||||
onLevelLoad(new EventParam(input.levelWrapper));
|
||||
onLevelLoad(input);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -43,7 +39,7 @@ public abstract class DhApiLevelLoadEvent
|
||||
public final IDhApiLevelWrapper levelWrapper;
|
||||
|
||||
|
||||
public EventParam(ILevelWrapper newLevelWrapper) { this.levelWrapper = new DhApiLevelWrapper(newLevelWrapper); }
|
||||
public EventParam(IDhApiLevelWrapper newLevelWrapper) { this.levelWrapper = newLevelWrapper; }
|
||||
}
|
||||
|
||||
}
|
||||
+4
-8
@@ -1,18 +1,14 @@
|
||||
package com.seibel.lod.api.methods.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper;
|
||||
import com.seibel.lod.api.items.objects.wrappers.DhApiLevelWrapper;
|
||||
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents.CoreDhApiLevelSaveEvent;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-10
|
||||
*/
|
||||
public abstract class DhApiLevelSaveEvent
|
||||
extends CoreDhApiLevelSaveEvent
|
||||
implements IDhApiEvent<DhApiLevelSaveEvent.EventParam, CoreDhApiLevelSaveEvent.CoreEventParam>
|
||||
implements IDhApiEvent<DhApiLevelSaveEvent.EventParam>
|
||||
{
|
||||
/** Fired after Distant Horizons saves LOD data for the server. */
|
||||
public abstract void onLevelSave(EventParam input);
|
||||
@@ -23,9 +19,9 @@ public abstract class DhApiLevelSaveEvent
|
||||
//=========================//
|
||||
|
||||
@Override
|
||||
public final boolean fireEvent(CoreDhApiLevelSaveEvent.CoreEventParam input)
|
||||
public final boolean fireEvent(EventParam input)
|
||||
{
|
||||
onLevelSave(new EventParam(input.levelWrapper));
|
||||
onLevelSave(input);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -43,7 +39,7 @@ public abstract class DhApiLevelSaveEvent
|
||||
public final IDhApiLevelWrapper levelWrapper;
|
||||
|
||||
|
||||
public EventParam(ILevelWrapper newLevelWrapper) { this.levelWrapper = new DhApiLevelWrapper(newLevelWrapper); }
|
||||
public EventParam(IDhApiLevelWrapper newLevelWrapper) { this.levelWrapper = newLevelWrapper; }
|
||||
}
|
||||
|
||||
}
|
||||
+5
-9
@@ -1,18 +1,14 @@
|
||||
package com.seibel.lod.api.methods.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper;
|
||||
import com.seibel.lod.api.items.objects.wrappers.DhApiLevelWrapper;
|
||||
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents.CoreDhApiLevelUnloadEvent;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-10
|
||||
*/
|
||||
public abstract class DhApiLevelUnloadEvent
|
||||
extends CoreDhApiLevelUnloadEvent
|
||||
implements IDhApiEvent<DhApiLevelUnloadEvent.EventParam, CoreDhApiLevelUnloadEvent.CoreEventParam>
|
||||
public abstract class DhApiLevelUnloadEvent
|
||||
implements IDhApiEvent<DhApiLevelUnloadEvent.EventParam>
|
||||
{
|
||||
/** Fired before Distant Horizons unloads a level. */
|
||||
public abstract void onLevelUnload(EventParam input);
|
||||
@@ -23,9 +19,9 @@ public abstract class DhApiLevelUnloadEvent
|
||||
//=========================//
|
||||
|
||||
@Override
|
||||
public final boolean fireEvent(CoreDhApiLevelUnloadEvent.CoreEventParam input)
|
||||
public final boolean fireEvent(EventParam input)
|
||||
{
|
||||
onLevelUnload(new EventParam(input.levelWrapper));
|
||||
onLevelUnload(input);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -43,7 +39,7 @@ public abstract class DhApiLevelUnloadEvent
|
||||
public final IDhApiLevelWrapper levelWrapper;
|
||||
|
||||
|
||||
public EventParam(ILevelWrapper newLevelWrapper) { this.levelWrapper = new DhApiLevelWrapper(newLevelWrapper); }
|
||||
public EventParam(IDhApiLevelWrapper newLevelWrapper) { this.levelWrapper = newLevelWrapper; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
package com.seibel.lod.api.methods.events.interfaces;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
import com.seibel.lod.core.dependencyInjection.IBindable;
|
||||
|
||||
/**
|
||||
* A combination of all interfaces required by all
|
||||
* DH Api events.
|
||||
*
|
||||
* @param <ApiInputType> This is the datatype that will be passed into the
|
||||
* event handler's method.
|
||||
* @param <CoreInputType> This is the datatype that will be passed in from Core
|
||||
* when the event is fired.
|
||||
* @param <T> This is the datatype that will be passed into the event handler's method.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public interface IDhApiEvent<ApiInputType, CoreInputType> extends ICoreDhApiEvent<CoreInputType>, IBindable
|
||||
public interface IDhApiEvent<T> extends IBindable
|
||||
{
|
||||
//==========//
|
||||
// external //
|
||||
//==========//
|
||||
|
||||
/**
|
||||
* Returns if the event should be automatically unbound
|
||||
* after firing. <br>
|
||||
@@ -24,7 +24,25 @@ public interface IDhApiEvent<ApiInputType, CoreInputType> extends ICoreDhApiEven
|
||||
*
|
||||
* Defaults to False (the event will not be removed after firing).
|
||||
*/
|
||||
@Override
|
||||
default boolean removeAfterFiring() { return false; };
|
||||
|
||||
|
||||
//==========//
|
||||
// internal //
|
||||
//==========//
|
||||
|
||||
/** Returns true if the event can be canceled. */
|
||||
boolean getCancelable();
|
||||
|
||||
/**
|
||||
* Called internally by Distant Horizons when the event happens.
|
||||
* This method shouldn't directly be overridden and
|
||||
* should call a more specific method instead.
|
||||
*
|
||||
* @param input the parameter object passed in from the event source. Can be null.
|
||||
* @return whether the event should be canceled or not.
|
||||
* A canceled event will still fire the other event handlers that are queued.
|
||||
*/
|
||||
boolean fireEvent(T input);
|
||||
|
||||
}
|
||||
|
||||
+14
-12
@@ -1,7 +1,6 @@
|
||||
package com.seibel.lod.api.methods.events.sharedParameterObjects;
|
||||
|
||||
import com.seibel.lod.api.items.objects.math.DhApiMat4f;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.sharedParameterObjects.CoreDhApiRenderParam;
|
||||
import com.seibel.lod.core.util.math.Mat4f;
|
||||
|
||||
/**
|
||||
* Parameter passed into Render events.
|
||||
@@ -12,29 +11,32 @@ import com.seibel.lod.core.api.external.coreImplementations.objects.events.share
|
||||
public class DhApiRenderParam
|
||||
{
|
||||
/** The projection matrix Minecraft is using to render this frame. */
|
||||
public final DhApiMat4f mcProjectionMatrix;
|
||||
public final Mat4f mcProjectionMatrix;
|
||||
/** The model view matrix Minecraft is using to render this frame. */
|
||||
public final DhApiMat4f mcModelViewMatrix;
|
||||
public final Mat4f mcModelViewMatrix;
|
||||
|
||||
/** The projection matrix Distant Horizons is using to render this frame. */
|
||||
public final DhApiMat4f dhProjectionMatrix;
|
||||
public final Mat4f dhProjectionMatrix;
|
||||
/** The model view matrix Distant Horizons is using to render this frame. */
|
||||
public final DhApiMat4f dhModelViewMatrix;
|
||||
public final Mat4f dhModelViewMatrix;
|
||||
|
||||
/** Indicates how far into this tick the frame is. */
|
||||
public final float partialTicks;
|
||||
|
||||
|
||||
|
||||
public DhApiRenderParam(CoreDhApiRenderParam param)
|
||||
public DhApiRenderParam(
|
||||
Mat4f newMcProjectionMatrix, Mat4f newMcModelViewMatrix,
|
||||
Mat4f newDhProjectionMatrix, Mat4f newDhModelViewMatrix,
|
||||
float newPartialTicks)
|
||||
{
|
||||
this.mcProjectionMatrix = new DhApiMat4f(param.mcProjectionMatrix);
|
||||
this.mcModelViewMatrix = new DhApiMat4f(param.mcModelViewMatrix);
|
||||
this.mcProjectionMatrix = newMcProjectionMatrix;
|
||||
this.mcModelViewMatrix = newMcModelViewMatrix;
|
||||
|
||||
this.dhProjectionMatrix = new DhApiMat4f(param.dhProjectionMatrix);
|
||||
this.dhModelViewMatrix = new DhApiMat4f(param.dhModelViewMatrix);
|
||||
this.dhProjectionMatrix = newDhProjectionMatrix;
|
||||
this.dhModelViewMatrix = newDhModelViewMatrix;
|
||||
|
||||
this.partialTicks = param.partialTicks;
|
||||
this.partialTicks = newPartialTicks;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+23
-25
@@ -2,8 +2,6 @@ package com.seibel.lod.api.override;
|
||||
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper;
|
||||
import com.seibel.lod.api.items.objects.DhApiResult;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.override.worldGenerator.ICoreDhApiWorldGenerator;
|
||||
import com.seibel.lod.core.dependencyInjection.WorldGeneratorInjector;
|
||||
|
||||
/**
|
||||
* Handles adding world generator overrides.
|
||||
@@ -21,18 +19,18 @@ public class DhApiWorldGeneratorOverrideRegister
|
||||
* 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(ICoreDhApiWorldGenerator worldGenerator)
|
||||
{
|
||||
try
|
||||
{
|
||||
WorldGeneratorInjector.INSTANCE.bind(worldGenerator);
|
||||
return DhApiResult.createSuccess();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return DhApiResult.createFail(e.getMessage());
|
||||
}
|
||||
}
|
||||
// public static DhApiResult registerWorldGeneratorOverride(ICoreDhApiWorldGenerator 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>
|
||||
@@ -41,18 +39,18 @@ public class DhApiWorldGeneratorOverrideRegister
|
||||
* 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, ICoreDhApiWorldGenerator worldGenerator)
|
||||
{
|
||||
try
|
||||
{
|
||||
// public static DhApiResult registerWorldGeneratorOverride(IDhApiLevelWrapper levelWrapper, ICoreDhApiWorldGenerator worldGenerator)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// WorldGeneratorInjector.INSTANCE.bind(levelWrapper, worldGenerator);
|
||||
return DhApiResult.createSuccess();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return DhApiResult.createFail(e.getMessage());
|
||||
}
|
||||
}
|
||||
// return DhApiResult.createSuccess();
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// return DhApiResult.createFail(e.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface IDependencyInjector<BindableType extends IBindable>
|
||||
{
|
||||
|
||||
/**
|
||||
* Links the given implementation object to an interface, so it can be referenced later.
|
||||
*
|
||||
* @param dependencyInterface The interface (or parent class) the implementation object should implement.
|
||||
* @param dependencyImplementation An object that implements the dependencyInterface interface.
|
||||
* @throws IllegalStateException if the interface has already been bound and duplicates aren't allowed
|
||||
* @throws IllegalArgumentException if the implementation object doesn't implement the interface
|
||||
*/
|
||||
void bind(Class<? extends BindableType> dependencyInterface, BindableType dependencyImplementation) throws IllegalStateException, IllegalArgumentException;
|
||||
/**
|
||||
* Checks if classToTest (or one of its ancestors)
|
||||
* implements the given interface.
|
||||
*/
|
||||
boolean checkIfClassImplements(Class<?> classToTest, Class<?> interfaceToLookFor);
|
||||
/** Checks if classToTest extends the given class. */
|
||||
boolean checkIfClassExtends(Class<?> classToTest, Class<?> extensionToLookFor);
|
||||
|
||||
|
||||
/**
|
||||
* This does not return incomplete dependencies. <Br>
|
||||
* See {@link #get(Class, boolean) get(Class, boolean)} for full documentation.
|
||||
*
|
||||
* @see #get(Class, boolean)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
<T extends BindableType> T get(Class<T> interfaceClass) throws ClassCastException;
|
||||
|
||||
/**
|
||||
* Returns all dependencies of type T that have been bound. <br>
|
||||
* Returns an empty list if no dependencies have been bound.
|
||||
*
|
||||
* @param <T> class of the dependency
|
||||
* (inferred from the objectClass parameter)
|
||||
* @param interfaceClass Interface of the dependency
|
||||
* @return the dependency of type T
|
||||
* @throws ClassCastException If the dependency isn't able to be cast to type T.
|
||||
* (this shouldn't normally happen, unless the bound object changed somehow)
|
||||
*/
|
||||
<T extends BindableType> ArrayList<T> getAll(Class<T> interfaceClass) throws ClassCastException;
|
||||
|
||||
/**
|
||||
* Returns a dependency of type T if one has been bound. <br>
|
||||
* Returns null if a dependency hasn't been bound. <br> <br>
|
||||
*
|
||||
* If the handler's {@link #allowDuplicateBindings} is true this returns the first bound dependency.
|
||||
*
|
||||
* @param <T> class of the dependency
|
||||
* (inferred from the interfaceClass parameter)
|
||||
* @param interfaceClass Interface of the dependency
|
||||
* @param allowIncompleteDependencies If true this method will also return dependencies that haven't completed their delayed setup.
|
||||
* @return the dependency of type T
|
||||
* @throws ClassCastException If the dependency isn't able to be cast to type T.
|
||||
* (this shouldn't normally happen, unless the bound object changed somehow)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
<T extends BindableType> T get(Class<T> interfaceClass, boolean allowIncompleteDependencies) throws ClassCastException;
|
||||
|
||||
|
||||
|
||||
/** Removes all bound dependencies. */
|
||||
public void clear();
|
||||
|
||||
|
||||
|
||||
/** Runs delayed setup for any dependencies that require it. */
|
||||
void runDelayedSetup();
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
|
||||
import com.seibel.lod.api.items.interfaces.override.IDhApiOverrideable;
|
||||
|
||||
public interface IOverrideInjector<BindableType extends IBindable>
|
||||
{
|
||||
/**
|
||||
* All core overrides should have this priority. <Br>
|
||||
* Should be lower than MIN_OVERRIDE_PRIORITY.
|
||||
*/
|
||||
public static final int CORE_PRIORITY = -1;
|
||||
/**
|
||||
* The lowest priority non-core overrides can have.
|
||||
* Should be higher than CORE_PRIORITY.
|
||||
*/
|
||||
public static final int MIN_NON_CORE_OVERRIDE_PRIORITY = 0;
|
||||
/** The priority given to overrides that don't explicitly define a priority. */
|
||||
public static final int DEFAULT_NON_CORE_OVERRIDE_PRIORITY = 10;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* See {@link IDependencyInjector#bind(Class, IBindable) bind(Class, IBindable)} for full documentation.
|
||||
*
|
||||
* @throws IllegalArgumentException if a non-Distant Horizons Override with the priority CORE is passed in or a invalid priority value.
|
||||
* @throws IllegalStateException if another override with the given priority already has been bound.
|
||||
* @see IDependencyInjector#bind(Class, IBindable)
|
||||
*/
|
||||
void bind(Class<? extends IDhApiOverrideable> dependencyInterface, IDhApiOverrideable dependencyImplementation) throws IllegalStateException, IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Returns the bound dependency with the highest priority. <br>
|
||||
* See {@link IDependencyInjector#get(Class, boolean) get(Class, boolean)} for full documentation.
|
||||
*
|
||||
* @see IDependencyInjector#get(Class, boolean)
|
||||
*/
|
||||
<T extends IDhApiOverrideable> T get(Class<T> interfaceClass) throws ClassCastException;
|
||||
|
||||
/**
|
||||
* Returns a dependency of type T with the specified priority if one has been bound. <br>
|
||||
* If there is a dependency, but it was bound with a different priority this will return null. <br> <br>
|
||||
*
|
||||
* See {@link IDependencyInjector#get(Class, boolean) get(Class, boolean)} for more documentation.
|
||||
*
|
||||
* @see IDependencyInjector#get(Class, boolean)
|
||||
*/
|
||||
<T extends IDhApiOverrideable> T get(Class<T> interfaceClass, int priority) throws ClassCastException;
|
||||
|
||||
|
||||
|
||||
/** Removes all bound overrides. */
|
||||
void clear();
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.seibel.lod.core.interfaces.config;
|
||||
|
||||
|
||||
/**
|
||||
* Use for making the config variables
|
||||
*
|
||||
* @author coolGi
|
||||
* @version 2022-5-26
|
||||
*/
|
||||
public interface IConfigEntry<T>
|
||||
{
|
||||
|
||||
/** Gets the default value of the option */
|
||||
T getDefaultValue();
|
||||
|
||||
void setApiValue(T newApiValue);
|
||||
T getApiValue();
|
||||
|
||||
/** Returns true if this config can be set via the API. */
|
||||
boolean getAllowApiOverride();
|
||||
|
||||
void set(T newValue);
|
||||
T get();
|
||||
T getTrueValue();
|
||||
|
||||
/** Sets the value without saving */
|
||||
void setWithoutSaving(T newValue);
|
||||
|
||||
/** Gets the min value */
|
||||
T getMin();
|
||||
/** Sets the min value */
|
||||
void setMin(T newMin);
|
||||
/** Gets the max value */
|
||||
T getMax();
|
||||
/** Sets the max value */
|
||||
void setMax(T newMax);
|
||||
/** Sets the min and max in 1 setter */
|
||||
void setMinMax(T newMin, T newMax);
|
||||
|
||||
/** Gets the comment */
|
||||
String getComment();
|
||||
/** Sets the comment */
|
||||
void setComment(String newComment);
|
||||
|
||||
/**
|
||||
* Checks if the option is valid
|
||||
*
|
||||
* 0 == valid
|
||||
* 1 == number too high
|
||||
* -1 == number too low
|
||||
*/
|
||||
byte isValid();
|
||||
/** Checks if a value is valid */
|
||||
byte isValid(T value);
|
||||
|
||||
/** Is the value of this equal to another */
|
||||
boolean equals(IConfigEntry<?> obj);
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.interfaces.config;
|
||||
package com.seibel.lod.core.interfaces.config;
|
||||
|
||||
|
||||
/**
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.objects.converters;
|
||||
package com.seibel.lod.core.interfaces.config.converters;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.config.IConverter;
|
||||
import com.seibel.lod.core.interfaces.config.IConverter;
|
||||
|
||||
|
||||
/**
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.objects.converters;
|
||||
package com.seibel.lod.core.interfaces.config.converters;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.config.IConverter;
|
||||
import com.seibel.lod.core.enums.rendering.ERendererMode;
|
||||
import com.seibel.lod.api.items.enums.rendering.ERendererMode;
|
||||
import com.seibel.lod.core.interfaces.config.IConverter;
|
||||
|
||||
/**
|
||||
* Used for simplifying the fake chunk rendering on/off setting.
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.seibel.lod.core.util;
|
||||
|
||||
public class MathUtil
|
||||
{
|
||||
/**
|
||||
* Clamps the given value between the min and max values.
|
||||
* May behave strangely if min > max.
|
||||
*/
|
||||
public static int clamp(int min, int value, int max)
|
||||
{
|
||||
return Math.min(max, Math.max(value, min));
|
||||
}
|
||||
|
||||
/**
|
||||
* Clamps the given value between the min and max values.
|
||||
* May behave strangely if min > max.
|
||||
*/
|
||||
public static float clamp(float min, float value, float max)
|
||||
{
|
||||
return Math.min(max, Math.max(value, min));
|
||||
}
|
||||
|
||||
/**
|
||||
* Clamps the given value between the min and max values.
|
||||
* May behave strangely if min > max.
|
||||
*/
|
||||
public static double clamp(double min, double value, double max)
|
||||
{
|
||||
return Math.min(max, Math.max(value, min));
|
||||
}
|
||||
|
||||
/**
|
||||
* Like Math.floorDiv, but reverse in that it is a ceilDiv
|
||||
*/
|
||||
public static int ceilDiv(int value, int divider) {
|
||||
return -Math.floorDiv(-value, divider);
|
||||
}
|
||||
|
||||
// Why is this not in the standard library?! Come on Java!
|
||||
public static byte min(byte a, byte b) {
|
||||
return a < b ? a : b;
|
||||
}
|
||||
public static byte max(byte a, byte b) {
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
|
||||
/** This is copied from Minecraft's MathHelper class */
|
||||
public static float fastInvSqrt(float numb)
|
||||
{
|
||||
float half = 0.5F * numb;
|
||||
int i = Float.floatToIntBits(numb);
|
||||
i = 1597463007 - (i >> 1);
|
||||
numb = Float.intBitsToFloat(i);
|
||||
return numb * (1.5F - half * numb * numb);
|
||||
}
|
||||
public static float pow2(float x) {return x*x;}
|
||||
public static double pow2(double x) {return x*x;}
|
||||
public static int pow2(int x) {return x*x;}
|
||||
|
||||
public static long pow2(long x) {return x*x;}
|
||||
|
||||
|
||||
}
|
||||
+4
-4
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.lod.core.util.math;
|
||||
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.util.MathUtil;
|
||||
|
||||
/**
|
||||
* This is closer to MC's implementation of a
|
||||
@@ -116,9 +116,9 @@ public class Vec3d
|
||||
|
||||
public void clamp(double min, double max)
|
||||
{
|
||||
this.x = LodUtil.clamp(min, this.x, max);
|
||||
this.y = LodUtil.clamp(min, this.y, max);
|
||||
this.z = LodUtil.clamp(min, this.z, max);
|
||||
this.x = MathUtil.clamp(min, this.x, max);
|
||||
this.y = MathUtil.clamp(min, this.y, max);
|
||||
this.z = MathUtil.clamp(min, this.z, max);
|
||||
}
|
||||
|
||||
public void set(double x, double y, double z)
|
||||
+5
-5
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.lod.core.util.math;
|
||||
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.util.MathUtil;
|
||||
|
||||
/**
|
||||
* A (almost) exact copy of Minecraft's 1.16.5
|
||||
@@ -109,9 +109,9 @@ public class Vec3f
|
||||
|
||||
public void clamp(float min, float max)
|
||||
{
|
||||
this.x = LodUtil.clamp(min, this.x, max);
|
||||
this.y = LodUtil.clamp(min, this.y, max);
|
||||
this.z = LodUtil.clamp(min, this.z, max);
|
||||
this.x = MathUtil.clamp(min, this.x, max);
|
||||
this.y = MathUtil.clamp(min, this.y, max);
|
||||
this.z = MathUtil.clamp(min, this.z, max);
|
||||
}
|
||||
|
||||
public void set(float x, float y, float z)
|
||||
@@ -156,7 +156,7 @@ public class Vec3f
|
||||
}
|
||||
else
|
||||
{
|
||||
float f1 = LodUtil.fastInvSqrt(squaredSum);
|
||||
float f1 = MathUtil.fastInvSqrt(squaredSum);
|
||||
this.x *= f1;
|
||||
this.y *= f1;
|
||||
this.z *= f1;
|
||||
+4
-4
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.lod.core.util.math;
|
||||
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.util.MathUtil;
|
||||
|
||||
/**
|
||||
* A (almost) exact copy of Minecraft's 1.16.5
|
||||
@@ -109,9 +109,9 @@ public class Vec3i
|
||||
|
||||
public void clamp(int min, int max)
|
||||
{
|
||||
this.x = LodUtil.clamp(min, this.x, max);
|
||||
this.y = LodUtil.clamp(min, this.y, max);
|
||||
this.z = LodUtil.clamp(min, this.z, max);
|
||||
this.x = MathUtil.clamp(min, this.x, max);
|
||||
this.y = MathUtil.clamp(min, this.y, max);
|
||||
this.z = MathUtil.clamp(min, this.z, max);
|
||||
}
|
||||
|
||||
public void set(int x, int y, int z)
|
||||
@@ -1,12 +1,6 @@
|
||||
package testItems.events.abstractObjects;
|
||||
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper;
|
||||
import com.seibel.lod.api.items.objects.wrappers.DhApiLevelWrapper;
|
||||
import com.seibel.lod.api.methods.events.abstractEvents.DhApiLevelLoadEvent;
|
||||
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents.CoreDhApiLevelLoadEvent;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents.CoreDhApiTestEvent;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
|
||||
/**
|
||||
* A dummy event implementation used for unit testing.
|
||||
@@ -15,12 +9,15 @@ import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
* @version 2022-9-11
|
||||
*/
|
||||
public abstract class DhApiTestEvent
|
||||
extends CoreDhApiTestEvent
|
||||
implements IDhApiEvent<Boolean, Boolean>
|
||||
implements IDhApiEvent<Boolean>
|
||||
{
|
||||
|
||||
public abstract void onTestEvent(Boolean input);
|
||||
|
||||
/** just used for testing */
|
||||
public abstract boolean getTestValue();
|
||||
|
||||
|
||||
|
||||
//=========================//
|
||||
// internal DH API methods //
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* 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 tests;
|
||||
|
||||
import com.seibel.lod.api.enums.DhApiEnumAssembly;
|
||||
import com.seibel.lod.core.enums.rendering.EFogDrawMode;
|
||||
import com.seibel.lod.core.enums.CoreEnumAssembly;
|
||||
import com.seibel.lod.core.enums.config.EVerticalQuality;
|
||||
import com.seibel.lod.core.util.EnumUtil;
|
||||
import org.junit.Test;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* These tests were primary created to confirm that the
|
||||
* API enums are properly synced with their Core variants.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-6-9
|
||||
*/
|
||||
public class ApiEnumSyncTests
|
||||
{
|
||||
|
||||
/** Make sure each DhApi enum has the same values as its corresponding core enum. */
|
||||
// @Test
|
||||
public void ConfirmEnumsAreSynced()
|
||||
{
|
||||
//=================//
|
||||
// test validation //
|
||||
//=================//
|
||||
|
||||
// this should always succeed (comparing an enum to itself)
|
||||
AssertEnumsValuesAreEqual(EnumUtil.compareEnumClassesByValues(EVerticalQuality.class, EVerticalQuality.class), true);
|
||||
// this should always fail (two completely different enums)
|
||||
AssertEnumsValuesAreEqual(EnumUtil.compareEnumClassesByValues(EVerticalQuality.class, EFogDrawMode.class), false);
|
||||
|
||||
|
||||
|
||||
|
||||
//================//
|
||||
// Api enum Setup //
|
||||
//================//
|
||||
|
||||
// make sure the enum packages are loaded
|
||||
new DhApiEnumAssembly();
|
||||
new CoreEnumAssembly();
|
||||
|
||||
// get the list of API enums
|
||||
ArrayList<Class<? extends Enum<?>>> apiEnumClassList = new ArrayList<>();
|
||||
ArrayList<String> apiConfigEnumPackageNames = EnumTestHelper.findPackageNamesStartingWith(DhApiEnumAssembly.class.getPackage().getName());
|
||||
for (String apiEnumPackageName : apiConfigEnumPackageNames)
|
||||
{
|
||||
apiEnumClassList.addAll(EnumTestHelper.getAllEnumsFromPackage(apiEnumPackageName));
|
||||
}
|
||||
|
||||
|
||||
// get the list of core enums
|
||||
ArrayList<Class<? extends Enum<?>>> coreEnumClassList = new ArrayList<>();
|
||||
ArrayList<String> coreEnumPackageNames = EnumTestHelper.findPackageNamesStartingWith(CoreEnumAssembly.class.getPackage().getName());
|
||||
for (String coreEnumPackageName : coreEnumPackageNames)
|
||||
{
|
||||
coreEnumClassList.addAll(EnumTestHelper.getAllEnumsFromPackage(coreEnumPackageName));
|
||||
}
|
||||
|
||||
|
||||
//======================//
|
||||
// Api enum comparisons //
|
||||
//======================//
|
||||
|
||||
// compare each API enum to its corresponding Core enum
|
||||
for (Class<? extends Enum<?>> apiEnumClass : apiEnumClassList)
|
||||
{
|
||||
String coreEnumName = CoreEnumAssembly.ENUM_PREFIX + apiEnumClass.getSimpleName().substring(DhApiEnumAssembly.API_ENUM_PREFIX.length());
|
||||
boolean coreEnumFound = false;
|
||||
|
||||
// find the core enum to compare against
|
||||
for (Class<? extends Enum<?>> coreEnumClass : coreEnumClassList)
|
||||
{
|
||||
if (coreEnumClass.getSimpleName().equals(coreEnumName))
|
||||
{
|
||||
AssertEnumsValuesAreEqual(EnumUtil.compareEnumClassesByValues(coreEnumClass, apiEnumClass), true);
|
||||
coreEnumFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!coreEnumFound)
|
||||
{
|
||||
Assert.fail("API enum [" + coreEnumName + "] not found in Core.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Helper method to make enum comparisons a little cleaner */
|
||||
private void AssertEnumsValuesAreEqual(EnumUtil.EnumComparisonResult comparisonResult, boolean assertEqual)
|
||||
{
|
||||
if (assertEqual)
|
||||
{
|
||||
Assert.assertTrue(comparisonResult.failMessage, comparisonResult.success);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.assertFalse(comparisonResult.failMessage, comparisonResult.success);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
package tests;/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarInputStream;
|
||||
|
||||
/**
|
||||
* A list of methods related to the Enum unit tests.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-9-5
|
||||
*/
|
||||
public class EnumTestHelper
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns a list of every Enum in the package with the given full name.
|
||||
*
|
||||
* @param packageFullName includes the package path
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static ArrayList<Class<? extends Enum<?>>> getAllEnumsFromPackage(String packageFullName)
|
||||
{
|
||||
ArrayList<Class<? extends Enum<?>>> enumList = new ArrayList<>();
|
||||
List<Class<?>> classesInPackage = getClassesInPackage(packageFullName, true, "DistantHorizons");
|
||||
|
||||
// get the enums from each file
|
||||
Assert.assertTrue("No files found in the package [" + packageFullName + "].", classesInPackage.size() != 0);
|
||||
for (Class<?> clazz : classesInPackage)
|
||||
{
|
||||
// ignore internal classes
|
||||
if (!clazz.getName().contains("$"))
|
||||
{
|
||||
// attempt to parse the file's class into an enum
|
||||
if (Enum.class.isAssignableFrom(clazz))
|
||||
{
|
||||
enumList.add((Class<? extends Enum<?>>) clazz);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("The Class [" + clazz + "] isn't an enum.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return enumList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns every class in the given package. <br><br>
|
||||
*
|
||||
* Originally from:
|
||||
* https://stackoverflow.com/questions/28678026/how-can-i-get-all-class-files-in-a-specific-package-in-java
|
||||
*
|
||||
* @param packageName
|
||||
* @param onlySearchJars if true only jar files will be searched, otherwise jars and loose files will be searched
|
||||
* @param expectedJarPathString Only search jars that contain this string
|
||||
*/
|
||||
public static List<Class<?>> getClassesInPackage(String packageName, boolean onlySearchJars, String expectedJarPathString)
|
||||
{
|
||||
String path = packageName.replace('.', '/');
|
||||
List<Class<?>> classes = new ArrayList<>();
|
||||
String[] classPathEntries = System.getProperty("java.class.path").split(
|
||||
System.getProperty("path.separator")
|
||||
);
|
||||
|
||||
String name;
|
||||
for (String classpathEntry : classPathEntries)
|
||||
{
|
||||
if (classpathEntry.endsWith(".jar") && classpathEntry.toLowerCase().contains(expectedJarPathString.toLowerCase()))
|
||||
{
|
||||
File jar = new File(classpathEntry);
|
||||
try
|
||||
{
|
||||
JarInputStream is = new JarInputStream(new FileInputStream(jar));
|
||||
JarEntry entry;
|
||||
while ((entry = is.getNextJarEntry()) != null)
|
||||
{
|
||||
name = entry.getName();
|
||||
if (name.endsWith(".class"))
|
||||
{
|
||||
if (name.contains(path) && name.endsWith(".class"))
|
||||
{
|
||||
try
|
||||
{
|
||||
String classPath = name.substring(0, entry.getName().length() - 6);
|
||||
classPath = classPath.replaceAll("[\\|/]", ".");
|
||||
classes.add(Class.forName(classPath));
|
||||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
// the class wasn't found
|
||||
System.err.println("The Class [" + packageName + "." + name + "] failed to load.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
System.err.println("Error reading the jar [" + jar.getPath() + "].");
|
||||
}
|
||||
}
|
||||
else if (!onlySearchJars)
|
||||
{
|
||||
File base = new File(classpathEntry + File.separatorChar + path);
|
||||
File[] files = base.listFiles();
|
||||
if (files != null)
|
||||
{
|
||||
for (File file : files)
|
||||
{
|
||||
try
|
||||
{
|
||||
name = file.getName();
|
||||
if (name.endsWith(".class"))
|
||||
{
|
||||
name = name.substring(0, name.length() - 6);
|
||||
classes.add(Class.forName(packageName + "." + name));
|
||||
}
|
||||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
// the class wasn't found
|
||||
System.err.println("The Class [" + packageName + "." + file.getName() + "] failed to load.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return classes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns every loaded package that begins with the given string. <br>
|
||||
*
|
||||
* Note: this will only search packages that have been loaded
|
||||
* at some point during the JVM's lifetime.
|
||||
* To Make sure the package(s) you want to find are loaded you can
|
||||
* initialize an object from that package to load it.
|
||||
*/
|
||||
public static ArrayList<String> findPackageNamesStartingWith(String packagePrefix)
|
||||
{
|
||||
ArrayList<String> nestedPackages = new ArrayList<>();
|
||||
|
||||
// search all the loaded packages
|
||||
Package[] packageArray = Package.getPackages();
|
||||
for (Package pack : packageArray)
|
||||
{
|
||||
String packageName = pack.getName();
|
||||
if (packageName.startsWith(packagePrefix))
|
||||
{
|
||||
nestedPackages.add(packageName);
|
||||
}
|
||||
}
|
||||
|
||||
return nestedPackages;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package tests;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents.CoreDhApiTestEvent;
|
||||
import com.seibel.lod.core.dependencyInjection.DhApiEventInjector;
|
||||
import org.junit.Assert;
|
||||
import testItems.events.abstractObjects.DhApiTestEvent;
|
||||
import testItems.events.objects.DhTestEvent;
|
||||
@@ -17,66 +15,66 @@ import java.util.ArrayList;
|
||||
public class EventInjectorTest
|
||||
{
|
||||
|
||||
//@Test
|
||||
public void testEventDependencies() // this also tests list dependencies since there can be more than one event handler bound per event
|
||||
{
|
||||
// Injector setup
|
||||
DhApiEventInjector TEST_EVENT_HANDLER = new DhApiEventInjector();
|
||||
|
||||
|
||||
// pre-dependency setup
|
||||
Assert.assertNull("Nothing should have been bound.", TEST_EVENT_HANDLER.get(DhApiTestEvent.class));
|
||||
|
||||
|
||||
// dependency setup
|
||||
TEST_EVENT_HANDLER.bind(DhApiTestEvent.class, new DhTestEvent());
|
||||
TEST_EVENT_HANDLER.bind(DhApiTestEvent.class, new DhTestEventAlt());
|
||||
TEST_EVENT_HANDLER.runDelayedSetup();
|
||||
|
||||
|
||||
// get first
|
||||
CoreDhApiTestEvent afterRenderEvent = TEST_EVENT_HANDLER.get(CoreDhApiTestEvent.class);
|
||||
Assert.assertNotNull("Event not bound.", afterRenderEvent);
|
||||
|
||||
|
||||
// get list
|
||||
ArrayList<CoreDhApiTestEvent> afterRenderEventList = TEST_EVENT_HANDLER.getAll(CoreDhApiTestEvent.class);
|
||||
Assert.assertEquals("Bound list doesn't contain the correct number of items.", 2, afterRenderEventList.size());
|
||||
// object one
|
||||
Assert.assertNotNull("Event not bound.", afterRenderEventList.get(0));
|
||||
Assert.assertEquals("First event object setup incorrectly.", null, afterRenderEventList.get(0).getTestValue());
|
||||
// object two
|
||||
Assert.assertNotNull("Event not bound.", afterRenderEventList.get(1));
|
||||
Assert.assertEquals("First event object setup incorrectly.", null, afterRenderEventList.get(1).getTestValue());
|
||||
|
||||
|
||||
// event firing
|
||||
Assert.assertEquals("fireAllEvents canceled returned canceled incorrectly.", true, TEST_EVENT_HANDLER.fireAllEvents(CoreDhApiTestEvent.class, true));
|
||||
// object one
|
||||
Assert.assertEquals("Event not fired for first object.", true, afterRenderEventList.get(0).getTestValue());
|
||||
// object two
|
||||
Assert.assertEquals("Event not fired for second object.", true, afterRenderEventList.get(1).getTestValue());
|
||||
|
||||
|
||||
// unbind
|
||||
CoreDhApiTestEvent unboundEvent = afterRenderEventList.get(0);
|
||||
Assert.assertTrue("Unbind should've removed item.", TEST_EVENT_HANDLER.unbind(CoreDhApiTestEvent.class, DhTestEvent.class));
|
||||
Assert.assertFalse("Unbind should've already removed item.", TEST_EVENT_HANDLER.unbind(CoreDhApiTestEvent.class, DhTestEvent.class));
|
||||
|
||||
// check unbinding
|
||||
afterRenderEventList = TEST_EVENT_HANDLER.getAll(CoreDhApiTestEvent.class);
|
||||
Assert.assertEquals("Unbound list doesn't contain the correct number of items.", 1, afterRenderEventList.size());
|
||||
Assert.assertNotNull("Unbinding removed all items.", afterRenderEventList.get(0));
|
||||
|
||||
|
||||
// check unbound event firing
|
||||
Assert.assertEquals("fireAllEvents canceled returned canceled incorrectly.", false, TEST_EVENT_HANDLER.fireAllEvents(CoreDhApiTestEvent.class, false));
|
||||
// remaining event
|
||||
Assert.assertEquals("Event not fired for remaining object.", false, ((DhTestEventAlt) afterRenderEventList.get(0)).eventFiredValue);
|
||||
// unbound event
|
||||
Assert.assertEquals("Event fired for unbound object.", true, unboundEvent.getTestValue());
|
||||
|
||||
}
|
||||
// //@Test
|
||||
// public void testEventDependencies() // this also tests list dependencies since there can be more than one event handler bound per event
|
||||
// {
|
||||
// // Injector setup
|
||||
// DhApiEventInjector TEST_EVENT_HANDLER = new DhApiEventInjector();
|
||||
//
|
||||
//
|
||||
// // pre-dependency setup
|
||||
// Assert.assertNull("Nothing should have been bound.", TEST_EVENT_HANDLER.get(DhApiTestEvent.class));
|
||||
//
|
||||
//
|
||||
// // dependency setup
|
||||
// TEST_EVENT_HANDLER.bind(DhApiTestEvent.class, new DhTestEvent());
|
||||
// TEST_EVENT_HANDLER.bind(DhApiTestEvent.class, new DhTestEventAlt());
|
||||
// TEST_EVENT_HANDLER.runDelayedSetup();
|
||||
//
|
||||
//
|
||||
// // get first
|
||||
// CoreDhApiTestEvent afterRenderEvent = TEST_EVENT_HANDLER.get(CoreDhApiTestEvent.class);
|
||||
// Assert.assertNotNull("Event not bound.", afterRenderEvent);
|
||||
//
|
||||
//
|
||||
// // get list
|
||||
// ArrayList<CoreDhApiTestEvent> afterRenderEventList = TEST_EVENT_HANDLER.getAll(CoreDhApiTestEvent.class);
|
||||
// Assert.assertEquals("Bound list doesn't contain the correct number of items.", 2, afterRenderEventList.size());
|
||||
// // object one
|
||||
// Assert.assertNotNull("Event not bound.", afterRenderEventList.get(0));
|
||||
// Assert.assertEquals("First event object setup incorrectly.", null, afterRenderEventList.get(0).getTestValue());
|
||||
// // object two
|
||||
// Assert.assertNotNull("Event not bound.", afterRenderEventList.get(1));
|
||||
// Assert.assertEquals("First event object setup incorrectly.", null, afterRenderEventList.get(1).getTestValue());
|
||||
//
|
||||
//
|
||||
// // event firing
|
||||
// Assert.assertEquals("fireAllEvents canceled returned canceled incorrectly.", true, TEST_EVENT_HANDLER.fireAllEvents(CoreDhApiTestEvent.class, true));
|
||||
// // object one
|
||||
// Assert.assertEquals("Event not fired for first object.", true, afterRenderEventList.get(0).getTestValue());
|
||||
// // object two
|
||||
// Assert.assertEquals("Event not fired for second object.", true, afterRenderEventList.get(1).getTestValue());
|
||||
//
|
||||
//
|
||||
// // unbind
|
||||
// CoreDhApiTestEvent unboundEvent = afterRenderEventList.get(0);
|
||||
// Assert.assertTrue("Unbind should've removed item.", TEST_EVENT_HANDLER.unbind(CoreDhApiTestEvent.class, DhTestEvent.class));
|
||||
// Assert.assertFalse("Unbind should've already removed item.", TEST_EVENT_HANDLER.unbind(CoreDhApiTestEvent.class, DhTestEvent.class));
|
||||
//
|
||||
// // check unbinding
|
||||
// afterRenderEventList = TEST_EVENT_HANDLER.getAll(CoreDhApiTestEvent.class);
|
||||
// Assert.assertEquals("Unbound list doesn't contain the correct number of items.", 1, afterRenderEventList.size());
|
||||
// Assert.assertNotNull("Unbinding removed all items.", afterRenderEventList.get(0));
|
||||
//
|
||||
//
|
||||
// // check unbound event firing
|
||||
// Assert.assertEquals("fireAllEvents canceled returned canceled incorrectly.", false, TEST_EVENT_HANDLER.fireAllEvents(CoreDhApiTestEvent.class, false));
|
||||
// // remaining event
|
||||
// Assert.assertEquals("Event not fired for remaining object.", false, ((DhTestEventAlt) afterRenderEventList.get(0)).eventFiredValue);
|
||||
// // unbound event
|
||||
// Assert.assertEquals("Event fired for unbound object.", true, unboundEvent.getTestValue());
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.interfaces.events;
|
||||
|
||||
import com.seibel.lod.core.dependencyInjection.IBindable;
|
||||
|
||||
/**
|
||||
* A combination of all interfaces required by all
|
||||
* DH Api events.
|
||||
*
|
||||
* @param <CoreInputType> This is the datatype that will be passed in from Core
|
||||
* when the event is fired.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public interface ICoreDhApiEvent<CoreInputType> extends IBindable
|
||||
{
|
||||
//==========//
|
||||
// internal //
|
||||
//==========//
|
||||
|
||||
/** Returns true if the event can be canceled. */
|
||||
boolean getCancelable();
|
||||
|
||||
/**
|
||||
* Called internally by Distant Horizons when the event happens.
|
||||
* This method shouldn't directly be overridden and
|
||||
* should call a more specific method instead.
|
||||
*
|
||||
* @param input the parameter object passed in from the event source. Can be null.
|
||||
* @return whether the event should be canceled or not.
|
||||
* A canceled event will still fire the other event handlers that are queued.
|
||||
*/
|
||||
boolean fireEvent(CoreInputType input);
|
||||
|
||||
|
||||
|
||||
//==========//
|
||||
// external //
|
||||
//==========//
|
||||
|
||||
/**
|
||||
* Returns if the event should be automatically unbound
|
||||
* after firing. <br>
|
||||
* Can be useful for one time setup events or waiting for a specific game state. <br> <Br>
|
||||
*
|
||||
* Defaults to False (the event will not be removed after firing).
|
||||
*/
|
||||
boolean removeAfterFiring();
|
||||
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.interfaces.override;
|
||||
|
||||
import com.seibel.lod.core.dependencyInjection.IBindable;
|
||||
import com.seibel.lod.core.dependencyInjection.OverrideInjector;
|
||||
|
||||
/**
|
||||
* Implemented by all DhApi objects that can be overridden.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-9-5
|
||||
*/
|
||||
public interface ICoreDhApiOverrideable extends IBindable
|
||||
{
|
||||
/**
|
||||
* Returns when this Override should be used. <br>
|
||||
* For most developers this can be left at the default.
|
||||
*/
|
||||
default int getPriority() { return OverrideInjector.DEFAULT_NON_CORE_OVERRIDE_PRIORITY; }
|
||||
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.interfaces.override.worldGenerator;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.override.ICoreDhApiOverrideable;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.world.ICoreDhApiLevelWrapper;
|
||||
import com.seibel.lod.core.enums.worldGeneration.EWorldGenThreadMode;
|
||||
import com.seibel.lod.core.enums.worldGeneration.EWorldGenerationStep;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-8
|
||||
*/
|
||||
public interface ICoreDhApiWorldGenerator extends ICoreDhApiOverrideable
|
||||
{
|
||||
/** Returns which thread chunk generation requests can be created on. */
|
||||
EWorldGenThreadMode getCoreThreadingMode();
|
||||
|
||||
IChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, ICoreDhApiLevelWrapper serverLevelWrapper, EWorldGenerationStep maxStepToGenerate);
|
||||
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers;
|
||||
|
||||
/**
|
||||
* 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 ICoreDhApiUnsafeWrapper
|
||||
{
|
||||
/**
|
||||
* Returns 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();
|
||||
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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.coreImplementations.interfaces.wrappers.world;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-7-14
|
||||
*/
|
||||
public interface ICoreDhApiDimensionTypeWrapper
|
||||
{
|
||||
String getDimensionName();
|
||||
|
||||
boolean hasCeiling();
|
||||
|
||||
boolean hasSkyLight();
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 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.coreImplementations.interfaces.wrappers.world;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.ICoreDhApiUnsafeWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
|
||||
/**
|
||||
* Can be either a Server or Client level.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-9-10
|
||||
*/
|
||||
public interface ICoreDhApiLevelWrapper extends ICoreDhApiUnsafeWrapper
|
||||
{
|
||||
boolean hasCeiling();
|
||||
|
||||
boolean hasSkyLight();
|
||||
|
||||
int getHeight();
|
||||
|
||||
default int getMinHeight() { return 0; }
|
||||
|
||||
}
|
||||
+11
-15
@@ -17,13 +17,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.api.methods.config.both;
|
||||
package com.seibel.lod.core.api.external.coreImplementations.methods.config.both;
|
||||
|
||||
import com.seibel.lod.api.items.enums.config.EDhApiDistanceGenerationMode;
|
||||
import com.seibel.lod.api.items.enums.config.EDhApiBlocksToAvoid;
|
||||
import com.seibel.lod.api.items.enums.config.EDhApiLightGenerationMode;
|
||||
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.converters.GenericEnumConverter;
|
||||
import com.seibel.lod.api.methods.config.DhApiConfig;
|
||||
import com.seibel.lod.core.config.Config.Client.WorldGenerator;
|
||||
import com.seibel.lod.core.enums.config.EBlocksToAvoid;
|
||||
@@ -47,19 +43,19 @@ public class DhApiWorldGeneration
|
||||
* outside Minecraft's vanilla render distance.
|
||||
*/
|
||||
public static IDhApiConfig<Boolean> getEnableDistantWorldGenerationConfig()
|
||||
{ return new DhApiConfig<Boolean, Boolean>(WorldGenerator.enableDistantGeneration); }
|
||||
{ return new DhApiConfig<>(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)); }
|
||||
public static IDhApiConfig<EDistanceGenerationMode> getDistantGeneratorDetailLevelConfig()
|
||||
{ return new DhApiConfig<>(WorldGenerator.distanceGenerationMode); }
|
||||
|
||||
/** 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)); }
|
||||
public static IDhApiConfig<ELightGenerationMode> getLightingModeConfig()
|
||||
{ return new DhApiConfig<>(WorldGenerator.lightGenerationMode); }
|
||||
|
||||
/** 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)); }
|
||||
public static IDhApiConfig<EGenerationPriority> getGenerationPriorityConfig()
|
||||
{ return new DhApiConfig<>(WorldGenerator.generationPriority); }
|
||||
|
||||
/**
|
||||
* Defines what blocks will be ignored when generating LODs.
|
||||
@@ -69,8 +65,8 @@ public class DhApiWorldGeneration
|
||||
* (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)); }
|
||||
public static IDhApiConfig<EBlocksToAvoid> getBlocksToAvoidConfig()
|
||||
{ return new DhApiConfig<>(WorldGenerator.blocksToAvoid); }
|
||||
|
||||
/**
|
||||
* Defines if the color of avoided blocks will color the block below them. <Br>
|
||||
@@ -82,7 +78,7 @@ public class DhApiWorldGeneration
|
||||
*/
|
||||
@Deprecated
|
||||
public static IDhApiConfig<Boolean> getTintWithAvoidedBlocksConfig()
|
||||
{ return new DhApiConfig<Boolean, Boolean>(WorldGenerator.tintWithAvoidedBlocks); }
|
||||
{ return new DhApiConfig<>(WorldGenerator.tintWithAvoidedBlocks); }
|
||||
|
||||
|
||||
}
|
||||
+4
-6
@@ -17,11 +17,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.api.methods.config.client;
|
||||
package com.seibel.lod.core.api.external.coreImplementations.methods.config.client;
|
||||
|
||||
import com.seibel.lod.api.items.enums.config.EDhApiGpuUploadMethod;
|
||||
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.converters.GenericEnumConverter;
|
||||
import com.seibel.lod.api.methods.config.DhApiConfig;
|
||||
import com.seibel.lod.core.config.Config.Client.Advanced.Buffers;
|
||||
import com.seibel.lod.core.enums.config.EGpuUploadMethod;
|
||||
@@ -36,8 +34,8 @@ 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)); }
|
||||
public static IDhApiConfig<EGpuUploadMethod> getGpuUploadMethodConfig()
|
||||
{ return new DhApiConfig<>(Buffers.gpuUploadMethod); }
|
||||
|
||||
/**
|
||||
* Defines how long we should wait after uploading one
|
||||
@@ -47,6 +45,6 @@ public class DhApiBuffers
|
||||
* uploading buffers to the GPU.
|
||||
*/
|
||||
public static IDhApiConfig<Integer> getBufferUploadTimeoutPerMegabyteInMillisecondsConfig()
|
||||
{ return new DhApiConfig<Integer, Integer>(Buffers.gpuUploadPerMegabyteInMilliseconds); }
|
||||
{ return new DhApiConfig<>(Buffers.gpuUploadPerMegabyteInMilliseconds); }
|
||||
|
||||
}
|
||||
+4
-6
@@ -17,11 +17,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.api.methods.config.client;
|
||||
package com.seibel.lod.core.api.external.coreImplementations.methods.config.client;
|
||||
|
||||
import com.seibel.lod.api.items.enums.config.EDhApiDebugMode;
|
||||
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.converters.GenericEnumConverter;
|
||||
import com.seibel.lod.api.methods.config.DhApiConfig;
|
||||
import com.seibel.lod.core.config.Config.Client.Advanced.Debugging;
|
||||
import com.seibel.lod.core.enums.rendering.EDebugMode;
|
||||
@@ -35,12 +33,12 @@ import com.seibel.lod.core.enums.rendering.EDebugMode;
|
||||
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)); }
|
||||
public static IDhApiConfig<EDebugMode> getDebugRenderModeConfig()
|
||||
{ return new DhApiConfig<>(Debugging.debugMode); }
|
||||
|
||||
/** If enabled debug keybindings can be used. */
|
||||
public static IDhApiConfig<Boolean> getEnableDebugKeybindingsConfig()
|
||||
{ return new DhApiConfig<Boolean, Boolean>(Debugging.enableDebugKeybindings); }
|
||||
{ return new DhApiConfig<>(Debugging.enableDebugKeybindings); }
|
||||
|
||||
|
||||
}
|
||||
+26
-28
@@ -17,16 +17,14 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.api.methods.config.client;
|
||||
package com.seibel.lod.core.api.external.coreImplementations.methods.config.client;
|
||||
|
||||
import com.seibel.lod.api.items.enums.config.*;
|
||||
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.converters.GenericEnumConverter;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.converters.RenderModeEnabledConverter;
|
||||
import com.seibel.lod.api.methods.config.DhApiConfig;
|
||||
import com.seibel.lod.core.interfaces.config.converters.RenderModeEnabledConverter;
|
||||
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.api.items.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;
|
||||
@@ -46,7 +44,7 @@ public class DhApiGraphics
|
||||
|
||||
/** The distance is the radius measured in chunks. */
|
||||
public static IDhApiConfig<Integer> getChunkRenderDistanceConfig()
|
||||
{ return new DhApiConfig<Integer, Integer>(Quality.lodChunkRenderDistance); }
|
||||
{ return new DhApiConfig<>(Quality.lodChunkRenderDistance); }
|
||||
|
||||
/**
|
||||
* Simplified version of {@link DhApiGraphics#getRenderingModeConfig()}
|
||||
@@ -65,8 +63,8 @@ public class DhApiGraphics
|
||||
*
|
||||
* 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)); }
|
||||
public static IDhApiConfig<ERendererMode> getRenderingModeConfig()
|
||||
{ return new DhApiConfig<>(Debugging.rendererMode); }
|
||||
|
||||
|
||||
|
||||
@@ -75,16 +73,16 @@ public class DhApiGraphics
|
||||
//==================//
|
||||
|
||||
/** 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)); }
|
||||
public static IDhApiConfig<EHorizontalResolution> getMaxDetailLevelConfig()
|
||||
{ return new DhApiConfig<>(Quality.drawResolution); }
|
||||
|
||||
/** 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)); }
|
||||
public static IDhApiConfig<EVerticalQuality> getVerticalQualityConfig()
|
||||
{ return new DhApiConfig<>(Quality.verticalQuality); }
|
||||
|
||||
/** 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)); }
|
||||
public static IDhApiConfig<EHorizontalQuality> getHorizontalQualityDropoffConfig()
|
||||
{ return new DhApiConfig<>(Quality.horizontalQuality); }
|
||||
|
||||
/**
|
||||
* The same as vanilla Minecraft's biome blending. <br><br>
|
||||
@@ -95,7 +93,7 @@ public class DhApiGraphics
|
||||
* ... <br>
|
||||
*/
|
||||
public static IDhApiConfig<Integer> getBiomeBlendingConfig()
|
||||
{ return new DhApiConfig<Integer, Integer>(Quality.lodBiomeBlending); }
|
||||
{ return new DhApiConfig<>(Quality.lodBiomeBlending); }
|
||||
|
||||
|
||||
|
||||
@@ -105,15 +103,15 @@ public class DhApiGraphics
|
||||
|
||||
/** 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); }
|
||||
{ return new DhApiConfig<>(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)); }
|
||||
public static IDhApiConfig<EVanillaOverdraw> getVanillaOverdrawConfig()
|
||||
{ return new DhApiConfig<>(AdvancedGraphics.vanillaOverdraw); }
|
||||
|
||||
/** Modifies how far the vanilla overdraw is rendered in chunks. */
|
||||
public static IDhApiConfig<Integer> getVanillaOverdrawOffsetConfig()
|
||||
{ return new DhApiConfig<Integer, Integer>(AdvancedGraphics.overdrawOffset); }
|
||||
{ return new DhApiConfig<>(AdvancedGraphics.overdrawOffset); }
|
||||
|
||||
/**
|
||||
* If enabled the near clip plane is extended to reduce
|
||||
@@ -122,41 +120,41 @@ public class DhApiGraphics
|
||||
* 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); }
|
||||
{ return new DhApiConfig<>(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); }
|
||||
{ return new DhApiConfig<>(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); }
|
||||
{ return new DhApiConfig<>(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); }
|
||||
{ return new DhApiConfig<>(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); }
|
||||
{ return new DhApiConfig<>(AdvancedGraphics.caveCullingHeight); }
|
||||
|
||||
/** This ratio is relative to Earth's real world curvature. */
|
||||
public static IDhApiConfig<Integer> getEarthCurvatureRatioConfig()
|
||||
{ return new DhApiConfig<Integer, Integer>(AdvancedGraphics.earthCurveRatio); }
|
||||
{ return new DhApiConfig<>(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); }
|
||||
{ return new DhApiConfig<>(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)); }
|
||||
public static IDhApiConfig<EBufferRebuildTimes> getGeometryRebuildFrequencyConfig()
|
||||
{ return new DhApiConfig<>(Config.Client.Advanced.Buffers.rebuildTimes); }
|
||||
|
||||
|
||||
|
||||
+27
-29
@@ -17,11 +17,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.api.methods.config.client;
|
||||
package com.seibel.lod.core.api.external.coreImplementations.methods.config.client;
|
||||
|
||||
import com.seibel.lod.api.items.enums.config.*;
|
||||
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.converters.GenericEnumConverter;
|
||||
import com.seibel.lod.api.methods.config.DhApiConfig;
|
||||
import com.seibel.lod.core.enums.rendering.*;
|
||||
import com.seibel.lod.core.config.Config.Client.Graphics.FogQuality;
|
||||
@@ -44,23 +42,23 @@ public class DhApiGraphicsFog
|
||||
//====================//
|
||||
|
||||
/** 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)); }
|
||||
public static IDhApiConfig<EFogDistance> getFogDistanceConfig()
|
||||
{ return new DhApiConfig<>(FogQuality.fogDistance); }
|
||||
|
||||
/** 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)); }
|
||||
public static IDhApiConfig<EFogDrawMode> getFogRenderConfig()
|
||||
{ return new DhApiConfig<>(FogQuality.fogDrawMode); }
|
||||
|
||||
/** 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)); }
|
||||
public static IDhApiConfig<EFogColorMode> getFogColorConfig()
|
||||
{ return new DhApiConfig<>(FogQuality.fogColorMode); }
|
||||
|
||||
/**
|
||||
* 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); }
|
||||
{ return new DhApiConfig<>(FogQuality.disableVanillaFog); }
|
||||
|
||||
|
||||
//=======================//
|
||||
@@ -76,7 +74,7 @@ public class DhApiGraphicsFog
|
||||
* 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); }
|
||||
{ return new DhApiConfig<>(FogQuality.AdvancedFog.farFogStart); }
|
||||
|
||||
/**
|
||||
* Defines where the fog ends as a percent of the radius
|
||||
@@ -87,23 +85,23 @@ public class DhApiGraphicsFog
|
||||
* 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); }
|
||||
{ return new DhApiConfig<>(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); }
|
||||
{ return new DhApiConfig<>(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); }
|
||||
{ return new DhApiConfig<>(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)); }
|
||||
public static IDhApiConfig<EFogFalloff> getFogFalloffConfig()
|
||||
{ return new DhApiConfig<>(FogQuality.AdvancedFog.farFogType); }
|
||||
|
||||
/** Defines the fog density. */
|
||||
public static IDhApiConfig<Double> getFogDensityConfig()
|
||||
{ return new DhApiConfig<Double, Double>(FogQuality.AdvancedFog.farFogDensity); }
|
||||
{ return new DhApiConfig<>(FogQuality.AdvancedFog.farFogDensity); }
|
||||
|
||||
|
||||
//=====================//
|
||||
@@ -111,43 +109,43 @@ public class DhApiGraphicsFog
|
||||
//=====================//
|
||||
|
||||
/** 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)); }
|
||||
public static IDhApiConfig<EHeightFogMixMode> getHeightFogMixModeConfig()
|
||||
{ return new DhApiConfig<>(FogQuality.AdvancedFog.HeightFog.heightFogMixMode); }
|
||||
|
||||
/** 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)); }
|
||||
public static IDhApiConfig<EHeightFogMode> getHeightFogModeConfig()
|
||||
{ return new DhApiConfig<>(FogQuality.AdvancedFog.HeightFog.heightFogMode); }
|
||||
|
||||
/**
|
||||
* 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); }
|
||||
{ return new DhApiConfig<>(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); }
|
||||
{ return new DhApiConfig<>(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); }
|
||||
{ return new DhApiConfig<>(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); }
|
||||
{ return new DhApiConfig<>(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); }
|
||||
{ return new DhApiConfig<>(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)); }
|
||||
public static IDhApiConfig<EFogFalloff> getHeightFogFalloffConfig()
|
||||
{ return new DhApiConfig<>(FogQuality.AdvancedFog.HeightFog.heightFogType); }
|
||||
|
||||
/** Defines the height fog's density. */
|
||||
public static IDhApiConfig<Double> getHeightFogDensityConfig()
|
||||
{ return new DhApiConfig<Double, Double>(FogQuality.AdvancedFog.HeightFog.heightFogDensity); }
|
||||
{ return new DhApiConfig<>(FogQuality.AdvancedFog.HeightFog.heightFogDensity); }
|
||||
|
||||
|
||||
}
|
||||
+4
-6
@@ -17,11 +17,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.api.methods.config.client;
|
||||
package com.seibel.lod.core.api.external.coreImplementations.methods.config.client;
|
||||
|
||||
import com.seibel.lod.api.items.enums.config.EDhApiServerFolderNameMode;
|
||||
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.converters.GenericEnumConverter;
|
||||
import com.seibel.lod.api.methods.config.DhApiConfig;
|
||||
import com.seibel.lod.core.config.Config.Client.Multiplayer;
|
||||
import com.seibel.lod.core.enums.config.EServerFolderNameMode;
|
||||
@@ -39,8 +37,8 @@ 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)); }
|
||||
public static IDhApiConfig<EServerFolderNameMode> getFolderSavingModeConfig()
|
||||
{ return new DhApiConfig<>(Multiplayer.serverFolderNameMode); }
|
||||
|
||||
/**
|
||||
* Defines the necessary similarity (as a percent) that two potential levels
|
||||
@@ -52,7 +50,7 @@ public class DhApiMultiplayer
|
||||
* or similar mods.
|
||||
*/
|
||||
public static IDhApiConfig<Double> getMultiverseSimilarityRequirementConfig()
|
||||
{ return new DhApiConfig<Double, Double>(Multiplayer.multiDimensionRequiredSimilarity); }
|
||||
{ return new DhApiConfig<>(Multiplayer.multiDimensionRequiredSimilarity); }
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.api.methods.config.client;
|
||||
package com.seibel.lod.core.api.external.coreImplementations.methods.config.client;
|
||||
|
||||
import com.seibel.lod.api.items.interfaces.config.IDhApiConfig;
|
||||
import com.seibel.lod.api.methods.config.DhApiConfig;
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.objects.converters;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.config.IConverter;
|
||||
|
||||
/**
|
||||
* This assumes the two enums contain the same values.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-6-30
|
||||
*/
|
||||
public class GenericEnumConverter<coreEnum extends Enum<coreEnum>, apiEnum extends Enum<apiEnum>> implements IConverter<coreEnum, apiEnum>
|
||||
{
|
||||
private final Class<coreEnum> apiCoreType;
|
||||
private final Class<apiEnum> apiEnumClass;
|
||||
|
||||
|
||||
public GenericEnumConverter(Class<coreEnum> newCoreEnumClass, Class<apiEnum> newApiEnumClass)
|
||||
{
|
||||
this.apiCoreType = newCoreEnumClass;
|
||||
this.apiEnumClass = newApiEnumClass;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public coreEnum convertToCoreType(apiEnum apiObject)
|
||||
{
|
||||
return parseEnum(apiObject.name(), this.apiCoreType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public apiEnum convertToApiType(coreEnum coreObject)
|
||||
{
|
||||
return parseEnum(coreObject.name(), this.apiEnumClass);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Since this does require string conversions it isn't the fastest option,
|
||||
* however it works and should be fast enough for most use cases. <br>
|
||||
* If speed becomes an issue this can always be replaced with either individual
|
||||
* converters for each enum (using a switch statement) or a more exotic solution. <br> <br>
|
||||
*
|
||||
* Original source: https://stackoverflow.com/questions/25487619/java-generic-function-to-parse-enums-from-strings
|
||||
*/
|
||||
private static <E extends Enum<E>> E parseEnum(String str, Class<E> enumClass)
|
||||
{
|
||||
return Enum.valueOf(enumClass, str);
|
||||
}
|
||||
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public abstract class CoreDhApiAfterDhInitEvent implements ICoreDhApiEvent<Void>
|
||||
{
|
||||
|
||||
}
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.sharedParameterObjects.CoreDhApiRenderParam;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public abstract class CoreDhApiAfterRenderEvent implements ICoreDhApiEvent<CoreDhApiAfterRenderEvent.CoreEventParam>
|
||||
{
|
||||
|
||||
//==================//
|
||||
// parameter object //
|
||||
//==================//
|
||||
|
||||
public static class CoreEventParam extends CoreDhApiRenderParam
|
||||
{
|
||||
public CoreEventParam(CoreDhApiRenderParam dhApiRenderParam)
|
||||
{
|
||||
super(dhApiRenderParam.mcProjectionMatrix, dhApiRenderParam.mcModelViewMatrix,
|
||||
dhApiRenderParam.dhProjectionMatrix, dhApiRenderParam.dhModelViewMatrix,
|
||||
dhApiRenderParam.partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public abstract class CoreDhApiBeforeDhInitEvent implements ICoreDhApiEvent<Void>
|
||||
{
|
||||
|
||||
}
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.sharedParameterObjects.CoreDhApiRenderParam;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public abstract class CoreDhApiBeforeRenderEvent implements ICoreDhApiEvent<CoreDhApiBeforeRenderEvent.CoreEventParam>
|
||||
{
|
||||
|
||||
//==================//
|
||||
// parameter object //
|
||||
//==================//
|
||||
|
||||
public static class CoreEventParam extends CoreDhApiRenderParam
|
||||
{
|
||||
public CoreEventParam(CoreDhApiRenderParam dhApiRenderParam)
|
||||
{
|
||||
super(dhApiRenderParam.mcProjectionMatrix, dhApiRenderParam.mcModelViewMatrix,
|
||||
dhApiRenderParam.dhProjectionMatrix, dhApiRenderParam.dhModelViewMatrix,
|
||||
dhApiRenderParam.partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public abstract class CoreDhApiLevelLoadEvent implements ICoreDhApiEvent<CoreDhApiLevelLoadEvent.CoreEventParam>
|
||||
{
|
||||
|
||||
//==================//
|
||||
// parameter object //
|
||||
//==================//
|
||||
|
||||
public static class CoreEventParam
|
||||
{
|
||||
/** The newly loaded level. */
|
||||
public final ILevelWrapper levelWrapper;
|
||||
|
||||
|
||||
public CoreEventParam(ILevelWrapper newLevelWrapper)
|
||||
{
|
||||
this.levelWrapper = newLevelWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public abstract class CoreDhApiLevelSaveEvent implements ICoreDhApiEvent<CoreDhApiLevelSaveEvent.CoreEventParam>
|
||||
{
|
||||
|
||||
//==================//
|
||||
// parameter object //
|
||||
//==================//
|
||||
|
||||
public static class CoreEventParam
|
||||
{
|
||||
/** The newly loaded level. */
|
||||
public final ILevelWrapper levelWrapper;
|
||||
|
||||
|
||||
public CoreEventParam(ILevelWrapper newLevelWrapper)
|
||||
{
|
||||
this.levelWrapper = newLevelWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public abstract class CoreDhApiLevelUnloadEvent implements ICoreDhApiEvent<CoreDhApiLevelUnloadEvent.CoreEventParam>
|
||||
{
|
||||
|
||||
//==================//
|
||||
// parameter object //
|
||||
//==================//
|
||||
|
||||
public static class CoreEventParam
|
||||
{
|
||||
/** The recently unloaded level. */
|
||||
public final ILevelWrapper levelWrapper;
|
||||
|
||||
|
||||
public CoreEventParam(ILevelWrapper newLevelWrapper)
|
||||
{
|
||||
this.levelWrapper = newLevelWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
|
||||
/**
|
||||
* Only used for unit testing
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-9-11
|
||||
*/
|
||||
public abstract class CoreDhApiTestEvent implements ICoreDhApiEvent<Boolean>
|
||||
{
|
||||
public abstract boolean getTestValue();
|
||||
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.objects.events.sharedParameterObjects;
|
||||
|
||||
import com.seibel.lod.core.util.math.Mat4f;
|
||||
|
||||
/**
|
||||
* Parameter passed into Render events.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-9-5
|
||||
*/
|
||||
public class CoreDhApiRenderParam
|
||||
{
|
||||
/** The projection matrix Minecraft is using to render this frame. */
|
||||
public final Mat4f mcProjectionMatrix;
|
||||
/** The model view matrix Minecraft is using to render this frame. */
|
||||
public final Mat4f mcModelViewMatrix;
|
||||
|
||||
/** The projection matrix Distant Horizons is using to render this frame. */
|
||||
public final Mat4f dhProjectionMatrix;
|
||||
/** The model view matrix Distant Horizons is using to render this frame. */
|
||||
public final Mat4f dhModelViewMatrix;
|
||||
|
||||
/** Indicates how far into this tick the frame is. */
|
||||
public final float partialTicks;
|
||||
|
||||
|
||||
|
||||
public CoreDhApiRenderParam(
|
||||
Mat4f newMcProjectionMatrix, Mat4f newMcModelViewMatrix,
|
||||
Mat4f newDhProjectionMatrix, Mat4f newDhModelViewMatrix,
|
||||
float newPartialTicks)
|
||||
{
|
||||
this.mcProjectionMatrix = newMcProjectionMatrix;
|
||||
this.mcModelViewMatrix = newMcModelViewMatrix;
|
||||
|
||||
this.dhProjectionMatrix = newDhProjectionMatrix;
|
||||
this.dhModelViewMatrix = newDhModelViewMatrix;
|
||||
|
||||
this.partialTicks = newPartialTicks;
|
||||
}
|
||||
|
||||
}
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* 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.coreImplementations.objects.wrappers;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.world.ICoreDhApiDimensionTypeWrapper;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.ICoreDhApiUnsafeWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IDimensionTypeWrapper;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 2022-9-8
|
||||
*/
|
||||
public class CoreDhApiDimensionTypeWrapper implements ICoreDhApiDimensionTypeWrapper, ICoreDhApiUnsafeWrapper
|
||||
{
|
||||
private final IDimensionTypeWrapper dimensionTypeWrapper;
|
||||
|
||||
|
||||
public CoreDhApiDimensionTypeWrapper(IDimensionTypeWrapper newDimensionTypeWrapper)
|
||||
{
|
||||
this.dimensionTypeWrapper = newDimensionTypeWrapper;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getDimensionName() { return this.dimensionTypeWrapper.getDimensionName(); }
|
||||
|
||||
@Override
|
||||
public boolean hasCeiling() { return this.dimensionTypeWrapper.hasCeiling(); }
|
||||
|
||||
@Override
|
||||
public boolean hasSkyLight() { return this.dimensionTypeWrapper.hasSkyLight(); }
|
||||
|
||||
|
||||
@Override
|
||||
public Object getWrappedMcObject_UNSAFE() { return this.dimensionTypeWrapper.getWrappedMcObject(); }
|
||||
|
||||
}
|
||||
-76
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* 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.coreImplementations.objects.wrappers;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.world.ICoreDhApiLevelWrapper;
|
||||
import com.seibel.lod.core.enums.ELevelType;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IDimensionTypeWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IServerLevelWrapper;
|
||||
|
||||
/**
|
||||
* Can be either a Server or Client level.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-9-8
|
||||
*/
|
||||
public class CoreDhApiLevelWrapper implements ICoreDhApiLevelWrapper
|
||||
{
|
||||
private final ILevelWrapper levelWrapper;
|
||||
private final IDimensionTypeWrapper dimensionTypeWrapper;
|
||||
|
||||
|
||||
public CoreDhApiLevelWrapper(ILevelWrapper newLevelWrapper)
|
||||
{
|
||||
this.levelWrapper = newLevelWrapper;
|
||||
this.dimensionTypeWrapper = this.levelWrapper.getDimensionType();
|
||||
}
|
||||
|
||||
|
||||
public ELevelType getLevelType()
|
||||
{
|
||||
if (this.levelWrapper.getClass().isAssignableFrom(IClientLevelWrapper.class))
|
||||
{
|
||||
return ELevelType.CLIENT_LEVEL;
|
||||
}
|
||||
else if (this.levelWrapper.getClass().isAssignableFrom(IServerLevelWrapper.class))
|
||||
{
|
||||
return ELevelType.CLIENT_LEVEL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// shouldn't normally happen, but just in case
|
||||
return ELevelType.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasCeiling() { return this.levelWrapper.hasCeiling(); }
|
||||
|
||||
public boolean hasSkyLight() { return this.levelWrapper.hasSkyLight(); }
|
||||
|
||||
public int getHeight() { return this.levelWrapper.getHeight(); }
|
||||
|
||||
public int getMinHeight() { return this.levelWrapper.getMinHeight(); }
|
||||
|
||||
@Override
|
||||
public Object getWrappedMcObject_UNSAFE() { return this.levelWrapper.unwrapLevel(); }
|
||||
|
||||
}
|
||||
@@ -19,13 +19,13 @@
|
||||
|
||||
package com.seibel.lod.core.api.internal;
|
||||
|
||||
import com.seibel.lod.api.methods.events.abstractEvents.*;
|
||||
import com.seibel.lod.api.methods.events.sharedParameterObjects.DhApiRenderParam;
|
||||
import com.seibel.lod.core.level.IClientLevel;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents.*;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.sharedParameterObjects.CoreDhApiRenderParam;
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
import com.seibel.lod.core.enums.rendering.EDebugMode;
|
||||
import com.seibel.lod.core.enums.rendering.ERendererMode;
|
||||
import com.seibel.lod.api.items.enums.rendering.ERendererMode;
|
||||
import com.seibel.lod.core.dependencyInjection.DhApiEventInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.logging.ConfigBasedLogger;
|
||||
@@ -150,7 +150,7 @@ public class ClientApi
|
||||
//TODO: Implement
|
||||
|
||||
// TODO: potentially add a list of chunks that were updated during the save
|
||||
DhApiEventInjector.INSTANCE.fireAllEvents(CoreDhApiLevelSaveEvent.class, new CoreDhApiLevelSaveEvent.CoreEventParam(level));
|
||||
// DhApiEventInjector.INSTANCE.fireAllEvents(DhApiLevelSaveEvent.class, new DhApiLevelSaveEvent.EventParam(level));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class ClientApi
|
||||
if (SharedApi.currentWorld != null)
|
||||
{
|
||||
SharedApi.currentWorld.unloadLevel(level);
|
||||
DhApiEventInjector.INSTANCE.fireAllEvents(CoreDhApiLevelUnloadEvent.class, new CoreDhApiLevelUnloadEvent.CoreEventParam(level));
|
||||
// DhApiEventInjector.INSTANCE.fireAllEvents(DhApiLevelUnloadEvent.class, new DhApiLevelUnloadEvent.EventParam(level));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ public class ClientApi
|
||||
if (SharedApi.currentWorld != null)
|
||||
{
|
||||
SharedApi.currentWorld.getOrLoadLevel(level);
|
||||
DhApiEventInjector.INSTANCE.fireAllEvents(CoreDhApiLevelLoadEvent.class, new CoreDhApiLevelLoadEvent.CoreEventParam(level));
|
||||
// DhApiEventInjector.INSTANCE.fireAllEvents(DhApiLevelLoadEvent.class, new DhApiLevelLoadEvent.EventParam(level));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,16 +260,16 @@ public class ClientApi
|
||||
{
|
||||
if (Config.Client.Advanced.Debugging.rendererMode.get() == ERendererMode.DEFAULT)
|
||||
{
|
||||
CoreDhApiRenderParam renderEventParam =
|
||||
new CoreDhApiRenderParam(mcProjectionMatrix, mcModelViewMatrix,
|
||||
DhApiRenderParam renderEventParam =
|
||||
new DhApiRenderParam(mcProjectionMatrix, mcModelViewMatrix,
|
||||
RenderUtil.createLodProjectionMatrix(mcProjectionMatrix, partialTicks),
|
||||
RenderUtil.createLodModelViewMatrix(mcModelViewMatrix), partialTicks);
|
||||
|
||||
boolean renderingCanceled = DhApiEventInjector.INSTANCE.fireAllEvents(CoreDhApiBeforeRenderEvent.class, new CoreDhApiBeforeRenderEvent.CoreEventParam(renderEventParam));
|
||||
if (!rendererDisabledBecauseOfExceptions && !renderingCanceled)
|
||||
// boolean renderingCanceled = DhApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeRenderEvent.class, new DhApiBeforeRenderEvent.EventParam(renderEventParam));
|
||||
if (!rendererDisabledBecauseOfExceptions)// && !renderingCanceled)
|
||||
{
|
||||
level.render(mcModelViewMatrix, mcProjectionMatrix, partialTicks, profiler);
|
||||
DhApiEventInjector.INSTANCE.fireAllEvents(CoreDhApiAfterRenderEvent.class, new CoreDhApiAfterRenderEvent.CoreEventParam(renderEventParam));
|
||||
// DhApiEventInjector.INSTANCE.fireAllEvents(DhApiAfterRenderEvent.class, new DhApiAfterRenderEvent.EventParam(renderEventParam));
|
||||
}
|
||||
}
|
||||
else if (Config.Client.Advanced.Debugging.rendererMode.get() == ERendererMode.DEBUG)
|
||||
|
||||
@@ -23,7 +23,7 @@ package com.seibel.lod.core.config;
|
||||
import com.seibel.lod.core.enums.rendering.EFogDrawMode;
|
||||
import com.seibel.lod.core.enums.rendering.EFogColorMode;
|
||||
import com.seibel.lod.core.enums.rendering.EFogDistance;
|
||||
import com.seibel.lod.core.enums.rendering.ERendererMode;
|
||||
import com.seibel.lod.api.items.enums.rendering.ERendererMode;
|
||||
import com.seibel.lod.core.config.types.*;
|
||||
|
||||
import com.seibel.lod.core.enums.config.*;
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package com.seibel.lod.core.config.types;
|
||||
|
||||
|
||||
import com.seibel.lod.core.interfaces.config.IConfigEntry;
|
||||
|
||||
/**
|
||||
* Use for making the config variables
|
||||
*
|
||||
* @author coolGi
|
||||
* @version 2022-5-26
|
||||
*/
|
||||
public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>>
|
||||
public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>> implements IConfigEntry<T>
|
||||
{
|
||||
private final T defaultValue;
|
||||
private String comment;
|
||||
@@ -40,16 +42,21 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>>
|
||||
|
||||
|
||||
/** Gets the default value of the option */
|
||||
public T getDefaultValue() {
|
||||
@Override
|
||||
public T getDefaultValue() {
|
||||
return this.defaultValue;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setApiValue(T newApiValue) {
|
||||
this.apiValue = newApiValue;
|
||||
}
|
||||
public T getApiValue() {
|
||||
@Override
|
||||
public T getApiValue() {
|
||||
return this.apiValue;
|
||||
}
|
||||
@Override
|
||||
public boolean getAllowApiOverride() { return this.allowApiOverride; }
|
||||
@Override
|
||||
public void set(T newValue) {
|
||||
super.set(newValue);
|
||||
@@ -61,42 +68,51 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>>
|
||||
return apiValue;
|
||||
return super.get();
|
||||
}
|
||||
@Override
|
||||
public T getTrueValue() {
|
||||
return super.get();
|
||||
}
|
||||
|
||||
/** Sets the value without saving */
|
||||
@Override
|
||||
public void setWithoutSaving(T newValue) {
|
||||
super.set(newValue);
|
||||
}
|
||||
|
||||
/** Gets the min value */
|
||||
@Override
|
||||
public T getMin() {
|
||||
return this.min;
|
||||
}
|
||||
/** Sets the min value */
|
||||
@Override
|
||||
public void setMin(T newMin) {
|
||||
this.min = newMin;
|
||||
}
|
||||
/** Gets the max value */
|
||||
@Override
|
||||
public T getMax() {
|
||||
return this.max;
|
||||
}
|
||||
/** Sets the max value */
|
||||
@Override
|
||||
public void setMax(T newMax) {
|
||||
this.max = newMax;
|
||||
}
|
||||
/** Sets the min and max in 1 setter */
|
||||
@Override
|
||||
public void setMinMax(T newMin, T newMax) {
|
||||
this.max = newMin;
|
||||
this.min = newMax;
|
||||
}
|
||||
|
||||
/** Gets the comment */
|
||||
@Override
|
||||
public String getComment() {
|
||||
return this.comment;
|
||||
}
|
||||
/** Sets the comment */
|
||||
@Override
|
||||
public void setComment(String newComment) {
|
||||
this.comment = newComment;
|
||||
}
|
||||
@@ -113,10 +129,12 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>>
|
||||
* 1 == number too high
|
||||
* -1 == number too low
|
||||
*/
|
||||
@Override
|
||||
public byte isValid() {
|
||||
return isValid(value);
|
||||
}
|
||||
/** Checks if a value is valid */
|
||||
@Override
|
||||
public byte isValid(T value) {
|
||||
if (this.configBase.disableMinMax)
|
||||
return 0;
|
||||
@@ -139,7 +157,10 @@ public class ConfigEntry<T> extends AbstractConfigType<T, ConfigEntry<T>>
|
||||
public void load() {
|
||||
configBase.configFileINSTANCE.loadEntry(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(IConfigEntry<?> obj) { return obj.getClass() == ConfigEntry.class ? equals((ConfigEntry<?>)obj) : false; }
|
||||
/** Is the value of this equal to another */
|
||||
public boolean equals(ConfigEntry<?> obj) {
|
||||
// Can all of this just be "return this.value.equals(obj.value)"?
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.seibel.lod.core.enums.ELodDirection;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.util.ColorUtil;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.util.MathUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
|
||||
public class ColumnBox
|
||||
@@ -54,7 +55,7 @@ public class ColumnBox
|
||||
boolean skipBot = ColumnFormat.doesItExist(botData) && (ColumnFormat.getHeight(botData) == y) && !isBotTransparent;
|
||||
if(LodRenderer.transparencyEnabled && LodRenderer.fakeOceanFloor) {
|
||||
if (!isTransparent && isTopTransparent && ColumnFormat.doesItExist(topData)) {
|
||||
skyLightTop = (byte) LodUtil.clamp(0, 15 - (ColumnFormat.getHeight(topData) - y), 15);
|
||||
skyLightTop = (byte) MathUtil.clamp(0, 15 - (ColumnFormat.getHeight(topData) - y), 15);
|
||||
ySize = (short) (ColumnFormat.getHeight(topData) - y - 1);
|
||||
//y = (short) (DataPointUtil.getHeight(topData) - 2);
|
||||
//ySize = 1;
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.render.glObject.buffer.GLVertexBuffer;
|
||||
import com.seibel.lod.core.util.ColorUtil;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.util.MathUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
//TODO: Recheck this class for refactoring
|
||||
@@ -464,7 +465,7 @@ public class LodQuadBuilder
|
||||
/** Returns how many Buffers will be needed to render everything in this builder. */
|
||||
public int getCurrentNeededVertexBufferCount()
|
||||
{
|
||||
return LodUtil.ceilDiv(getCurrentQuadsCount(), RenderBuffer.MAX_QUADS_PER_BUFFER);
|
||||
return MathUtil.ceilDiv(getCurrentQuadsCount(), RenderBuffer.MAX_QUADS_PER_BUFFER);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+11
-47
@@ -30,7 +30,7 @@ import java.util.Map;
|
||||
* @author James Seibel
|
||||
* @version 2022-8-15
|
||||
*/
|
||||
public class DependencyInjector<BindableType extends IBindable>
|
||||
public class DependencyInjector<BindableType extends IBindable> implements IDependencyInjector<BindableType>
|
||||
{
|
||||
protected final Map<Class<? extends BindableType>, ArrayList<BindableType>> dependencies = new HashMap<>();
|
||||
|
||||
@@ -55,14 +55,7 @@ public class DependencyInjector<BindableType extends IBindable>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Links the given implementation object to an interface, so it can be referenced later.
|
||||
*
|
||||
* @param dependencyInterface The interface (or parent class) the implementation object should implement.
|
||||
* @param dependencyImplementation An object that implements the dependencyInterface interface.
|
||||
* @throws IllegalStateException if the interface has already been bound and {@link DependencyInjector#allowDuplicateBindings} is false
|
||||
* @throws IllegalArgumentException if the implementation object doesn't implement the interface
|
||||
*/
|
||||
@Override
|
||||
public void bind(Class<? extends BindableType> dependencyInterface, BindableType dependencyImplementation) throws IllegalStateException, IllegalArgumentException
|
||||
{
|
||||
// duplicate check if requested
|
||||
@@ -97,11 +90,8 @@ public class DependencyInjector<BindableType extends IBindable>
|
||||
// add the dependency
|
||||
dependencies.get(dependencyInterface).add(dependencyImplementation);
|
||||
}
|
||||
/**
|
||||
* Checks if classToTest (or one of its ancestors)
|
||||
* implements the given interface.
|
||||
*/
|
||||
protected boolean checkIfClassImplements(Class<?> classToTest, Class<?> interfaceToLookFor)
|
||||
@Override
|
||||
public boolean checkIfClassImplements(Class<?> classToTest, Class<?> interfaceToLookFor)
|
||||
{
|
||||
// check the parent class (if applicable)
|
||||
if (classToTest.getSuperclass() != Object.class && classToTest.getSuperclass() != null)
|
||||
@@ -133,56 +123,28 @@ public class DependencyInjector<BindableType extends IBindable>
|
||||
|
||||
return false;
|
||||
}
|
||||
/** Checks if classToTest extends the given class. */
|
||||
protected boolean checkIfClassExtends(Class<?> classToTest, Class<?> extensionToLookFor)
|
||||
@Override
|
||||
public boolean checkIfClassExtends(Class<?> classToTest, Class<?> extensionToLookFor)
|
||||
{
|
||||
return extensionToLookFor.isAssignableFrom(classToTest);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This does not return incomplete dependencies. <Br>
|
||||
* See {@link #get(Class, boolean) get(Class, boolean)} for full documentation.
|
||||
*
|
||||
* @see #get(Class, boolean)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends BindableType> T get(Class<T> interfaceClass) throws ClassCastException
|
||||
{
|
||||
return (T) getInternalLogic(interfaceClass, false).get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all dependencies of type T that have been bound. <br>
|
||||
* Returns an empty list if no dependencies have been bound.
|
||||
*
|
||||
* @param <T> class of the dependency
|
||||
* (inferred from the objectClass parameter)
|
||||
* @param interfaceClass Interface of the dependency
|
||||
* @return the dependency of type T
|
||||
* @throws ClassCastException If the dependency isn't able to be cast to type T.
|
||||
* (this shouldn't normally happen, unless the bound object changed somehow)
|
||||
*/
|
||||
@Override
|
||||
public <T extends BindableType> ArrayList<T> getAll(Class<T> interfaceClass) throws ClassCastException
|
||||
{
|
||||
return getInternalLogic(interfaceClass, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a dependency of type T if one has been bound. <br>
|
||||
* Returns null if a dependency hasn't been bound. <br> <br>
|
||||
*
|
||||
* If the handler's {@link #allowDuplicateBindings} is true this returns the first bound dependency.
|
||||
*
|
||||
* @param <T> class of the dependency
|
||||
* (inferred from the interfaceClass parameter)
|
||||
* @param interfaceClass Interface of the dependency
|
||||
* @param allowIncompleteDependencies If true this method will also return dependencies that haven't completed their delayed setup.
|
||||
* @return the dependency of type T
|
||||
* @throws ClassCastException If the dependency isn't able to be cast to type T.
|
||||
* (this shouldn't normally happen, unless the bound object changed somehow)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T extends BindableType> T get(Class<T> interfaceClass, boolean allowIncompleteDependencies) throws ClassCastException
|
||||
{
|
||||
return (T) getInternalLogic(interfaceClass, allowIncompleteDependencies).get(0);
|
||||
@@ -222,6 +184,7 @@ public class DependencyInjector<BindableType extends IBindable>
|
||||
|
||||
|
||||
/** Removes all bound dependencies. */
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
this.dependencies.clear();
|
||||
@@ -230,6 +193,7 @@ public class DependencyInjector<BindableType extends IBindable>
|
||||
|
||||
|
||||
/** Runs delayed setup for any dependencies that require it. */
|
||||
@Override
|
||||
public void runDelayedSetup()
|
||||
{
|
||||
for (Class<? extends BindableType> interfaceKey : dependencies.keySet())
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
import com.seibel.lod.api.methods.events.interfaces.IDhApiEvent;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.util.ArrayList;
|
||||
* @author Leetom
|
||||
* @version 2022-8-15
|
||||
*/
|
||||
public class DhApiEventInjector extends DependencyInjector<ICoreDhApiEvent> // Note to self: Don't try adding a generic type to IDhApiEvent, the consturctor won't accept it
|
||||
public class DhApiEventInjector extends DependencyInjector<IDhApiEvent> // Note to self: Don't try adding a generic type to IDhApiEvent, the consturctor won't accept it
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger(DhApiEventInjector.class.getSimpleName());
|
||||
|
||||
@@ -46,7 +46,7 @@ public class DhApiEventInjector extends DependencyInjector<ICoreDhApiEvent> // N
|
||||
|
||||
public DhApiEventInjector()
|
||||
{
|
||||
super(ICoreDhApiEvent.class, true);
|
||||
super(IDhApiEvent.class, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class DhApiEventInjector extends DependencyInjector<ICoreDhApiEvent> // N
|
||||
* @throws IllegalArgumentException if the implementation object doesn't implement the interface
|
||||
* @return true if the handler was unbound, false if the handler wasn't bound.
|
||||
*/
|
||||
public boolean unbind(Class<? extends ICoreDhApiEvent> dependencyInterface, Class<? extends ICoreDhApiEvent> dependencyClassToRemove) throws IllegalArgumentException
|
||||
public boolean unbind(Class<? extends IDhApiEvent> dependencyInterface, Class<? extends IDhApiEvent> dependencyClassToRemove) throws IllegalArgumentException
|
||||
{
|
||||
// make sure the given dependency implements the necessary interfaces
|
||||
boolean implementsInterface = checkIfClassImplements(dependencyClassToRemove, dependencyInterface)
|
||||
@@ -77,7 +77,7 @@ public class DhApiEventInjector extends DependencyInjector<ICoreDhApiEvent> // N
|
||||
// actually remove the dependency
|
||||
if (this.dependencies.containsKey(dependencyInterface))
|
||||
{
|
||||
ArrayList<ICoreDhApiEvent> dependencyList = this.dependencies.get(dependencyInterface);
|
||||
ArrayList<IDhApiEvent> dependencyList = this.dependencies.get(dependencyInterface);
|
||||
int indexToRemove = -1;
|
||||
for(int i = 0; i < dependencyList.size(); i++)
|
||||
{
|
||||
@@ -107,12 +107,12 @@ public class DhApiEventInjector extends DependencyInjector<ICoreDhApiEvent> // N
|
||||
* @return if any of the events returned that this event should be canceled.
|
||||
* @param <T> the parameter type taken by the event handlers.
|
||||
*/
|
||||
public <T, U extends ICoreDhApiEvent<T>> boolean fireAllEvents(Class<U> dependencyInterface, T eventParameterObject)
|
||||
public <T, U extends IDhApiEvent<T>> boolean fireAllEvents(Class<U> dependencyInterface, T eventParameterObject)
|
||||
{
|
||||
boolean cancelEvent = false;
|
||||
|
||||
ArrayList<U> eventList = this.getAll(dependencyInterface);
|
||||
for (ICoreDhApiEvent<T> event : eventList)
|
||||
for (IDhApiEvent<T> event : eventList)
|
||||
{
|
||||
if (event != null)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.override.ICoreDhApiOverrideable;
|
||||
import com.seibel.lod.api.items.interfaces.override.IDhApiOverrideable;
|
||||
import com.seibel.lod.core.util.StringUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -31,26 +31,13 @@ import java.util.HashMap;
|
||||
* @author James Seibel
|
||||
* @version 2022-9-8
|
||||
*/
|
||||
public class OverrideInjector
|
||||
public class OverrideInjector implements IOverrideInjector<IDhApiOverrideable>
|
||||
{
|
||||
public static final OverrideInjector INSTANCE = new OverrideInjector();
|
||||
|
||||
private final HashMap<Class<? extends ICoreDhApiOverrideable>, OverridePriorityListContainer> overrideContainerByInterface = new HashMap<>();
|
||||
private final HashMap<Class<? extends IDhApiOverrideable>, OverridePriorityListContainer> overrideContainerByInterface = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
* All core overrides should have this priority. <Br>
|
||||
* Should be lower than MIN_OVERRIDE_PRIORITY.
|
||||
*/
|
||||
public static final int CORE_PRIORITY = -1;
|
||||
/**
|
||||
* The lowest priority non-core overrides can have.
|
||||
* Should be higher than CORE_PRIORITY.
|
||||
*/
|
||||
public static final int MIN_NON_CORE_OVERRIDE_PRIORITY = 0;
|
||||
/** The priority given to overrides that don't explicitly define a priority. */
|
||||
public static final int DEFAULT_NON_CORE_OVERRIDE_PRIORITY = 10;
|
||||
|
||||
/**
|
||||
* This is used to determine if an override is part of Distant Horizons'
|
||||
* Core or not.
|
||||
@@ -68,19 +55,12 @@ public class OverrideInjector
|
||||
this.corePackagePath = thisPackageName.substring(0, secondPackageEndingIndex); // this should be "com.seibel.lod"
|
||||
}
|
||||
|
||||
/** This constructor should only be used for testing different corePackagePaths. */
|
||||
public OverrideInjector(String newCorePackagePath) { this.corePackagePath = newCorePackagePath; }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* See {@link DependencyInjector#bind(Class, IBindable) bind(Class, IBindable)} for full documentation.
|
||||
*
|
||||
* @throws IllegalArgumentException if a non-Distant Horizons Override with the priority CORE is passed in or a invalid priority value.
|
||||
* @throws IllegalStateException if another override with the given priority already has been bound.
|
||||
* @see DependencyInjector#bind(Class, IBindable)
|
||||
*/
|
||||
public void bind(Class<? extends ICoreDhApiOverrideable> dependencyInterface, ICoreDhApiOverrideable dependencyImplementation) throws IllegalStateException, IllegalArgumentException
|
||||
@Override
|
||||
public void bind(Class<? extends IDhApiOverrideable> dependencyInterface, IDhApiOverrideable dependencyImplementation) throws IllegalStateException, IllegalArgumentException
|
||||
{
|
||||
// make sure a override container exists
|
||||
OverridePriorityListContainer overrideContainer = this.overrideContainerByInterface.get(dependencyInterface);
|
||||
@@ -111,7 +91,7 @@ public class OverrideInjector
|
||||
}
|
||||
|
||||
// check if an override already exists with this priority
|
||||
ICoreDhApiOverrideable existingOverride = overrideContainer.getOverrideWithPriority(dependencyImplementation.getPriority());
|
||||
IDhApiOverrideable existingOverride = overrideContainer.getOverrideWithPriority(dependencyImplementation.getPriority());
|
||||
if (existingOverride != null)
|
||||
{
|
||||
throw new IllegalStateException("An override already exists with the priority [" + dependencyImplementation.getPriority() + "].");
|
||||
@@ -122,29 +102,17 @@ public class OverrideInjector
|
||||
overrideContainer.addOverride(dependencyImplementation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bound dependency with the highest priority. <br>
|
||||
* See {@link DependencyInjector#get(Class, boolean) get(Class, boolean)} for full documentation.
|
||||
*
|
||||
* @see DependencyInjector#get(Class, boolean)
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends ICoreDhApiOverrideable> T get(Class<T> interfaceClass) throws ClassCastException
|
||||
public <T extends IDhApiOverrideable> T get(Class<T> interfaceClass) throws ClassCastException
|
||||
{
|
||||
OverridePriorityListContainer overrideContainer = this.overrideContainerByInterface.get(interfaceClass);
|
||||
return overrideContainer != null ? (T) overrideContainer.getOverrideWithHighestPriority() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a dependency of type T with the specified priority if one has been bound. <br>
|
||||
* If there is a dependency, but it was bound with a different priority this will return null. <br> <br>
|
||||
*
|
||||
* See {@link DependencyInjector#get(Class, boolean) get(Class, boolean)} for more documentation.
|
||||
*
|
||||
* @see DependencyInjector#get(Class, boolean)
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends ICoreDhApiOverrideable> T get(Class<T> interfaceClass, int priority) throws ClassCastException
|
||||
public <T extends IDhApiOverrideable> T get(Class<T> interfaceClass, int priority) throws ClassCastException
|
||||
{
|
||||
OverridePriorityListContainer overrideContainer = this.overrideContainerByInterface.get(interfaceClass);
|
||||
return overrideContainer != null ? (T) overrideContainer.getOverrideWithPriority(priority) : null;
|
||||
@@ -152,7 +120,7 @@ public class OverrideInjector
|
||||
|
||||
|
||||
|
||||
/** Removes all bound overrides. */
|
||||
@Override
|
||||
public void clear() { this.overrideContainerByInterface.clear(); }
|
||||
|
||||
|
||||
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.override.ICoreDhApiOverrideable;
|
||||
import com.seibel.lod.api.items.interfaces.override.IDhApiOverrideable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class OverridePriorityListContainer implements IBindable
|
||||
|
||||
|
||||
/** Doesn't do any validation */
|
||||
public void addOverride(ICoreDhApiOverrideable override)
|
||||
public void addOverride(IDhApiOverrideable override)
|
||||
{
|
||||
OverridePriorityPair priorityPair = new OverridePriorityPair(override, override.getPriority());
|
||||
this.overridePairList.add(priorityPair);
|
||||
@@ -26,7 +26,7 @@ public class OverridePriorityListContainer implements IBindable
|
||||
}
|
||||
|
||||
/** @return true if the override was removed from the list, false otherwise. */
|
||||
public boolean removeOverride(ICoreDhApiOverrideable override)
|
||||
public boolean removeOverride(IDhApiOverrideable override)
|
||||
{
|
||||
if (this.overridePairList.contains(override))
|
||||
{
|
||||
@@ -44,7 +44,7 @@ public class OverridePriorityListContainer implements IBindable
|
||||
|
||||
// getters //
|
||||
|
||||
public ICoreDhApiOverrideable getOverrideWithLowestPriority()
|
||||
public IDhApiOverrideable getOverrideWithLowestPriority()
|
||||
{
|
||||
if (this.overridePairList.size() == 0)
|
||||
{
|
||||
@@ -56,7 +56,7 @@ public class OverridePriorityListContainer implements IBindable
|
||||
return this.overridePairList.get(this.overridePairList.size() - 1).override;
|
||||
}
|
||||
}
|
||||
public ICoreDhApiOverrideable getOverrideWithHighestPriority()
|
||||
public IDhApiOverrideable getOverrideWithHighestPriority()
|
||||
{
|
||||
if (this.overridePairList.size() != 0)
|
||||
{
|
||||
@@ -67,7 +67,7 @@ public class OverridePriorityListContainer implements IBindable
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public ICoreDhApiOverrideable getCoreOverride()
|
||||
public IDhApiOverrideable getCoreOverride()
|
||||
{
|
||||
int lastIndex = this.overridePairList.size() - 1;
|
||||
if (this.overridePairList.get(lastIndex) != null && this.overridePairList.get(lastIndex).priority == OverrideInjector.CORE_PRIORITY)
|
||||
@@ -80,7 +80,7 @@ public class OverridePriorityListContainer implements IBindable
|
||||
}
|
||||
}
|
||||
/** Returns null if no override with the given priority is found */
|
||||
public ICoreDhApiOverrideable getOverrideWithPriority(int priority)
|
||||
public IDhApiOverrideable getOverrideWithPriority(int priority)
|
||||
{
|
||||
for (OverridePriorityPair pair : this.overridePairList)
|
||||
{
|
||||
@@ -103,10 +103,10 @@ public class OverridePriorityListContainer implements IBindable
|
||||
|
||||
private class OverridePriorityPair
|
||||
{
|
||||
public final ICoreDhApiOverrideable override;
|
||||
public final IDhApiOverrideable override;
|
||||
public int priority;
|
||||
|
||||
public OverridePriorityPair(ICoreDhApiOverrideable newOverride, int newPriority)
|
||||
public OverridePriorityPair(IDhApiOverrideable newOverride, int newPriority)
|
||||
{
|
||||
this.override = newOverride;
|
||||
this.priority = newPriority;
|
||||
|
||||
+12
-12
@@ -19,8 +19,8 @@
|
||||
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.override.worldGenerator.ICoreDhApiWorldGenerator;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.world.ICoreDhApiLevelWrapper;
|
||||
import com.seibel.lod.api.items.interfaces.override.worldGenerator.IDhApiWorldGenerator;
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper;
|
||||
import com.seibel.lod.core.util.StringUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -36,7 +36,7 @@ public class WorldGeneratorInjector
|
||||
{
|
||||
public static final WorldGeneratorInjector INSTANCE = new WorldGeneratorInjector();
|
||||
|
||||
private final HashMap<ICoreDhApiLevelWrapper, OverrideInjector> worldGeneratorByLevelWrapper = new HashMap<>();
|
||||
private final HashMap<IDhApiLevelWrapper, OverrideInjector> worldGeneratorByLevelWrapper = new HashMap<>();
|
||||
/** World generators that aren't bound to a specific level and are used if no other world generators are bound. */
|
||||
private final OverrideInjector backupUniversalWorldGenerators;
|
||||
|
||||
@@ -75,7 +75,7 @@ public class WorldGeneratorInjector
|
||||
* @throws IllegalArgumentException if a non-Distant Horizons world generator with the priority CORE is passed in
|
||||
* @see DependencyInjector#bind(Class, IBindable)
|
||||
*/
|
||||
public void bind(ICoreDhApiWorldGenerator worldGeneratorImplementation) throws IllegalStateException, IllegalArgumentException
|
||||
public void bind(IDhApiWorldGenerator worldGeneratorImplementation) throws IllegalStateException, IllegalArgumentException
|
||||
{
|
||||
bind(null, worldGeneratorImplementation);
|
||||
}
|
||||
@@ -87,7 +87,7 @@ public class WorldGeneratorInjector
|
||||
* @throws IllegalArgumentException if a non-Distant Horizons world generator with the priority CORE is passed in
|
||||
* @see DependencyInjector#bind(Class, IBindable)
|
||||
*/
|
||||
public void bind(ICoreDhApiLevelWrapper levelForWorldGenerator, ICoreDhApiWorldGenerator worldGeneratorImplementation) throws IllegalStateException, IllegalArgumentException
|
||||
public void bind(IDhApiLevelWrapper levelForWorldGenerator, IDhApiWorldGenerator worldGeneratorImplementation) throws IllegalStateException, IllegalArgumentException
|
||||
{
|
||||
if (levelForWorldGenerator != null)
|
||||
{
|
||||
@@ -97,12 +97,12 @@ public class WorldGeneratorInjector
|
||||
worldGeneratorByLevelWrapper.put(levelForWorldGenerator, new OverrideInjector(this.corePackagePath));
|
||||
}
|
||||
|
||||
worldGeneratorByLevelWrapper.get(levelForWorldGenerator).bind(ICoreDhApiWorldGenerator.class, worldGeneratorImplementation);
|
||||
worldGeneratorByLevelWrapper.get(levelForWorldGenerator).bind(IDhApiWorldGenerator.class, worldGeneratorImplementation);
|
||||
}
|
||||
else
|
||||
{
|
||||
// a null level wrapper binds the generator to all levels
|
||||
backupUniversalWorldGenerators.bind(ICoreDhApiWorldGenerator.class, worldGeneratorImplementation);
|
||||
backupUniversalWorldGenerators.bind(IDhApiWorldGenerator.class, worldGeneratorImplementation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,9 +114,9 @@ public class WorldGeneratorInjector
|
||||
*
|
||||
* @see OverrideInjector#get(Class)
|
||||
*/
|
||||
public ICoreDhApiWorldGenerator get() throws ClassCastException
|
||||
public IDhApiWorldGenerator get() throws ClassCastException
|
||||
{
|
||||
return backupUniversalWorldGenerators.get(ICoreDhApiWorldGenerator.class);
|
||||
return backupUniversalWorldGenerators.get(IDhApiWorldGenerator.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,17 +126,17 @@ public class WorldGeneratorInjector
|
||||
*
|
||||
* @see OverrideInjector#get(Class)
|
||||
*/
|
||||
public ICoreDhApiWorldGenerator get(ICoreDhApiLevelWrapper levelForWorldGenerator) throws ClassCastException
|
||||
public IDhApiWorldGenerator get(IDhApiLevelWrapper levelForWorldGenerator) throws ClassCastException
|
||||
{
|
||||
if (!worldGeneratorByLevelWrapper.containsKey(levelForWorldGenerator))
|
||||
{
|
||||
// no generator exists for this specific level.
|
||||
// check for a backup universal world generator
|
||||
return backupUniversalWorldGenerators.get(ICoreDhApiWorldGenerator.class);
|
||||
return backupUniversalWorldGenerators.get(IDhApiWorldGenerator.class);
|
||||
}
|
||||
|
||||
// use the existing world generator
|
||||
return worldGeneratorByLevelWrapper.get(levelForWorldGenerator).get(ICoreDhApiWorldGenerator.class);
|
||||
return worldGeneratorByLevelWrapper.get(levelForWorldGenerator).get(IDhApiWorldGenerator.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* 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.enums;
|
||||
|
||||
import com.seibel.lod.core.enums.config.CoreConfigEnumAssembly;
|
||||
import com.seibel.lod.core.enums.rendering.CoreRenderingEnumAssembly;
|
||||
import com.seibel.lod.core.enums.worldGeneration.CoreWorldGenerationEnumAssembly;
|
||||
|
||||
/**
|
||||
* Assembly classes are used to reference the package they are in.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-9-6
|
||||
*/
|
||||
public class CoreEnumAssembly
|
||||
{
|
||||
// These variables are added in order to load each package into the JVM's class loader.
|
||||
// This is done so they can be found via reflection.
|
||||
private static final CoreRenderingEnumAssembly renderingAssembly = new CoreRenderingEnumAssembly();
|
||||
private static final CoreConfigEnumAssembly configAssembly = new CoreConfigEnumAssembly();
|
||||
private static final CoreWorldGenerationEnumAssembly worldGenAssembly = new CoreWorldGenerationEnumAssembly();
|
||||
|
||||
/** All enums should have this prefix */
|
||||
public static final String ENUM_PREFIX = "E";
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user