diff --git a/api/src/main/java/com/seibel/lod/api/DhApiMain.java b/api/src/main/java/com/seibel/lod/api/DhApiMain.java index c1e790a6b..1d1632847 100644 --- a/api/src/main/java/com/seibel/lod/api/DhApiMain.java +++ b/api/src/main/java/com/seibel/lod/api/DhApiMain.java @@ -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; - } } diff --git a/api/src/main/java/com/seibel/lod/api/enums/DhApiEnumAssembly.java b/api/src/main/java/com/seibel/lod/api/enums/DhApiEnumAssembly.java deleted file mode 100644 index f27545510..000000000 --- a/api/src/main/java/com/seibel/lod/api/enums/DhApiEnumAssembly.java +++ /dev/null @@ -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 . - */ - -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"; -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/DhApiConfigEnumAssembly.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/DhApiConfigEnumAssembly.java deleted file mode 100644 index 48fd69c0d..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/DhApiConfigEnumAssembly.java +++ /dev/null @@ -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 . - */ - -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 -{ - -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiBlocksToAvoid.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiBlocksToAvoid.java deleted file mode 100644 index 5d988dce0..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiBlocksToAvoid.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * NONE,
- * NON_FULL,
- * NO_COLLISION,
- * BOTH,
- * - * @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; - } -} \ No newline at end of file diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiBufferRebuildTimes.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiBufferRebuildTimes.java deleted file mode 100644 index 74627f2f7..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiBufferRebuildTimes.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * CONSTANT
- * FREQUENT
- * NORMAL
- * RARE

- * - * Determines how fast the buffers should be regenerated - * - * @author Leonardo Amato - * @version 9-25-2021 - */ -public enum EDhApiBufferRebuildTimes -{ - CONSTANT, - FREQUENT, - NORMAL, - RARE; -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiDebugMode.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiDebugMode.java deleted file mode 100644 index 892f15ad3..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiDebugMode.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * OFF,
- * SHOW_WIREFRAME,
- * SHOW_DETAIL,
- * SHOW_DETAIL_WIREFRAME,
- * SHOW_GENMODE,
- * SHOW_GENMODE_WIREFRAME,
- * SHOW_OVERLAPPING_QUADS,
- * SHOW_OVERLAPPING_QUADS_WIREFRAME,
- * - * @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; - -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiDistanceGenerationMode.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiDistanceGenerationMode.java deleted file mode 100644 index 9bf12c2de..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiDistanceGenerationMode.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * NONE
- * BIOME_ONLY
- * BIOME_ONLY_SIMULATE_HEIGHT
- * SURFACE
- * FEATURES
- * FULL

- * - * 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.
- * Doesn't generate height, everything is shown at sea level.
- * 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.
- * 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.
- * 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.
- * Single-threaded - Slow (15-50 ms, with spikes up to 200 ms) - */ - FULL; - -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiDropoffQuality.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiDropoffQuality.java deleted file mode 100644 index e746d5a7d..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiDropoffQuality.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * AUTO
- * SMOOTH_DROPOFF
- * PERFORMANCE_FOCUSED

- * - * 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; - } - - -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiFogColorMode.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiFogColorMode.java deleted file mode 100644 index 2452fc5c5..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiFogColorMode.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * USE_DEFAULT_FOG_COLOR,
- * USE_SKY_COLOR,
- * - * @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, -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiFogDistance.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiFogDistance.java deleted file mode 100644 index 05a4575b1..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiFogDistance.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * NEAR,
- * FAR,
- * NEAR_AND_FAR
- * - * @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 -} \ No newline at end of file diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiFogDrawMode.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiFogDrawMode.java deleted file mode 100644 index 6252edb8c..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiFogDrawMode.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * USE_OPTIFINE_FOG_SETTING,
- * FOG_ENABLED,
- * FOG_DISABLED
- * - * @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; - -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiFogFalloff.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiFogFalloff.java deleted file mode 100644 index ca17b8ec3..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiFogFalloff.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.seibel.lod.api.items.enums.config; - -/** - * LINEAR,
- * EXPONENTIAL,
- * EXPONENTIAL_SQUARED
- * - * @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, -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiGenerationPriority.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiGenerationPriority.java deleted file mode 100644 index eeb0dbfb6..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiGenerationPriority.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * AUTO
- * Near_First
- * Far_First

- * - * 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 -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiGpuUploadMethod.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiGpuUploadMethod.java deleted file mode 100644 index 1e6de21c1..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiGpuUploadMethod.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * AUTO,
- * BUFFER_STORAGE,
- * SUB_DATA,
- * BUFFER_MAPPING,
- * DATA
- * - * @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.
- * Fast rendering, no stuttering. - */ - BUFFER_STORAGE, - - /** - * Backup option for NVIDIA.
- * Fast rendering but may stutter when uploading. - */ - SUB_DATA, - - /** - * Default option for AMD/Intel.
- * May end up storing buffers in System memory.
- * Fast rending if in GPU memory, slow if in system memory,
- * but won't stutter when uploading. - */ - BUFFER_MAPPING, - - /** - * Backup option for AMD/Intel.
- * Fast rendering but may stutter when uploading. - */ - DATA; - -} \ No newline at end of file diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiHeightFogMixMode.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiHeightFogMixMode.java deleted file mode 100644 index adcc05ea7..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiHeightFogMixMode.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * BASIC
- * IGNORE_HEIGHT
- * ADDITION
- * MAX
- * MULTIPLY
- * INVERSE_MULTIPLY
- * LIMITED_ADDITION
- * MULTIPLY_ADDITION
- * INVERSE_MULTIPLY_ADDITION
- * AVERAGE
- * - * @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, -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiHeightFogMode.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiHeightFogMode.java deleted file mode 100644 index f7497ee99..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiHeightFogMode.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * ABOVE_CAMERA,
- * BELOW_CAMERA,
- * ABOVE_AND_BELOW_CAMERA,
- * ABOVE_SET_HEIGHT,
- * BELOW_SET_HEIGHT,
- * ABOVE_AND_BELOW_SET_HEIGHT,
- * - * @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; - } -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiHorizontalQuality.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiHorizontalQuality.java deleted file mode 100644 index f56ad8fa8..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiHorizontalQuality.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * LOWEST
- * LOW
- * MEDIUM
- * HIGH

- * - * 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; - } -} \ No newline at end of file diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiHorizontalResolution.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiHorizontalResolution.java deleted file mode 100644 index c8c51839f..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiHorizontalResolution.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * BLOCK
- * TWO_BLOCKS
- * FOUR_BLOCKS
- * HALF_CHUNK
- * CHUNK
- * - * @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; - -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiLightGenerationMode.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiLightGenerationMode.java deleted file mode 100644 index 68516c28f..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiLightGenerationMode.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * FAST,
- * 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 -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiRendererMode.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiRendererMode.java deleted file mode 100644 index e310c8921..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiRendererMode.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * DEFAULT,
- * DEBUG,
- * DISABLED,
- * - * @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; - -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiServerFolderNameMode.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiServerFolderNameMode.java deleted file mode 100644 index b7c8ea812..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiServerFolderNameMode.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * AUTO,
- * NAME_ONLY,
- * NAME_IP,
- * NAME_IP_PORT,

- * - * 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
- * NAME_IP_PORT for all others - */ - AUTO, - - /** Only use the server name */ - NAME_ONLY, - - /** - * {SERVER_NAME} IP {IP}
- * Example: Minecraft Server IP 192.168.1.40 - */ - NAME_IP, - - /** - * {SERVER_NAME} IP {IP}:{PORT}
- * Example: Minecraft Server IP 192.168.1.40:25565 - */ - NAME_IP_PORT, - - /** - * {SERVER_NAME} IP {IP}
- * Example: Minecraft Server IP 192.168.1.40:25565 GameVersion 1.16.5

- * - * Not normally recommended, since the game version can change if the - * server installs paper or some other jar.
- * This is just here to provide backwards compatibility. - */ - NAME_IP_PORT_MC_VERSION; - -} diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiVanillaOverdraw.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiVanillaOverdraw.java deleted file mode 100644 index bfd7d62f0..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiVanillaOverdraw.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * NEVER,
- * DYNAMIC,
- * ALWAYS

- * - * 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, -} \ No newline at end of file diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiVerticalQuality.java b/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiVerticalQuality.java deleted file mode 100644 index c57d45969..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/config/EDhApiVerticalQuality.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.api.items.enums.config; - -/** - * LOW,
- * MEDIUM,
- * HIGH,
- * ULTRA
- * - * @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 - -} \ No newline at end of file diff --git a/core/src/main/java/com/seibel/lod/core/enums/rendering/ERendererMode.java b/api/src/main/java/com/seibel/lod/api/items/enums/rendering/ERendererMode.java similarity index 97% rename from core/src/main/java/com/seibel/lod/core/enums/rendering/ERendererMode.java rename to api/src/main/java/com/seibel/lod/api/items/enums/rendering/ERendererMode.java index c6dc73ca3..faa9ebae1 100644 --- a/core/src/main/java/com/seibel/lod/core/enums/rendering/ERendererMode.java +++ b/api/src/main/java/com/seibel/lod/api/items/enums/rendering/ERendererMode.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.seibel.lod.core.enums.rendering; +package com.seibel.lod.api.items.enums.rendering; /** * Default diff --git a/api/src/main/java/com/seibel/lod/api/items/enums/worldGeneration/DhApiWorldGenerationEnumAssembly.java b/api/src/main/java/com/seibel/lod/api/items/enums/worldGeneration/DhApiWorldGenerationEnumAssembly.java deleted file mode 100644 index 46ca55d09..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/enums/worldGeneration/DhApiWorldGenerationEnumAssembly.java +++ /dev/null @@ -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 . - */ - -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 -{ - -} diff --git a/api/src/main/java/com/seibel/lod/api/items/interfaces/IDhApiUnsafeWrapper.java b/api/src/main/java/com/seibel/lod/api/items/interfaces/IDhApiUnsafeWrapper.java index d228a438a..d97b1c712 100644 --- a/api/src/main/java/com/seibel/lod/api/items/interfaces/IDhApiUnsafeWrapper.java +++ b/api/src/main/java/com/seibel/lod/api/items/interfaces/IDhApiUnsafeWrapper.java @@ -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.
@@ -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(); } diff --git a/api/src/main/java/com/seibel/lod/api/items/interfaces/override/AbstractDhApiWorldGenerator.java b/api/src/main/java/com/seibel/lod/api/items/interfaces/override/AbstractDhApiWorldGenerator.java index e14f574b6..ebc66b6c4 100644 --- a/api/src/main/java/com/seibel/lod/api/items/interfaces/override/AbstractDhApiWorldGenerator.java +++ b/api/src/main/java/com/seibel/lod/api/items/interfaces/override/AbstractDhApiWorldGenerator.java @@ -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 threadModeEnumConverter = new GenericEnumConverter<>(EWorldGenThreadMode.class, EDhApiWorldGenThreadMode.class); - private final GenericEnumConverter 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)); diff --git a/api/src/main/java/com/seibel/lod/api/items/interfaces/override/IDhApiOverrideable.java b/api/src/main/java/com/seibel/lod/api/items/interfaces/override/IDhApiOverrideable.java index bddb9617f..bd0ef9c36 100644 --- a/api/src/main/java/com/seibel/lod/api/items/interfaces/override/IDhApiOverrideable.java +++ b/api/src/main/java/com/seibel/lod/api/items/interfaces/override/IDhApiOverrideable.java @@ -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.
* 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; } } diff --git a/api/src/main/java/com/seibel/lod/api/items/interfaces/override/worldGenerator/IDhApiWorldGenerator.java b/api/src/main/java/com/seibel/lod/api/items/interfaces/override/worldGenerator/IDhApiWorldGenerator.java new file mode 100644 index 000000000..62154137b --- /dev/null +++ b/api/src/main/java/com/seibel/lod/api/items/interfaces/override/worldGenerator/IDhApiWorldGenerator.java @@ -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); + +} diff --git a/api/src/main/java/com/seibel/lod/api/items/interfaces/world/IDhApiDimensionTypeWrapper.java b/api/src/main/java/com/seibel/lod/api/items/interfaces/world/IDhApiDimensionTypeWrapper.java index 36364dedf..872f20828 100644 --- a/api/src/main/java/com/seibel/lod/api/items/interfaces/world/IDhApiDimensionTypeWrapper.java +++ b/api/src/main/java/com/seibel/lod/api/items/interfaces/world/IDhApiDimensionTypeWrapper.java @@ -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(); } diff --git a/api/src/main/java/com/seibel/lod/api/items/interfaces/world/IDhApiLevelWrapper.java b/api/src/main/java/com/seibel/lod/api/items/interfaces/world/IDhApiLevelWrapper.java index 9191efe70..0409b1c9b 100644 --- a/api/src/main/java/com/seibel/lod/api/items/interfaces/world/IDhApiLevelWrapper.java +++ b/api/src/main/java/com/seibel/lod/api/items/interfaces/world/IDhApiLevelWrapper.java @@ -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; } } diff --git a/api/src/main/java/com/seibel/lod/api/items/objects/math/DhApiMat4f.java b/api/src/main/java/com/seibel/lod/api/items/objects/math/DhApiMat4f.java deleted file mode 100644 index 81301f792..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/objects/math/DhApiMat4f.java +++ /dev/null @@ -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 . - */ - -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. - *
- * 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"; - } - - -} diff --git a/api/src/main/java/com/seibel/lod/api/items/objects/wrappers/DhApiDimensionTypeWrapper.java b/api/src/main/java/com/seibel/lod/api/items/objects/wrappers/DhApiDimensionTypeWrapper.java deleted file mode 100644 index e60b17618..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/objects/wrappers/DhApiDimensionTypeWrapper.java +++ /dev/null @@ -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 . - */ - -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(); } - -} diff --git a/api/src/main/java/com/seibel/lod/api/items/objects/wrappers/DhApiLevelWrapper.java b/api/src/main/java/com/seibel/lod/api/items/objects/wrappers/DhApiLevelWrapper.java deleted file mode 100644 index 901f00abd..000000000 --- a/api/src/main/java/com/seibel/lod/api/items/objects/wrappers/DhApiLevelWrapper.java +++ /dev/null @@ -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 . - */ - -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(); } - -} diff --git a/api/src/main/java/com/seibel/lod/api/methods/config/DhApiConfig.java b/api/src/main/java/com/seibel/lod/api/methods/config/DhApiConfig.java index 63e983adc..6cdc6ab93 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/config/DhApiConfig.java +++ b/api/src/main/java/com/seibel/lod/api/methods/config/DhApiConfig.java @@ -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 implements IDhApiConfig { - private final ConfigEntry configEntry; + private final IConfigEntry configEntry; private final IConverter configConverter; @@ -30,7 +30,7 @@ public class DhApiConfig implements IDhApiConfig * Uses the default object converter, this requires coreType and apiType to be the same. */ @SuppressWarnings("unchecked") // DefaultConverter's cast is safe - public DhApiConfig(ConfigEntry newConfigEntry) + public DhApiConfig(IConfigEntry newConfigEntry) { this.configEntry = newConfigEntry; this.configConverter = (IConverter) new DefaultConverter(); @@ -40,7 +40,7 @@ public class DhApiConfig implements IDhApiConfig * This constructor should only be called internally.
* There is no reason for API users to create this object.

*/ - public DhApiConfig(ConfigEntry newConfigEntry, IConverter newConverter) + public DhApiConfig(IConfigEntry newConfigEntry, IConverter newConverter) { this.configEntry = newConfigEntry; this.configConverter = newConverter; @@ -53,7 +53,7 @@ public class DhApiConfig implements IDhApiConfig 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 implements IDhApiConfig } } - 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()); } diff --git a/api/src/main/java/com/seibel/lod/api/methods/events/DhApiEventRegister.java b/api/src/main/java/com/seibel/lod/api/methods/events/DhApiEventRegister.java index bac209f8f..447dd2285 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/events/DhApiEventRegister.java +++ b/api/src/main/java/com/seibel/lod/api/methods/events/DhApiEventRegister.java @@ -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 eventInterface, ICoreDhApiEvent eventHandlerImplementation) + public static DhApiResult on(Class 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 eventInterface, Class eventHandlerClass) + public static DhApiResult off(Class eventInterface, Class 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() + "]."); - } +// } } } diff --git a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiAfterDhInitEvent.java b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiAfterDhInitEvent.java index 03d63c0f3..ba576877d 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiAfterDhInitEvent.java +++ b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiAfterDhInitEvent.java @@ -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 + implements IDhApiEvent { /** Fired after Distant Horizons finishes its initial setup on Minecraft startup. */ public abstract void afterDistantHorizonsInit(); diff --git a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiAfterRenderEvent.java b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiAfterRenderEvent.java index 6e711e8d8..700dd9065 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiAfterRenderEvent.java +++ b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiAfterRenderEvent.java @@ -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 + implements IDhApiEvent { /** 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); + } } } \ No newline at end of file diff --git a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiBeforeDhInitEvent.java b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiBeforeDhInitEvent.java index a07f13245..c50f3fdc8 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiBeforeDhInitEvent.java +++ b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiBeforeDhInitEvent.java @@ -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 + implements IDhApiEvent { /** Fired before Distant Horizons starts its initial setup on Minecraft startup. */ public abstract void beforeDistantHorizonsInit(); diff --git a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiBeforeRenderEvent.java b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiBeforeRenderEvent.java index 37bd31af1..8bdb4698a 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiBeforeRenderEvent.java +++ b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiBeforeRenderEvent.java @@ -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 + implements IDhApiEvent { /** * 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); + } } } \ No newline at end of file diff --git a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiLevelLoadEvent.java b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiLevelLoadEvent.java index ab678bb4a..2d5f147e7 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiLevelLoadEvent.java +++ b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiLevelLoadEvent.java @@ -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 + implements IDhApiEvent { /** 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; } } } \ No newline at end of file diff --git a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiLevelSaveEvent.java b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiLevelSaveEvent.java index f241a62c2..e64675489 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiLevelSaveEvent.java +++ b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiLevelSaveEvent.java @@ -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 + implements IDhApiEvent { /** 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; } } } \ No newline at end of file diff --git a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiLevelUnloadEvent.java b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiLevelUnloadEvent.java index 1e2673519..30c8ee0d4 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiLevelUnloadEvent.java +++ b/api/src/main/java/com/seibel/lod/api/methods/events/abstractEvents/DhApiLevelUnloadEvent.java @@ -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 +public abstract class DhApiLevelUnloadEvent + implements IDhApiEvent { /** 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; } } } \ No newline at end of file diff --git a/api/src/main/java/com/seibel/lod/api/methods/events/interfaces/IDhApiEvent.java b/api/src/main/java/com/seibel/lod/api/methods/events/interfaces/IDhApiEvent.java index 60a4c25ff..0d1ea70ef 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/events/interfaces/IDhApiEvent.java +++ b/api/src/main/java/com/seibel/lod/api/methods/events/interfaces/IDhApiEvent.java @@ -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 This is the datatype that will be passed into the - * event handler's method. - * @param This is the datatype that will be passed in from Core - * when the event is fired. + * @param This is the datatype that will be passed into the event handler's method. * * @author James Seibel * @version 2022-9-6 */ -public interface IDhApiEvent extends ICoreDhApiEvent, IBindable +public interface IDhApiEvent extends IBindable { + //==========// + // external // + //==========// + /** * Returns if the event should be automatically unbound * after firing.
@@ -24,7 +24,25 @@ public interface IDhApiEvent 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); + } diff --git a/api/src/main/java/com/seibel/lod/api/methods/events/sharedParameterObjects/DhApiRenderParam.java b/api/src/main/java/com/seibel/lod/api/methods/events/sharedParameterObjects/DhApiRenderParam.java index f9d799e93..db5d29545 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/events/sharedParameterObjects/DhApiRenderParam.java +++ b/api/src/main/java/com/seibel/lod/api/methods/events/sharedParameterObjects/DhApiRenderParam.java @@ -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; } } diff --git a/api/src/main/java/com/seibel/lod/api/override/DhApiWorldGeneratorOverrideRegister.java b/api/src/main/java/com/seibel/lod/api/override/DhApiWorldGeneratorOverrideRegister.java index 38333e5f0..646994bb8 100644 --- a/api/src/main/java/com/seibel/lod/api/override/DhApiWorldGeneratorOverrideRegister.java +++ b/api/src/main/java/com/seibel/lod/api/override/DhApiWorldGeneratorOverrideRegister.java @@ -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.

@@ -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()); +// } +// } } diff --git a/core/src/main/java/com/seibel/lod/core/ModInfo.java b/api/src/main/java/com/seibel/lod/core/ModInfo.java similarity index 100% rename from core/src/main/java/com/seibel/lod/core/ModInfo.java rename to api/src/main/java/com/seibel/lod/core/ModInfo.java diff --git a/core/src/main/java/com/seibel/lod/core/dependencyInjection/IBindable.java b/api/src/main/java/com/seibel/lod/core/dependencyInjection/IBindable.java similarity index 100% rename from core/src/main/java/com/seibel/lod/core/dependencyInjection/IBindable.java rename to api/src/main/java/com/seibel/lod/core/dependencyInjection/IBindable.java diff --git a/api/src/main/java/com/seibel/lod/core/dependencyInjection/IDependencyInjector.java b/api/src/main/java/com/seibel/lod/core/dependencyInjection/IDependencyInjector.java new file mode 100644 index 000000000..b02272025 --- /dev/null +++ b/api/src/main/java/com/seibel/lod/core/dependencyInjection/IDependencyInjector.java @@ -0,0 +1,75 @@ +package com.seibel.lod.core.dependencyInjection; + + +import java.util.ArrayList; + +public interface IDependencyInjector +{ + + /** + * 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 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.
+ * See {@link #get(Class, boolean) get(Class, boolean)} for full documentation. + * + * @see #get(Class, boolean) + */ + @SuppressWarnings("unchecked") + T get(Class interfaceClass) throws ClassCastException; + + /** + * Returns all dependencies of type T that have been bound.
+ * Returns an empty list if no dependencies have been bound. + * + * @param 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) + */ + ArrayList getAll(Class interfaceClass) throws ClassCastException; + + /** + * Returns a dependency of type T if one has been bound.
+ * Returns null if a dependency hasn't been bound.

+ * + * If the handler's {@link #allowDuplicateBindings} is true this returns the first bound dependency. + * + * @param 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 get(Class interfaceClass, boolean allowIncompleteDependencies) throws ClassCastException; + + + + /** Removes all bound dependencies. */ + public void clear(); + + + + /** Runs delayed setup for any dependencies that require it. */ + void runDelayedSetup(); +} diff --git a/api/src/main/java/com/seibel/lod/core/dependencyInjection/IOverrideInjector.java b/api/src/main/java/com/seibel/lod/core/dependencyInjection/IOverrideInjector.java new file mode 100644 index 000000000..3adc2f7d8 --- /dev/null +++ b/api/src/main/java/com/seibel/lod/core/dependencyInjection/IOverrideInjector.java @@ -0,0 +1,56 @@ +package com.seibel.lod.core.dependencyInjection; + + +import com.seibel.lod.api.items.interfaces.override.IDhApiOverrideable; + +public interface IOverrideInjector +{ + /** + * All core overrides should have this priority.
+ * 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 dependencyInterface, IDhApiOverrideable dependencyImplementation) throws IllegalStateException, IllegalArgumentException; + + /** + * Returns the bound dependency with the highest priority.
+ * See {@link IDependencyInjector#get(Class, boolean) get(Class, boolean)} for full documentation. + * + * @see IDependencyInjector#get(Class, boolean) + */ + T get(Class interfaceClass) throws ClassCastException; + + /** + * Returns a dependency of type T with the specified priority if one has been bound.
+ * If there is a dependency, but it was bound with a different priority this will return null.

+ * + * See {@link IDependencyInjector#get(Class, boolean) get(Class, boolean)} for more documentation. + * + * @see IDependencyInjector#get(Class, boolean) + */ + T get(Class interfaceClass, int priority) throws ClassCastException; + + + + /** Removes all bound overrides. */ + void clear(); + + +} diff --git a/api/src/main/java/com/seibel/lod/core/interfaces/config/IConfigEntry.java b/api/src/main/java/com/seibel/lod/core/interfaces/config/IConfigEntry.java new file mode 100644 index 000000000..35f361e88 --- /dev/null +++ b/api/src/main/java/com/seibel/lod/core/interfaces/config/IConfigEntry.java @@ -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 +{ + + /** 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); + +} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/config/IConverter.java b/api/src/main/java/com/seibel/lod/core/interfaces/config/IConverter.java similarity index 83% rename from core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/config/IConverter.java rename to api/src/main/java/com/seibel/lod/core/interfaces/config/IConverter.java index 6a7d7f674..ec72c638e 100644 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/config/IConverter.java +++ b/api/src/main/java/com/seibel/lod/core/interfaces/config/IConverter.java @@ -1,4 +1,4 @@ -package com.seibel.lod.core.api.external.coreImplementations.interfaces.config; +package com.seibel.lod.core.interfaces.config; /** diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/converters/DefaultConverter.java b/api/src/main/java/com/seibel/lod/core/interfaces/config/converters/DefaultConverter.java similarity index 70% rename from core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/converters/DefaultConverter.java rename to api/src/main/java/com/seibel/lod/core/interfaces/config/converters/DefaultConverter.java index 846512a7b..134954f74 100644 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/converters/DefaultConverter.java +++ b/api/src/main/java/com/seibel/lod/core/interfaces/config/converters/DefaultConverter.java @@ -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; /** diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/converters/RenderModeEnabledConverter.java b/api/src/main/java/com/seibel/lod/core/interfaces/config/converters/RenderModeEnabledConverter.java similarity index 68% rename from core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/converters/RenderModeEnabledConverter.java rename to api/src/main/java/com/seibel/lod/core/interfaces/config/converters/RenderModeEnabledConverter.java index 86edf9c92..e43d9ae0f 100644 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/converters/RenderModeEnabledConverter.java +++ b/api/src/main/java/com/seibel/lod/core/interfaces/config/converters/RenderModeEnabledConverter.java @@ -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. diff --git a/api/src/main/java/com/seibel/lod/core/util/MathUtil.java b/api/src/main/java/com/seibel/lod/core/util/MathUtil.java new file mode 100644 index 000000000..d232be9fc --- /dev/null +++ b/api/src/main/java/com/seibel/lod/core/util/MathUtil.java @@ -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;} + + +} diff --git a/core/src/main/java/com/seibel/lod/core/util/math/Mat4f.java b/api/src/main/java/com/seibel/lod/core/util/math/Mat4f.java similarity index 100% rename from core/src/main/java/com/seibel/lod/core/util/math/Mat4f.java rename to api/src/main/java/com/seibel/lod/core/util/math/Mat4f.java diff --git a/core/src/main/java/com/seibel/lod/core/util/math/Vec3d.java b/api/src/main/java/com/seibel/lod/core/util/math/Vec3d.java similarity index 97% rename from core/src/main/java/com/seibel/lod/core/util/math/Vec3d.java rename to api/src/main/java/com/seibel/lod/core/util/math/Vec3d.java index 403a4f03f..992d35264 100644 --- a/core/src/main/java/com/seibel/lod/core/util/math/Vec3d.java +++ b/api/src/main/java/com/seibel/lod/core/util/math/Vec3d.java @@ -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) diff --git a/core/src/main/java/com/seibel/lod/core/util/math/Vec3f.java b/api/src/main/java/com/seibel/lod/core/util/math/Vec3f.java similarity index 96% rename from core/src/main/java/com/seibel/lod/core/util/math/Vec3f.java rename to api/src/main/java/com/seibel/lod/core/util/math/Vec3f.java index b9e308023..4c50f1a92 100644 --- a/core/src/main/java/com/seibel/lod/core/util/math/Vec3f.java +++ b/api/src/main/java/com/seibel/lod/core/util/math/Vec3f.java @@ -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; diff --git a/core/src/main/java/com/seibel/lod/core/util/math/Vec3i.java b/api/src/main/java/com/seibel/lod/core/util/math/Vec3i.java similarity index 95% rename from core/src/main/java/com/seibel/lod/core/util/math/Vec3i.java rename to api/src/main/java/com/seibel/lod/core/util/math/Vec3i.java index 2c27c11a6..dc0d2c6a2 100644 --- a/core/src/main/java/com/seibel/lod/core/util/math/Vec3i.java +++ b/api/src/main/java/com/seibel/lod/core/util/math/Vec3i.java @@ -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) diff --git a/api/src/test/java/testItems/events/abstractObjects/DhApiTestEvent.java b/api/src/test/java/testItems/events/abstractObjects/DhApiTestEvent.java index 82fa1cd28..8952cb2d6 100644 --- a/api/src/test/java/testItems/events/abstractObjects/DhApiTestEvent.java +++ b/api/src/test/java/testItems/events/abstractObjects/DhApiTestEvent.java @@ -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 + implements IDhApiEvent { public abstract void onTestEvent(Boolean input); + /** just used for testing */ + public abstract boolean getTestValue(); + + //=========================// // internal DH API methods // diff --git a/api/src/test/java/tests/ApiEnumSyncTests.java b/api/src/test/java/tests/ApiEnumSyncTests.java deleted file mode 100644 index 40ed41aaf..000000000 --- a/api/src/test/java/tests/ApiEnumSyncTests.java +++ /dev/null @@ -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 . - */ - -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>> apiEnumClassList = new ArrayList<>(); - ArrayList apiConfigEnumPackageNames = EnumTestHelper.findPackageNamesStartingWith(DhApiEnumAssembly.class.getPackage().getName()); - for (String apiEnumPackageName : apiConfigEnumPackageNames) - { - apiEnumClassList.addAll(EnumTestHelper.getAllEnumsFromPackage(apiEnumPackageName)); - } - - - // get the list of core enums - ArrayList>> coreEnumClassList = new ArrayList<>(); - ArrayList 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> 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> 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); - } - } - -} diff --git a/api/src/test/java/tests/EnumTestHelper.java b/api/src/test/java/tests/EnumTestHelper.java deleted file mode 100644 index 9555f5b03..000000000 --- a/api/src/test/java/tests/EnumTestHelper.java +++ /dev/null @@ -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 . - */ - -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>> getAllEnumsFromPackage(String packageFullName) - { - ArrayList>> enumList = new ArrayList<>(); - List> 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>) clazz); - } - else - { - System.out.println("The Class [" + clazz + "] isn't an enum."); - } - } - } - - return enumList; - } - - /** - * Returns every class in the given package.

- * - * 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> getClassesInPackage(String packageName, boolean onlySearchJars, String expectedJarPathString) - { - String path = packageName.replace('.', '/'); - List> 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.
- * - * 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 findPackageNamesStartingWith(String packagePrefix) - { - ArrayList 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; - } - -} diff --git a/api/src/test/java/tests/EventInjectorTest.java b/api/src/test/java/tests/EventInjectorTest.java index e881d4a1b..4888aa9fa 100644 --- a/api/src/test/java/tests/EventInjectorTest.java +++ b/api/src/test/java/tests/EventInjectorTest.java @@ -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 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 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()); +// +// } } diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/events/ICoreDhApiEvent.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/events/ICoreDhApiEvent.java deleted file mode 100644 index 0280ec631..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/events/ICoreDhApiEvent.java +++ /dev/null @@ -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 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 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.
- * Can be useful for one time setup events or waiting for a specific game state.

- * - * Defaults to False (the event will not be removed after firing). - */ - boolean removeAfterFiring(); - -} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/override/ICoreDhApiOverrideable.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/override/ICoreDhApiOverrideable.java deleted file mode 100644 index b135d7f85..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/override/ICoreDhApiOverrideable.java +++ /dev/null @@ -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.
- * For most developers this can be left at the default. - */ - default int getPriority() { return OverrideInjector.DEFAULT_NON_CORE_OVERRIDE_PRIORITY; } - -} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/override/worldGenerator/ICoreDhApiWorldGenerator.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/override/worldGenerator/ICoreDhApiWorldGenerator.java deleted file mode 100644 index 41cbc1d33..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/override/worldGenerator/ICoreDhApiWorldGenerator.java +++ /dev/null @@ -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); - -} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/wrappers/ICoreDhApiUnsafeWrapper.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/wrappers/ICoreDhApiUnsafeWrapper.java deleted file mode 100644 index 1590734fa..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/wrappers/ICoreDhApiUnsafeWrapper.java +++ /dev/null @@ -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.
- * Warning: This object will be Minecraft - * version dependent and may change without notice.

- * - * In order to cast this object to something usable, you may want - * to use obj.getClass() 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(); - -} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/wrappers/world/ICoreDhApiDimensionTypeWrapper.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/wrappers/world/ICoreDhApiDimensionTypeWrapper.java deleted file mode 100644 index 017ab88ff..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/wrappers/world/ICoreDhApiDimensionTypeWrapper.java +++ /dev/null @@ -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 . - */ - -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(); -} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/wrappers/world/ICoreDhApiLevelWrapper.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/wrappers/world/ICoreDhApiLevelWrapper.java deleted file mode 100644 index edc261399..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/interfaces/wrappers/world/ICoreDhApiLevelWrapper.java +++ /dev/null @@ -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 . - */ - -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; } - -} diff --git a/api/src/main/java/com/seibel/lod/api/methods/config/Readme.md b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/Readme.md similarity index 100% rename from api/src/main/java/com/seibel/lod/api/methods/config/Readme.md rename to core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/Readme.md diff --git a/api/src/main/java/com/seibel/lod/api/methods/config/both/DhApiWorldGeneration.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/both/DhApiWorldGeneration.java similarity index 61% rename from api/src/main/java/com/seibel/lod/api/methods/config/both/DhApiWorldGeneration.java rename to core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/both/DhApiWorldGeneration.java index 9af167821..49a9123e2 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/config/both/DhApiWorldGeneration.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/both/DhApiWorldGeneration.java @@ -17,13 +17,9 @@ * along with this program. If not, see . */ -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 getEnableDistantWorldGenerationConfig() - { return new DhApiConfig(WorldGenerator.enableDistantGeneration); } + { return new DhApiConfig<>(WorldGenerator.enableDistantGeneration); } /** Defines to what level fake chunks will be generated. */ - public static IDhApiConfig getDistantGeneratorDetailLevelConfig() - { return new DhApiConfig(WorldGenerator.distanceGenerationMode, new GenericEnumConverter<>(EDistanceGenerationMode.class, EDhApiDistanceGenerationMode.class)); } + public static IDhApiConfig getDistantGeneratorDetailLevelConfig() + { return new DhApiConfig<>(WorldGenerator.distanceGenerationMode); } /** Defines how generated fake chunks will be lit. */ - public static IDhApiConfig getLightingModeConfig() - { return new DhApiConfig(WorldGenerator.lightGenerationMode, new GenericEnumConverter<>(ELightGenerationMode.class, EDhApiLightGenerationMode.class)); } + public static IDhApiConfig getLightingModeConfig() + { return new DhApiConfig<>(WorldGenerator.lightGenerationMode); } /** Defines the order in which fake chunks will be generated. */ - public static IDhApiConfig getGenerationPriorityConfig() - { return new DhApiConfig(WorldGenerator.generationPriority, new GenericEnumConverter<>(EGenerationPriority.class, EDhApiLightGenerationMode.class)); } + public static IDhApiConfig 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 getBlocksToAvoidConfig() - { return new DhApiConfig(WorldGenerator.blocksToAvoid, new GenericEnumConverter<>(EBlocksToAvoid.class, EDhApiBlocksToAvoid.class)); } + public static IDhApiConfig getBlocksToAvoidConfig() + { return new DhApiConfig<>(WorldGenerator.blocksToAvoid); } /** * Defines if the color of avoided blocks will color the block below them.
@@ -82,7 +78,7 @@ public class DhApiWorldGeneration */ @Deprecated public static IDhApiConfig getTintWithAvoidedBlocksConfig() - { return new DhApiConfig(WorldGenerator.tintWithAvoidedBlocks); } + { return new DhApiConfig<>(WorldGenerator.tintWithAvoidedBlocks); } } diff --git a/api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiBuffers.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiBuffers.java similarity index 74% rename from api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiBuffers.java rename to core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiBuffers.java index 34d1fbecb..f5e4402bc 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiBuffers.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiBuffers.java @@ -17,11 +17,9 @@ * along with this program. If not, see . */ -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 getGpuUploadMethodConfig() - { return new DhApiConfig(Buffers.gpuUploadMethod, new GenericEnumConverter<>(EGpuUploadMethod.class, EDhApiGpuUploadMethod.class)); } + public static IDhApiConfig 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 getBufferUploadTimeoutPerMegabyteInMillisecondsConfig() - { return new DhApiConfig(Buffers.gpuUploadPerMegabyteInMilliseconds); } + { return new DhApiConfig<>(Buffers.gpuUploadPerMegabyteInMilliseconds); } } diff --git a/api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiDebugging.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiDebugging.java similarity index 72% rename from api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiDebugging.java rename to core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiDebugging.java index 929ead609..402ff1ff9 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiDebugging.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiDebugging.java @@ -17,11 +17,9 @@ * along with this program. If not, see . */ -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 getDebugRenderModeConfig() - { return new DhApiConfig(Debugging.debugMode, new GenericEnumConverter<>(EDebugMode.class, EDhApiDebugMode.class)); } + public static IDhApiConfig getDebugRenderModeConfig() + { return new DhApiConfig<>(Debugging.debugMode); } /** If enabled debug keybindings can be used. */ public static IDhApiConfig getEnableDebugKeybindingsConfig() - { return new DhApiConfig(Debugging.enableDebugKeybindings); } + { return new DhApiConfig<>(Debugging.enableDebugKeybindings); } } diff --git a/api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiGraphics.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiGraphics.java similarity index 63% rename from api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiGraphics.java rename to core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiGraphics.java index 324091350..70b032ee4 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiGraphics.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiGraphics.java @@ -17,16 +17,14 @@ * along with this program. If not, see . */ -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 getChunkRenderDistanceConfig() - { return new DhApiConfig(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 getRenderingModeConfig() - { return new DhApiConfig(Debugging.rendererMode, new GenericEnumConverter<>(ERendererMode.class, EDhApiRendererMode.class)); } + public static IDhApiConfig 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 getMaxDetailLevelConfig() - { return new DhApiConfig(Quality.drawResolution, new GenericEnumConverter<>(EHorizontalResolution.class, EDhApiHorizontalResolution.class)); } + public static IDhApiConfig getMaxDetailLevelConfig() + { return new DhApiConfig<>(Quality.drawResolution); } /** Defines how detailed fake chunks are in the vertical direction */ - public static IDhApiConfig getVerticalQualityConfig() - { return new DhApiConfig(Quality.verticalQuality, new GenericEnumConverter<>(EVerticalQuality.class, EDhApiVerticalQuality.class)); } + public static IDhApiConfig getVerticalQualityConfig() + { return new DhApiConfig<>(Quality.verticalQuality); } /** Modifies the quadratic function fake chunks use for horizontal quality drop-off. */ - public static IDhApiConfig getHorizontalQualityDropoffConfig() - { return new DhApiConfig(Quality.horizontalQuality, new GenericEnumConverter<>(EHorizontalQuality.class, EDhApiHorizontalQuality.class)); } + public static IDhApiConfig getHorizontalQualityDropoffConfig() + { return new DhApiConfig<>(Quality.horizontalQuality); } /** * The same as vanilla Minecraft's biome blending.

@@ -95,7 +93,7 @@ public class DhApiGraphics * ...
*/ public static IDhApiConfig getBiomeBlendingConfig() - { return new DhApiConfig(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 getDisableDirectionalCullingConfig() - { return new DhApiConfig(AdvancedGraphics.disableDirectionalCulling); } + { return new DhApiConfig<>(AdvancedGraphics.disableDirectionalCulling); } /** Determines how fake chunks are rendered in comparison to vanilla MC's chunks. */ - public static IDhApiConfig getVanillaOverdrawConfig() - { return new DhApiConfig(AdvancedGraphics.vanillaOverdraw, new GenericEnumConverter<>(EVanillaOverdraw.class, EDhApiVanillaOverdraw.class)); } + public static IDhApiConfig getVanillaOverdrawConfig() + { return new DhApiConfig<>(AdvancedGraphics.vanillaOverdraw); } /** Modifies how far the vanilla overdraw is rendered in chunks. */ public static IDhApiConfig getVanillaOverdrawOffsetConfig() - { return new DhApiConfig(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 getUseExtendedNearClipPlaneConfig() - { return new DhApiConfig(AdvancedGraphics.useExtendedNearClipPlane); } + { return new DhApiConfig<>(AdvancedGraphics.useExtendedNearClipPlane); } /** * Modifies how bright fake chunks are.
* This is done when generating the vertex data and is applied before any shaders. */ public static IDhApiConfig getBrightnessMultiplierConfig() - { return new DhApiConfig(AdvancedGraphics.brightnessMultiplier); } + { return new DhApiConfig<>(AdvancedGraphics.brightnessMultiplier); } /** * Modifies how saturated fake chunks are.
* This is done when generating the vertex data and is applied before any shaders. */ public static IDhApiConfig getSaturationMultiplierConfig() - { return new DhApiConfig(AdvancedGraphics.saturationMultiplier); } + { return new DhApiConfig<>(AdvancedGraphics.saturationMultiplier); } /** Defines if Distant Horizons should attempt to cull fake chunk cave geometry. */ public static IDhApiConfig getCaveCullingEnabledConfig() - { return new DhApiConfig(AdvancedGraphics.enableCaveCulling); } + { return new DhApiConfig<>(AdvancedGraphics.enableCaveCulling); } /** Defines what height cave culling should be used below if enabled. */ public static IDhApiConfig getCaveCullingHeightConfig() - { return new DhApiConfig(AdvancedGraphics.caveCullingHeight); } + { return new DhApiConfig<>(AdvancedGraphics.caveCullingHeight); } /** This ratio is relative to Earth's real world curvature. */ public static IDhApiConfig getEarthCurvatureRatioConfig() - { return new DhApiConfig(AdvancedGraphics.earthCurveRatio); } + { return new DhApiConfig<>(AdvancedGraphics.earthCurveRatio); } /** If enabled vanilla chunk rendering is disabled and only fake chunks are rendered. */ public static IDhApiConfig getEnableLodOnlyModeConfig() - { return new DhApiConfig(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 getGeometryRebuildFrequencyConfig() - { return new DhApiConfig(Config.Client.Advanced.Buffers.rebuildTimes, new GenericEnumConverter<>(EBufferRebuildTimes.class, EDhApiBufferRebuildTimes.class)); } + public static IDhApiConfig getGeometryRebuildFrequencyConfig() + { return new DhApiConfig<>(Config.Client.Advanced.Buffers.rebuildTimes); } diff --git a/api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiGraphicsFog.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiGraphicsFog.java similarity index 59% rename from api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiGraphicsFog.java rename to core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiGraphicsFog.java index 40ff7725f..713f906ff 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiGraphicsFog.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiGraphicsFog.java @@ -17,11 +17,9 @@ * along with this program. If not, see . */ -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 getFogDistanceConfig() - { return new DhApiConfig(FogQuality.fogDistance, new GenericEnumConverter<>(EFogDistance.class, EDhApiFogDistance.class)); } + public static IDhApiConfig getFogDistanceConfig() + { return new DhApiConfig<>(FogQuality.fogDistance); } /** Should be used to enable/disable fog rendering. */ - public static IDhApiConfig getFogRenderConfig() - { return new DhApiConfig(FogQuality.fogDrawMode, new GenericEnumConverter<>(EFogDrawMode.class, EDhApiFogDrawMode.class)); } + public static IDhApiConfig getFogRenderConfig() + { return new DhApiConfig<>(FogQuality.fogDrawMode); } /** Can be used to enable support with mods that change vanilla MC's fog color. */ - public static IDhApiConfig getFogColorConfig() - { return new DhApiConfig(FogQuality.fogColorMode, new GenericEnumConverter<>(EFogColorMode.class, EDhApiFogColorMode.class)); } + public static IDhApiConfig getFogColorConfig() + { return new DhApiConfig<>(FogQuality.fogColorMode); } /** * If enabled attempts to disable vanilla MC's fog on real chunks.
* May not play nice with other fog editing mods. */ public static IDhApiConfig getDisableVanillaFogConfig() - { return new DhApiConfig(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
*/ public static IDhApiConfig getFogStartDistanceConfig() - { return new DhApiConfig(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
*/ public static IDhApiConfig getFogEndDistanceConfig() - { return new DhApiConfig(FogQuality.AdvancedFog.farFogEnd); } + { return new DhApiConfig<>(FogQuality.AdvancedFog.farFogEnd); } /** Defines how opaque the fog is at its thinnest point. */ public static IDhApiConfig getFogMinThicknessConfig() - { return new DhApiConfig(FogQuality.AdvancedFog.farFogMin); } + { return new DhApiConfig<>(FogQuality.AdvancedFog.farFogMin); } /** Defines how opaque the fog is at its thickest point. */ public static IDhApiConfig getFogMaxThicknessConfig() - { return new DhApiConfig(FogQuality.AdvancedFog.farFogMax); } + { return new DhApiConfig<>(FogQuality.AdvancedFog.farFogMax); } /** Defines how the fog changes in thickness. */ - public static IDhApiConfig getFogFalloffConfig() - { return new DhApiConfig(FogQuality.AdvancedFog.farFogType, new GenericEnumConverter<>(EFogFalloff.class, EDhApiFogFalloff.class)); } + public static IDhApiConfig getFogFalloffConfig() + { return new DhApiConfig<>(FogQuality.AdvancedFog.farFogType); } /** Defines the fog density. */ public static IDhApiConfig getFogDensityConfig() - { return new DhApiConfig(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 getHeightFogMixModeConfig() - { return new DhApiConfig(FogQuality.AdvancedFog.HeightFog.heightFogMixMode, new GenericEnumConverter<>(EHeightFogMixMode.class, EDhApiHeightFogMixMode.class)); } + public static IDhApiConfig getHeightFogMixModeConfig() + { return new DhApiConfig<>(FogQuality.AdvancedFog.HeightFog.heightFogMixMode); } /** Defines how the height fog is drawn relative to the camera or world. */ - public static IDhApiConfig getHeightFogModeConfig() - { return new DhApiConfig(FogQuality.AdvancedFog.HeightFog.heightFogMode, new GenericEnumConverter<>(EHeightFogMode.class, EDhApiHeightFogMode.class)); } + public static IDhApiConfig 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 getHeightFogBaseHeightConfig() - { return new DhApiConfig(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 getHeightFogStartingHeightPercentConfig() - { return new DhApiConfig(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 getHeightFogEndingHeightPercentConfig() - { return new DhApiConfig(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 getHeightFogMinThicknessConfig() - { return new DhApiConfig(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 getHeightFogMaxThicknessConfig() - { return new DhApiConfig(FogQuality.AdvancedFog.HeightFog.heightFogMax); } + { return new DhApiConfig<>(FogQuality.AdvancedFog.HeightFog.heightFogMax); } /** Defines how the height fog changes in thickness. */ - public static IDhApiConfig getHeightFogFalloffConfig() - { return new DhApiConfig(FogQuality.AdvancedFog.HeightFog.heightFogType, new GenericEnumConverter<>(EFogFalloff.class, EDhApiFogFalloff.class)); } + public static IDhApiConfig getHeightFogFalloffConfig() + { return new DhApiConfig<>(FogQuality.AdvancedFog.HeightFog.heightFogType); } /** Defines the height fog's density. */ public static IDhApiConfig getHeightFogDensityConfig() - { return new DhApiConfig(FogQuality.AdvancedFog.HeightFog.heightFogDensity); } + { return new DhApiConfig<>(FogQuality.AdvancedFog.HeightFog.heightFogDensity); } } diff --git a/api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiMultiplayer.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiMultiplayer.java similarity index 75% rename from api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiMultiplayer.java rename to core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiMultiplayer.java index 71a5da008..9f17721da 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiMultiplayer.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiMultiplayer.java @@ -17,11 +17,9 @@ * along with this program. If not, see . */ -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.
* Note: Changing this while connected to a multiplayer world will cause undefined behavior! */ - public static IDhApiConfig getFolderSavingModeConfig() - { return new DhApiConfig(Multiplayer.serverFolderNameMode, new GenericEnumConverter<>(EServerFolderNameMode.class, EDhApiServerFolderNameMode.class)); } + public static IDhApiConfig 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 getMultiverseSimilarityRequirementConfig() - { return new DhApiConfig(Multiplayer.multiDimensionRequiredSimilarity); } + { return new DhApiConfig<>(Multiplayer.multiDimensionRequiredSimilarity); } } diff --git a/api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiThreading.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiThreading.java similarity index 96% rename from api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiThreading.java rename to core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiThreading.java index dea0b8349..190cd6d9e 100644 --- a/api/src/main/java/com/seibel/lod/api/methods/config/client/DhApiThreading.java +++ b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/methods/config/client/DhApiThreading.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -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; diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/converters/GenericEnumConverter.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/converters/GenericEnumConverter.java deleted file mode 100644 index 5ace88ac0..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/converters/GenericEnumConverter.java +++ /dev/null @@ -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, apiEnum extends Enum> implements IConverter -{ - private final Class apiCoreType; - private final Class apiEnumClass; - - - public GenericEnumConverter(Class newCoreEnumClass, Class 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.
- * 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.

- * - * Original source: https://stackoverflow.com/questions/25487619/java-generic-function-to-parse-enums-from-strings - */ - private static > E parseEnum(String str, Class enumClass) - { - return Enum.valueOf(enumClass, str); - } - -} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiAfterDhInitEvent.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiAfterDhInitEvent.java deleted file mode 100644 index cce54aff9..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiAfterDhInitEvent.java +++ /dev/null @@ -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 -{ - -} \ No newline at end of file diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiAfterRenderEvent.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiAfterRenderEvent.java deleted file mode 100644 index cc0decb5b..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiAfterRenderEvent.java +++ /dev/null @@ -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 -{ - - //==================// - // parameter object // - //==================// - - public static class CoreEventParam extends CoreDhApiRenderParam - { - public CoreEventParam(CoreDhApiRenderParam dhApiRenderParam) - { - super(dhApiRenderParam.mcProjectionMatrix, dhApiRenderParam.mcModelViewMatrix, - dhApiRenderParam.dhProjectionMatrix, dhApiRenderParam.dhModelViewMatrix, - dhApiRenderParam.partialTicks); - } - } - -} \ No newline at end of file diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiBeforeDhInitEvent.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiBeforeDhInitEvent.java deleted file mode 100644 index 60d1b0410..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiBeforeDhInitEvent.java +++ /dev/null @@ -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 -{ - -} \ No newline at end of file diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiBeforeRenderEvent.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiBeforeRenderEvent.java deleted file mode 100644 index aa7d5295a..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiBeforeRenderEvent.java +++ /dev/null @@ -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 -{ - - //==================// - // parameter object // - //==================// - - public static class CoreEventParam extends CoreDhApiRenderParam - { - public CoreEventParam(CoreDhApiRenderParam dhApiRenderParam) - { - super(dhApiRenderParam.mcProjectionMatrix, dhApiRenderParam.mcModelViewMatrix, - dhApiRenderParam.dhProjectionMatrix, dhApiRenderParam.dhModelViewMatrix, - dhApiRenderParam.partialTicks); - } - } - -} \ No newline at end of file diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiLevelLoadEvent.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiLevelLoadEvent.java deleted file mode 100644 index 9d61dd2ca..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiLevelLoadEvent.java +++ /dev/null @@ -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 -{ - - //==================// - // parameter object // - //==================// - - public static class CoreEventParam - { - /** The newly loaded level. */ - public final ILevelWrapper levelWrapper; - - - public CoreEventParam(ILevelWrapper newLevelWrapper) - { - this.levelWrapper = newLevelWrapper; - } - } - -} \ No newline at end of file diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiLevelSaveEvent.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiLevelSaveEvent.java deleted file mode 100644 index cbcd11e61..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiLevelSaveEvent.java +++ /dev/null @@ -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 -{ - - //==================// - // parameter object // - //==================// - - public static class CoreEventParam - { - /** The newly loaded level. */ - public final ILevelWrapper levelWrapper; - - - public CoreEventParam(ILevelWrapper newLevelWrapper) - { - this.levelWrapper = newLevelWrapper; - } - } - -} \ No newline at end of file diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiLevelUnloadEvent.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiLevelUnloadEvent.java deleted file mode 100644 index 7eafb1a47..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiLevelUnloadEvent.java +++ /dev/null @@ -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 -{ - - //==================// - // parameter object // - //==================// - - public static class CoreEventParam - { - /** The recently unloaded level. */ - public final ILevelWrapper levelWrapper; - - - public CoreEventParam(ILevelWrapper newLevelWrapper) - { - this.levelWrapper = newLevelWrapper; - } - } - -} \ No newline at end of file diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiTestEvent.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiTestEvent.java deleted file mode 100644 index e7bd26342..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/abstractEvents/CoreDhApiTestEvent.java +++ /dev/null @@ -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 -{ - public abstract boolean getTestValue(); - -} \ No newline at end of file diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/sharedParameterObjects/CoreDhApiRenderParam.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/sharedParameterObjects/CoreDhApiRenderParam.java deleted file mode 100644 index 0ba4f337b..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/events/sharedParameterObjects/CoreDhApiRenderParam.java +++ /dev/null @@ -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; - } - -} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/wrappers/CoreDhApiDimensionTypeWrapper.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/wrappers/CoreDhApiDimensionTypeWrapper.java deleted file mode 100644 index 58cb5b387..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/wrappers/CoreDhApiDimensionTypeWrapper.java +++ /dev/null @@ -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 . - */ - -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(); } - -} diff --git a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/wrappers/CoreDhApiLevelWrapper.java b/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/wrappers/CoreDhApiLevelWrapper.java deleted file mode 100644 index f2fa7d182..000000000 --- a/core/src/main/java/com/seibel/lod/core/api/external/coreImplementations/objects/wrappers/CoreDhApiLevelWrapper.java +++ /dev/null @@ -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 . - */ - -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(); } - -} diff --git a/core/src/main/java/com/seibel/lod/core/api/internal/ClientApi.java b/core/src/main/java/com/seibel/lod/core/api/internal/ClientApi.java index 05eb7b578..b656c41ac 100644 --- a/core/src/main/java/com/seibel/lod/core/api/internal/ClientApi.java +++ b/core/src/main/java/com/seibel/lod/core/api/internal/ClientApi.java @@ -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) diff --git a/core/src/main/java/com/seibel/lod/core/config/Config.java b/core/src/main/java/com/seibel/lod/core/config/Config.java index d40d47b77..074c9b79a 100644 --- a/core/src/main/java/com/seibel/lod/core/config/Config.java +++ b/core/src/main/java/com/seibel/lod/core/config/Config.java @@ -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.*; diff --git a/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java b/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java index aed8cadf5..9fd3464e6 100644 --- a/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java +++ b/core/src/main/java/com/seibel/lod/core/config/types/ConfigEntry.java @@ -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 extends AbstractConfigType> +public class ConfigEntry extends AbstractConfigType> implements IConfigEntry { private final T defaultValue; private String comment; @@ -40,16 +42,21 @@ public class ConfigEntry extends AbstractConfigType> /** 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 extends AbstractConfigType> 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 extends AbstractConfigType> * 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 extends AbstractConfigType> 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)"? diff --git a/core/src/main/java/com/seibel/lod/core/datatype/column/render/ColumnBox.java b/core/src/main/java/com/seibel/lod/core/datatype/column/render/ColumnBox.java index f23f7e5b5..d8e58b4f7 100644 --- a/core/src/main/java/com/seibel/lod/core/datatype/column/render/ColumnBox.java +++ b/core/src/main/java/com/seibel/lod/core/datatype/column/render/ColumnBox.java @@ -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; diff --git a/core/src/main/java/com/seibel/lod/core/datatype/column/render/LodQuadBuilder.java b/core/src/main/java/com/seibel/lod/core/datatype/column/render/LodQuadBuilder.java index c444d2e60..8cf243741 100644 --- a/core/src/main/java/com/seibel/lod/core/datatype/column/render/LodQuadBuilder.java +++ b/core/src/main/java/com/seibel/lod/core/datatype/column/render/LodQuadBuilder.java @@ -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); } } diff --git a/core/src/main/java/com/seibel/lod/core/dependencyInjection/DependencyInjector.java b/core/src/main/java/com/seibel/lod/core/dependencyInjection/DependencyInjector.java index ce8217da0..3f9656be6 100644 --- a/core/src/main/java/com/seibel/lod/core/dependencyInjection/DependencyInjector.java +++ b/core/src/main/java/com/seibel/lod/core/dependencyInjection/DependencyInjector.java @@ -30,7 +30,7 @@ import java.util.Map; * @author James Seibel * @version 2022-8-15 */ -public class DependencyInjector +public class DependencyInjector implements IDependencyInjector { protected final Map, ArrayList> dependencies = new HashMap<>(); @@ -55,14 +55,7 @@ public class DependencyInjector - /** - * 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 dependencyInterface, BindableType dependencyImplementation) throws IllegalStateException, IllegalArgumentException { // duplicate check if requested @@ -97,11 +90,8 @@ public class DependencyInjector // 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 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.
- * See {@link #get(Class, boolean) get(Class, boolean)} for full documentation. - * - * @see #get(Class, boolean) - */ @SuppressWarnings("unchecked") + @Override public T get(Class interfaceClass) throws ClassCastException { return (T) getInternalLogic(interfaceClass, false).get(0); } - /** - * Returns all dependencies of type T that have been bound.
- * Returns an empty list if no dependencies have been bound. - * - * @param 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 ArrayList getAll(Class interfaceClass) throws ClassCastException { return getInternalLogic(interfaceClass, false); } - /** - * Returns a dependency of type T if one has been bound.
- * Returns null if a dependency hasn't been bound.

- * - * If the handler's {@link #allowDuplicateBindings} is true this returns the first bound dependency. - * - * @param 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 get(Class interfaceClass, boolean allowIncompleteDependencies) throws ClassCastException { return (T) getInternalLogic(interfaceClass, allowIncompleteDependencies).get(0); @@ -222,6 +184,7 @@ public class DependencyInjector /** Removes all bound dependencies. */ + @Override public void clear() { this.dependencies.clear(); @@ -230,6 +193,7 @@ public class DependencyInjector /** Runs delayed setup for any dependencies that require it. */ + @Override public void runDelayedSetup() { for (Class interfaceKey : dependencies.keySet()) diff --git a/core/src/main/java/com/seibel/lod/core/dependencyInjection/DhApiEventInjector.java b/core/src/main/java/com/seibel/lod/core/dependencyInjection/DhApiEventInjector.java index 6dd3de6f4..3127a1632 100644 --- a/core/src/main/java/com/seibel/lod/core/dependencyInjection/DhApiEventInjector.java +++ b/core/src/main/java/com/seibel/lod/core/dependencyInjection/DhApiEventInjector.java @@ -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 // Note to self: Don't try adding a generic type to IDhApiEvent, the consturctor won't accept it +public class DhApiEventInjector extends DependencyInjector // 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 // N public DhApiEventInjector() { - super(ICoreDhApiEvent.class, true); + super(IDhApiEvent.class, true); } @@ -56,7 +56,7 @@ public class DhApiEventInjector extends DependencyInjector // 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 dependencyInterface, Class dependencyClassToRemove) throws IllegalArgumentException + public boolean unbind(Class dependencyInterface, Class 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 // N // actually remove the dependency if (this.dependencies.containsKey(dependencyInterface)) { - ArrayList dependencyList = this.dependencies.get(dependencyInterface); + ArrayList 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 // N * @return if any of the events returned that this event should be canceled. * @param the parameter type taken by the event handlers. */ - public > boolean fireAllEvents(Class dependencyInterface, T eventParameterObject) + public > boolean fireAllEvents(Class dependencyInterface, T eventParameterObject) { boolean cancelEvent = false; ArrayList eventList = this.getAll(dependencyInterface); - for (ICoreDhApiEvent event : eventList) + for (IDhApiEvent event : eventList) { if (event != null) { diff --git a/core/src/main/java/com/seibel/lod/core/dependencyInjection/OverrideInjector.java b/core/src/main/java/com/seibel/lod/core/dependencyInjection/OverrideInjector.java index d21f00ced..04b2085ef 100644 --- a/core/src/main/java/com/seibel/lod/core/dependencyInjection/OverrideInjector.java +++ b/core/src/main/java/com/seibel/lod/core/dependencyInjection/OverrideInjector.java @@ -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 { public static final OverrideInjector INSTANCE = new OverrideInjector(); - private final HashMap, OverridePriorityListContainer> overrideContainerByInterface = new HashMap<>(); + private final HashMap, OverridePriorityListContainer> overrideContainerByInterface = new HashMap<>(); - /** - * All core overrides should have this priority.
- * 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 dependencyInterface, ICoreDhApiOverrideable dependencyImplementation) throws IllegalStateException, IllegalArgumentException + @Override + public void bind(Class 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.
- * See {@link DependencyInjector#get(Class, boolean) get(Class, boolean)} for full documentation. - * - * @see DependencyInjector#get(Class, boolean) - */ + @Override @SuppressWarnings("unchecked") - public T get(Class interfaceClass) throws ClassCastException + public T get(Class 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.
- * If there is a dependency, but it was bound with a different priority this will return null.

- * - * See {@link DependencyInjector#get(Class, boolean) get(Class, boolean)} for more documentation. - * - * @see DependencyInjector#get(Class, boolean) - */ + @Override @SuppressWarnings("unchecked") - public T get(Class interfaceClass, int priority) throws ClassCastException + public T get(Class 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(); } diff --git a/core/src/main/java/com/seibel/lod/core/dependencyInjection/OverridePriorityListContainer.java b/core/src/main/java/com/seibel/lod/core/dependencyInjection/OverridePriorityListContainer.java index f66a876d4..f2d0d59d2 100644 --- a/core/src/main/java/com/seibel/lod/core/dependencyInjection/OverridePriorityListContainer.java +++ b/core/src/main/java/com/seibel/lod/core/dependencyInjection/OverridePriorityListContainer.java @@ -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; diff --git a/core/src/main/java/com/seibel/lod/core/dependencyInjection/WorldGeneratorInjector.java b/core/src/main/java/com/seibel/lod/core/dependencyInjection/WorldGeneratorInjector.java index bae6cc046..4169be5b3 100644 --- a/core/src/main/java/com/seibel/lod/core/dependencyInjection/WorldGeneratorInjector.java +++ b/core/src/main/java/com/seibel/lod/core/dependencyInjection/WorldGeneratorInjector.java @@ -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 worldGeneratorByLevelWrapper = new HashMap<>(); + private final HashMap 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); } diff --git a/core/src/main/java/com/seibel/lod/core/enums/CoreEnumAssembly.java b/core/src/main/java/com/seibel/lod/core/enums/CoreEnumAssembly.java deleted file mode 100644 index ddac9819b..000000000 --- a/core/src/main/java/com/seibel/lod/core/enums/CoreEnumAssembly.java +++ /dev/null @@ -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 . - */ - -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"; -} diff --git a/core/src/main/java/com/seibel/lod/core/enums/config/CoreConfigEnumAssembly.java b/core/src/main/java/com/seibel/lod/core/enums/config/CoreConfigEnumAssembly.java deleted file mode 100644 index b3de49624..000000000 --- a/core/src/main/java/com/seibel/lod/core/enums/config/CoreConfigEnumAssembly.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.core.enums.config; - -/** - * Assembly classes are used to reference the package they are in. - * - * @author James Seibel - * @version 2022-6-9 - */ -public class CoreConfigEnumAssembly -{ - -} diff --git a/core/src/main/java/com/seibel/lod/core/enums/config/EHorizontalResolution.java b/core/src/main/java/com/seibel/lod/core/enums/config/EHorizontalResolution.java index a4e033eeb..e361d48cf 100644 --- a/core/src/main/java/com/seibel/lod/core/enums/config/EHorizontalResolution.java +++ b/core/src/main/java/com/seibel/lod/core/enums/config/EHorizontalResolution.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Collections; import com.seibel.lod.core.util.LodUtil; +import com.seibel.lod.core.util.MathUtil; /** * BLOCK
@@ -166,7 +167,7 @@ public enum EHorizontalResolution { EHorizontalResolution[] lowerDetails = getSelfAndLowerDetails(maxDetailLevel); int distanceBetweenDetails = maxDistance / lowerDetails.length; - int index = LodUtil.clamp(0, distance / distanceBetweenDetails, lowerDetails.length - 1); + int index = MathUtil.clamp(0, distance / distanceBetweenDetails, lowerDetails.length - 1); return lowerDetails[index]; diff --git a/core/src/main/java/com/seibel/lod/core/enums/rendering/CoreRenderingEnumAssembly.java b/core/src/main/java/com/seibel/lod/core/enums/rendering/CoreRenderingEnumAssembly.java deleted file mode 100644 index 85e9b71b6..000000000 --- a/core/src/main/java/com/seibel/lod/core/enums/rendering/CoreRenderingEnumAssembly.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.core.enums.rendering; - -/** - * Assembly classes are used to reference the package they are in. - * - * @author James Seibel - * @version 2022-6-9 - */ -public class CoreRenderingEnumAssembly -{ - -} diff --git a/core/src/main/java/com/seibel/lod/core/enums/worldGeneration/CoreWorldGenerationEnumAssembly.java b/core/src/main/java/com/seibel/lod/core/enums/worldGeneration/CoreWorldGenerationEnumAssembly.java deleted file mode 100644 index 2be29ae7c..000000000 --- a/core/src/main/java/com/seibel/lod/core/enums/worldGeneration/CoreWorldGenerationEnumAssembly.java +++ /dev/null @@ -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 . - */ - -package com.seibel.lod.core.enums.worldGeneration; - -/** - * Assembly classes are used to reference the package they are in. - * - * @author James Seibel - * @version 2022-7-25 - */ -public class CoreWorldGenerationEnumAssembly -{ - -} diff --git a/core/src/main/java/com/seibel/lod/core/pos/DhBlockPos2D.java b/core/src/main/java/com/seibel/lod/core/pos/DhBlockPos2D.java index e01ec430e..9c0b3c33c 100644 --- a/core/src/main/java/com/seibel/lod/core/pos/DhBlockPos2D.java +++ b/core/src/main/java/com/seibel/lod/core/pos/DhBlockPos2D.java @@ -1,6 +1,7 @@ package com.seibel.lod.core.pos; import com.seibel.lod.core.util.LodUtil; +import com.seibel.lod.core.util.MathUtil; public class DhBlockPos2D { public final int x; @@ -25,7 +26,7 @@ public class DhBlockPos2D { return Math.sqrt(Math.pow(x - other.x, 2) + Math.pow(z - other.z, 2)); } public long distSquared(DhBlockPos2D other) { - return LodUtil.pow2((long)x - other.x) + LodUtil.pow2((long)z - other.z); + return MathUtil.pow2((long)x - other.x) + MathUtil.pow2((long)z - other.z); } public Pos2D toPos2D() { diff --git a/core/src/main/java/com/seibel/lod/core/pos/Pos2D.java b/core/src/main/java/com/seibel/lod/core/pos/Pos2D.java index 862ba2b2a..7417222ae 100644 --- a/core/src/main/java/com/seibel/lod/core/pos/Pos2D.java +++ b/core/src/main/java/com/seibel/lod/core/pos/Pos2D.java @@ -20,6 +20,7 @@ package com.seibel.lod.core.pos; import com.seibel.lod.core.util.LodUtil; +import com.seibel.lod.core.util.MathUtil; import java.util.Objects; @@ -45,7 +46,7 @@ public class Pos2D { return Math.sqrt(Math.pow(x - other.x, 2) + Math.pow(y - other.y, 2)); } public long distSquared(Pos2D other) { - return LodUtil.pow2((long)x - other.x) + LodUtil.pow2((long)y - other.y); + return MathUtil.pow2((long)x - other.x) + MathUtil.pow2((long)y - other.y); } public int hashCode() { diff --git a/core/src/main/java/com/seibel/lod/core/render/LodQuadTree.java b/core/src/main/java/com/seibel/lod/core/render/LodQuadTree.java index 9442af5b0..ba74c246b 100644 --- a/core/src/main/java/com/seibel/lod/core/render/LodQuadTree.java +++ b/core/src/main/java/com/seibel/lod/core/render/LodQuadTree.java @@ -9,6 +9,7 @@ import com.seibel.lod.core.logging.DhLoggerBuilder; import com.seibel.lod.core.pos.Pos2D; import com.seibel.lod.core.util.DetailDistanceUtil; import com.seibel.lod.core.util.LodUtil; +import com.seibel.lod.core.util.MathUtil; import com.seibel.lod.core.util.gridList.MovableGridRingList; import org.apache.logging.log4j.Logger; @@ -77,7 +78,7 @@ public class LodQuadTree implements AutoCloseable { for (byte i = LAYER_BEGINNING_OFFSET; i < numbersOfSectionLevels; i++) { byte targetDataDetail = getLayerDataDetail(i); int maxDist = getFurthestDistance(targetDataDetail); - int halfSize = LodUtil.ceilDiv(maxDist, (1 << i)) + 2; // +2 to make sure the section is fully contained in the ringList + int halfSize = MathUtil.ceilDiv(maxDist, (1 << i)) + 2; // +2 to make sure the section is fully contained in the ringList { DhSectionPos checkerPos = new DhSectionPos(i, halfSize, halfSize); byte checkedDetail = calculateExpectedDetailLevel(new DhBlockPos2D(initialPlayerX, initialPlayerZ),checkerPos); diff --git a/core/src/main/java/com/seibel/lod/core/render/glObject/vertexAttribute/VertexAttribute.java b/core/src/main/java/com/seibel/lod/core/render/glObject/vertexAttribute/VertexAttribute.java index 554f24f20..534f1f3bb 100644 --- a/core/src/main/java/com/seibel/lod/core/render/glObject/vertexAttribute/VertexAttribute.java +++ b/core/src/main/java/com/seibel/lod/core/render/glObject/vertexAttribute/VertexAttribute.java @@ -20,6 +20,7 @@ package com.seibel.lod.core.render.glObject.vertexAttribute; import com.seibel.lod.core.render.glObject.GLProxy; +import com.seibel.lod.core.util.MathUtil; import org.lwjgl.opengl.GL32; import com.seibel.lod.core.util.LodUtil; @@ -43,7 +44,7 @@ public abstract class VertexAttribute { this(elementCount, glType, normalized, byteSize, false); } private static int _align(int bytes) { - return LodUtil.ceilDiv(bytes, 4)*4; + return MathUtil.ceilDiv(bytes, 4)*4; } public static VertexPointer addFloatPointer(boolean normalized) { diff --git a/core/src/main/java/com/seibel/lod/core/util/DetailDistanceUtil.java b/core/src/main/java/com/seibel/lod/core/util/DetailDistanceUtil.java index fad4b2436..9634c74f0 100644 --- a/core/src/main/java/com/seibel/lod/core/util/DetailDistanceUtil.java +++ b/core/src/main/java/com/seibel/lod/core/util/DetailDistanceUtil.java @@ -84,7 +84,7 @@ public class DetailDistanceUtil else detail = (int) (Math.log(distance/distanceUnit) / logBase); - return (byte) LodUtil.clamp(minDetail, detail+minDetail, maxDetail - 1); + return (byte) MathUtil.clamp(minDetail, detail+minDetail, maxDetail - 1); } public static byte getDetailLevelFromDistance(double distance) diff --git a/core/src/main/java/com/seibel/lod/core/util/LevelPosUtil.java b/core/src/main/java/com/seibel/lod/core/util/LevelPosUtil.java index 77732974b..e7eb95c5a 100644 --- a/core/src/main/java/com/seibel/lod/core/util/LevelPosUtil.java +++ b/core/src/main/java/com/seibel/lod/core/util/LevelPosUtil.java @@ -156,7 +156,7 @@ public class LevelPosUtil double cPosZ = posZ * width + width/2.; cPosX = playerPosX - cPosX; cPosZ = playerPosZ - cPosZ; - return Math.sqrt(LodUtil.pow2(cPosX) + LodUtil.pow2(cPosZ)); + return Math.sqrt(MathUtil.pow2(cPosX) + MathUtil.pow2(cPosZ)); } public static double maxDistance(byte detailLevel, int posX, int posZ, int playerPosX, int playerPosZ) @@ -165,10 +165,10 @@ public class LevelPosUtil double startPosX = posX * width; double startPosZ = posZ * width; - double endPosX = LodUtil.pow2(playerPosX - startPosX - width); - double endPosZ = LodUtil.pow2(playerPosZ - startPosZ - width); - startPosX = LodUtil.pow2(playerPosX - startPosX); - startPosZ = LodUtil.pow2(playerPosZ - startPosZ); + double endPosX = MathUtil.pow2(playerPosX - startPosX - width); + double endPosZ = MathUtil.pow2(playerPosZ - startPosZ - width); + startPosX = MathUtil.pow2(playerPosX - startPosX); + startPosZ = MathUtil.pow2(playerPosZ - startPosZ); double maxDistance = Math.sqrt(startPosX + startPosZ); maxDistance = Math.max(maxDistance, Math.sqrt(startPosX + endPosZ)); @@ -208,10 +208,10 @@ public class LevelPosUtil } else { - double startPosX2 = LodUtil.pow2(playerPosX - startPosX); - double startPosZ2 = LodUtil.pow2(playerPosZ - startPosZ); - double endPosX2 = LodUtil.pow2(playerPosX - endPosX); - double endPosZ2 = LodUtil.pow2(playerPosZ - endPosZ); + double startPosX2 = MathUtil.pow2(playerPosX - startPosX); + double startPosZ2 = MathUtil.pow2(playerPosZ - startPosZ); + double endPosX2 = MathUtil.pow2(playerPosX - endPosX); + double endPosZ2 = MathUtil.pow2(playerPosZ - endPosZ); double minDistance = Math.sqrt(startPosX2 + startPosZ2); minDistance = Math.min(minDistance, Math.sqrt(startPosX2 + endPosZ2)); diff --git a/core/src/main/java/com/seibel/lod/core/util/LodUtil.java b/core/src/main/java/com/seibel/lod/core/util/LodUtil.java index 9a24f939d..ced34873c 100644 --- a/core/src/main/java/com/seibel/lod/core/util/LodUtil.java +++ b/core/src/main/java/com/seibel/lod/core/util/LodUtil.java @@ -238,48 +238,6 @@ public class LodUtil return folderName; } - /** - * 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; - } - public static int computeOverdrawOffset() { int chunkRenderDist = MC_RENDER.getRenderDistance() + 1; EVanillaOverdraw overdraw = Config.Client.Graphics.AdvancedGraphics.vanillaOverdraw.get(); @@ -326,21 +284,6 @@ public class LodUtil } - /** 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;} - // True if the requested threshold pass, or false otherwise // For details, see: // https://stackoverflow.com/questions/3571203/what-are-runtime-getruntime-totalmemory-and-freememory diff --git a/core/src/main/java/com/seibel/lod/core/util/RenderUtil.java b/core/src/main/java/com/seibel/lod/core/util/RenderUtil.java index 97dd665d6..1ea43188b 100644 --- a/core/src/main/java/com/seibel/lod/core/util/RenderUtil.java +++ b/core/src/main/java/com/seibel/lod/core/util/RenderUtil.java @@ -191,8 +191,8 @@ public class RenderUtil double fov = MC_RENDER.getFov(partialTicks); double aspectRatio = (double) MC_RENDER.getScreenWidth() / MC_RENDER.getScreenHeight(); return (float) (nearClipPlane - / Math.sqrt(1d + LodUtil.pow2(Math.tan(fov / 180d * Math.PI / 2d)) - * (LodUtil.pow2(aspectRatio) + 1d))); + / Math.sqrt(1d + MathUtil.pow2(Math.tan(fov / 180d * Math.PI / 2d)) + * (MathUtil.pow2(aspectRatio) + 1d))); } public static int getFarClipPlaneDistanceInBlocks() { diff --git a/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java b/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java index 1013600d3..8efd9ad95 100644 --- a/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java +++ b/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java @@ -23,7 +23,7 @@ import com.seibel.lod.core.config.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.enums.config.*; import com.seibel.lod.core.enums.rendering.*; import com.seibel.lod.core.dependencyInjection.IBindable; diff --git a/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/LodConfigWrapperSingleton.java b/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/LodConfigWrapperSingleton.java index 8cd0fedb4..94dab4b76 100644 --- a/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/LodConfigWrapperSingleton.java +++ b/core/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/LodConfigWrapperSingleton.java @@ -3,7 +3,7 @@ package com.seibel.lod.core.wrapperInterfaces.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.Config; import com.seibel.lod.core.enums.config.*; import com.seibel.lod.core.enums.rendering.*; diff --git a/core/src/test/java/testItems/overrideInjection/interfaces/IOverrideTest.java b/core/src/test/java/testItems/overrideInjection/interfaces/IOverrideTest.java index 54e9f9675..abb54b4c5 100644 --- a/core/src/test/java/testItems/overrideInjection/interfaces/IOverrideTest.java +++ b/core/src/test/java/testItems/overrideInjection/interfaces/IOverrideTest.java @@ -1,6 +1,6 @@ package testItems.overrideInjection.interfaces; -import com.seibel.lod.core.api.external.coreImplementations.interfaces.override.ICoreDhApiOverrideable; +import com.seibel.lod.api.items.interfaces.override.IDhApiOverrideable; /** * Dummy override test interface for dependency unit tests. @@ -8,7 +8,7 @@ import com.seibel.lod.core.api.external.coreImplementations.interfaces.override. * @author James Seibel * @version 2022-9-5 */ -public interface IOverrideTest extends ICoreDhApiOverrideable +public interface IOverrideTest extends IDhApiOverrideable { public int getValue(); diff --git a/core/src/test/java/testItems/worldGeneratorInjection/objects/LevelWrapperTest.java b/core/src/test/java/testItems/worldGeneratorInjection/objects/LevelWrapperTest.java index 6a34df382..836f6e1d8 100644 --- a/core/src/test/java/testItems/worldGeneratorInjection/objects/LevelWrapperTest.java +++ b/core/src/test/java/testItems/worldGeneratorInjection/objects/LevelWrapperTest.java @@ -1,6 +1,8 @@ package testItems.worldGeneratorInjection.objects; -import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.world.ICoreDhApiLevelWrapper; +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; /** * Stub implementation of a Level wrapper for basic unit testing. @@ -8,11 +10,17 @@ import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers. * @author James Seibel * @version 2022-9-8 */ -public class LevelWrapperTest implements ICoreDhApiLevelWrapper +public class LevelWrapperTest implements IDhApiLevelWrapper { @Override public Object getWrappedMcObject_UNSAFE() { return null; } + @Override + public IDhApiDimensionTypeWrapper getDimensionType() { return null; } + + @Override + public EDhApiLevelType getLevelType() { return null; } + @Override public boolean hasCeiling() { return false; } @@ -22,4 +30,7 @@ public class LevelWrapperTest implements ICoreDhApiLevelWrapper @Override public int getHeight() { return 0; } + @Override + public int getMinHeight() { return IDhApiLevelWrapper.super.getMinHeight(); } + } diff --git a/core/src/test/java/testItems/worldGeneratorInjection/objects/WorldGeneratorTestCore.java b/core/src/test/java/testItems/worldGeneratorInjection/objects/WorldGeneratorTestCore.java index e9b6aaa57..6396ad250 100644 --- a/core/src/test/java/testItems/worldGeneratorInjection/objects/WorldGeneratorTestCore.java +++ b/core/src/test/java/testItems/worldGeneratorInjection/objects/WorldGeneratorTestCore.java @@ -1,11 +1,11 @@ package testItems.worldGeneratorInjection.objects; -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.enums.worldGeneration.EWorldGenThreadMode; -import com.seibel.lod.core.enums.worldGeneration.EWorldGenerationStep; +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.worldGenerator.IDhApiWorldGenerator; +import com.seibel.lod.api.items.interfaces.world.IDhApiChunkWrapper; +import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper; import com.seibel.lod.core.dependencyInjection.OverrideInjector; -import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper; /** * Dummy test implementation object for world generator injection unit tests. @@ -13,9 +13,9 @@ import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper; * @author James Seibel * @version 2022-7-26 */ -public class WorldGeneratorTestCore implements ICoreDhApiWorldGenerator +public class WorldGeneratorTestCore implements IDhApiWorldGenerator { - public static EWorldGenThreadMode THREAD_MODE = EWorldGenThreadMode.SINGLE_THREADED; + public static EDhApiWorldGenThreadMode THREAD_MODE = EDhApiWorldGenThreadMode.SINGLE_THREADED; //==============// @@ -31,14 +31,19 @@ public class WorldGeneratorTestCore implements ICoreDhApiWorldGenerator // IDhApiWorldGenerator // //======================// - @Override - public EWorldGenThreadMode getCoreThreadingMode() { return THREAD_MODE; } - @Override - public IChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, ICoreDhApiLevelWrapper serverLevelWrapper, EWorldGenerationStep maxStepToGenerate) + /** Returns which thread chunk generation requests can be created on. */ + @Override + public EDhApiWorldGenThreadMode getCoreThreadingMode() + { + return THREAD_MODE; + } + + @Override + public IDhApiChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiWorldGenerationStep maxStepToGenerate) { - // not necessary for testing return null; } + } diff --git a/core/src/test/java/testItems/worldGeneratorInjection/objects/WorldGeneratorTestPrimary.java b/core/src/test/java/testItems/worldGeneratorInjection/objects/WorldGeneratorTestPrimary.java index 5be747a4b..73189914b 100644 --- a/core/src/test/java/testItems/worldGeneratorInjection/objects/WorldGeneratorTestPrimary.java +++ b/core/src/test/java/testItems/worldGeneratorInjection/objects/WorldGeneratorTestPrimary.java @@ -1,7 +1,10 @@ package testItems.worldGeneratorInjection.objects; -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.enums.worldGeneration.EDhApiWorldGenThreadMode; +import com.seibel.lod.api.items.enums.worldGeneration.EDhApiWorldGenerationStep; +import com.seibel.lod.api.items.interfaces.override.worldGenerator.IDhApiWorldGenerator; +import com.seibel.lod.api.items.interfaces.world.IDhApiChunkWrapper; +import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper; import com.seibel.lod.core.enums.worldGeneration.EWorldGenThreadMode; import com.seibel.lod.core.enums.worldGeneration.EWorldGenerationStep; import com.seibel.lod.core.dependencyInjection.OverrideInjector; @@ -13,10 +16,10 @@ import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper; * @author James Seibel * @version 2022-8-9 */ -public class WorldGeneratorTestPrimary implements ICoreDhApiWorldGenerator +public class WorldGeneratorTestPrimary implements IDhApiWorldGenerator { public static int PRIORITY = OverrideInjector.DEFAULT_NON_CORE_OVERRIDE_PRIORITY + 5; - public static EWorldGenThreadMode THREAD_MODE = EWorldGenThreadMode.MULTI_THREADED; + public static EDhApiWorldGenThreadMode THREAD_MODE = EDhApiWorldGenThreadMode.MULTI_THREADED; //==============// @@ -33,12 +36,11 @@ public class WorldGeneratorTestPrimary implements ICoreDhApiWorldGenerator //======================// @Override - public EWorldGenThreadMode getCoreThreadingMode() { return THREAD_MODE; } - - @Override - public IChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, ICoreDhApiLevelWrapper serverLevelWrapper, EWorldGenerationStep maxStepToGenerate) + public EDhApiWorldGenThreadMode getCoreThreadingMode() { return THREAD_MODE; } + + @Override + public IDhApiChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiWorldGenerationStep maxStepToGenerate) { - // not necessary for testing return null; } diff --git a/core/src/test/java/testItems/worldGeneratorInjection/objects/WorldGeneratorTestSecondary.java b/core/src/test/java/testItems/worldGeneratorInjection/objects/WorldGeneratorTestSecondary.java index 774ba4fd8..c3f07c7dd 100644 --- a/core/src/test/java/testItems/worldGeneratorInjection/objects/WorldGeneratorTestSecondary.java +++ b/core/src/test/java/testItems/worldGeneratorInjection/objects/WorldGeneratorTestSecondary.java @@ -1,7 +1,10 @@ package testItems.worldGeneratorInjection.objects; -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.enums.worldGeneration.EDhApiWorldGenThreadMode; +import com.seibel.lod.api.items.enums.worldGeneration.EDhApiWorldGenerationStep; +import com.seibel.lod.api.items.interfaces.override.worldGenerator.IDhApiWorldGenerator; +import com.seibel.lod.api.items.interfaces.world.IDhApiChunkWrapper; +import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper; import com.seibel.lod.core.enums.worldGeneration.EWorldGenThreadMode; import com.seibel.lod.core.enums.worldGeneration.EWorldGenerationStep; import com.seibel.lod.core.dependencyInjection.OverrideInjector; @@ -13,10 +16,10 @@ import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper; * @author James Seibel * @version 2022-8-9 */ -public class WorldGeneratorTestSecondary implements ICoreDhApiWorldGenerator +public class WorldGeneratorTestSecondary implements IDhApiWorldGenerator { public static int PRIORITY = OverrideInjector.DEFAULT_NON_CORE_OVERRIDE_PRIORITY; - public static EWorldGenThreadMode THREAD_MODE = EWorldGenThreadMode.SERVER_THREAD; + public static EDhApiWorldGenThreadMode THREAD_MODE = EDhApiWorldGenThreadMode.SERVER_THREAD; //==============// @@ -31,14 +34,13 @@ public class WorldGeneratorTestSecondary implements ICoreDhApiWorldGenerator //======================// // IDhApiWorldGenerator // //======================// - + @Override - public EWorldGenThreadMode getCoreThreadingMode() { return THREAD_MODE; } - + public EDhApiWorldGenThreadMode getCoreThreadingMode() { return THREAD_MODE; } + @Override - public IChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, ICoreDhApiLevelWrapper serverLevelWrapper, EWorldGenerationStep maxStepToGenerate) + public IDhApiChunkWrapper generateCoreChunk(int chunkPosX, int chunkPosZ, IDhApiLevelWrapper serverLevelWrapper, EDhApiWorldGenerationStep maxStepToGenerate) { - // not necessary for testing return null; } diff --git a/core/src/test/java/tests/DependencyInjectorTest.java b/core/src/test/java/tests/DependencyInjectorTest.java index 536d807f5..00db3c49d 100644 --- a/core/src/test/java/tests/DependencyInjectorTest.java +++ b/core/src/test/java/tests/DependencyInjectorTest.java @@ -1,7 +1,8 @@ package tests; -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.enums.worldGeneration.EDhApiWorldGenThreadMode; +import com.seibel.lod.api.items.interfaces.override.worldGenerator.IDhApiWorldGenerator; +import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper; import com.seibel.lod.core.dependencyInjection.DependencyInjector; import com.seibel.lod.core.dependencyInjection.IBindable; import com.seibel.lod.core.dependencyInjection.OverrideInjector; @@ -166,7 +167,7 @@ public class DependencyInjectorTest // variables to use later - ICoreDhApiWorldGenerator generator; + IDhApiWorldGenerator generator; WorldGeneratorTestCore coreGenerator = new WorldGeneratorTestCore(); WorldGeneratorTestSecondary secondaryGenerator = new WorldGeneratorTestSecondary(); WorldGeneratorTestPrimary primaryGenerator = new WorldGeneratorTestPrimary(); @@ -211,7 +212,7 @@ public class DependencyInjectorTest // in-line get // (make sure the returned type is correct and compiles, the actual value doesn't matter) - EWorldGenThreadMode threadMode = TEST_INJECTOR.get().getCoreThreadingMode(); + EDhApiWorldGenThreadMode threadMode = TEST_INJECTOR.get().getCoreThreadingMode(); } @@ -226,12 +227,12 @@ public class DependencyInjectorTest // variables to use later - ICoreDhApiWorldGenerator generator; + IDhApiWorldGenerator generator; WorldGeneratorTestCore backupGenerator = new WorldGeneratorTestCore(); WorldGeneratorTestPrimary levelGenerator = new WorldGeneratorTestPrimary(); - ICoreDhApiLevelWrapper boundLevel = new LevelWrapperTest(); - ICoreDhApiLevelWrapper unboundLevel = new LevelWrapperTest(); + IDhApiLevelWrapper boundLevel = new LevelWrapperTest(); + IDhApiLevelWrapper unboundLevel = new LevelWrapperTest();