Compare commits

...

78 Commits

Author SHA1 Message Date
Ran 3f37f7f02a Update Readme.md 2022-04-17 17:00:53 +00:00
TomTheFurry a88feda9ec Fix it so it build 2022-04-04 15:47:49 +08:00
TomTheFurry 07b7ecb30a Maybe fixed the light again? 2022-04-04 12:01:01 +08:00
TomTheFurry 32bbe487c0 Fix dumb stuff costing performance on world gen 2022-04-03 16:02:06 +08:00
TomTheFurry b367e5c3aa Fix dumb stuff costing performance on world gen 2022-04-03 16:01:54 +08:00
TomTheFurry a43b2b69a6 Fix up big blocks missing side faces 2022-04-03 13:06:18 +08:00
James Seibel 2a1de6f579 add missing fabric libraries for sodium 2022-04-02 23:46:31 -05:00
James Seibel 7dadff4219 automatically copy lod.accesswidener when building
By default the fabric build folder needs this file to run, but it wasn't being copied over, now it should be.
2022-04-02 23:08:33 -05:00
James Seibel 07c53a02ca Add phosphor as an option to build.gradle 2022-04-02 23:06:57 -05:00
TomTheFurry 1e54885d88 Disabled framebuffer fix for now making optifine shaders to work again 2022-04-02 22:24:17 +08:00
TomTheFurry 68f4084ab0 Fix coolGi's java-8 port 2022-04-02 22:18:40 +08:00
TomTheFurry 6fa968e016 Make lightmap fix works with Optifine shaders? 2022-04-02 21:11:38 +08:00
TomTheFurry 93c2078724 Make lightmap fix works with Optifine shaders? 2022-04-02 21:09:39 +08:00
TomTheFurry 2289d898ce Update core. 2022-04-02 15:25:28 +08:00
TomTheFurry 15e5a04ffd Maybe fixed colormatic's mod compat? 2022-04-02 13:49:28 +08:00
TomTheFurry 150ba98a4e MacOS Patch Successful! + fix missing fabric api 2022-04-01 19:46:54 +08:00
coolGi2007 d9484c9df4 Why dose the readme still say preprocessor_test 2022-04-01 08:26:59 +00:00
James Seibel a92e09c2be Merge branch '1.18.X' of gitlab.com:jeseibel/minecraft-lod-mod into 1.18.X 2022-03-31 21:23:41 -05:00
James Seibel f7e1dc378f Fix the default folder selection if sub-dimensions are disabled 2022-03-31 21:23:38 -05:00
Ran f7b84b1909 It was nice knowing you fabric-api 2022-03-31 14:49:53 +06:00
Ran abae2f6358 I forgor 2022-03-31 14:35:03 +06:00
Ran e83939f1b2 Remove fabric api as a dependency 2022-03-31 14:30:41 +06:00
James Seibel 0bddc2dcac Fix invalid files that use the server port 2022-03-30 21:18:59 -05:00
James Seibel 42a8e0e0f0 Add additional logging to getFileBasePath 2022-03-30 19:57:59 -05:00
TomTheFurry 7b77e07a7d Fix race & stuck playerData in sub-dim, add dataPoint verify 2022-03-30 18:39:10 +08:00
cola98765 db17d27823 change XZ setting 3 -> 1 made it easier to change it with static at the start of the file 2022-03-30 11:55:02 +02:00
James Seibel 362b800f25 Close #140 (no rendering if world named "No World Loaded" ) 2022-03-29 20:49:11 -05:00
TomTheFurry 29e26d659d I think test renderer is now more correct? 2022-03-29 13:09:29 +08:00
TomTheFurry afa658cc00 Add RendererType & Debug Renderer + fix Logger bug 2022-03-28 17:04:06 +08:00
James Seibel cde0d466dd Fix a null pointer error when moving empty folders 2022-03-27 21:49:26 -05:00
James Seibel 4031b55630 Fix old folders not moving if sub-dims are disabled 2022-03-27 00:09:41 -05:00
James Seibel 86e07156d1 Make multi-Dim similarity = 0 disable the new system
By default the old system of 1 world per dimension is used
2022-03-26 23:16:12 -05:00
James Seibel 1e8df274ee Update a log in Sub-Dim 2022-03-26 21:34:47 -05:00
James Seibel f0153cc4a6 Fix incorrect files/folders crashing the sub-dim system 2022-03-26 21:27:28 -05:00
James Seibel 3044c238fd Automatically move old files to the new sub-dim system 2022-03-26 20:53:53 -05:00
James Seibel ead58390cd Merge in SubDim changes 2022-03-26 11:39:31 -05:00
TomTheFurry 504d22ff37 Update core 2022-03-26 23:32:50 +08:00
TomTheFurry cc42f8667f Update core 2022-03-26 18:56:39 +08:00
James Seibel 6135b3ce7f Merge branch '1.18.X' of gitlab.com:jeseibel/minecraft-lod-mod into 1.18.X 2022-03-23 21:18:06 -05:00
James Seibel 3c8efa17d5 Add better logging and hopefully fix some issues with multi-dim support 2022-03-23 21:18:03 -05:00
James Seibel dccae0aea0 Re-add the gradle cache to hopefully improve compile speed 2022-03-23 02:06:42 +00:00
James Seibel 2728236ced Merge branch '1.18.X' of gitlab.com:jeseibel/minecraft-lod-mod into 1.18.X 2022-03-22 20:48:46 -05:00
James Seibel 76ce1d6b21 Change the deleteMerged task's folder path 2022-03-22 20:48:37 -05:00
James Seibel 94ddebaec0 Fix some YAML errors 2022-03-23 01:28:43 +00:00
James Seibel cec165176b Go back to sequential compiles, deleting the merged between compiles 2022-03-22 20:13:38 -05:00
James Seibel 99ad837441 comment out one of the artifacts and rename the caches 2022-03-22 19:52:50 -05:00
James Seibel f8be132ba2 Increase compiler memory and flip the compile order 2022-03-22 19:43:49 -05:00
James Seibel 122f5431a6 Try disabling caching and re-enabling the daemon 2022-03-23 00:31:17 +00:00
James Seibel c2884954a4 Disable the gradle daemon to hopefully fix a compiler crash 2022-03-22 12:28:25 +00:00
James Seibel 3a0453c8c5 Dummy commit to trigger a rebuild 2022-03-22 12:22:19 +00:00
TomTheFurry 9d241ab175 Add CaveCullingHeight + 'Fun' mode into config 2022-03-22 18:23:53 +08:00
TomTheFurry ee7eed8d3c Fix 0 size quad bug + improve black face filling 2022-03-22 13:05:22 +08:00
Ran 1125452a8f Fix DHJarMerger 2022-03-22 10:55:30 +06:00
James Seibel a3712c8f72 Last attempt at fixing artifacts incorrectly merging for the night
7707f55b appears to have worked correctly, now if I can just figure out if it was a fluke...
2022-03-22 04:16:35 +00:00
James Seibel e2022fab2d Make compiling sequential to fix a mystery compiler error 2022-03-22 03:36:39 +00:00
James Seibel bcea1be19b Fix the cache key being incorrectly set 2022-03-22 03:20:19 +00:00
James Seibel 8d799203c5 Update .gitlab-ci.yml file 2022-03-22 03:14:55 +00:00
James Seibel 980ce2f2af Go back to parallel builds
And potentially fix the caching
2022-03-22 03:14:25 +00:00
James Seibel c6bea3faa3 Try sequential builds in CI 2022-03-22 03:02:44 +00:00
James Seibel 7707f55b25 Update .gitlab-ci.yml file 2022-03-22 02:39:42 +00:00
James Seibel f087bb7182 Update .gitlab-ci.yml file 2022-03-22 02:38:33 +00:00
James Seibel bf269c9abf Fix an incorrect Array Index 2022-03-21 21:21:22 -05:00
tom lee a8c7405f9d Update core + forgot to undo the always getMaxRenderedChunk() 2022-03-21 17:29:33 +08:00
tom lee 43c9232e7e Update core 2022-03-21 16:56:40 +08:00
tom lee 8351c58d7b Update core + remove Manifold from core + remove awt.Colors 2022-03-21 15:16:37 +08:00
tom lee aa86381b80 Update core 2022-03-20 23:18:23 +08:00
tom lee 563840ca58 Fix some block failing to get correct colors 2022-03-20 17:15:12 +08:00
tom lee b5b9b688c3 Update core 2022-03-20 16:31:04 +08:00
tom lee 3731223087 Update core 2022-03-20 16:27:40 +08:00
tom lee 72d770c0f3 Maybe this will work? 2022-03-20 13:51:49 +08:00
tom lee ee4b83fa99 Fix StructFeatManager to work on 1.18.2 + Update core 2022-03-20 13:42:12 +08:00
James Seibel ee6e3a9876 Merge branch 'preprocessor_test' into 1.18.X 2022-03-19 20:15:18 -05:00
coolGi2007 f84570a6fc Downgraded stuff from 1.18.2 to 1.18.X 2022-03-10 16:35:20 +10:30
James Seibel a0f5af46a2 Closes #217 (Change Server Folder Name)
Adds multiple options for formatting the server folder name.
If LODs have already been generated with a previous setting the files will have to be transferred to the new folder.
2022-03-07 22:16:00 -06:00
James Seibel 18074f15f5 Rename MinecraftWrapper -> MinecraftClientWrapper
closes #150
2022-03-05 18:28:36 -06:00
James Seibel bba0424c6d remove WorldWrapper.isEmpty()
It wasn't used and there was a comment saying not to use it
2022-03-05 18:14:22 -06:00
James Seibel 282f6cfbb8 Update the DependencyHandler to support circular references
Also rename "DependencySetup" To "FabricDependencySetup"
2022-03-05 17:52:22 -06:00
coolGi2007 b97b1b61b7 Reverted the commit that added 1.18.2 to this branch 2022-03-02 18:08:11 +10:30
31 changed files with 554 additions and 203 deletions
+4 -1
View File
@@ -50,4 +50,7 @@ classes/
Merged/ Merged/
# file from notepad++ # file from notepad++
*.bak *.bak
# file genearated via MC version switching using preprocessor
build.properties
+29 -43
View File
@@ -3,13 +3,10 @@ image: gradle:eclipse-temurin
# all stages need to be defined here # all stages need to be defined here
stages: stages:
- build_18-1 - build_18_1
- build_18-2 - build_18_2
# - zip_artifacts
variables: variables:
# If we have correctness issues when compiling this can be set to false
GRADLE_OPTS: "-Dorg.gradle.daemon=true"
# Pull core when building # Pull core when building
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
@@ -20,59 +17,47 @@ before_script:
- echo GE_JOB_ID=$CI_JOB_ID >> generate_jars.env - echo GE_JOB_ID=$CI_JOB_ID >> generate_jars.env
# 1.18.1 build # 1.18.1 build
build_18-1: build_18_1:
stage: build_18-1 stage: build_18_1
script: ./gradlew build -PmcVer=1.18.1 --gradle-user-home cache/; ./gradlew merge --gradle-user-home cache/ script:
- ./gradlew deleteMerged --gradle-user-home cache/; # make sure any previously merged jars are removed before running this job
- ./gradlew build -PmcVer=1.18.1 --gradle-user-home cache/;
- ./gradlew merge --gradle-user-home cache/;
# build using Java 17 # build using Java 17
image: eclipse-temurin:17 image: eclipse-temurin:17
artifacts:
name: "Merged_NightlyBuild_1_18_1-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
paths:
# relative to the root directory
- Merged
expire_in: 1 day
cache: cache:
key: "$CI_COMMIT_REF_NAME_18-1" key: "gradleCache"
policy: pull-push policy: pull-push
paths: paths:
- .gradle - .gradle
- cache/ - cache/
# 1.18.2 build # 1.18.2 build
build_18-2: build_18_2:
stage: build_18-2 stage: build_18_2
script: ./gradlew build -PmcVer=1.18.2 --gradle-user-home cache/; ./gradlew merge --gradle-user-home cache/ script:
# build using Java 17 - ./gradlew deleteMerged --gradle-user-home cache/;
- ./gradlew build -PmcVer=1.18.2 --gradle-user-home cache/;
- ./gradlew merge --gradle-user-home cache/;
image: eclipse-temurin:17 image: eclipse-temurin:17
artifacts:
name: "Merged_NightlyBuild_1_18_2-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
paths:
- Merged
expire_in: 1 day
cache: cache:
key: "$CI_COMMIT_REF_NAME_18-2" key: "gradleCache"
policy: pull-push policy: pull-push
paths: paths:
- .gradle - .gradle
- cache/ - cache/
# TEMPORARY, there should be a way of either generating artifacts per build or in a separate stage
artifacts:
# This should only be done after the last build, otherwise there will be duplicate jars
name: "Merged_NightlyBuild-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
paths:
# relative to the root directory
- Merged
expire_in: 1 day
# # put artifacts in a zip
# # This should only be done after all the builds have been completed
# zip_artifacts:
# stage: zip_artifacts
# # The complier complains if we don't do something with the script line
# script: echo 'Building complete. Creating artifact Zip.'
# # build using Java 17
# image: eclipse-temurin:17
# artifacts:
# # This should only be done after the last build, otherwise there will be duplicate jars
# name: "Merged_NightlyBuild-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
# paths:
# # relative to the root directory
# - Merged
# expire_in: 1 day
# unused deployment stage # unused deployment stage
@@ -98,3 +83,4 @@ build_18-2:
# url: 'https://gitlab.com/jeseibel/minecraft-lod-mod/cw/-/jobs/${GE_JOB_ID}/artifacts/file/fabric/build/libs' # url: 'https://gitlab.com/jeseibel/minecraft-lod-mod/cw/-/jobs/${GE_JOB_ID}/artifacts/file/fabric/build/libs'
# - name: 'Forge Jars' # - name: 'Forge Jars'
# url: 'https://gitlab.com/jeseibel/minecraft-lod-mod/cw/-/jobs/${GE_JOB_ID}/artifacts/file/forge/build/libs' # url: 'https://gitlab.com/jeseibel/minecraft-lod-mod/cw/-/jobs/${GE_JOB_ID}/artifacts/file/forge/build/libs'
+2
View File
@@ -9,6 +9,7 @@ fabric_api_version=0.46.6+1.18
# Fabric mod versions # Fabric mod versions
modmenu_version=3.0.1 modmenu_version=3.0.1
starlight_version_fabric=3554912 starlight_version_fabric=3554912
phosphor_version_fabric=3573395
lithium_version=mc1.18.1-0.7.7 lithium_version=mc1.18.1-0.7.7
sodium_version=3605309 sodium_version=3605309
iris_version=1.18.x-v1.1.4 iris_version=1.18.x-v1.1.4
@@ -20,6 +21,7 @@ fabric_api_version=0.46.6+1.18
# 1 = Can be referenced in code but doesn't run # 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client # 2 = Can be referenced in code and runs in client
enable_starlight=0 enable_starlight=0
enable_phosphor=0
enable_sodium=1 enable_sodium=1
enable_lithium=0 enable_lithium=0
enable_iris=0 enable_iris=0
+3 -1
View File
@@ -10,6 +10,7 @@ fabric_api_version=0.48.0+1.18.2
# Fabric mod versions # Fabric mod versions
modmenu_version=3.1.0 modmenu_version=3.1.0
starlight_version_fabric=3667443 starlight_version_fabric=3667443
phosphor_version_fabric=3573395
lithium_version=mc1.18.2-0.7.9 lithium_version=mc1.18.2-0.7.9
sodium_version=3669187 sodium_version=3669187
iris_version=1.18.x-v1.2.2 iris_version=1.18.x-v1.2.2
@@ -21,6 +22,7 @@ fabric_api_version=0.48.0+1.18.2
# 1 = Can be referenced in code but doesn't run # 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client # 2 = Can be referenced in code and runs in client
enable_starlight=0 enable_starlight=0
enable_phosphor=0
enable_sodium=1 enable_sodium=1
enable_lithium=0 enable_lithium=0
enable_iris=0 enable_iris=0
@@ -32,7 +34,7 @@ forge_version=40.0.18
starlight_version_forge=0 starlight_version_forge=0
# Forge mod run # Forge mod run
# 0 = Dont enable and don't run # 0 = Don't enable and don't run
# 1 = Can be referenced in code but doesn't run # 1 = Can be referenced in code but doesn't run
# 2 = Can be referenced in code and runs in client # 2 = Can be referenced in code and runs in client
enable_starlight_forge=0 enable_starlight_forge=0
+3 -1
View File
@@ -1,3 +1,5 @@
# THIS VERSION IS NO LONGER MAINTAINED! ALL DEVELOPMENT HAVE BEEN MOVED OVER TO THE MAIN BRANCH
# <img src="https://gitlab.com/jeseibel/distant-horizons-core/-/raw/main/_logo%20files/LOD%20logo%20flat%20-%20with%20boarder.png" width="32"> Distant Horizons # <img src="https://gitlab.com/jeseibel/distant-horizons-core/-/raw/main/_logo%20files/LOD%20logo%20flat%20-%20with%20boarder.png" width="32"> Distant Horizons
> A mod that adds a Level of Detail System to Minecraft > A mod that adds a Level of Detail System to Minecraft
@@ -80,7 +82,7 @@ If running on IDE, to ensure IDE pickup the changed versions, you will need to r
6. The compiled jar file will be in the folder `Merged` 6. The compiled jar file will be in the folder `Merged`
**If in terminal:** **If in terminal:**
1. `git clone -b preprocessor_test --recurse-submodules https://gitlab.com/jeseibel/minecraft-lod-mod.git` 1. `git clone -b 1.18.X --recurse-submodules https://gitlab.com/jeseibel/minecraft-lod-mod.git`
2. `cd minecraft-lod-mod` 2. `cd minecraft-lod-mod`
3. `./gradlew assemble` 3. `./gradlew assemble`
4. `./gradlew mergeJars` 4. `./gradlew mergeJars`
+27 -1
View File
@@ -180,10 +180,17 @@ allprojects { p ->
// def excapedMCVersion = rootProject.minecraft_version.replace(".", "_") // def excapedMCVersion = rootProject.minecraft_version.replace(".", "_")
// options.compilerArgs += ['-Xplugin:Manifold', "-AMC_VERSION_${excapedMCVersion}"] // options.compilerArgs += ['-Xplugin:Manifold', "-AMC_VERSION_${excapedMCVersion}"]
// //
options.compilerArgs += ['-Xplugin:Manifold'] //options.compilerArgs += ['-deprecation']
//options.compilerArgs += ['-verbose']
//options.compilerArgs += ['-Xlint:unchecked']
//options.compilerArgs += ['-Xdiags:verbose']
//options.compilerArgs += ['-Xprint']
//options.compilerArgs += ['-XprintProcessorInfo']
//options.compilerArgs += ['-XprintRounds']
// println options.compilerArgs // println options.compilerArgs
if (p != project(":core")) { if (p != project(":core")) {
options.compilerArgs += ['-Xplugin:Manifold']
options.release = rootProject.java_version as Integer options.release = rootProject.java_version as Integer
} }
} }
@@ -196,4 +203,23 @@ allprojects { p ->
runClient.enabled = false runClient.enabled = false
runServer.enabled = false runServer.enabled = false
} }
// this is necessary for running the fabric build
if (p == project(":common")) {
println "Coping [common/src/main/resources/lod.accesswidner] to [fabric/build/resources/main]."
copy {
from "$rootProject.rootDir/common/src/main/resources"
into "$rootProject.rootDir/fabric/build/resources/main"
include "*.accesswidener"
}
}
} }
// this deletes the merged folder so we don't carry over
// the previous merges to each new build job in the CI/CD pipeline
task deleteMerged(type: Delete) {
delete files("./Merged")
}
-1
View File
@@ -1 +0,0 @@
MC_VERSION_1_18_2=
@@ -29,6 +29,8 @@ import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.I
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality.IAdvancedFog.IHeightFog; import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality.IAdvancedFog.IHeightFog;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IMultiplayer; import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IMultiplayer;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IWorldGenerator; import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IWorldGenerator;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IAdvanced;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IAdvanced.IDebugging.*;
/** /**
@@ -257,7 +259,12 @@ public class Config
public static String _vanillaOverdraw = IAdvancedGraphics.VANILLA_OVERDRAW_DESC; public static String _vanillaOverdraw = IAdvancedGraphics.VANILLA_OVERDRAW_DESC;
@ConfigAnnotations.Entry @ConfigAnnotations.Entry
public static VanillaOverdraw vanillaOverdraw = IAdvancedGraphics.VANILLA_OVERDRAW_DEFAULT; public static VanillaOverdraw vanillaOverdraw = IAdvancedGraphics.VANILLA_OVERDRAW_DEFAULT;
@ConfigAnnotations.FileComment
public static String _overdrawOffset = IAdvancedGraphics.OVERDRAW_OFFSET_DESC;
@ConfigAnnotations.Entry(minValue = -16, maxValue = 16)
public static int overdrawOffset = IAdvancedGraphics.OVERDRAW_OFFSET_MIN_DEFAULT_MAX.defaultValue;
@ConfigAnnotations.FileComment @ConfigAnnotations.FileComment
public static String _useExtendedNearClipPlane = IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DESC; public static String _useExtendedNearClipPlane = IAdvancedGraphics.USE_EXTENDED_NEAR_CLIP_PLANE_DESC;
@ConfigAnnotations.Entry @ConfigAnnotations.Entry
@@ -272,7 +279,17 @@ public class Config
public static String _saturationMultiplier = IAdvancedGraphics.SATURATION_MULTIPLIER_DESC; public static String _saturationMultiplier = IAdvancedGraphics.SATURATION_MULTIPLIER_DESC;
@ConfigAnnotations.Entry @ConfigAnnotations.Entry
public static double saturationMultiplier = IAdvancedGraphics.SATURATION_MULTIPLIER_DEFAULT; public static double saturationMultiplier = IAdvancedGraphics.SATURATION_MULTIPLIER_DEFAULT;
@ConfigAnnotations.FileComment
public static String _enableCaveCulling = IAdvancedGraphics.ENABLE_CAVE_CULLING_DESC;
@ConfigAnnotations.Entry
public static boolean enableCaveCulling = IAdvancedGraphics.ENABLE_CAVE_CULLING_DEFAULT;
@ConfigAnnotations.FileComment
public static String _caveCullingHeight = IAdvancedGraphics.CAVE_CULLING_HEIGHT_DESC;
@ConfigAnnotations.Entry(minValue = -4096, maxValue = 4096)
public static int caveCullingHeight = IAdvancedGraphics.CAVE_CULLING_HEIGHT_MIN_DEFAULT_MAX.defaultValue;
/* /*
@ConfigAnnotations.FileComment @ConfigAnnotations.FileComment
public static String _backsideCullingRange = IAdvancedGraphics.VANILLA_CULLING_RANGE_DESC; public static String _backsideCullingRange = IAdvancedGraphics.VANILLA_CULLING_RANGE_DESC;
@@ -329,8 +346,8 @@ public class Config
@ConfigAnnotations.FileComment @ConfigAnnotations.FileComment
public static String _multiDimensionRequiredSimilarity = IMultiplayer.MULTI_DIMENSION_REQUIRED_SIMILARITY_DESC; public static String _multiDimensionRequiredSimilarity = IMultiplayer.MULTI_DIMENSION_REQUIRED_SIMILARITY_DESC;
@ConfigAnnotations.Entry @ConfigAnnotations.Entry(minValue = 0.0, maxValue = 1.0)
public static double multiDimensionRequiredSimilarity = IMultiplayer.MULTI_DIMENSION_REQUIRED_SIMILARITY_DEFAULT; public static double multiDimensionRequiredSimilarity = IMultiplayer.MULTI_DIMENSION_REQUIRED_SIMILARITY_MIN_DEFAULT_MAX.defaultValue;
} }
@@ -345,8 +362,13 @@ public class Config
@ConfigAnnotations.ScreenEntry @ConfigAnnotations.ScreenEntry
public static Buffers buffers; public static Buffers buffers;
@ConfigAnnotations.FileComment
public static String _lodOnlyMode = IAdvanced.LOD_ONLY_MODE_DESC;
@ConfigAnnotations.Entry
public static boolean lodOnlyMode = IAdvanced.LOD_ONLY_MODE_DEFAULT;
public static class Threading public static class Threading
{ {
@ConfigAnnotations.FileComment @ConfigAnnotations.FileComment
@@ -364,9 +386,9 @@ public class Config
public static class Debugging public static class Debugging
{ {
@ConfigAnnotations.FileComment @ConfigAnnotations.FileComment
public static String _drawLods = IDebugging.DRAW_LODS_DESC; public static String _rendererType = IDebugging.RENDERER_TYPE_DESC;
@ConfigAnnotations.Entry @ConfigAnnotations.Entry
public static boolean drawLods = IDebugging.DRAW_LODS_DEFAULT; public static RendererType rendererType = IDebugging.RENDERER_TYPE_DEFAULT;
@ConfigAnnotations.FileComment @ConfigAnnotations.FileComment
public static String _debugMode = IDebugging.DEBUG_MODE_DESC; public static String _debugMode = IDebugging.DEBUG_MODE_DESC;
@@ -377,6 +399,67 @@ public class Config
public static String _enableDebugKeybindings = IDebugging.DEBUG_KEYBINDINGS_ENABLED_DESC; public static String _enableDebugKeybindings = IDebugging.DEBUG_KEYBINDINGS_ENABLED_DESC;
@ConfigAnnotations.Entry @ConfigAnnotations.Entry
public static boolean enableDebugKeybindings = IDebugging.DEBUG_KEYBINDINGS_ENABLED_DEFAULT; public static boolean enableDebugKeybindings = IDebugging.DEBUG_KEYBINDINGS_ENABLED_DEFAULT;
@ConfigAnnotations.ScreenEntry
public static DebugSwitch debugSwitch;
public static class DebugSwitch {
/* The logging switches available:
* WorldGenEvent
* WorldGenPerformance
* WorldGenLoadEvent
* LodBuilderEvent
* RendererBufferEvent
* RendererGLEvent
* FileReadWriteEvent
* FileSubDimEvent
* NetworkEvent //NOT IMPL YET
*/
@ConfigAnnotations.FileComment
public static String _logWorldGenEvent = IDebugSwitch.LOG_WORLDGEN_EVENT_DESC;
@ConfigAnnotations.Entry
public static LoggerMode logWorldGenEvent = IDebugSwitch.LOG_WORLDGEN_EVENT_DEFAULT;
@ConfigAnnotations.FileComment
public static String _logWorldGenPerformance = IDebugSwitch.LOG_WORLDGEN_PERFORMANCE_DESC;
@ConfigAnnotations.Entry
public static LoggerMode logWorldGenPerformance = IDebugSwitch.LOG_WORLDGEN_PERFORMANCE_DEFAULT;
@ConfigAnnotations.FileComment
public static String _logWorldGenLoadEvent = IDebugSwitch.LOG_WORLDGEN_LOAD_EVENT_DESC;
@ConfigAnnotations.Entry
public static LoggerMode logWorldGenLoadEvent = IDebugSwitch.LOG_WORLDGEN_LOAD_EVENT_DEFAULT;
@ConfigAnnotations.FileComment
public static String _logLodBuilderEvent = IDebugSwitch.LOG_LODBUILDER_EVENT_DESC;
@ConfigAnnotations.Entry
public static LoggerMode logLodBuilderEvent = IDebugSwitch.LOG_LODBUILDER_EVENT_DEFAULT;
@ConfigAnnotations.FileComment
public static String _logRendererBufferEvent = IDebugSwitch.LOG_RENDERER_BUFFER_EVENT_DESC;
@ConfigAnnotations.Entry
public static LoggerMode logRendererBufferEvent = IDebugSwitch.LOG_RENDERER_BUFFER_EVENT_DEFAULT;
@ConfigAnnotations.FileComment
public static String _logRendererGLEvent = IDebugSwitch.LOG_RENDERER_GL_EVENT_DESC;
@ConfigAnnotations.Entry
public static LoggerMode logRendererGLEvent = IDebugSwitch.LOG_RENDERER_GL_EVENT_DEFAULT;
@ConfigAnnotations.FileComment
public static String _logFileReadWriteEvent = IDebugSwitch.LOG_FILE_READWRITE_EVENT_DESC;
@ConfigAnnotations.Entry
public static LoggerMode logFileReadWriteEvent = IDebugSwitch.LOG_FILE_READWRITE_EVENT_DEFAULT;
@ConfigAnnotations.FileComment
public static String _logFileSubDimEvent = IDebugSwitch.LOG_FILE_SUB_DIM_EVENT_DESC;
@ConfigAnnotations.Entry
public static LoggerMode logFileSubDimEvent = IDebugSwitch.LOG_FILE_SUB_DIM_EVENT_DEFAULT;
@ConfigAnnotations.FileComment
public static String _logNetworkEvent = IDebugSwitch.LOG_NETWORK_EVENT_DESC;
@ConfigAnnotations.Entry
public static LoggerMode logNetworkEvent = IDebugSwitch.LOG_NETWORK_EVENT_DEFAULT;
}
} }
@@ -237,13 +237,24 @@ public class BlockDetailWrapper extends IBlockDetailWrapper
!(state.getBlock() instanceof RotatedPillarBlock && direction == Direction.UP)) !(state.getBlock() instanceof RotatedPillarBlock && direction == Direction.UP))
break; break;
}; };
if (quads == null || quads.isEmpty()) {
quads = Minecraft.getInstance().getModelManager().getBlockModelShaper().
getBlockModel(state).getQuads(state, null, random);
}
if (quads != null && !quads.isEmpty()) { if (quads != null && !quads.isEmpty()) {
needPostTinting = quads.get(0).isTinted(); needPostTinting = quads.get(0).isTinted();
needShade = quads.get(0).isShade(); needShade = quads.get(0).isShade();
tintIndex = quads.get(0).getTintIndex(); tintIndex = quads.get(0).getTintIndex();
baseColor = calculateColorFromTexture(quads.get(0).getSprite(), baseColor = calculateColorFromTexture(quads.get(0).getSprite(),
ColorMode.getColorMode(state.getBlock())); ColorMode.getColorMode(state.getBlock()));
} } else { // Backup method.
needPostTinting = false;
needShade = false;
tintIndex = 0;
baseColor = calculateColorFromTexture(Minecraft.getInstance().getModelManager().getBlockModelShaper().getParticleIcon(state),
ColorMode.getColorMode(state.getBlock()));
}
} else { // Liquid Block } else { // Liquid Block
needPostTinting = true; needPostTinting = true;
@@ -27,15 +27,9 @@ import java.util.stream.Stream;
public class TintGetterOverrideFast implements BlockAndTintGetter { public class TintGetterOverrideFast implements BlockAndTintGetter {
LevelReader parent; LevelReader parent;
private final Object2ObjectArrayMap<ColorResolver, ConcurrentHashMap<Biome, Integer>> tintCaches;
public TintGetterOverrideFast(LevelReader parent) { public TintGetterOverrideFast(LevelReader parent) {
this.parent = parent; this.parent = parent;
this.tintCaches = Util.make(new Object2ObjectArrayMap(3), object2ObjectArrayMap -> {
object2ObjectArrayMap.put(BiomeColors.GRASS_COLOR_RESOLVER, new ConcurrentHashMap<Biome, Integer>());
object2ObjectArrayMap.put(BiomeColors.FOLIAGE_COLOR_RESOLVER, new ConcurrentHashMap<Biome, Integer>());
object2ObjectArrayMap.put(BiomeColors.WATER_COLOR_RESOLVER, new ConcurrentHashMap<Biome, Integer>());
});
} }
private Biome _getBiome(BlockPos pos) { private Biome _getBiome(BlockPos pos) {
@@ -49,7 +43,7 @@ public class TintGetterOverrideFast implements BlockAndTintGetter {
@Override @Override
public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) { public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) {
Biome b = _getBiome(blockPos); Biome b = _getBiome(blockPos);
return tintCaches.get(colorResolver).computeIfAbsent(b, (key) -> colorResolver.getColor(b, blockPos.getX(), blockPos.getZ())); return colorResolver.getColor(b, blockPos.getX(), blockPos.getZ());
} }
@Override @Override
@@ -26,17 +26,11 @@ import java.util.stream.Stream;
public class TintGetterOverrideSmooth implements BlockAndTintGetter { public class TintGetterOverrideSmooth implements BlockAndTintGetter {
LevelReader parent; LevelReader parent;
private final Object2ObjectArrayMap<ColorResolver, BlockTintCache> tintCaches;
public int smoothingRange; public int smoothingRange;
public TintGetterOverrideSmooth(LevelReader parent, int smoothingRange) { public TintGetterOverrideSmooth(LevelReader parent, int smoothingRange) {
this.parent = parent; this.parent = parent;
this.smoothingRange = smoothingRange; this.smoothingRange = smoothingRange;
this.tintCaches = Util.make(new Object2ObjectArrayMap(3), object2ObjectArrayMap -> {
object2ObjectArrayMap.put(BiomeColors.GRASS_COLOR_RESOLVER, new BlockTintCache((pos) -> calculateBlockTint(pos, BiomeColors.GRASS_COLOR_RESOLVER)));
object2ObjectArrayMap.put(BiomeColors.FOLIAGE_COLOR_RESOLVER, new BlockTintCache((pos) -> calculateBlockTint(pos, BiomeColors.FOLIAGE_COLOR_RESOLVER)));
object2ObjectArrayMap.put(BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache((pos) -> calculateBlockTint(pos, BiomeColors.WATER_COLOR_RESOLVER)));
});
} }
private Biome _getBiome(BlockPos pos) { private Biome _getBiome(BlockPos pos) {
@@ -71,8 +65,7 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter {
@Override @Override
public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) { public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) {
BlockTintCache blockTintCache = this.tintCaches.get(colorResolver); return calculateBlockTint(blockPos, colorResolver);
return blockTintCache.getColor(blockPos);
} }
@Override @Override
@@ -459,6 +459,17 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.vanillaOverdraw").value = newVanillaOverdraw; ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.vanillaOverdraw").value = newVanillaOverdraw;
ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.vanillaOverdraw"); ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.vanillaOverdraw");
} }
@Override
public int getOverdrawOffset() {
return Config.Client.Graphics.AdvancedGraphics.overdrawOffset;
}
@Override
public void setOverdrawOffset(int newOverdrawOffset) {
ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.overdrawOffset").value = newOverdrawOffset;
ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.overdrawOffset");
}
/* /*
@Override @Override
public int getBacksideCullingRange() public int getBacksideCullingRange()
@@ -507,6 +518,30 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.saturationMultiplier").value = newSaturationMultiplier; ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.saturationMultiplier").value = newSaturationMultiplier;
ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.saturationMultiplier"); ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.saturationMultiplier");
} }
@Override
public boolean getEnableCaveCulling() {
return Config.Client.Graphics.AdvancedGraphics.enableCaveCulling;
}
@Override
public void setEnableCaveCulling(boolean newEnableCaveCulling) {
ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.enableCaveCulling").value = newEnableCaveCulling;
ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.enableCaveCulling");
}
@Override
public int getCaveCullingHeight() {
return Config.Client.Graphics.AdvancedGraphics.caveCullingHeight;
}
@Override
public void setCaveCullingHeight(int newCaveCullingHeight) {
ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.caveCullingHeight").value = newCaveCullingHeight;
ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.caveCullingHeight");
}
} }
} }
@@ -656,8 +691,8 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
{ {
return buffers; return buffers;
} }
public Advanced() public Advanced()
{ {
threading = new Threading(); threading = new Threading();
@@ -701,19 +736,29 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
//===============// //===============//
public static class Debugging implements IDebugging public static class Debugging implements IDebugging
{ {
public final IDebugSwitch debugSwitch;
@Override @Override
public boolean getDrawLods() public IDebugSwitch debugSwitch()
{ {
return (boolean) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.drawLods").value; return debugSwitch;
}
/* RendererType:
* DEFAULT
* DEBUG
* DISABLED
* */
@Override
public RendererType getRendererType() {
return (RendererType) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.rendererType").value;
} }
@Override @Override
public void setDrawLods(boolean newDrawLods) public void setRendererType(RendererType newRenderType) {
{ ConfigGui.editSingleOption.getEntry("client.advanced.debugging.rendererType").value = newRenderType;
ConfigGui.editSingleOption.getEntry("client.advanced.debugging.drawLods").value = newDrawLods; ConfigGui.editSingleOption.saveOption("client.advanced.debugging.rendererType");
ConfigGui.editSingleOption.saveOption("client.advanced.debugging.drawLods");
} }
@Override @Override
public DebugMode getDebugMode() public DebugMode getDebugMode()
{ {
@@ -738,6 +783,116 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
ConfigGui.editSingleOption.getEntry("client.advanced.debugging.enableDebugKeybindings").value = newEnableDebugKeybindings; ConfigGui.editSingleOption.getEntry("client.advanced.debugging.enableDebugKeybindings").value = newEnableDebugKeybindings;
ConfigGui.editSingleOption.saveOption("client.advanced.debugging.enableDebugKeybindings"); ConfigGui.editSingleOption.saveOption("client.advanced.debugging.enableDebugKeybindings");
} }
public Debugging()
{
debugSwitch = new DebugSwitch();
}
public static class DebugSwitch implements IDebugSwitch {
/* The logging switches available:
* WorldGenEvent
* WorldGenPerformance
* WorldGenLoadEvent
* LodBuilderEvent
* RendererBufferEvent
* RendererGLEvent
* FileReadWriteEvent
* FileSubDimEvent
* NetworkEvent //NOT IMPL YET
*/
@Override
public LoggerMode getLogWorldGenEvent() {
return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logWorldGenEvent").value;
}
@Override
public void setLogWorldGenEvent(LoggerMode newLogWorldGenEvent) {
ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logWorldGenEvent").value = newLogWorldGenEvent;
ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logWorldGenEvent");
}
@Override
public LoggerMode getLogWorldGenPerformance() {
return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logWorldGenPerformance").value;
}
@Override
public void setLogWorldGenPerformance(LoggerMode newLogWorldGenPerformance) {
ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logWorldGenPerformance").value = newLogWorldGenPerformance;
ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logWorldGenPerformance");
}
@Override
public LoggerMode getLogWorldGenLoadEvent() {
return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logWorldGenLoadEvent").value;
}
@Override
public void setLogWorldGenLoadEvent(LoggerMode newLogWorldGenLoadEvent) {
ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logWorldGenLoadEvent").value = newLogWorldGenLoadEvent;
ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logWorldGenLoadEvent");
}
@Override
public LoggerMode getLogLodBuilderEvent() {
return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logLodBuilderEvent").value;
}
@Override
public void setLogLodBuilderEvent(LoggerMode newLogLodBuilderEvent) {
ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logLodBuilderEvent").value = newLogLodBuilderEvent;
ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logLodBuilderEvent");
}
@Override
public LoggerMode getLogRendererBufferEvent() {
return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logRendererBufferEvent").value;
}
@Override
public void setLogRendererBufferEvent(LoggerMode newLogRendererBufferEvent) {
ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logRendererBufferEvent").value = newLogRendererBufferEvent;
ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logRendererBufferEvent");
}
@Override
public LoggerMode getLogRendererGLEvent() {
return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logRendererGLEvent").value;
}
@Override
public void setLogRendererGLEvent(LoggerMode newLogRendererGLEvent) {
ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logRendererGLEvent").value = newLogRendererGLEvent;
ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logRendererGLEvent");
}
@Override
public LoggerMode getLogFileReadWriteEvent() {
return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logFileReadWriteEvent").value;
}
@Override
public void setLogFileReadWriteEvent(LoggerMode newLogFileReadWriteEvent) {
ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logFileReadWriteEvent").value = newLogFileReadWriteEvent;
ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logFileReadWriteEvent");
}
@Override
public LoggerMode getLogFileSubDimEvent() {
return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logFileSubDimEvent").value;
}
@Override
public void setLogFileSubDimEvent(LoggerMode newLogFileSubDimEvent) {
ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logFileSubDimEvent").value = newLogFileSubDimEvent;
ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logFileSubDimEvent");
}
@Override
public LoggerMode getLogNetworkEvent() {
return (LoggerMode) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logNetworkEvent").value;
}
@Override
public void setLogNetworkEvent(LoggerMode newLogNetworkEvent) {
ConfigGui.editSingleOption.getEntry("client.advanced.debugging.debugSwitch.logNetworkEvent").value = newLogNetworkEvent;
ConfigGui.editSingleOption.saveOption("client.advanced.debugging.debugSwitch.logNetworkEvent");
}
}
} }
@@ -781,6 +936,18 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
ConfigGui.editSingleOption.saveOption("client.advanced.buffers.newBufferRebuildTimes"); ConfigGui.editSingleOption.saveOption("client.advanced.buffers.newBufferRebuildTimes");
} }
} }
@Override
public boolean getLodOnlyMode() {
return Config.Client.Advanced.lodOnlyMode;
}
@Override
public void setLodOnlyMode(boolean newLodOnlyMode) {
ConfigGui.editSingleOption.getEntry("client.advanced.buffers.lodOnlyMode").value = newLodOnlyMode;
ConfigGui.editSingleOption.saveOption("client.advanced.buffers.lodOnlyMode");
}
} }
} }
} }
@@ -63,8 +63,7 @@ import net.minecraft.world.level.dimension.DimensionType;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
/** /**
* A singleton that wraps the Minecraft class * A singleton that wraps the Minecraft object.
* to allow for easier movement between Minecraft versions.
* *
* @author James Seibel * @author James Seibel
* @version 3-5-2022 * @version 3-5-2022
@@ -188,7 +187,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper
{ {
if (lightMap == null) if (lightMap == null)
{ {
sendChatMessage("new"); //sendChatMessage("new");
// make sure the lightMap is up-to-date // make sure the lightMap is up-to-date
getCurrentLightMap(); getCurrentLightMap();
} }
@@ -196,23 +195,6 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper
return lightMap.getPixelRGBA(blockLight, skyLight); return lightMap.getPixelRGBA(blockLight, skyLight);
} }
/**
* Returns the Color at the given pixel coordinates
* from the current lightmap.
* @param blockLight x location in texture space
* @param skyLight z location in texture space
*/
@Override
public Color getColorFromLightMap(int blockLight, int skyLight) {
if (lightMap == null) {
// make sure the lightMap is up-to-date
getCurrentLightMap();
}
return LodUtil.intToColor(lightMap.getPixelRGBA(blockLight, skyLight));
}
//=============// //=============//
@@ -10,11 +10,9 @@ import com.mojang.blaze3d.platform.NativeImage;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import com.seibel.lod.common.wrappers.misc.LightMapWrapper; import com.seibel.lod.common.wrappers.misc.LightMapWrapper;
import com.seibel.lod.core.api.ApiShared; import com.seibel.lod.core.api.ApiShared;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.handlers.dependencyInjection.ModAccessorHandler; import com.seibel.lod.core.handlers.dependencyInjection.ModAccessorHandler;
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.wrapperInterfaces.misc.ILightMapWrapper;
import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.LightTexture;
import com.mojang.math.Vector3f; import com.mojang.math.Vector3f;
@@ -170,7 +168,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
* <p> * <p>
*/ */
public boolean usingBackupGetVanillaRenderedChunks = true; public boolean usingBackupGetVanillaRenderedChunks = false;
@Override @Override
public HashSet<AbstractChunkPosWrapper> getVanillaRenderedChunks() public HashSet<AbstractChunkPosWrapper> getVanillaRenderedChunks()
{ {
@@ -214,13 +212,14 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
} }
return getMaximumRenderedChunks(); return getMaximumRenderedChunks();
} }
@Override @Override
@Deprecated
public int[] getLightmapPixels() public int[] getLightmapPixels()
{ {
LightTexture tex = GAME_RENDERER.lightTexture(); LightTexture tex = GAME_RENDERER.lightTexture();
tex.tick(); // This call makes no sense, but it fixes pause menu flicker bug //tex.tick(); // This call makes no sense, but it fixes pause menu flicker bug
NativeImage lightMapPixels = tex.lightPixels; NativeImage lightMapPixels = tex.lightTexture.getPixels();
LightMapWrapper lightMap = new LightMapWrapper(lightMapPixels); LightMapWrapper lightMap = new LightMapWrapper(lightMapPixels);
@@ -235,7 +234,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
// this could probably be kept as a int, but // this could probably be kept as a int, but
// it is easier to test and see the colors when debugging this way. // it is easier to test and see the colors when debugging this way.
// When creating a new release this should be changed to the int version. // When creating a new release this should be changed to the int version.
Color c = LodUtil.intToColor(lightMap.getLightValue(u, v)); int col = lightMap.getLightValue(u, v);
// these should both create a totally white image // these should both create a totally white image
// int col = // int col =
@@ -245,12 +244,12 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
// (0b11111111 << 8) + // green // (0b11111111 << 8) + // green
// (0b11111111 << 16) + // blue // (0b11111111 << 16) + // blue
// (0b11111111 << 24); // blue // (0b11111111 << 24); // blue
int col = // int col =
((c.getRed() & 0xFF) << 16) | // blue // ((c.getRed() & 0xFF) << 16) | // blue
((c.getGreen() & 0xFF) << 8) | // green // ((c.getGreen() & 0xFF) << 8) | // green
((c.getBlue() & 0xFF)) | // red // ((c.getBlue() & 0xFF)) | // red
((c.getAlpha() & 0xFF) << 24); // alpha // ((c.getAlpha() & 0xFF) << 24); // alpha
// 2D array stored in a 1D array. // 2D array stored in a 1D array.
// Thank you Tim from College ;) // Thank you Tim from College ;)
@@ -260,9 +259,17 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
return pixels; return pixels;
} }
@Override
public ILightMapWrapper getLightmapWrapper() {
return new LightMapWrapper(GAME_RENDERER.lightTexture());
}
@Override @Override
@Deprecated
public int getLightmapTextureHeight() public int getLightmapTextureHeight()
{ {
int height = -1; int height = -1;
@@ -281,6 +288,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
} }
@Override @Override
@Deprecated
public int getLightmapTextureWidth() public int getLightmapTextureWidth()
{ {
int width = -1; int width = -1;
@@ -300,6 +308,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
@Override @Override
@Deprecated
public int getLightmapGLFormat() { public int getLightmapGLFormat() {
int glFormat = -1; int glFormat = -1;
@@ -2,6 +2,8 @@ package com.seibel.lod.common.wrappers.misc;
import com.mojang.blaze3d.platform.NativeImage; import com.mojang.blaze3d.platform.NativeImage;
import com.seibel.lod.core.wrapperInterfaces.misc.ILightMapWrapper; import com.seibel.lod.core.wrapperInterfaces.misc.ILightMapWrapper;
import net.minecraft.client.renderer.LightTexture;
import org.lwjgl.opengl.GL32;
/** /**
* @author James Seibel * @author James Seibel
@@ -11,11 +13,17 @@ public class LightMapWrapper implements ILightMapWrapper
{ {
static NativeImage lightMap = null; static NativeImage lightMap = null;
private LightTexture tex;
public LightMapWrapper(NativeImage newLightMap) public LightMapWrapper(NativeImage newLightMap)
{ {
lightMap = newLightMap; lightMap = newLightMap;
} }
public LightMapWrapper(LightTexture lightTexture) {
tex = lightTexture;
}
public static void setLightMap(NativeImage newLightMap) public static void setLightMap(NativeImage newLightMap)
{ {
lightMap = newLightMap; lightMap = newLightMap;
@@ -26,4 +34,14 @@ public class LightMapWrapper implements ILightMapWrapper
{ {
return lightMap.getPixelRGBA(skyLight, blockLight); return lightMap.getPixelRGBA(skyLight, blockLight);
} }
@Override
public void bind() {
GL32.glBindTexture(GL32.GL_TEXTURE_2D, tex.lightTexture.getId());
}
@Override
public void unbind() {
GL32.glBindTexture(GL32.GL_TEXTURE_2D, 0);
}
} }
@@ -110,9 +110,11 @@ public class BiomeWrapper implements IBiomeWrapper
case SAVANNA: case SAVANNA:
case SWAMP: case SWAMP:
default: default:
Color tmp = LodUtil.intToColor(biome.getGrassColor(x, z)); colorInt = biome.getGrassColor(x,z);
tmp = tmp.darker(); //FIXME: Repair what James did - LeeTom
colorInt = LodUtil.colorToInt(tmp); // Color tmp = LodUtil.intToColor(biome.getGrassColor(x, z));
// tmp = tmp.darker();
// colorInt = LodUtil.colorToInt(tmp);
break; break;
} }
@@ -19,7 +19,8 @@
package com.seibel.lod.common.wrappers.worldGeneration; package com.seibel.lod.common.wrappers.worldGeneration;
import com.seibel.lod.core.api.ApiShared; import com.seibel.lod.core.logging.ConfigBasedLogger;
import com.seibel.lod.core.logging.ConfigBasedSpamLogger;
import com.seibel.lod.core.builders.lodBuilding.LodBuilder; import com.seibel.lod.core.builders.lodBuilding.LodBuilder;
import com.seibel.lod.core.builders.lodBuilding.LodBuilderConfig; import com.seibel.lod.core.builders.lodBuilding.LodBuilderConfig;
import com.seibel.lod.core.enums.config.DistanceGenerationMode; import com.seibel.lod.core.enums.config.DistanceGenerationMode;
@@ -70,6 +71,7 @@ import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.world.level.lighting.LevelLightEngine;
import org.apache.logging.log4j.LogManager;
/* /*
Total: 3.135214124s Total: 3.135214124s
@@ -87,9 +89,17 @@ Lod Generation: 0.269023348s
public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnvionmentWrapper public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnvionmentWrapper
{ {
public static final boolean ENABLE_PERF_LOGGING = false; private static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
public static final boolean ENABLE_EVENT_LOGGING = false; public static final ConfigBasedSpamLogger PREF_LOGGER =
public static final boolean ENABLE_LOAD_EVENT_LOGGING = false; new ConfigBasedSpamLogger(LogManager.getLogger("LodWorldGen"),
() -> CONFIG.client().advanced().debugging().debugSwitch().getLogWorldGenPerformance(),1);
public static final ConfigBasedLogger EVENT_LOGGER =
new ConfigBasedLogger(LogManager.getLogger("LodWorldGen"),
() -> CONFIG.client().advanced().debugging().debugSwitch().getLogWorldGenEvent());
public static final ConfigBasedLogger LOAD_LOGGER =
new ConfigBasedLogger(LogManager.getLogger("LodWorldGen"),
() -> CONFIG.client().advanced().debugging().debugSwitch().getLogWorldGenLoadEvent());
//TODO: Make actual proper support for StarLight //TODO: Make actual proper support for StarLight
public static class PrefEvent public static class PrefEvent
@@ -224,7 +234,6 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
public final StepLight stepLight = new StepLight(this); public final StepLight stepLight = new StepLight(this);
public boolean unsafeThreadingRecorded = false; public boolean unsafeThreadingRecorded = false;
//public boolean safeMode = false; //public boolean safeMode = false;
private static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
private static final IMinecraftClientWrapper MC = SingletonHandler.get(IMinecraftClientWrapper.class); private static final IMinecraftClientWrapper MC = SingletonHandler.get(IMinecraftClientWrapper.class);
public static final long EXCEPTION_TIMER_RESET_TIME = TimeUnit.NANOSECONDS.convert(1, TimeUnit.SECONDS); public static final long EXCEPTION_TIMER_RESET_TIME = TimeUnit.NANOSECONDS.convert(1, TimeUnit.SECONDS);
public static final int EXCEPTION_COUNTER_TRIGGER = 20; public static final int EXCEPTION_COUNTER_TRIGGER = 20;
@@ -249,9 +258,8 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
public <T> T joinSync(CompletableFuture<T> f) { public <T> T joinSync(CompletableFuture<T> f) {
if (!unsafeThreadingRecorded && !f.isDone()) { if (!unsafeThreadingRecorded && !f.isDone()) {
MC.sendChatMessage("\u00A74\u00A7l\u00A7uERROR: Distant Horizons: Unsafe Threading in Chunk Generator Detected!"); EVENT_LOGGER.error("Unsafe Threading in Chunk Generator: ", new RuntimeException("Concurrent future"));
MC.sendChatMessage("\u00A7eTo increase stability, it is recommended to set world generation threads count to 1."); EVENT_LOGGER.error("To increase stability, it is recommended to set world generation threads count to 1.");
ApiShared.LOGGER.error("Unsafe Threading in Chunk Generator: ", new RuntimeException("Concurrent future"));
unsafeThreadingRecorded = true; unsafeThreadingRecorded = true;
} }
return f.join(); return f.join();
@@ -300,8 +308,8 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
} }
catch (Throwable e) catch (Throwable e)
{ {
ApiShared.LOGGER.error("Batching World Generator: Event {} gotten an exception", event); EVENT_LOGGER.error("Batching World Generator: Event {} gotten an exception", event);
ApiShared.LOGGER.error("Exception: ", e); EVENT_LOGGER.error("Exception: ", e);
unknownExceptionCount++; unknownExceptionCount++;
lastExceptionTriggerTime = System.nanoTime(); lastExceptionTriggerTime = System.nanoTime();
} }
@@ -312,12 +320,12 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
} }
else if (event.hasTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS)) else if (event.hasTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS))
{ {
ApiShared.LOGGER.error("Batching World Generator: " + event + " timed out and terminated!"); EVENT_LOGGER.error("Batching World Generator: " + event + " timed out and terminated!");
ApiShared.LOGGER.info("Dump PrefEvent: " + event.pEvent); EVENT_LOGGER.info("Dump PrefEvent: " + event.pEvent);
try try
{ {
if (!event.terminate()) if (!event.terminate())
ApiShared.LOGGER.error("Failed to terminate the stuck generation event!"); EVENT_LOGGER.error("Failed to terminate the stuck generation event!");
} }
finally finally
{ {
@@ -326,10 +334,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
} }
} }
if (unknownExceptionCount > EXCEPTION_COUNTER_TRIGGER) { if (unknownExceptionCount > EXCEPTION_COUNTER_TRIGGER) {
try { EVENT_LOGGER.error("Too many exceptions in Batching World Generator! Disabling the generator.");
MC.sendChatMessage("\u00A74\u00A7l\u00A7uERROR: Distant Horizons: Too many exceptions in Batching World Generator! Disabling the generator.");
} catch (Exception e) {}
ApiShared.LOGGER.error("Too many exceptions in Batching World Generator! Now disabling.");
unknownExceptionCount = 0; unknownExceptionCount = 0;
CONFIG.client().worldGenerator().setEnableDistantGeneration(false); CONFIG.client().worldGenerator().setEnableDistantGeneration(false);
} }
@@ -338,14 +343,13 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
public BatchGenerationEnvironment(IWorldWrapper serverlevel, LodBuilder lodBuilder, LodDimension lodDim) public BatchGenerationEnvironment(IWorldWrapper serverlevel, LodBuilder lodBuilder, LodDimension lodDim)
{ {
super(serverlevel, lodBuilder, lodDim); super(serverlevel, lodBuilder, lodDim);
ApiShared.LOGGER.info("================WORLD_GEN_STEP_INITING============="); EVENT_LOGGER.info("================WORLD_GEN_STEP_INITING=============");
ChunkGenerator generator = ((WorldWrapper) serverlevel).getServerWorld().getChunkSource().getGenerator(); ChunkGenerator generator = ((WorldWrapper) serverlevel).getServerWorld().getChunkSource().getGenerator();
if (!(generator instanceof NoiseBasedChunkGenerator || if (!(generator instanceof NoiseBasedChunkGenerator ||
generator instanceof DebugLevelSource || generator instanceof DebugLevelSource ||
generator instanceof FlatLevelSource)) { generator instanceof FlatLevelSource)) {
MC.sendChatMessage("\u00A74\u00A7l\u00A7uWARNING: Distant Horizons: Unknown Chunk Generator Detected! Distant Generation May Fail!"); EVENT_LOGGER.warn("Unknown Chunk Generator detected: [{}], Distant Generation May Fail!", generator.getClass());
MC.sendChatMessage("\u00A7eIf it does crash, set Distant Generation to OFF or Generation Mode to None."); EVENT_LOGGER.warn("If it does crash, set Distant Generation to OFF or Generation Mode to None.");
ApiShared.LOGGER.warn("Unknown Chunk Generator detected: {}", generator.getClass());
} }
params = new GlobalParameters((ServerLevel) ((WorldWrapper) serverlevel).getWorld(), lodBuilder, lodDim); params = new GlobalParameters((ServerLevel) ((WorldWrapper) serverlevel).getWorld(), lodBuilder, lodDim);
} }
@@ -360,7 +364,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
} }
catch (Exception e) catch (Exception e)
{ {
ApiShared.LOGGER.error("DistantHorizons: Couldn't load chunk {}", chunkPos, e); LOAD_LOGGER.error("DistantHorizons: Couldn't load chunk {}", chunkPos, e);
} }
if (chunkData == null) if (chunkData == null)
{ {
@@ -371,7 +375,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
try { try {
return ChunkLoader.read(level, lightEngine, chunkPos, chunkData); return ChunkLoader.read(level, lightEngine, chunkPos, chunkData);
} catch (Exception e) { } catch (Exception e) {
ApiShared.LOGGER.error("DistantHorizons: Couldn't load chunk {}", chunkPos, e); LOAD_LOGGER.error("DistantHorizons: Couldn't load chunk {}", chunkPos, e);
return new ProtoChunk(chunkPos, UpgradeData.EMPTY, level, level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), null); return new ProtoChunk(chunkPos, UpgradeData.EMPTY, level, level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), null);
} }
} }
@@ -380,8 +384,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
public void generateLodFromList(GenerationEvent e) public void generateLodFromList(GenerationEvent e)
{ {
if (ENABLE_EVENT_LOGGING) EVENT_LOGGER.debug("Lod Generate Event: " + e.pos);
ApiShared.LOGGER.info("Lod Generate Event: " + e.pos);
e.pEvent.beginNano = System.nanoTime(); e.pEvent.beginNano = System.nanoTime();
ArrayGridList<ChunkAccess> referencedChunks; ArrayGridList<ChunkAccess> referencedChunks;
ArrayGridList<ChunkAccess> genChunks; ArrayGridList<ChunkAccess> genChunks;
@@ -424,7 +427,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
region = new LightedWorldGenRegion(params.level, lightEngine, referencedChunks, region = new LightedWorldGenRegion(params.level, lightEngine, referencedChunks,
ChunkStatus.STRUCTURE_STARTS, refRange, e.lightMode, generator); ChunkStatus.STRUCTURE_STARTS, refRange, e.lightMode, generator);
adaptor.setRegion(region); adaptor.setRegion(region);
e.tParam.makeStructFeat(region); e.tParam.makeStructFeat(region, params);
genChunks = new ArrayGridList<>(referencedChunks, RANGE_TO_RANGE_EMPTY_EXTENSION, genChunks = new ArrayGridList<>(referencedChunks, RANGE_TO_RANGE_EMPTY_EXTENSION,
referencedChunks.gridSize - RANGE_TO_RANGE_EMPTY_EXTENSION); referencedChunks.gridSize - RANGE_TO_RANGE_EMPTY_EXTENSION);
generateDirect(e, genChunks, e.target, region); generateDirect(e, genChunks, e.target, region);
@@ -474,15 +477,13 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
boolean isPartial = target.isOldNoiseGeneration(); boolean isPartial = target.isOldNoiseGeneration();
if (isFull) if (isFull)
{ {
if (ENABLE_LOAD_EVENT_LOGGING) LOAD_LOGGER.info("Detected full existing chunk at {}", target.getPos());
ApiShared.LOGGER.info("Detected full existing chunk at {}", target.getPos());
params.lodBuilder.generateLodNodeFromChunk(params.lodDim, wrappedChunk, params.lodBuilder.generateLodNodeFromChunk(params.lodDim, wrappedChunk,
new LodBuilderConfig(DistanceGenerationMode.FULL), true, e.genAllDetails); new LodBuilderConfig(DistanceGenerationMode.FULL), true, e.genAllDetails);
} }
else if (isPartial) else if (isPartial)
{ {
if (ENABLE_LOAD_EVENT_LOGGING) LOAD_LOGGER.info("Detected old existing chunk at {}", target.getPos());
ApiShared.LOGGER.info("Detected old existing chunk at {}", target.getPos());
params.lodBuilder.generateLodNodeFromChunk(params.lodDim, wrappedChunk, params.lodBuilder.generateLodNodeFromChunk(params.lodDim, wrappedChunk,
new LodBuilderConfig(generationMode), true, e.genAllDetails); new LodBuilderConfig(generationMode), true, e.genAllDetails);
} }
@@ -505,10 +506,10 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
} }
e.pEvent.endNano = System.nanoTime(); e.pEvent.endNano = System.nanoTime();
e.refreshTimeout(); e.refreshTimeout();
if (ENABLE_PERF_LOGGING) if (PREF_LOGGER.canMaybeLog())
{ {
e.tParam.perf.recordEvent(e.pEvent); e.tParam.perf.recordEvent(e.pEvent);
ApiShared.LOGGER.info(e.tParam.perf); PREF_LOGGER.infoInc("{}", e.tParam.perf);
} }
} }
@@ -594,14 +595,14 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
@Override @Override
public void stop(boolean blocking) { public void stop(boolean blocking) {
ApiShared.LOGGER.info("Batch Chunk Generator shutting down..."); EVENT_LOGGER.info("Batch Chunk Generator shutting down...");
executors.shutdownNow(); executors.shutdownNow();
if (blocking) try { if (blocking) try {
if (!executors.awaitTermination(10, TimeUnit.SECONDS)) { if (!executors.awaitTermination(10, TimeUnit.SECONDS)) {
ApiShared.LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads..."); EVENT_LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads...");
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
ApiShared.LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads...", e); EVENT_LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads...", e);
} }
} }
} }
@@ -3,7 +3,6 @@ package com.seibel.lod.common.wrappers.worldGeneration;
import com.mojang.datafixers.DataFixer; import com.mojang.datafixers.DataFixer;
import com.seibel.lod.core.builders.lodBuilding.LodBuilder; import com.seibel.lod.core.builders.lodBuilding.LodBuilder;
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
import com.seibel.lod.core.objects.lod.LodDimension; import com.seibel.lod.core.objects.lod.LodDimension;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
@@ -15,9 +14,6 @@ import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.chunk.storage.ChunkScanAccess; import net.minecraft.world.level.chunk.storage.ChunkScanAccess;
import net.minecraft.world.level.levelgen.DebugLevelSource;
import net.minecraft.world.level.levelgen.FlatLevelSource;
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
import net.minecraft.world.level.levelgen.WorldGenSettings; import net.minecraft.world.level.levelgen.WorldGenSettings;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
import net.minecraft.world.level.storage.WorldData; import net.minecraft.world.level.storage.WorldData;
@@ -6,13 +6,14 @@ import com.seibel.lod.common.wrappers.worldGeneration.mimicObject.WorldGenStruct
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.levelgen.WorldGenSettings;
import net.minecraft.world.level.levelgen.structure.StructureCheck; import net.minecraft.world.level.levelgen.structure.StructureCheck;
public final class ThreadedParameters public final class ThreadedParameters
{ {
private static final ThreadLocal<ThreadedParameters> localParam = new ThreadLocal<ThreadedParameters>(); private static final ThreadLocal<ThreadedParameters> localParam = new ThreadLocal<ThreadedParameters>();
final ServerLevel level; final ServerLevel level;
public final WorldGenStructFeatManager structFeat; public WorldGenStructFeatManager structFeat = null;
public final StructureCheck structCheck; public final StructureCheck structCheck;
boolean isValid = true; boolean isValid = true;
public final PerfCalculator perf = new PerfCalculator(); public final PerfCalculator perf = new PerfCalculator();
@@ -38,11 +39,10 @@ public final class ThreadedParameters
structCheck = new StructureCheck(param.chunkScanner, param.registry, param.structures, structCheck = new StructureCheck(param.chunkScanner, param.registry, param.structures,
param.level.dimension(), param.generator, level, param.generator.getBiomeSource(), param.worldSeed, param.level.dimension(), param.generator, level, param.generator.getBiomeSource(), param.worldSeed,
param.fixerUpper); param.fixerUpper);
structFeat = new WorldGenStructFeatManager(level, param.worldGenSettings, null, structCheck);
} }
public void makeStructFeat(WorldGenLevel genLevel) public void makeStructFeat(WorldGenLevel genLevel, GlobalParameters param)
{ {
structFeat.setGenLevel(genLevel); structFeat = new WorldGenStructFeatManager(param.worldGenSettings, genLevel, structCheck);
} }
} }
@@ -4,9 +4,10 @@ package com.seibel.lod.common.wrappers.worldGeneration.mimicObject;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import com.mojang.serialization.Dynamic; import com.mojang.serialization.Dynamic;
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
import com.seibel.lod.core.api.ApiShared; import com.seibel.lod.core.api.ApiShared;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.logging.ConfigBasedLogger;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import it.unimi.dsi.fastutil.longs.LongSet; import it.unimi.dsi.fastutil.longs.LongSet;
import java.util.Arrays; import java.util.Arrays;
@@ -56,7 +57,7 @@ import org.apache.logging.log4j.Logger;
public class ChunkLoader public class ChunkLoader
{ {
private static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState()); private static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState());
private static final Logger LOGGER = ApiShared.LOGGER; private static final ConfigBasedLogger LOGGER = BatchGenerationEnvironment.LOAD_LOGGER;
private static final String TAG_UPGRADE_DATA = "UpgradeData"; private static final String TAG_UPGRADE_DATA = "UpgradeData";
private static final String BLOCK_TICKS_TAG = "block_ticks"; private static final String BLOCK_TICKS_TAG = "block_ticks";
private static final String FLUID_TICKS_TAG = "fluid_ticks"; private static final String FLUID_TICKS_TAG = "fluid_ticks";
@@ -279,7 +280,7 @@ public class ChunkLoader
ChunkPos actualPos = new ChunkPos(chunkData.getInt("xPos"), chunkData.getInt("zPos")); ChunkPos actualPos = new ChunkPos(chunkData.getInt("xPos"), chunkData.getInt("zPos"));
if (!Objects.equals(chunkPos, actualPos)) if (!Objects.equals(chunkPos, actualPos))
{ {
LOGGER.error("Distant Horizons: Chunk file at {} is in the wrong location; Ignoring. (Expected {}, got {})", (Object) chunkPos, (Object) chunkPos, (Object) actualPos); LOGGER.error("Chunk file at {} is in the wrong location; Ignoring. (Expected {}, got {})", (Object) chunkPos, (Object) chunkPos, (Object) actualPos);
return null; return null;
} }
@@ -6,7 +6,6 @@ import com.seibel.lod.core.api.ApiShared;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment.EmptyChunkGenerator; import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment.EmptyChunkGenerator;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.enums.config.LightGenerationMode; import com.seibel.lod.core.enums.config.LightGenerationMode;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
@@ -1,7 +1,11 @@
package com.seibel.lod.common.wrappers.worldGeneration.mimicObject; package com.seibel.lod.common.wrappers.worldGeneration.mimicObject;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.stream.Stream; import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Predicate;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@@ -17,60 +21,61 @@ import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.levelgen.WorldGenSettings; import net.minecraft.world.level.levelgen.WorldGenSettings;
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
import net.minecraft.world.level.levelgen.feature.StructureFeature; import net.minecraft.world.level.levelgen.feature.StructureFeature;
import net.minecraft.world.level.levelgen.structure.StructureCheck; import net.minecraft.world.level.levelgen.structure.StructureCheck;
import net.minecraft.world.level.levelgen.structure.StructureStart; import net.minecraft.world.level.levelgen.structure.StructureStart;
public class WorldGenStructFeatManager extends StructureFeatureManager { public class WorldGenStructFeatManager extends StructureFeatureManager {
WorldGenLevel genLevel; final WorldGenLevel genLevel;
WorldGenSettings worldGenSettings; WorldGenSettings worldGenSettings;
StructureCheck structureCheck; StructureCheck structureCheck;
public WorldGenStructFeatManager(LevelAccessor levelAccessor, WorldGenSettings worldGenSettings, public WorldGenStructFeatManager(WorldGenSettings worldGenSettings,
WorldGenLevel genLevel, StructureCheck structureCheck) { WorldGenLevel genLevel, StructureCheck structureCheck) {
super(levelAccessor, worldGenSettings, structureCheck); super(genLevel, worldGenSettings, structureCheck);
this.genLevel = genLevel; this.genLevel = genLevel;
this.worldGenSettings = worldGenSettings; this.worldGenSettings = worldGenSettings;
} }
public void setGenLevel(WorldGenLevel genLevel) {
this.genLevel = genLevel;
}
@Override @Override
public WorldGenStructFeatManager forWorldGenRegion(WorldGenRegion worldGenRegion) { public WorldGenStructFeatManager forWorldGenRegion(WorldGenRegion worldGenRegion) {
if (worldGenRegion == genLevel) if (worldGenRegion == genLevel)
return this; return this;
return new WorldGenStructFeatManager(worldGenRegion, worldGenSettings, worldGenRegion, structureCheck); return new WorldGenStructFeatManager(worldGenSettings, worldGenRegion, structureCheck);
}
private ChunkAccess _getChunk(int x, int z, ChunkStatus status) {
if (genLevel == null) return null;
return genLevel.getChunk(x, z, status, false);
} }
@Override @Override
public boolean hasAnyStructureAt(BlockPos blockPos) { public boolean hasAnyStructureAt(BlockPos blockPos) {
SectionPos sectionPos = SectionPos.of(blockPos); SectionPos sectionPos = SectionPos.of(blockPos);
ChunkAccess chunk = genLevel.getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_REFERENCES, ChunkAccess chunk = _getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_REFERENCES);
false);
if (chunk == null) return false; if (chunk == null) return false;
return chunk.hasAnyStructureReferences(); return chunk.hasAnyStructureReferences();
} }
// TODO Check this
/*
#if MC_VERSION_1_18_1
@Override @Override
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
public List<? extends StructureStart<?>> startsForFeature(SectionPos sectionPos, public List<? extends StructureStart<?>> startsForFeature(SectionPos sectionPos,
StructureFeature<?> structureFeature) { StructureFeature<?> structureFeature) {
if (genLevel == null)
return List.of(); ChunkAccess chunk = _getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_REFERENCES);
ChunkAccess chunk = genLevel.getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_REFERENCES, if (chunk == null) return List.of();
false);
if (chunk == null) // Copied from StructureFeatureManager::startsForFeature(...) with slight tweaks
return List.of();
LongSet longSet = chunk.getReferencesForFeature(structureFeature); LongSet longSet = chunk.getReferencesForFeature(structureFeature);
ImmutableList.Builder builder = ImmutableList.builder(); ImmutableList.Builder builder = ImmutableList.builder();
LongIterator longIterator = longSet.iterator(); LongIterator longIterator = longSet.iterator();
while (longIterator.hasNext()) { while (longIterator.hasNext()) {
long l = (Long)longIterator.next(); long l = (Long)longIterator.next();
SectionPos sectPos = SectionPos.of(new ChunkPos(l), genLevel.getMinSection()); SectionPos sectPos = SectionPos.of(new ChunkPos(l), genLevel.getMinSection());
ChunkAccess startChunk = genLevel.getChunk(sectPos.x(), sectPos.z(), ChunkStatus.STRUCTURE_STARTS, false); ChunkAccess startChunk = _getChunk(sectPos.x(), sectPos.z(), ChunkStatus.STRUCTURE_STARTS);
if (startChunk == null) continue; if (startChunk == null) continue;
StructureStart<?> structureStart = this.getStartForFeature(sectPos, structureFeature, startChunk); StructureStart<?> structureStart = this.getStartForFeature(sectPos, structureFeature, startChunk);
if (structureStart == null || !structureStart.isValid()) continue; if (structureStart == null || !structureStart.isValid()) continue;
@@ -78,5 +83,52 @@ public class WorldGenStructFeatManager extends StructureFeatureManager {
} }
return builder.build(); return builder.build();
} }
*/ #elif MC_VERSION_1_18_2
@Override
public List<StructureStart> startsForFeature(SectionPos sectionPos, Predicate<ConfiguredStructureFeature<?, ?>> predicate) {
ChunkAccess chunk = _getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_REFERENCES);
if (chunk == null) return List.of();
// Copied from StructureFeatureManager::startsForFeature(...)
Map<ConfiguredStructureFeature<?, ?>, LongSet> map = chunk.getAllReferences();
ImmutableList.Builder<StructureStart> builder = ImmutableList.builder();
Iterator<Map.Entry<ConfiguredStructureFeature<?, ?>, LongSet>> var5 = map.entrySet().iterator();
while(var5.hasNext()) {
Map.Entry<ConfiguredStructureFeature<?, ?>, LongSet> entry = var5.next();
ConfiguredStructureFeature<?, ?> configuredStructureFeature = entry.getKey();
if (predicate.test(configuredStructureFeature)) {
LongSet var10002 = (LongSet)entry.getValue();
Objects.requireNonNull(builder);
this.fillStartsForFeature(configuredStructureFeature, var10002, builder::add);
}
}
return builder.build();
}
@Override
public List<StructureStart> startsForFeature(SectionPos sectionPos, ConfiguredStructureFeature<?, ?> configuredStructureFeature) {
ChunkAccess chunk = _getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_REFERENCES);
if (chunk == null) return List.of();
// Copied from StructureFeatureManager::startsForFeature(...)
LongSet longSet = chunk.getReferencesForFeature(configuredStructureFeature);
ImmutableList.Builder<StructureStart> builder = ImmutableList.builder();
Objects.requireNonNull(builder);
this.fillStartsForFeature(configuredStructureFeature, longSet, builder::add);
return builder.build();
}
@Override
public Map<ConfiguredStructureFeature<?, ?>, LongSet> getAllStructuresAt(BlockPos blockPos) {
SectionPos sectionPos = SectionPos.of(blockPos);
ChunkAccess chunk = _getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_REFERENCES);
if (chunk == null) return Map.of();
return chunk.getAllReferences();
}
#endif
} }
@@ -16,6 +16,7 @@ accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chu
# lighting # lighting
accessible field net/minecraft/client/renderer/LightTexture lightPixels Lcom/mojang/blaze3d/platform/NativeImage; accessible field net/minecraft/client/renderer/LightTexture lightPixels Lcom/mojang/blaze3d/platform/NativeImage;
accessible field net/minecraft/client/renderer/LightTexture lightTexture Lnet/minecraft/client/renderer/texture/DynamicTexture;
accessible field net/minecraft/world/level/lighting/LevelLightEngine blockEngine Lnet/minecraft/world/level/lighting/LayerLightEngine; accessible field net/minecraft/world/level/lighting/LevelLightEngine blockEngine Lnet/minecraft/world/level/lighting/LayerLightEngine;
accessible field net/minecraft/world/level/lighting/LevelLightEngine skyEngine Lnet/minecraft/world/level/lighting/LayerLightEngine; accessible field net/minecraft/world/level/lighting/LevelLightEngine skyEngine Lnet/minecraft/world/level/lighting/LayerLightEngine;
+1 -1
Submodule core updated: 6cd0281d0e...02b0637adc
+13 -4
View File
@@ -17,6 +17,10 @@ configurations {
compileClasspath.extendsFrom common compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common runtimeClasspath.extendsFrom common
developmentFabric.extendsFrom common developmentFabric.extendsFrom common
addModJar
include.extendsFrom addModJar
modImplementation.extendsFrom addModJar
} }
repositories { repositories {
@@ -36,19 +40,24 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
// Fabric API // Fabric API
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" addModJar(fabricApi.module("fabric-lifecycle-events-v1", rootProject.fabric_api_version))
addModJar(fabricApi.module("fabric-key-binding-api-v1", rootProject.fabric_api_version))
addModJar(fabricApi.module("fabric-networking-api-v1", rootProject.fabric_api_version))
// Mod Menu // Mod Menu
modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}") { modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}")
exclude(group: "net.fabricmc.fabric-api")
}
// Starlight // Starlight
addMod("curse.maven:starlight-521783:${rootProject.starlight_version_fabric}", rootProject.enable_starlight) addMod("curse.maven:starlight-521783:${rootProject.starlight_version_fabric}", rootProject.enable_starlight)
// Phosphor
addMod("curse.maven:phosphor-372124:${rootProject.phosphor_version_fabric}", rootProject.enable_phosphor)
// Sodium // Sodium
addMod("curse.maven:sodium-394468:${rootProject.sodium_version}", rootProject.enable_sodium) addMod("curse.maven:sodium-394468:${rootProject.sodium_version}", rootProject.enable_sodium)
implementation "org.joml:joml:1.10.2" implementation "org.joml:joml:1.10.2"
modImplementation(fabricApi.module("fabric-rendering-data-attachment-v1", rootProject.fabric_api_version))
modImplementation(fabricApi.module("fabric-rendering-fluids-v1", rootProject.fabric_api_version))
// Lithium // Lithium
addMod("maven.modrinth:lithium:${rootProject.lithium_version}", rootProject.enable_lithium) addMod("maven.modrinth:lithium:${rootProject.lithium_version}", rootProject.enable_lithium)
@@ -21,6 +21,7 @@ package com.seibel.lod.fabric.mixins;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f; import com.mojang.math.Matrix4f;
import com.seibel.lod.common.Config;
import com.seibel.lod.common.wrappers.McObjectConverter; import com.seibel.lod.common.wrappers.McObjectConverter;
import com.seibel.lod.core.api.ClientApi; import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.objects.math.Mat4f; import com.seibel.lod.core.objects.math.Mat4f;
@@ -61,6 +62,7 @@ public class MixinWorldRenderer
previousPartialTicks = tickDelta; previousPartialTicks = tickDelta;
} }
/* Inject rendering at renderSky
// HEAD or RETURN // HEAD or RETURN
@Inject(at = @At("RETURN"), @Inject(at = @At("RETURN"),
method = "renderSky", method = "renderSky",
@@ -73,10 +75,9 @@ public class MixinWorldRenderer
ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks);
} }*/
/*
// Inject rendering at first call to renderChunkLayer
// HEAD or RETURN // HEAD or RETURN
@Inject(at = @At("HEAD"), @Inject(at = @At("HEAD"),
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V", method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V",
@@ -91,6 +92,8 @@ public class MixinWorldRenderer
ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks);
} }
//callback.cancel(); if (Config.Client.Advanced.lodOnlyMode) {
}*/ callback.cancel();
}
}
} }
+3 -1
View File
@@ -33,7 +33,9 @@
"accessWidener" : "lod.accesswidener", "accessWidener" : "lod.accesswidener",
"depends": { "depends": {
"fabricloader": "*", "fabricloader": "*",
"fabric": "*", "fabric-lifecycle-events-v1": "*",
"fabric-key-binding-api-v1": "*",
"fabric-networking-api-v1": "*",
"minecraft": "${minecraft_version}", "minecraft": "${minecraft_version}",
"java": ">=${java_version}" "java": ">=${java_version}"
}, },
@@ -23,6 +23,8 @@ import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.api.EventApi; import com.seibel.lod.core.api.EventApi;
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper; import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.world.entity.player.Player;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import com.seibel.lod.common.wrappers.chunk.ChunkWrapper; import com.seibel.lod.common.wrappers.chunk.ChunkWrapper;
@@ -27,13 +27,10 @@ import com.seibel.lod.core.ModInfo;
import com.seibel.lod.core.api.ApiShared; import com.seibel.lod.core.api.ApiShared;
import com.seibel.lod.core.handlers.ReflectionHandler; import com.seibel.lod.core.handlers.ReflectionHandler;
import com.seibel.lod.core.handlers.dependencyInjection.ModAccessorHandler; import com.seibel.lod.core.handlers.dependencyInjection.ModAccessorHandler;
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IOptifineAccessor; import com.seibel.lod.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
import com.seibel.lod.forge.networking.NetworkHandler; import com.seibel.lod.forge.networking.NetworkHandler;
import com.seibel.lod.forge.wrappers.ForgeDependencySetup; import com.seibel.lod.forge.wrappers.ForgeDependencySetup;
import com.seibel.lod.forge.wrappers.modAccessor.ModChecker;
import com.seibel.lod.forge.wrappers.modAccessor.OptifineAccessor; import com.seibel.lod.forge.wrappers.modAccessor.OptifineAccessor;
import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.BakedQuad;
@@ -88,6 +85,9 @@ public class ForgeMain implements LodForgeMethodCaller
if (ReflectionHandler.instance.optifinePresent()) { if (ReflectionHandler.instance.optifinePresent()) {
ModAccessorHandler.bind(IOptifineAccessor.class, new OptifineAccessor()); ModAccessorHandler.bind(IOptifineAccessor.class, new OptifineAccessor());
} }
ModAccessorHandler.finishBinding();
ModAccessorHandler.finishBinding(); ModAccessorHandler.finishBinding();
@@ -21,6 +21,7 @@ package com.seibel.lod.forge.mixins;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f; import com.mojang.math.Matrix4f;
import com.seibel.lod.common.Config;
import com.seibel.lod.common.wrappers.McObjectConverter; import com.seibel.lod.common.wrappers.McObjectConverter;
import com.seibel.lod.core.api.ClientApi; import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.objects.math.Mat4f; import com.seibel.lod.core.objects.math.Mat4f;
@@ -61,7 +62,9 @@ public class MixinWorldRenderer
} }
// HEAD or RETURN // HEAD or RETURN
@Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V") @Inject(at = @At("HEAD"),
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V",
cancellable = true)
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback) private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
{ {
// only render before solid blocks // only render before solid blocks
@@ -72,5 +75,8 @@ public class MixinWorldRenderer
ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks); ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks);
} }
if (Config.Client.Advanced.lodOnlyMode) {
callback.cancel();
}
} }
} }
Binary file not shown.