Compare commits
227 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 268993e38c | |||
| 752eeeb7af | |||
| 7f57a7c794 | |||
| 5fb1915c69 | |||
| a7e2ead7fa | |||
| 21a510c023 | |||
| b3ee205f49 | |||
| e242893a92 | |||
| 48c5d32093 | |||
| a3d167a958 | |||
| 923fe0576f | |||
| 9bb1a04402 | |||
| e355fcd660 | |||
| 6c62155d36 | |||
| 2d2ea5b44f | |||
| 05dbe0f07e | |||
| e27676d06b | |||
| 89e32cd17a | |||
| 8f48d15b1f | |||
| 4af31ac5b9 | |||
| 993a9a6864 | |||
| 9c90db3718 | |||
| 4d37429c49 | |||
| e03536f315 | |||
| 6057141094 | |||
| 55f7e2cd30 | |||
| 39e923ae79 | |||
| 99852fded6 | |||
| d75bf8afe7 | |||
| 086185783c | |||
| 70321c2d0f | |||
| 9ce353d897 | |||
| 1d1a2d455d | |||
| fa1e7704e0 | |||
| 1227c56353 | |||
| 22c85f1eda | |||
| d75a4f8d1a | |||
| 7f69809345 | |||
| e460aa2e0d | |||
| 705535e574 | |||
| f0966befb2 | |||
| ec3bab3158 | |||
| 7510f23d19 | |||
| 9c9974de5b | |||
| e49a400dba | |||
| 893e82b181 | |||
| f8427c4f40 | |||
| 6576f55c55 | |||
| ddca97f679 | |||
| 6bf405c0b1 | |||
| d97bc912f7 | |||
| ac91979a3f | |||
| 3119fae67b | |||
| b77a53fc2a | |||
| 9d45717356 | |||
| 6235453387 | |||
| 0e52c06d35 | |||
| 680ab28491 | |||
| b31ee404fd | |||
| 4c604a24cb | |||
| ebba4939c5 | |||
| 285a507370 | |||
| 2f7008bbc3 | |||
| 68b0550696 | |||
| bafe93a28a | |||
| b1b464c592 | |||
| b21cfd8304 | |||
| 8dc3f744fe | |||
| 225703cdf1 | |||
| 3fb9fa8609 | |||
| a4fca06531 | |||
| fdd416b514 | |||
| 03f134bde3 | |||
| e8d1ca995c | |||
| 00b43dc90f | |||
| 2efb6fff49 | |||
| 16adf15975 | |||
| 417b98f881 | |||
| ffa64874c9 | |||
| 8454b5056d | |||
| a81fd9a483 | |||
| 4ee1949873 | |||
| 6acb4d4184 | |||
| 2798368099 | |||
| bcdce2bdf5 | |||
| 43773652aa | |||
| 10072200b5 | |||
| a00647f8e7 | |||
| 96429eec00 | |||
| c49e38a58c | |||
| b2047ce0c0 | |||
| 5b60d515e9 | |||
| cf0205caa4 | |||
| c91ab1deb1 | |||
| 2b5dd236aa | |||
| 0658479921 | |||
| ff8b07ac12 | |||
| fb87ee529a | |||
| 1fabc24e45 | |||
| 9ab2cfcb6a | |||
| e81e31fc24 | |||
| e69b7dec7d | |||
| 534e4a4377 | |||
| 3193773583 | |||
| 4d4906228e | |||
| e4a1d7478a | |||
| cf8eaa57cf | |||
| 2211add5e0 | |||
| e432358e1b | |||
| 3ccce80e1d | |||
| 1952f91540 | |||
| 0e1017111e | |||
| b4be8ab83f | |||
| 3b807dae95 | |||
| 9fdaeed69b | |||
| b7d627f0f5 | |||
| 733bbc0b58 | |||
| 17f6147e13 | |||
| 08c4c8667a | |||
| 526791aae7 | |||
| 8fdd6dcccc | |||
| fb4f5819fd | |||
| 58554f3891 | |||
| 5020084663 | |||
| 5aaab01ac9 | |||
| 024f60de9b | |||
| 1ccc46869d | |||
| 3edcb8d03d | |||
| d7189f0f05 | |||
| f19aa7831e | |||
| 601eeb7fbe | |||
| a8f20a407b | |||
| 872a7d9fa8 | |||
| 310b85ad83 | |||
| b8d94ba7eb | |||
| 4c112aa8ae | |||
| df6da4b48a | |||
| c3e8449979 | |||
| d8707bfe01 | |||
| f07940c11f | |||
| 889c3d32c9 | |||
| 1e502c5933 | |||
| f01e31f475 | |||
| 4285f32b94 | |||
| af5bcafa45 | |||
| 909870b321 | |||
| 2b5dd8b77e | |||
| 4d4e4a9706 | |||
| ac82e90dc2 | |||
| 8063141406 | |||
| 5c17e9599b | |||
| 2e54f2166d | |||
| a0bd2ba4a1 | |||
| 38102ac17f | |||
| 139c5869c9 | |||
| 79206420f9 | |||
| e046b972ca | |||
| ea4949b3a2 | |||
| 05d5f0b943 | |||
| 81df84dc37 | |||
| ff9bab99c7 | |||
| 301ea26a03 | |||
| bd7a03b0ca | |||
| 4e0619a269 | |||
| 8b13afeb23 | |||
| ce44feeb40 | |||
| 821e86b875 | |||
| 015e596eda | |||
| 09e535abf4 | |||
| 855f7f0f9a | |||
| 5fa3e3cb7f | |||
| 0bddc2dcac | |||
| 42a8e0e0f0 | |||
| 7b77e07a7d | |||
| db17d27823 | |||
| 362b800f25 | |||
| 29e26d659d | |||
| afa658cc00 | |||
| cde0d466dd | |||
| 4031b55630 | |||
| 86e07156d1 | |||
| 1e8df274ee | |||
| f0153cc4a6 | |||
| 3044c238fd | |||
| ead58390cd | |||
| 504d22ff37 | |||
| cc42f8667f | |||
| 6135b3ce7f | |||
| 3c8efa17d5 | |||
| dccae0aea0 | |||
| 2728236ced | |||
| 76ce1d6b21 | |||
| 94ddebaec0 | |||
| cec165176b | |||
| 99ad837441 | |||
| f8be132ba2 | |||
| 122f5431a6 | |||
| c2884954a4 | |||
| 3a0453c8c5 | |||
| 9d241ab175 | |||
| ee7eed8d3c | |||
| 1125452a8f | |||
| a3712c8f72 | |||
| e2022fab2d | |||
| bcea1be19b | |||
| 8d799203c5 | |||
| 980ce2f2af | |||
| c6bea3faa3 | |||
| 7707f55b25 | |||
| f087bb7182 | |||
| bf269c9abf | |||
| a8c7405f9d | |||
| 43c9232e7e | |||
| 8351c58d7b | |||
| aa86381b80 | |||
| 563840ca58 | |||
| b5b9b688c3 | |||
| 3731223087 | |||
| 72d770c0f3 | |||
| ee4b83fa99 | |||
| ee6e3a9876 | |||
| f84570a6fc | |||
| a0f5af46a2 | |||
| 18074f15f5 | |||
| bba0424c6d | |||
| 282f6cfbb8 | |||
| b97b1b61b7 |
@@ -51,3 +51,6 @@ Merged/
|
|||||||
|
|
||||||
# file from notepad++
|
# file from notepad++
|
||||||
*.bak
|
*.bak
|
||||||
|
|
||||||
|
# file genearated via MC version switching using preprocessor
|
||||||
|
build.properties
|
||||||
+229
-49
@@ -3,13 +3,17 @@ image: gradle:eclipse-temurin
|
|||||||
|
|
||||||
# all stages need to be defined here
|
# all stages need to be defined here
|
||||||
stages:
|
stages:
|
||||||
- build_18-1
|
- build_19_4
|
||||||
- build_18-2
|
- build_19_3
|
||||||
# - zip_artifacts
|
- build_19_2
|
||||||
|
- build_19_1
|
||||||
|
- build_19
|
||||||
|
- build_18_2
|
||||||
|
- build_18_1
|
||||||
|
- build_17_1
|
||||||
|
- build_16_5
|
||||||
|
|
||||||
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 +24,234 @@ 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
|
|
||||||
build_18-1:
|
# 1.16.5 build
|
||||||
stage: build_18-1
|
build_16_5:
|
||||||
script: ./gradlew build -PmcVer=1.18.1 --gradle-user-home cache/; ./gradlew merge --gradle-user-home cache/
|
stage: build_16_5
|
||||||
# build using Java 17
|
script:
|
||||||
|
- echo "Building 1.16.5..."
|
||||||
|
- ./gradlew deleteMerged -PmcVer="1.16.5" --gradle-user-home cache/;
|
||||||
|
- ./gradlew clean -PmcVer="1.16.5" --gradle-user-home cache/;
|
||||||
|
- ./gradlew core:build -PmcVer="1.16.5" --gradle-user-home cache/;
|
||||||
|
- ./gradlew build -PmcVer="1.16.5" --gradle-user-home cache/;
|
||||||
|
- ./gradlew mergeJars -PmcVer="1.16.5" --gradle-user-home cache/;
|
||||||
image: eclipse-temurin:17
|
image: eclipse-temurin:17
|
||||||
cache:
|
|
||||||
key: "$CI_COMMIT_REF_NAME_18-1"
|
|
||||||
policy: pull-push
|
|
||||||
paths:
|
|
||||||
- .gradle
|
|
||||||
- cache/
|
|
||||||
|
|
||||||
|
|
||||||
# 1.18.2 build
|
|
||||||
build_18-2:
|
|
||||||
stage: build_18-2
|
|
||||||
script: ./gradlew build -PmcVer=1.18.2 --gradle-user-home cache/; ./gradlew merge --gradle-user-home cache/
|
|
||||||
# build using Java 17
|
|
||||||
image: eclipse-temurin:17
|
|
||||||
cache:
|
|
||||||
key: "$CI_COMMIT_REF_NAME_18-2"
|
|
||||||
policy: pull-push
|
|
||||||
paths:
|
|
||||||
- .gradle
|
|
||||||
- cache/
|
|
||||||
|
|
||||||
# TEMPORARY, there should be a way of either generating artifacts per build or in a separate stage
|
|
||||||
artifacts:
|
artifacts:
|
||||||
# This should only be done after the last build, otherwise there will be duplicate jars
|
name: "Merged_NightlyBuild_1_16_5-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||||
name: "Merged_NightlyBuild-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
paths:
|
||||||
|
- Merged
|
||||||
|
expire_in: 1 day
|
||||||
|
when: always
|
||||||
|
cache:
|
||||||
|
key: "gradleCache"
|
||||||
|
policy: pull-push
|
||||||
|
paths:
|
||||||
|
- .gradle
|
||||||
|
- cache/
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
# 1.17.1 build
|
||||||
|
build_17_1:
|
||||||
|
stage: build_17_1
|
||||||
|
script:
|
||||||
|
- echo "Building 1.17.1..."
|
||||||
|
- ./gradlew deleteMerged -PmcVer="1.17.1" --gradle-user-home cache/;
|
||||||
|
- ./gradlew clean -PmcVer="1.17.1" --gradle-user-home cache/;
|
||||||
|
- ./gradlew core:build -PmcVer="1.17.7" --gradle-user-home cache/;
|
||||||
|
- ./gradlew build -PmcVer="1.17.1" --gradle-user-home cache/;
|
||||||
|
- ./gradlew mergeJars -PmcVer="1.17.1" --gradle-user-home cache/;
|
||||||
|
image: eclipse-temurin:17
|
||||||
|
artifacts:
|
||||||
|
name: "Merged_NightlyBuild_1_17_1-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||||
|
paths:
|
||||||
|
- Merged
|
||||||
|
expire_in: 1 day
|
||||||
|
# even if one build fails, upload the successful jars
|
||||||
|
when: always
|
||||||
|
cache:
|
||||||
|
key: "gradleCache"
|
||||||
|
policy: pull-push
|
||||||
|
paths:
|
||||||
|
- .gradle
|
||||||
|
- cache/
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
# 1.18.1 build
|
||||||
|
build_18_1:
|
||||||
|
stage: build_18_1
|
||||||
|
script:
|
||||||
|
- echo "Building 1.18.1..."
|
||||||
|
- ./gradlew deleteMerged -PmcVer="1.18.1" --gradle-user-home cache/; # make sure any previously merged jars are removed before running this job
|
||||||
|
- ./gradlew clean -PmcVer="1.18.1" --gradle-user-home cache/;
|
||||||
|
- ./gradlew core:build -PmcVer="1.18.1" --gradle-user-home cache/;
|
||||||
|
- ./gradlew build -PmcVer="1.18.1" --gradle-user-home cache/;
|
||||||
|
- ./gradlew mergeJars -PmcVer="1.18.1" --gradle-user-home cache/;
|
||||||
|
# build using Java 17
|
||||||
|
image: eclipse-temurin:17
|
||||||
|
artifacts:
|
||||||
|
name: "Merged_NightlyBuild_1_18_1-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||||
paths:
|
paths:
|
||||||
# relative to the root directory
|
# relative to the root directory
|
||||||
- Merged
|
- Merged
|
||||||
expire_in: 1 day
|
expire_in: 1 day
|
||||||
|
when: always
|
||||||
|
cache:
|
||||||
|
key: "gradleCache"
|
||||||
|
policy: pull-push
|
||||||
|
paths:
|
||||||
|
- .gradle
|
||||||
|
- cache/
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
# 1.18.2 build
|
||||||
|
build_18_2:
|
||||||
|
stage: build_18_2
|
||||||
|
script:
|
||||||
|
- echo "Building 1.18.2..."
|
||||||
|
- ./gradlew deleteMerged -PmcVer="1.18.2" --gradle-user-home cache/;
|
||||||
|
- ./gradlew clean -PmcVer="1.18.2" --gradle-user-home cache/;
|
||||||
|
- ./gradlew core:build -PmcVer="1.18.2" --gradle-user-home cache/;
|
||||||
|
- ./gradlew build -PmcVer="1.18.2" --gradle-user-home cache/;
|
||||||
|
- ./gradlew mergeJars -PmcVer="1.18.2" --gradle-user-home cache/;
|
||||||
|
image: eclipse-temurin:17
|
||||||
|
artifacts:
|
||||||
|
name: "Merged_NightlyBuild_1_18_2-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||||
|
paths:
|
||||||
|
- Merged
|
||||||
|
expire_in: 1 day
|
||||||
|
when: always
|
||||||
|
cache:
|
||||||
|
key: "gradleCache"
|
||||||
|
policy: pull-push
|
||||||
|
paths:
|
||||||
|
- .gradle
|
||||||
|
- cache/
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
# # put artifacts in a zip
|
# 1.19 build
|
||||||
# # This should only be done after all the builds have been completed
|
build_19:
|
||||||
# zip_artifacts:
|
stage: build_19
|
||||||
# stage: zip_artifacts
|
script:
|
||||||
# # The complier complains if we don't do something with the script line
|
- echo "Building 1.19..."
|
||||||
# script: echo 'Building complete. Creating artifact Zip.'
|
- ./gradlew deleteMerged -PmcVer="1.19" --gradle-user-home cache/;
|
||||||
# # build using Java 17
|
- ./gradlew clean -PmcVer="1.19" --gradle-user-home cache/;
|
||||||
# image: eclipse-temurin:17
|
- ./gradlew core:build -PmcVer="1.19" --gradle-user-home cache/;
|
||||||
# artifacts:
|
- ./gradlew build -PmcVer="1.19" --gradle-user-home cache/;
|
||||||
# # This should only be done after the last build, otherwise there will be duplicate jars
|
- ./gradlew mergeJars -PmcVer="1.19" --gradle-user-home cache/;
|
||||||
# name: "Merged_NightlyBuild-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
image: eclipse-temurin:17
|
||||||
# paths:
|
artifacts:
|
||||||
# # relative to the root directory
|
name: "Merged_NightlyBuild_1_19-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||||
# - Merged
|
paths:
|
||||||
# expire_in: 1 day
|
- Merged
|
||||||
|
expire_in: 1 day
|
||||||
|
when: always
|
||||||
|
cache:
|
||||||
|
key: "gradleCache"
|
||||||
|
policy: pull-push
|
||||||
|
paths:
|
||||||
|
- .gradle
|
||||||
|
- cache/
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
# 1.19.1 build
|
||||||
|
build_19_1:
|
||||||
|
stage: build_19_1
|
||||||
|
script:
|
||||||
|
- echo "Building 1.19.1..."
|
||||||
|
- ./gradlew deleteMerged -PmcVer="1.19.1" --gradle-user-home cache/;
|
||||||
|
- ./gradlew clean -PmcVer="1.19.1" --gradle-user-home cache/;
|
||||||
|
- ./gradlew core:build -PmcVer="1.19.1" --gradle-user-home cache/;
|
||||||
|
- ./gradlew build -PmcVer="1.19.1" --gradle-user-home cache/;
|
||||||
|
- ./gradlew mergeJars -PmcVer="1.19.1" --gradle-user-home cache/;
|
||||||
|
image: eclipse-temurin:17
|
||||||
|
artifacts:
|
||||||
|
name: "Merged_NightlyBuild_1_19_1-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||||
|
paths:
|
||||||
|
- Merged
|
||||||
|
expire_in: 1 day
|
||||||
|
when: always
|
||||||
|
cache:
|
||||||
|
key: "gradleCache"
|
||||||
|
policy: pull-push
|
||||||
|
paths:
|
||||||
|
- .gradle
|
||||||
|
- cache/
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
# 1.19.2 build
|
||||||
|
build_19_2:
|
||||||
|
stage: build_19_2
|
||||||
|
script:
|
||||||
|
- echo "Building 1.19.2..."
|
||||||
|
- ./gradlew deleteMerged -PmcVer="1.19.2" --gradle-user-home cache/;
|
||||||
|
- ./gradlew clean -PmcVer="1.19.2" --gradle-user-home cache/;
|
||||||
|
- ./gradlew core:build -PmcVer="1.19.2" --gradle-user-home cache/;
|
||||||
|
- ./gradlew build -PmcVer="1.19.2" --gradle-user-home cache/;
|
||||||
|
- ./gradlew mergeJars -PmcVer="1.19.2" --gradle-user-home cache/;
|
||||||
|
image: eclipse-temurin:17
|
||||||
|
artifacts:
|
||||||
|
name: "Merged_NightlyBuild_1_19_2-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||||
|
paths:
|
||||||
|
- Merged
|
||||||
|
expire_in: 1 day
|
||||||
|
when: always
|
||||||
|
cache:
|
||||||
|
key: "gradleCache"
|
||||||
|
policy: pull-push
|
||||||
|
paths:
|
||||||
|
- .gradle
|
||||||
|
- cache/
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
# 1.19.3 build
|
||||||
|
build_19_3:
|
||||||
|
stage: build_19_3
|
||||||
|
script:
|
||||||
|
- echo "Building 1.19.3..."
|
||||||
|
- ./gradlew deleteMerged -PmcVer="1.19.3" --gradle-user-home cache/;
|
||||||
|
- ./gradlew clean -PmcVer="1.19.3" --gradle-user-home cache/;
|
||||||
|
- ./gradlew core:build -PmcVer="1.19.3" --gradle-user-home cache/;
|
||||||
|
- ./gradlew build -PmcVer="1.19.3" --gradle-user-home cache/;
|
||||||
|
- ./gradlew mergeJars -PmcVer="1.19.3" --gradle-user-home cache/;
|
||||||
|
image: eclipse-temurin:17
|
||||||
|
artifacts:
|
||||||
|
name: "Merged_NightlyBuild_1_19_3-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||||
|
paths:
|
||||||
|
- Merged
|
||||||
|
expire_in: 1 day
|
||||||
|
when: always
|
||||||
|
cache:
|
||||||
|
key: "gradleCache"
|
||||||
|
policy: pull-push
|
||||||
|
paths:
|
||||||
|
- .gradle
|
||||||
|
- cache/
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
# 1.19.4 build
|
||||||
|
build_19_4:
|
||||||
|
stage: build_19_4
|
||||||
|
script:
|
||||||
|
- echo "Building 1.19.4..."
|
||||||
|
- ./gradlew deleteMerged -PmcVer="1.19.4" --gradle-user-home cache/;
|
||||||
|
- ./gradlew clean -PmcVer="1.19.4" --gradle-user-home cache/;
|
||||||
|
- ./gradlew core:build -PmcVer="1.19.4" --gradle-user-home cache/;
|
||||||
|
- ./gradlew build -PmcVer="1.19.4" --gradle-user-home cache/;
|
||||||
|
- ./gradlew mergeJars -PmcVer="1.19.4" --gradle-user-home cache/;
|
||||||
|
image: eclipse-temurin:17
|
||||||
|
artifacts:
|
||||||
|
name: "Merged_NightlyBuild_1_19_4-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||||
|
paths:
|
||||||
|
- Merged
|
||||||
|
expire_in: 1 day
|
||||||
|
when: always
|
||||||
|
cache:
|
||||||
|
key: "gradleCache"
|
||||||
|
policy: pull-push
|
||||||
|
paths:
|
||||||
|
- .gradle
|
||||||
|
- cache/
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
|
||||||
# unused deployment stage
|
# unused deployment stage
|
||||||
@@ -98,3 +277,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'
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# 1.16.5 version
|
||||||
|
|
||||||
|
java_version=8
|
||||||
|
minecraft_version=1.16.5
|
||||||
|
parchment_version=2022.03.06
|
||||||
|
compatible_minecraft_versions=["1.16.4", "1.16.5"]
|
||||||
|
|
||||||
|
# Fabric loader
|
||||||
|
fabric_loader_version=0.13.2
|
||||||
|
fabric_api_version=0.42.0+1.16
|
||||||
|
# Fabric mod versions
|
||||||
|
modmenu_version=1.16.22
|
||||||
|
starlight_version_fabric=
|
||||||
|
phosphor_version_fabric=
|
||||||
|
lithium_version=mc1.16.5-0.6.6
|
||||||
|
sodium_version=mc1.16.5-0.2.0
|
||||||
|
iris_version=1.16.x-v1.1.4
|
||||||
|
bclib_version=
|
||||||
|
immersive_portals_version =
|
||||||
|
|
||||||
|
# Fabric mod run
|
||||||
|
# 0 = Dont enable and dont run
|
||||||
|
# 1 = Can be refranced in code but dosnt run
|
||||||
|
# 2 = Can be refranced in code and runs in client
|
||||||
|
enable_starlight=0
|
||||||
|
enable_phosphor=0
|
||||||
|
enable_lithium=0
|
||||||
|
enable_sodium=1
|
||||||
|
enable_iris=0
|
||||||
|
enable_bclib=0
|
||||||
|
|
||||||
|
# Forge loader
|
||||||
|
forge_version=36.2.28
|
||||||
|
# Forge mod versions
|
||||||
|
starlight_version_forge=
|
||||||
|
terraforged_version=3285909
|
||||||
|
|
||||||
|
# Forge mod run
|
||||||
|
# 0 = Dont enable and dont run
|
||||||
|
# 1 = Can be refranced in code but dosnt run
|
||||||
|
# 2 = Can be refranced in code and runs in client
|
||||||
|
enable_starlight_forge=0
|
||||||
|
enable_terraforged=2
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# 1.17.1 version
|
||||||
|
|
||||||
|
java_version=16
|
||||||
|
minecraft_version=1.17.1
|
||||||
|
parchment_version=2021.12.12
|
||||||
|
compatible_minecraft_versions=["1.17", "1.17.1"]
|
||||||
|
|
||||||
|
# Fabric loader
|
||||||
|
fabric_loader_version=0.13.2
|
||||||
|
fabric_api_version=0.46.1+1.17
|
||||||
|
# Fabric mod versions
|
||||||
|
modmenu_version=2.0.14
|
||||||
|
starlight_version_fabric=3442770
|
||||||
|
phosphor_version_fabric=
|
||||||
|
lithium_version=mc1.17.1-0.7.5
|
||||||
|
sodium_version=mc1.17.1-0.3.4
|
||||||
|
iris_version=1.17.x-v1.1.4
|
||||||
|
bclib_version=
|
||||||
|
immersive_portals_version = 0.14-1.17
|
||||||
|
|
||||||
|
# Fabric mod run
|
||||||
|
# 0 = Dont enable and dont run
|
||||||
|
# 1 = Can be refranced in code but dosnt run
|
||||||
|
# 2 = Can be refranced in code and runs in client
|
||||||
|
enable_starlight=0
|
||||||
|
enable_phosphor=0
|
||||||
|
enable_lithium=0
|
||||||
|
enable_sodium=1
|
||||||
|
enable_iris=0
|
||||||
|
enable_bclib=0
|
||||||
|
|
||||||
|
# Forge loader
|
||||||
|
forge_version=37.1.1
|
||||||
|
# Forge mod versions
|
||||||
|
starlight_version_forge=3457784
|
||||||
|
terraforged_version=
|
||||||
|
|
||||||
|
# Forge mod run
|
||||||
|
# 0 = Dont enable and dont run
|
||||||
|
# 1 = Can be refranced in code but dosnt run
|
||||||
|
# 2 = Can be refranced in code and runs in client
|
||||||
|
enable_starlight_forge=0
|
||||||
|
enable_terraforged=0
|
||||||
+9
-3
@@ -1,7 +1,9 @@
|
|||||||
# 1.18.1 version based stuff
|
# 1.18.1 version
|
||||||
|
|
||||||
minecraft_version=1.18.1
|
|
||||||
java_version = 17
|
java_version = 17
|
||||||
|
minecraft_version=1.18.1
|
||||||
|
parchment_version=2022.03.06
|
||||||
|
compatible_minecraft_versions=["1.18", "1.18.1"]
|
||||||
|
|
||||||
# Fabric loader
|
# Fabric loader
|
||||||
fabric_loader_version=0.13.3
|
fabric_loader_version=0.13.3
|
||||||
@@ -9,8 +11,9 @@ 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=mc1.18.1-0.4.0-alpha6
|
||||||
iris_version=1.18.x-v1.1.4
|
iris_version=1.18.x-v1.1.4
|
||||||
bclib_version=1.2.5
|
bclib_version=1.2.5
|
||||||
immersive_portals_version = v1.0.4-1.18
|
immersive_portals_version = v1.0.4-1.18
|
||||||
@@ -20,6 +23,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
|
||||||
@@ -29,9 +33,11 @@ fabric_api_version=0.46.6+1.18
|
|||||||
forge_version=39.1.2
|
forge_version=39.1.2
|
||||||
# Forge mod versions
|
# Forge mod versions
|
||||||
starlight_version_forge=3559934
|
starlight_version_forge=3559934
|
||||||
|
terraforged_version=
|
||||||
|
|
||||||
# Forge mod run
|
# Forge mod run
|
||||||
# 0 = Dont enable and don't run
|
# 0 = Dont 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
|
||||||
|
enable_terraforged=0
|
||||||
|
|||||||
+10
-5
@@ -1,8 +1,9 @@
|
|||||||
# 1.18.2 version based stuff
|
# 1.18.2 version based stuff
|
||||||
# architectury_plugin_version = 3.4-SNAPSHOT
|
|
||||||
# dev_architectury_loom_version = 0.10.0-SNAPSHOT
|
|
||||||
minecraft_version=1.18.2
|
|
||||||
java_version = 17
|
java_version = 17
|
||||||
|
minecraft_version=1.18.2
|
||||||
|
parchment_version=2022.03.13
|
||||||
|
compatible_minecraft_versions=["1.18.2"]
|
||||||
|
|
||||||
# Fabric loader
|
# Fabric loader
|
||||||
fabric_loader_version=0.13.3
|
fabric_loader_version=0.13.3
|
||||||
@@ -10,8 +11,9 @@ 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=mc1.18.2-0.4.1
|
||||||
iris_version=1.18.x-v1.2.2
|
iris_version=1.18.x-v1.2.2
|
||||||
immersive_portals_version = v1.0.4-1.18
|
immersive_portals_version = v1.0.4-1.18
|
||||||
bclib_version=0
|
bclib_version=0
|
||||||
@@ -21,6 +23,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
|
||||||
@@ -30,9 +33,11 @@ fabric_api_version=0.48.0+1.18.2
|
|||||||
forge_version=40.0.18
|
forge_version=40.0.18
|
||||||
# Forge mod versions
|
# Forge mod versions
|
||||||
starlight_version_forge=0
|
starlight_version_forge=0
|
||||||
|
terraforged_version=
|
||||||
|
|
||||||
# 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
|
||||||
|
enable_terraforged=0
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# 1.18.2 version based stuff
|
||||||
|
|
||||||
|
java_version = 17
|
||||||
|
minecraft_version=1.19.1
|
||||||
|
parchment_version=2022.03.13
|
||||||
|
compatible_minecraft_versions=["1.19", "1.19.1"]
|
||||||
|
|
||||||
|
# Fabric loader
|
||||||
|
fabric_loader_version=0.14.8
|
||||||
|
fabric_api_version=0.58.5+1.19.1
|
||||||
|
# Fabric mod versions
|
||||||
|
modmenu_version=4.0.0
|
||||||
|
starlight_version_fabric=0
|
||||||
|
phosphor_version_fabric=0
|
||||||
|
lithium_version=0
|
||||||
|
sodium_version=mc1.19.2-0.4.4
|
||||||
|
iris_version=1.19.x-v1.2.6
|
||||||
|
immersive_portals_version = 0
|
||||||
|
bclib_version=0
|
||||||
|
|
||||||
|
# Fabric mod run
|
||||||
|
# 0 = Don't enable and don't run
|
||||||
|
# 1 = Can be referenced in code but doesn't run
|
||||||
|
# 2 = Can be referenced in code and runs in client
|
||||||
|
enable_starlight=0
|
||||||
|
enable_phosphor=0
|
||||||
|
enable_sodium=1
|
||||||
|
enable_lithium=0
|
||||||
|
enable_iris=0
|
||||||
|
enable_bclib=0
|
||||||
|
|
||||||
|
# Forge loader
|
||||||
|
forge_version=42.0.0
|
||||||
|
# Forge mod versions
|
||||||
|
starlight_version_forge=0
|
||||||
|
terraforged_version=
|
||||||
|
|
||||||
|
# Forge mod run
|
||||||
|
# 0 = Don't enable and don't run
|
||||||
|
# 1 = Can be referenced in code but doesn't run
|
||||||
|
# 2 = Can be referenced in code and runs in client
|
||||||
|
enable_starlight_forge=0
|
||||||
|
enable_terraforged=0
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# 1.18.2 version based stuff
|
||||||
|
|
||||||
|
java_version = 17
|
||||||
|
minecraft_version=1.19.2
|
||||||
|
parchment_version=2022.03.13
|
||||||
|
compatible_minecraft_versions=["1.19.2"]
|
||||||
|
|
||||||
|
# Fabric loader
|
||||||
|
fabric_loader_version=0.14.8
|
||||||
|
fabric_api_version=0.58.5+1.19.1
|
||||||
|
# Fabric mod versions
|
||||||
|
modmenu_version=4.0.0
|
||||||
|
starlight_version_fabric=0
|
||||||
|
phosphor_version_fabric=0
|
||||||
|
lithium_version=0
|
||||||
|
sodium_version=mc1.19.2-0.4.4
|
||||||
|
iris_version=1.19.x-v1.2.6
|
||||||
|
immersive_portals_version = 0
|
||||||
|
bclib_version=0
|
||||||
|
|
||||||
|
# Fabric mod run
|
||||||
|
# 0 = Don't enable and don't run
|
||||||
|
# 1 = Can be referenced in code but doesn't run
|
||||||
|
# 2 = Can be referenced in code and runs in client
|
||||||
|
enable_starlight=0
|
||||||
|
enable_phosphor=0
|
||||||
|
enable_sodium=1
|
||||||
|
enable_lithium=0
|
||||||
|
enable_iris=0
|
||||||
|
enable_bclib=0
|
||||||
|
|
||||||
|
# Forge loader
|
||||||
|
forge_version=43.0.0
|
||||||
|
# Forge mod versions
|
||||||
|
starlight_version_forge=0
|
||||||
|
terraforged_version=
|
||||||
|
|
||||||
|
# Forge mod run
|
||||||
|
# 0 = Don't enable and don't run
|
||||||
|
# 1 = Can be referenced in code but doesn't run
|
||||||
|
# 2 = Can be referenced in code and runs in client
|
||||||
|
enable_starlight_forge=0
|
||||||
|
enable_terraforged=0
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# 1.18.2 version based stuff
|
||||||
|
|
||||||
|
java_version = 17
|
||||||
|
minecraft_version=1.19.3
|
||||||
|
parchment_version=2022.03.13
|
||||||
|
compatible_minecraft_versions=["1.19.3"]
|
||||||
|
|
||||||
|
# Fabric loader
|
||||||
|
fabric_loader_version=0.14.11
|
||||||
|
fabric_api_version=0.68.1+1.19.3
|
||||||
|
# Fabric mod versions
|
||||||
|
modmenu_version=5.0.2
|
||||||
|
starlight_version_fabric=0
|
||||||
|
phosphor_version_fabric=0
|
||||||
|
lithium_version=0
|
||||||
|
sodium_version=mc1.19.3-0.4.11
|
||||||
|
iris_version=1.19.x-v1.2.6
|
||||||
|
immersive_portals_version = 0
|
||||||
|
bclib_version=0
|
||||||
|
|
||||||
|
# Fabric mod run
|
||||||
|
# 0 = Don't enable and don't run
|
||||||
|
# 1 = Can be referenced in code but doesn't run
|
||||||
|
# 2 = Can be referenced in code and runs in client
|
||||||
|
enable_starlight=0
|
||||||
|
enable_phosphor=0
|
||||||
|
enable_sodium=1
|
||||||
|
enable_lithium=0
|
||||||
|
enable_iris=0
|
||||||
|
enable_bclib=0
|
||||||
|
|
||||||
|
# Forge loader
|
||||||
|
forge_version=44.0.6
|
||||||
|
# Forge mod versions
|
||||||
|
starlight_version_forge=0
|
||||||
|
terraforged_version=
|
||||||
|
|
||||||
|
# Forge mod run
|
||||||
|
# 0 = Don't enable and don't run
|
||||||
|
# 1 = Can be referenced in code but doesn't run
|
||||||
|
# 2 = Can be referenced in code and runs in client
|
||||||
|
enable_starlight_forge=0
|
||||||
|
enable_terraforged=0
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# 1.18.2 version based stuff
|
||||||
|
|
||||||
|
java_version = 17
|
||||||
|
minecraft_version=1.19.4
|
||||||
|
parchment_version=2022.03.13
|
||||||
|
compatible_minecraft_versions=["1.19.4"]
|
||||||
|
|
||||||
|
# Fabric loader
|
||||||
|
fabric_loader_version=0.14.17
|
||||||
|
fabric_api_version=0.75.3+1.19.4
|
||||||
|
# Fabric mod versions
|
||||||
|
modmenu_version=6.1.0-rc.1
|
||||||
|
starlight_version_fabric=0
|
||||||
|
phosphor_version_fabric=0
|
||||||
|
lithium_version=0
|
||||||
|
sodium_version=mc1.19.4-0.4.11
|
||||||
|
iris_version=1.19.x-v1.2.6
|
||||||
|
immersive_portals_version = 0
|
||||||
|
bclib_version=0
|
||||||
|
|
||||||
|
# Fabric mod run
|
||||||
|
# 0 = Don't enable and don't run
|
||||||
|
# 1 = Can be referenced in code but doesn't run
|
||||||
|
# 2 = Can be referenced in code and runs in client
|
||||||
|
enable_starlight=0
|
||||||
|
enable_phosphor=0
|
||||||
|
enable_sodium=1
|
||||||
|
enable_lithium=0
|
||||||
|
enable_iris=0
|
||||||
|
enable_bclib=0
|
||||||
|
|
||||||
|
# Forge loader
|
||||||
|
forge_version=45.0.0
|
||||||
|
# Forge mod versions
|
||||||
|
starlight_version_forge=0
|
||||||
|
terraforged_version=
|
||||||
|
|
||||||
|
# Forge mod run
|
||||||
|
# 0 = Don't enable and don't run
|
||||||
|
# 1 = Can be referenced in code but doesn't run
|
||||||
|
# 2 = Can be referenced in code and runs in client
|
||||||
|
enable_starlight_forge=0
|
||||||
|
enable_terraforged=0
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# 1.18.2 version based stuff
|
||||||
|
|
||||||
|
java_version = 17
|
||||||
|
minecraft_version=1.19
|
||||||
|
parchment_version=2022.03.13
|
||||||
|
compatible_minecraft_versions=["1.19"]
|
||||||
|
|
||||||
|
# Fabric loader
|
||||||
|
fabric_loader_version=0.14.8
|
||||||
|
fabric_api_version=0.57.0+1.19
|
||||||
|
# Fabric mod versions
|
||||||
|
modmenu_version=4.0.0
|
||||||
|
starlight_version_fabric=0
|
||||||
|
phosphor_version_fabric=0
|
||||||
|
lithium_version=0
|
||||||
|
sodium_version=mc1.19.2-0.4.4
|
||||||
|
iris_version=1.19.x-v1.2.6
|
||||||
|
immersive_portals_version = 0
|
||||||
|
bclib_version=0
|
||||||
|
|
||||||
|
# Fabric mod run
|
||||||
|
# 0 = Don't enable and don't run
|
||||||
|
# 1 = Can be referenced in code but doesn't run
|
||||||
|
# 2 = Can be referenced in code and runs in client
|
||||||
|
enable_starlight=0
|
||||||
|
enable_phosphor=0
|
||||||
|
enable_sodium=1
|
||||||
|
enable_lithium=0
|
||||||
|
enable_iris=0
|
||||||
|
enable_bclib=0
|
||||||
|
|
||||||
|
# Forge loader
|
||||||
|
forge_version=41.0.94
|
||||||
|
# Forge mod versions
|
||||||
|
starlight_version_forge=0
|
||||||
|
terraforged_version=
|
||||||
|
|
||||||
|
# Forge mod run
|
||||||
|
# 0 = Don't enable and don't run
|
||||||
|
# 1 = Can be referenced in code but doesn't run
|
||||||
|
# 2 = Can be referenced in code and runs in client
|
||||||
|
enable_starlight_forge=0
|
||||||
|
enable_terraforged=0
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
> A mod that adds a Level of Detail System to Minecraft
|
> A mod that adds a Level of Detail System to Minecraft
|
||||||
|
|
||||||
|
## Please move to main branch, this branch is mainly used for porting to newer versions of Minecraft until main becomes stable
|
||||||
|
|
||||||
# What is Distant Horizons?
|
# What is Distant Horizons?
|
||||||
|
|
||||||
@@ -12,13 +13,48 @@ allowing for an increased view distance without harming performance.
|
|||||||
Or in other words: this mod lets you see farther without turning your game into a slide show.\
|
Or in other words: this mod lets you see farther without turning your game into a slide show.\
|
||||||
If you want to see a quick demo, check out a video covering the mod here:
|
If you want to see a quick demo, check out a video covering the mod here:
|
||||||
|
|
||||||
<a href="https://www.youtube.com/watch?v=H2tnvEVbO1c" target="_blank"></a>
|
<a href="https://youtu.be/_04BZ8W2bDM" target="_blank"></a>
|
||||||
|
|
||||||
### Versions
|
### Versions
|
||||||
|
|
||||||
|
This branch is for these versions of Minecraft
|
||||||
|
- 1.19.3
|
||||||
|
- 1.19.2
|
||||||
|
- 1.19.1 & 1.19
|
||||||
|
- 1.18.2
|
||||||
|
- 1.18.1 & 1.18
|
||||||
|
- 1.17.1 & 1.17
|
||||||
|
- 1.16.5 & 1.16.4
|
||||||
|
|
||||||
Architectury version: 3.4-SNAPSHOT\
|
Architectury version: 3.4-SNAPSHOT\
|
||||||
|
Architectury loom version: 0.12.0-SNAPSHOT\
|
||||||
Java Compiler plugin: Manifold Preprocessor
|
Java Compiler plugin: Manifold Preprocessor
|
||||||
|
|
||||||
|
|
||||||
|
#### 1.19.4 mods
|
||||||
|
Forge version: 45.0.0\
|
||||||
|
Fabric version: 0.14.17\
|
||||||
|
Fabric API version: 0.75.3+1.19.4\
|
||||||
|
Modmenu version: 6.1.0-rc.1
|
||||||
|
|
||||||
|
#### 1.19.3 mods
|
||||||
|
Forge version: 44.0.6\
|
||||||
|
Fabric version: 0.14.11\
|
||||||
|
Fabric API version: 0.68.1+1.19.3\
|
||||||
|
Modmenu version: 5.0.2
|
||||||
|
|
||||||
|
#### 1.19.2 mods
|
||||||
|
Forge version: 43.0.0\
|
||||||
|
Fabric version: 0.14.8\
|
||||||
|
Fabric API version: 0.58.5+1.19.1\
|
||||||
|
Modmenu version: 4.0.0
|
||||||
|
|
||||||
|
#### 1.19.1 mods
|
||||||
|
Forge version: 42.0.0\
|
||||||
|
Fabric version: 0.14.8\
|
||||||
|
Fabric API version: 0.58.5+1.19.1\
|
||||||
|
Modmenu version: 4.0.0
|
||||||
|
|
||||||
#### 1.18.2 mods
|
#### 1.18.2 mods
|
||||||
Forge version: 40.0.18\
|
Forge version: 40.0.18\
|
||||||
Fabric version: 0.13.3\
|
Fabric version: 0.13.3\
|
||||||
@@ -28,17 +64,41 @@ Modmenu version: 3.1.0
|
|||||||
#### 1.18.1 mods
|
#### 1.18.1 mods
|
||||||
Forge version: 39.1.2\
|
Forge version: 39.1.2\
|
||||||
Fabric version: 0.13.3\
|
Fabric version: 0.13.3\
|
||||||
Fabric API version: 0.46.6+1.18\
|
Fabric API version: 0.42.6+1.18\
|
||||||
Modmenu version: 3.0.1
|
Modmenu version: 3.0.1
|
||||||
|
|
||||||
|
#### 1.17.1 mods
|
||||||
|
Forge version: 37.1.1\
|
||||||
|
Fabric version: 0.13.2\
|
||||||
|
Fabric API version: 0.46.1+1.17\
|
||||||
|
Modmenu version: 2.0.14
|
||||||
|
|
||||||
|
#### 1.16.5 mods
|
||||||
|
Forge version: 36.2.28\
|
||||||
|
Fabric vetsion: 0.13.2\
|
||||||
|
Fabric API version: 0.42.0+1.16\
|
||||||
|
Modmenu version: 1.16.22
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Notes:\
|
Notes:\
|
||||||
This version has been confirmed to work in IDE and Retail Minecraft.\
|
This version has been confirmed to work in IDE and Retail Minecraft with ether the Fabric or Forge mod-loader.
|
||||||
(Retail running forge version 1.18.1-39.0.5 and fabric version 1.18-0.12.12 and 1.18.1-0.13.2)
|
|
||||||
|
|
||||||
|
|
||||||
## Source Code Installation
|
## Source Code Installation
|
||||||
|
|
||||||
|
#### Nightlly builds
|
||||||
|
This mod has an autobuild system to automatically build the mod on each commit
|
||||||
|
- 1.19.1: https://gitlab.com/jeseibel/minecraft-lod-mod/-/jobs/artifacts/stable/download?job=build_19_4
|
||||||
|
- 1.19.1: https://gitlab.com/jeseibel/minecraft-lod-mod/-/jobs/artifacts/stable/download?job=build_19_3
|
||||||
|
- 1.19.1: https://gitlab.com/jeseibel/minecraft-lod-mod/-/jobs/artifacts/stable/download?job=build_19_2
|
||||||
|
- 1.19.1: https://gitlab.com/jeseibel/minecraft-lod-mod/-/jobs/artifacts/stable/download?job=build_19_1
|
||||||
|
- 1.19: https://gitlab.com/jeseibel/minecraft-lod-mod/-/jobs/artifacts/stable/download?job=build_19
|
||||||
|
- 1.18.2: https://gitlab.com/jeseibel/minecraft-lod-mod/-/jobs/artifacts/stable/download?job=build_18_2
|
||||||
|
- 1.18.1: https://gitlab.com/jeseibel/minecraft-lod-mod/-/jobs/artifacts/stable/download?job=build_18_1
|
||||||
|
- 1.17.1: https://gitlab.com/jeseibel/minecraft-lod-mod/-/jobs/artifacts/stable/download?job=build_17_1
|
||||||
|
- 1.16.5: https://gitlab.com/jeseibel/minecraft-lod-mod/-/jobs/artifacts/stable/download?job=build_16_5
|
||||||
|
|
||||||
See the Fabric Documentation online for more detailed instructions:\
|
See the Fabric Documentation online for more detailed instructions:\
|
||||||
https://fabricmc.net/wiki/tutorial:setup
|
https://fabricmc.net/wiki/tutorial:setup
|
||||||
|
|
||||||
@@ -60,11 +120,18 @@ https://fabricmc.net/wiki/tutorial:setup
|
|||||||
4. Import the project into eclipse
|
4. Import the project into eclipse
|
||||||
|
|
||||||
## Switching Versions
|
## Switching Versions
|
||||||
This branch support 2 built versions:
|
This branch support 9 built versions:
|
||||||
|
- 1.19.4
|
||||||
|
- 1.19.3
|
||||||
|
- 1.19.2
|
||||||
|
- 1.19.1
|
||||||
|
- 1.19
|
||||||
- 1.18.2
|
- 1.18.2
|
||||||
- 1.18.1 (which also runs on 1.18)
|
- 1.18.1 (which also runs on 1.18)
|
||||||
|
- 1.17.1 (which also runs on 1.17)
|
||||||
|
- 1.16.5 (which also runs 1.16.4)
|
||||||
|
|
||||||
To switch between active versions, change `mcVer=1.18.?` in `gradle.properties` file.
|
To switch between active versions, change `mcVer=1.?` in `gradle.properties` file.
|
||||||
|
|
||||||
If running on IDE, to ensure IDE pickup the changed versions, you will need to run a gradle command again to allow gradle to update all the libs. (In IntellJ you will also need to do a gradle sync again if it didn't start it automatically.)
|
If running on IDE, to ensure IDE pickup the changed versions, you will need to run a gradle command again to allow gradle to update all the libs. (In IntellJ you will also need to do a gradle sync again if it didn't start it automatically.)
|
||||||
>Note: There may be a `java.nio.file.FileSystemException` thrown on running the command after switching versions. To fix it, either restart your IDE (as your IDE is locking up a file) or use tools like LockHunter to unlock the linked file. (Often a lib file under `common\build\lib` or `forge\build\lib` or `fabric\build\lib`). If anyone knows how to solve this issue please comment to this issue: https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues/233
|
>Note: There may be a `java.nio.file.FileSystemException` thrown on running the command after switching versions. To fix it, either restart your IDE (as your IDE is locking up a file) or use tools like LockHunter to unlock the linked file. (Often a lib file under `common\build\lib` or `forge\build\lib` or `fabric\build\lib`). If anyone knows how to solve this issue please comment to this issue: https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues/233
|
||||||
@@ -80,12 +147,20 @@ 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 stable --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`
|
||||||
5. The compiled jar file will be in the folder `Merged`
|
5. The compiled jar file will be in the folder `Merged`
|
||||||
>Note: You can add the arg: `-PmcVer=1.18.?` to tell gradle to build a selected MC version instead of having to manually modify the `gradle.properties` file.
|
> ### **WARNING:** Due to a bug at the moment, the merged jar does not contain the core.
|
||||||
|
> To add the core follow the steps below
|
||||||
|
> 1. Go into `core/build/libs` and extract the jar with the smallest name
|
||||||
|
> 2. In that extracted folder, copy the folder called `com`
|
||||||
|
> 3. Go into the `Merged` folder and extract the jar in that
|
||||||
|
> 4. Paste in the folder which you copied from step 2 into the newly extracted jar
|
||||||
|
> 5. Zip all the files that were extracted and make sure the file extension is .jar
|
||||||
|
|
||||||
|
>Note: You can add the arg: `-PmcVer=1.?` to tell gradle to build a selected MC version instead of having to manually modify the `gradle.properties` file.
|
||||||
|
|
||||||
|
|
||||||
## Other commands
|
## Other commands
|
||||||
@@ -99,7 +174,12 @@ If running on IDE, to ensure IDE pickup the changed versions, you will need to r
|
|||||||
|
|
||||||
The Minecraft source code is NOT added to your workspace in an editable way. Minecraft is treated like a normal Library. Sources are there for documentation and research purposes only.
|
The Minecraft source code is NOT added to your workspace in an editable way. Minecraft is treated like a normal Library. Sources are there for documentation and research purposes only.
|
||||||
|
|
||||||
Source code uses Mojang mappings.
|
Source code uses Mojang mappings & [Parchment](https://parchmentmc.org/) mappings.
|
||||||
|
|
||||||
|
To generate the source code run `./gradlew genSources`\
|
||||||
|
If your IDE fails to auto-detect the sources JAR when browsing Minecraft classes manually select the JAR file ending with -sources.jar when prompted by your IDE
|
||||||
|
|
||||||
|
In IntelliJ it's at the top where it says choose sources when browsing Minecraft classes
|
||||||
|
|
||||||
## Useful commands
|
## Useful commands
|
||||||
|
|
||||||
|
|||||||
+270
-54
@@ -1,6 +1,5 @@
|
|||||||
import io.github.ran.jarmerger.JarMergerPlugin
|
import io.github.ran.jarmerger.JarMergerPlugin
|
||||||
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
dependencies{
|
dependencies{
|
||||||
classpath files('plugins/DHJarMerger-1.0.jar')
|
classpath files('plugins/DHJarMerger-1.0.jar')
|
||||||
@@ -9,21 +8,67 @@ buildscript {
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||||
id "dev.architectury.loom" version "0.10.0-SNAPSHOT" apply false
|
id "dev.architectury.loom" version "0.12.0-SNAPSHOT" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
def writeBuildGradlePredefine() {
|
apply plugin: "java"
|
||||||
def excapedMCVersion = rootProject.minecraft_version.replace(".", "_")
|
apply plugin: "architectury-plugin"
|
||||||
new File(projectDir, "build.properties").text = "MC_VERSION_${excapedMCVersion}=\n"
|
apply plugin: "maven-publish"
|
||||||
}
|
apply plugin: JarMergerPlugin
|
||||||
|
|
||||||
def loadProperties() {
|
archivesBaseName = rootProject.archives_base_name
|
||||||
def defaultMcVersion = '1.18.2'
|
version = rootProject.mod_version
|
||||||
if (!project.hasProperty("mcVer")) {
|
group = rootProject.maven_group
|
||||||
println "No mcVer set! Defaulting to ${defaultMcVersion}."
|
|
||||||
println "Tip: Use -PmcVer='${defaultMcVersion}' in cmd arg to set mcVer."
|
task printConfigurations {
|
||||||
|
doLast {task ->
|
||||||
|
println "Project Name: $name configurations:"
|
||||||
|
configurations.each {
|
||||||
|
println " $it.name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def writeBuildGradlePredefine(List<String> mcVers, int mcIndex) {
|
||||||
|
ArrayList<String> redefineList = new ArrayList<String>()
|
||||||
|
for (int i=0; i<mcVers.size(); i++) {
|
||||||
|
String mcStr = mcVers.get(i).replace(".", "_")
|
||||||
|
if (mcIndex<i) {
|
||||||
|
redefineList.add("PRE_MC_"+mcStr)
|
||||||
|
}
|
||||||
|
if (mcIndex==i) {
|
||||||
|
redefineList.add("MC_"+mcStr)
|
||||||
|
}
|
||||||
|
if (mcIndex>=i) {
|
||||||
|
redefineList.add("POST_MC_"+mcStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StringBuilder sb = new StringBuilder()
|
||||||
|
for (String s : redefineList) {
|
||||||
|
sb.append(s)
|
||||||
|
sb.append("=\n")
|
||||||
|
}
|
||||||
|
new File(projectDir, "build.properties").text = sb.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets up the variables for Manifold in the code
|
||||||
|
def loadProperties() {
|
||||||
|
def defaultMcVersion = "1.19.2"
|
||||||
|
def mcVersion = ""
|
||||||
|
def mcVers = mcVersions.split(",")
|
||||||
|
int mcIndex = -1
|
||||||
|
println "Avalible MC versions: ${mcVersions}"
|
||||||
|
if (project.hasProperty("mcVer")) {
|
||||||
|
mcVersion = mcVer
|
||||||
|
mcIndex = Arrays.asList(mcVers).indexOf(mcVer)
|
||||||
|
}
|
||||||
|
if (mcIndex == -1) {
|
||||||
|
println "No mcVer set or the set mcVer is invalid! Defaulting to ${defaultMcVersion}."
|
||||||
|
println "Tip: Use -PmcVer='${defaultMcVersion}' in cmd arg to set mcVer."
|
||||||
|
mcVersion = defaultMcVersion
|
||||||
|
mcIndex = Arrays.asList(mcVers).indexOf(defaultMcVersion)
|
||||||
|
assert mcIndex != -1
|
||||||
}
|
}
|
||||||
def mcVersion = project.hasProperty("mcVer") ? mcVer : defaultMcVersion
|
|
||||||
|
|
||||||
println "Loading properties file at " + mcVersion + ".properties"
|
println "Loading properties file at " + mcVersion + ".properties"
|
||||||
def props = new Properties()
|
def props = new Properties()
|
||||||
@@ -33,19 +78,154 @@ def loadProperties() {
|
|||||||
rootProject.ext.set(prop.key, prop.value)
|
rootProject.ext.set(prop.key, prop.value)
|
||||||
// println "Added prop [key:" + prop.key + ", value:" + prop.value + "]"
|
// println "Added prop [key:" + prop.key + ", value:" + prop.value + "]"
|
||||||
}
|
}
|
||||||
writeBuildGradlePredefine()
|
writeBuildGradlePredefine(Arrays.asList(mcVers), mcIndex)
|
||||||
|
|
||||||
|
// Stuff for access wideners
|
||||||
|
def mcVersionToAcsessWidenerVersion = [
|
||||||
|
"1.16.5": "1_16",
|
||||||
|
"1.17.1": "1_17",
|
||||||
|
"1.18.1": "1_18",
|
||||||
|
"1.18.2": "1_18",
|
||||||
|
"1.19" : "1_19",
|
||||||
|
"1.19.1" : "1_19",
|
||||||
|
"1.19.2" : "1_19",
|
||||||
|
"1.19.3" : "1_19_3",
|
||||||
|
"1.19.4" : "1_19_3"
|
||||||
|
]
|
||||||
|
// Use this as sometimes multiple versions use the same access wideners
|
||||||
|
rootProject.ext.set("acsessWidenerVersion", mcVersionToAcsessWidenerVersion.get(mcVersion))
|
||||||
}
|
}
|
||||||
loadProperties()
|
loadProperties()
|
||||||
|
|
||||||
apply plugin: JarMergerPlugin
|
|
||||||
|
|
||||||
architectury {
|
architectury {
|
||||||
minecraft = rootProject.minecraft_version
|
minecraft = rootProject.minecraft_version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
|
||||||
|
// For parchment mappings
|
||||||
|
maven { url "https://maven.parchmentmc.org" }
|
||||||
|
|
||||||
|
// used to download and compile dependencies from git repos
|
||||||
|
maven { url 'https://jitpack.io' }
|
||||||
|
|
||||||
|
// For Manifold Preprocessor
|
||||||
|
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
||||||
|
|
||||||
|
// Required for importing Modrinth mods
|
||||||
|
maven {
|
||||||
|
name = "Modrinth"
|
||||||
|
url = "https://api.modrinth.com/maven"
|
||||||
|
content {
|
||||||
|
includeGroup "maven.modrinth"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required for importing CursedForge mods
|
||||||
|
maven {
|
||||||
|
url "https://www.cursemaven.com"
|
||||||
|
content {
|
||||||
|
includeGroup "curse.maven"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// These 2 are for importing mods that arnt on CursedForge, Modrinth, GitHub, GitLab or anywhere opensource
|
||||||
|
flatDir {
|
||||||
|
dirs "${rootDir}/mods/fabric"
|
||||||
|
content {
|
||||||
|
includeGroup "fabric-mod"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
flatDir {
|
||||||
|
dirs "${rootDir}/mods/forge"
|
||||||
|
content {
|
||||||
|
includeGroup "forge-mod"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
def resourceTargets = ["fabric.mod.json", "META-INF/mods.toml"] // Location of where to put
|
||||||
|
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
||||||
|
def replaceProperties = [
|
||||||
|
version : mod_version,
|
||||||
|
mod_name : mod_name,
|
||||||
|
authors : mod_authors,
|
||||||
|
description : mod_description,
|
||||||
|
homepage : mod_homepage,
|
||||||
|
source : mod_source,
|
||||||
|
issues : mod_issues,
|
||||||
|
minecraft_version : minecraft_version,
|
||||||
|
compatible_minecraft_versions: compatible_minecraft_versions,
|
||||||
|
java_version : java_version
|
||||||
|
]
|
||||||
|
// The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties
|
||||||
|
//TODO: Make Forge loader version also be relaced with non hardcoded value instead of "[36,42)"
|
||||||
|
|
||||||
|
inputs.properties replaceProperties
|
||||||
|
replaceProperties.put 'project', project
|
||||||
|
filesMatching(resourceTargets) {
|
||||||
|
expand replaceProperties
|
||||||
|
}
|
||||||
|
|
||||||
|
intoTargets.each { target ->
|
||||||
|
if (file(target).exists()) {
|
||||||
|
copy {
|
||||||
|
from(sourceSets.main.resources) {
|
||||||
|
include resourceTargets
|
||||||
|
expand replaceProperties
|
||||||
|
}
|
||||||
|
into target
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copies the correct accesswidener and renames it
|
||||||
|
task copyAccessWidener(type: Copy) {
|
||||||
|
from project(":common").file("src/main/resources/${rootProject.acsessWidenerVersion}.lod.accesswidener")
|
||||||
|
into(file("build/resources/main"))
|
||||||
|
rename "${rootProject.acsessWidenerVersion}.lod.accesswidener", "lod.accesswidener"
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyCoreResources(type: Copy) {
|
||||||
|
from fileTree(project(":core").file("src/main/resources"))
|
||||||
|
into file("build/resources/main")
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyCommonResources(type: Copy) {
|
||||||
|
from fileTree(project(":common").file("src/main/resources"))
|
||||||
|
into file("build/resources/main")
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
//runClient.enabled = false
|
||||||
|
//runServer.enabled = false
|
||||||
|
|
||||||
|
// 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")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ===============================CORE Gradle basically================================
|
||||||
subprojects { p ->
|
subprojects { p ->
|
||||||
|
if (p == project(":core")) {
|
||||||
|
|
||||||
|
apply plugin: "java"
|
||||||
|
apply plugin: "architectury-plugin"
|
||||||
|
apply plugin: "maven-publish"
|
||||||
apply plugin: "dev.architectury.loom"
|
apply plugin: "dev.architectury.loom"
|
||||||
|
|
||||||
|
p.archivesBaseName = rootProject.archives_base_name
|
||||||
|
p.version = rootProject.mod_version
|
||||||
|
p.group = rootProject.maven_group
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
silentMojangMappingsLicense()
|
silentMojangMappingsLicense()
|
||||||
}
|
}
|
||||||
@@ -58,8 +238,24 @@ subprojects { p ->
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
||||||
// The following line declares the mojmap mappings
|
// The following line declares the mojmap mappings & parchment mappings
|
||||||
mappings loom.officialMojangMappings()
|
mappings loom.layered() {
|
||||||
|
// Mojmap mappings
|
||||||
|
officialMojangMappings()
|
||||||
|
// Parchment mappings (it adds parameter mappings & javadoc)
|
||||||
|
if (
|
||||||
|
rootProject.minecraft_version != "1.19"
|
||||||
|
&& rootProject.minecraft_version != "1.19.1"
|
||||||
|
&& rootProject.minecraft_version != "1.19.2"
|
||||||
|
&& rootProject.minecraft_version != "1.19.3"
|
||||||
|
&& rootProject.minecraft_version != "1.19.4"
|
||||||
|
) // We are not gonna use this build script anymore so dont bother fixing this
|
||||||
|
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip")
|
||||||
|
else
|
||||||
|
parchment("org.parchmentmc.data:parchment-1.18.2:${rootProject.parchment_version}@zip") // As 1.19.x or higher doesnt have parchment mappings yet, we use 1.18.2 mapping
|
||||||
|
// Note: parchment may have later mappings at the time you are reading this, but at the time this was written, it didnt
|
||||||
|
// Check the main branch for the new build system, with the working mappings
|
||||||
|
}
|
||||||
|
|
||||||
//Manifold
|
//Manifold
|
||||||
annotationProcessor "systems.manifold:manifold-preprocessor:${rootProject.manifold_version}"
|
annotationProcessor "systems.manifold:manifold-preprocessor:${rootProject.manifold_version}"
|
||||||
@@ -67,38 +263,36 @@ subprojects { p ->
|
|||||||
// Toml
|
// Toml
|
||||||
implementation("com.electronwill.night-config:toml:${rootProject.toml_version}")
|
implementation("com.electronwill.night-config:toml:${rootProject.toml_version}")
|
||||||
|
|
||||||
if (p != project(":forge")) {
|
|
||||||
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
||||||
// Do NOT use other classes from fabric loader unless working with fabric
|
// Do NOT use other classes from fabric loader unless working with fabric
|
||||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p != project(":core")) {
|
// Allows the jar to run standalone
|
||||||
common(project(":core")) { transitive false }
|
|
||||||
shadowMe(project(":core")) { transitive false }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
attributes 'Implementation-Title': rootProject.archives_base_name,
|
attributes 'Implementation-Title': rootProject.archives_base_name,
|
||||||
'Implementation-Version': rootProject.mod_version,
|
'Implementation-Version': rootProject.mod_version,
|
||||||
'Main-Class': 'com.seibel.lod.core.JarMain'
|
'Main-Class': 'com.seibel.lod.core.JarMain'
|
||||||
|
// When changing the main of the jar change this line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
allprojects { p ->
|
task printConfigurations {
|
||||||
apply plugin: "java"
|
doLast {task ->
|
||||||
apply plugin: "architectury-plugin"
|
println "Project Name: $p.name configurations:"
|
||||||
apply plugin: "maven-publish"
|
configurations.each {
|
||||||
|
println " $it.name"
|
||||||
archivesBaseName = rootProject.archives_base_name
|
}
|
||||||
version = rootProject.mod_version
|
}
|
||||||
group = rootProject.maven_group
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
||||||
|
// For parchment mappings
|
||||||
|
maven { url "https://maven.parchmentmc.org" }
|
||||||
|
|
||||||
// used to download and compile dependencies from git repos
|
// used to download and compile dependencies from git repos
|
||||||
maven { url 'https://jitpack.io' }
|
maven { url 'https://jitpack.io' }
|
||||||
|
|
||||||
@@ -137,23 +331,23 @@ allprojects { p ->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Put stuff from gradle.properties into the mod info
|
|
||||||
processResources {
|
processResources {
|
||||||
def resourceTargets = ["fabric.mod.json", "META-INF/mods.toml"] // Location of where to put
|
def resourceTargets = ["fabric.mod.json", "META-INF/mods.toml"] // Location of where to put
|
||||||
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
||||||
def replaceProperties = [
|
def replaceProperties = [
|
||||||
version: mod_version,
|
version : mod_version,
|
||||||
mod_name: mod_name,
|
mod_name : mod_name,
|
||||||
authors: mod_authors,
|
authors : mod_authors,
|
||||||
description: mod_description,
|
description : mod_description,
|
||||||
homepage: mod_homepage,
|
homepage : mod_homepage,
|
||||||
source: mod_source,
|
source : mod_source,
|
||||||
issues: mod_issues,
|
issues : mod_issues,
|
||||||
minecraft_version: minecraft_version,
|
minecraft_version : minecraft_version,
|
||||||
java_version: java_version
|
compatible_minecraft_versions: compatible_minecraft_versions,
|
||||||
] // The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties
|
java_version : java_version
|
||||||
//TODO: Make Forge loader version also be relaced with non hardcoded value instead of "[36,41)"
|
]
|
||||||
|
// The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties
|
||||||
|
//TODO: Make Forge loader version also be relaced with non hardcoded value instead of "[36,42)"
|
||||||
|
|
||||||
inputs.properties replaceProperties
|
inputs.properties replaceProperties
|
||||||
replaceProperties.put 'project', project
|
replaceProperties.put 'project', project
|
||||||
@@ -173,27 +367,49 @@ allprojects { p ->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Copies the correct accesswidener and renames it
|
||||||
|
task copyAccessWidener(type: Copy) {
|
||||||
|
from project(":common").file("src/main/resources/${rootProject.acsessWidenerVersion}.lod.accesswidener")
|
||||||
|
into(file(p.file("build/resources/main")))
|
||||||
|
rename "${rootProject.acsessWidenerVersion}.lod.accesswidener", "lod.accesswidener"
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyCoreResources(type: Copy) {
|
||||||
|
from fileTree(project(":core").file("src/main/resources"))
|
||||||
|
into p.file("build/resources/main")
|
||||||
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
task copyCommonResources(type: Copy) {
|
||||||
|
from fileTree(project(":common").file("src/main/resources"))
|
||||||
|
into p.file("build/resources/main")
|
||||||
|
}
|
||||||
|
|
||||||
|
p.tasks.withType(JavaCompile) {
|
||||||
// Add Manifold Preprocessor
|
// Add Manifold Preprocessor
|
||||||
// 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")) {
|
|
||||||
options.release = rootProject.java_version as Integer
|
// Set the java version
|
||||||
}
|
options.release = 8; // Core should use Java 8 no matter what
|
||||||
|
// TODO: make everything use java 8
|
||||||
|
// options.release = 8 // Use Java 8 for everything so back porting is easier
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p == project(":core") || p == project(":common")) {
|
p.runClient.enabled = false
|
||||||
runClient.enabled = false
|
p.runServer.enabled = false
|
||||||
runServer.enabled = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
MC_VERSION_1_18_2=
|
|
||||||
+205
-8
@@ -1,16 +1,72 @@
|
|||||||
loom {
|
apply plugin: "java"
|
||||||
accessWidenerPath.set(file("src/main/resources/lod.accesswidener"))
|
apply plugin: "architectury-plugin"
|
||||||
}
|
apply plugin: "maven-publish"
|
||||||
|
apply plugin: "dev.architectury.loom"
|
||||||
|
|
||||||
|
archivesBaseName = rootProject.archives_base_name
|
||||||
|
version = rootProject.mod_version
|
||||||
|
group = rootProject.maven_group
|
||||||
|
|
||||||
architectury {
|
architectury {
|
||||||
common()
|
common(rootProject.enabled_platforms.split(","))
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEvaluate {
|
loom {
|
||||||
tasks {
|
silentMojangMappingsLicense()
|
||||||
remapJar {
|
accessWidenerPath.set(project(":common").file("src/main/resources/${acsessWidenerVersion}.lod.accesswidener"))
|
||||||
remapAccessWidener.set(false)
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
common
|
||||||
|
shadowMe
|
||||||
|
implementation.extendsFrom shadowMe
|
||||||
|
}
|
||||||
|
java {
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
||||||
|
// The following line declares the mojmap mappings & parchment mappings
|
||||||
|
mappings loom.layered() {
|
||||||
|
// Mojmap mappings
|
||||||
|
officialMojangMappings()
|
||||||
|
// Parchment mappings (it adds parameter mappings & javadoc)
|
||||||
|
if (
|
||||||
|
rootProject.minecraft_version != "1.19"
|
||||||
|
&& rootProject.minecraft_version != "1.19.1"
|
||||||
|
&& rootProject.minecraft_version != "1.19.2"
|
||||||
|
&& rootProject.minecraft_version != "1.19.3"
|
||||||
|
&& rootProject.minecraft_version != "1.19.4"
|
||||||
|
) // We are not gonna use this build script anymore so dont bother fixing this
|
||||||
|
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip")
|
||||||
|
else
|
||||||
|
parchment("org.parchmentmc.data:parchment-1.18.2:${rootProject.parchment_version}@zip") // As 1.19.x or higher doesnt have parchment mappings yet, we use 1.18.2 mapping
|
||||||
|
// Note: parchment may have later mappings at the time you are reading this, but at the time this was written, it didnt
|
||||||
|
// Check the main branch for the new build system, with the working mappings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Manifold
|
||||||
|
annotationProcessor "systems.manifold:manifold-preprocessor:${rootProject.manifold_version}"
|
||||||
|
|
||||||
|
// Toml
|
||||||
|
implementation("com.electronwill.night-config:toml:${rootProject.toml_version}")
|
||||||
|
|
||||||
|
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
||||||
|
// Do NOT use other classes from fabric loader unless working with fabric
|
||||||
|
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"\
|
||||||
|
|
||||||
|
common(project(":core")) { transitive false }
|
||||||
|
shadowMe(project(":core")) { transitive false }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allows the jar to run standalone
|
||||||
|
jar {
|
||||||
|
manifest {
|
||||||
|
attributes 'Implementation-Title': rootProject.archives_base_name,
|
||||||
|
'Implementation-Version': rootProject.mod_version,
|
||||||
|
'Main-Class': 'com.seibel.lod.core.JarMain' // When changing the main of the jar change this line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,3 +83,144 @@ publishing {
|
|||||||
// Add repositories to publish to here.
|
// Add repositories to publish to here.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task printConfigurations {
|
||||||
|
doLast {task ->
|
||||||
|
println "Project Name: $name configurations:"
|
||||||
|
configurations.each {
|
||||||
|
println " $it.name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
|
||||||
|
// For parchment mappings
|
||||||
|
maven { url "https://maven.parchmentmc.org" }
|
||||||
|
|
||||||
|
// used to download and compile dependencies from git repos
|
||||||
|
maven { url 'https://jitpack.io' }
|
||||||
|
|
||||||
|
// For Manifold Preprocessor
|
||||||
|
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
||||||
|
|
||||||
|
// Required for importing Modrinth mods
|
||||||
|
maven {
|
||||||
|
name = "Modrinth"
|
||||||
|
url = "https://api.modrinth.com/maven"
|
||||||
|
content {
|
||||||
|
includeGroup "maven.modrinth"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required for importing CursedForge mods
|
||||||
|
maven {
|
||||||
|
url "https://www.cursemaven.com"
|
||||||
|
content {
|
||||||
|
includeGroup "curse.maven"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// These 2 are for importing mods that arnt on CursedForge, Modrinth, GitHub, GitLab or anywhere opensource
|
||||||
|
flatDir {
|
||||||
|
dirs "${rootDir}/mods/fabric"
|
||||||
|
content {
|
||||||
|
includeGroup "fabric-mod"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
flatDir {
|
||||||
|
dirs "${rootDir}/mods/forge"
|
||||||
|
content {
|
||||||
|
includeGroup "forge-mod"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copies the correct accesswidener and renames it
|
||||||
|
task copyAccessWidener(type: Copy) {
|
||||||
|
from project(":common").file("src/main/resources/${rootProject.acsessWidenerVersion}.lod.accesswidener")
|
||||||
|
into(file("build/resources/main"))
|
||||||
|
rename "${rootProject.acsessWidenerVersion}.lod.accesswidener", "lod.accesswidener"
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyCoreResources(type: Copy) {
|
||||||
|
from fileTree(project(":core").file("src/main/resources"))
|
||||||
|
into file("build/resources/main")
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyCommonResources(type: Copy) {
|
||||||
|
from fileTree(project(":common").file("src/main/resources"))
|
||||||
|
into file("build/resources/main")
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
def resourceTargets = ["fabric.mod.json", "META-INF/mods.toml"] // Location of where to put
|
||||||
|
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
||||||
|
def replaceProperties = [
|
||||||
|
version : mod_version,
|
||||||
|
mod_name : mod_name,
|
||||||
|
authors : mod_authors,
|
||||||
|
description : mod_description,
|
||||||
|
homepage : mod_homepage,
|
||||||
|
source : mod_source,
|
||||||
|
issues : mod_issues,
|
||||||
|
minecraft_version : minecraft_version,
|
||||||
|
compatible_minecraft_versions: compatible_minecraft_versions,
|
||||||
|
java_version : java_version
|
||||||
|
]
|
||||||
|
// The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties
|
||||||
|
//TODO: Make Forge loader version also be relaced with non hardcoded value instead of "[36,42)"
|
||||||
|
|
||||||
|
inputs.properties replaceProperties
|
||||||
|
replaceProperties.put 'project', project
|
||||||
|
filesMatching(resourceTargets) {
|
||||||
|
expand replaceProperties
|
||||||
|
}
|
||||||
|
|
||||||
|
intoTargets.each { target ->
|
||||||
|
if (file(target).exists()) {
|
||||||
|
copy {
|
||||||
|
from(sourceSets.main.resources) {
|
||||||
|
include resourceTargets
|
||||||
|
expand replaceProperties
|
||||||
|
}
|
||||||
|
into target
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
println "Copying [common/src/main/resources/${acsessWidenerVersion}.lod.accesswidner] to [fabric/build/resources/main]."
|
||||||
|
copy {
|
||||||
|
from project(":common").file("src/main/resources/${acsessWidenerVersion}.lod.accesswidener")
|
||||||
|
into project(":fabric").file("build/resources/main")
|
||||||
|
rename "${acsessWidenerVersion}.lod.accesswidener", "lod.accesswidener"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
// Add Manifold Preprocessor
|
||||||
|
// def excapedMCVersion = rootProject.minecraft_version.replace(".", "_")
|
||||||
|
// options.compilerArgs += ['-Xplugin:Manifold', "-AMC_VERSION_${excapedMCVersion}"]
|
||||||
|
//
|
||||||
|
//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
|
||||||
|
|
||||||
|
// Set the java version
|
||||||
|
options.compilerArgs += ['-Xplugin:Manifold']
|
||||||
|
options.release = rootProject.java_version as Integer
|
||||||
|
// TODO: make everything use java 8
|
||||||
|
// options.release = 8 // Use Java 8 for everything so back porting is easier
|
||||||
|
}
|
||||||
|
|
||||||
|
sourcesJar {
|
||||||
|
}
|
||||||
|
|
||||||
|
runClient.enabled = false
|
||||||
|
runServer.enabled = false
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 James Seibel
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -29,11 +29,13 @@ 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.*;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This handles any configuration the user has access to.
|
* This handles any configuration the user has access to.
|
||||||
* @author coolGi2007
|
* @author coolGi
|
||||||
* @version 12-12-2021
|
* @version 12-12-2021
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -104,7 +106,7 @@ public class Config
|
|||||||
|
|
||||||
@ConfigAnnotations.FileComment
|
@ConfigAnnotations.FileComment
|
||||||
public static String _lodChunkRenderDistance = IQuality.LOD_CHUNK_RENDER_DISTANCE_DESC;
|
public static String _lodChunkRenderDistance = IQuality.LOD_CHUNK_RENDER_DISTANCE_DESC;
|
||||||
@ConfigAnnotations.Entry(minValue = 16, maxValue = 2048)
|
@ConfigAnnotations.Entry(minValue = 32, maxValue = 2048)
|
||||||
public static int lodChunkRenderDistance = IQuality.LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX.defaultValue;
|
public static int lodChunkRenderDistance = IQuality.LOD_CHUNK_RENDER_DISTANCE_MIN_DEFAULT_MAX.defaultValue;
|
||||||
|
|
||||||
@ConfigAnnotations.FileComment
|
@ConfigAnnotations.FileComment
|
||||||
@@ -114,7 +116,7 @@ public class Config
|
|||||||
|
|
||||||
@ConfigAnnotations.FileComment
|
@ConfigAnnotations.FileComment
|
||||||
public static String _horizontalScale = IQuality.HORIZONTAL_SCALE_DESC;
|
public static String _horizontalScale = IQuality.HORIZONTAL_SCALE_DESC;
|
||||||
@ConfigAnnotations.Entry(minValue = 2, maxValue = 32)
|
@ConfigAnnotations.Entry(minValue = 2, maxValue = 64)
|
||||||
public static int horizontalScale = IQuality.HORIZONTAL_SCALE_MIN_DEFAULT_MAX.defaultValue;
|
public static int horizontalScale = IQuality.HORIZONTAL_SCALE_MIN_DEFAULT_MAX.defaultValue;
|
||||||
|
|
||||||
@ConfigAnnotations.FileComment
|
@ConfigAnnotations.FileComment
|
||||||
@@ -258,6 +260,11 @@ public class Config
|
|||||||
@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
|
||||||
@@ -273,6 +280,21 @@ public class Config
|
|||||||
@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
|
||||||
|
public static String _earthCurveRatio = IAdvancedGraphics.EARTH_CURVE_RATIO_DESC;
|
||||||
|
@ConfigAnnotations.Entry(minValue = 0, maxValue = 5000)
|
||||||
|
public static int earthCurveRatio = IAdvancedGraphics.EARTH_CURVE_RATIO_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;
|
||||||
@@ -305,14 +327,6 @@ public class Config
|
|||||||
@ConfigAnnotations.Entry
|
@ConfigAnnotations.Entry
|
||||||
public static GenerationPriority generationPriority = IWorldGenerator.GENERATION_PRIORITY_DEFAULT;
|
public static GenerationPriority generationPriority = IWorldGenerator.GENERATION_PRIORITY_DEFAULT;
|
||||||
|
|
||||||
/*
|
|
||||||
@ConfigAnnotations.FileComment
|
|
||||||
public static String _allowUnstableFeatureGeneration = IWorldGenerator.ALLOW_UNSTABLE_FEATURE_GENERATION_DESC;
|
|
||||||
// FIXME: Temperary override. In 1.18, the newer Unstable gnerator is more usable
|
|
||||||
@ConfigAnnotations.Entry
|
|
||||||
public static boolean allowUnstableFeatureGeneration = true;//IWorldGenerator.ALLOW_UNSTABLE_FEATURE_GENERATION_DEFAULT;
|
|
||||||
*/
|
|
||||||
|
|
||||||
@ConfigAnnotations.FileComment
|
@ConfigAnnotations.FileComment
|
||||||
public static String _blocksToAvoid = IWorldGenerator.BLOCKS_TO_AVOID_DESC;
|
public static String _blocksToAvoid = IWorldGenerator.BLOCKS_TO_AVOID_DESC;
|
||||||
@ConfigAnnotations.Entry
|
@ConfigAnnotations.Entry
|
||||||
@@ -329,8 +343,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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,13 +360,18 @@ 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
|
||||||
public static String _numberOfWorldGenerationThreads = IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DESC;
|
public static String _numberOfWorldGenerationThreads = IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DESC;
|
||||||
@ConfigAnnotations.Entry(minValue = 1, maxValue = 50)
|
@ConfigAnnotations.Entry(minValue = 0.1, maxValue = 50.0)
|
||||||
public static int numberOfWorldGenerationThreads = IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DEFAULT.defaultValue;
|
public static double numberOfWorldGenerationThreads = IThreading.NUMBER_OF_WORLD_GENERATION_THREADS_DEFAULT.defaultValue;
|
||||||
|
|
||||||
@ConfigAnnotations.FileComment
|
@ConfigAnnotations.FileComment
|
||||||
public static String _numberOfBufferBuilderThreads = IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_DESC;
|
public static String _numberOfBufferBuilderThreads = IThreading.NUMBER_OF_BUFFER_BUILDER_THREADS_DESC;
|
||||||
@@ -364,9 +383,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 +396,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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common;
|
package com.seibel.lod.common;
|
||||||
|
|
||||||
import com.seibel.lod.common.forge.LodForgeMethodCaller;
|
import com.seibel.lod.common.forge.LodForgeMethodCaller;
|
||||||
@@ -13,9 +32,8 @@ public class LodCommonMain {
|
|||||||
public static boolean forge = false;
|
public static boolean forge = false;
|
||||||
public static boolean serverSided;
|
public static boolean serverSided;
|
||||||
public static LodForgeMethodCaller forgeMethodCaller;
|
public static LodForgeMethodCaller forgeMethodCaller;
|
||||||
public static NetworkInterface networkInterface;
|
|
||||||
|
|
||||||
public static void startup(LodForgeMethodCaller caller, boolean serverSided, NetworkInterface networkInterface) {
|
public static void startup(LodForgeMethodCaller caller, boolean serverSided) {
|
||||||
LodCommonMain.serverSided = serverSided;
|
LodCommonMain.serverSided = serverSided;
|
||||||
if (caller != null) {
|
if (caller != null) {
|
||||||
LodCommonMain.forge = true;
|
LodCommonMain.forge = true;
|
||||||
@@ -23,13 +41,6 @@ public class LodCommonMain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DependencySetup.createInitialBindings();
|
DependencySetup.createInitialBindings();
|
||||||
|
|
||||||
LodCommonMain.networkInterface = networkInterface;
|
|
||||||
if (!serverSided) {
|
|
||||||
networkInterface.register_Client();
|
|
||||||
} else {
|
|
||||||
networkInterface.register_Server();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.forge;
|
package com.seibel.lod.common.forge;
|
||||||
|
|
||||||
import com.seibel.lod.common.wrappers.minecraft.MinecraftClientWrapper;
|
import com.seibel.lod.common.wrappers.minecraft.MinecraftClientWrapper;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
#if POST_MC_1_19
|
||||||
|
import net.minecraft.util.RandomSource;
|
||||||
|
#endif
|
||||||
|
import net.minecraft.world.level.ColorResolver;
|
||||||
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
@@ -15,5 +39,11 @@ import java.util.Random;
|
|||||||
* @author Ran
|
* @author Ran
|
||||||
*/
|
*/
|
||||||
public interface LodForgeMethodCaller {
|
public interface LodForgeMethodCaller {
|
||||||
List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random);
|
#if PRE_MC_1_19
|
||||||
|
List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random); // FIXME: For 1.19
|
||||||
|
#else
|
||||||
|
List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random); // FIXME: For 1.19
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int colorResolverGetColor(ColorResolver resolver, Biome biome, double x, double z);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.networking;
|
package com.seibel.lod.common.networking;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.networking;
|
package com.seibel.lod.common.networking;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.networking;
|
package com.seibel.lod.common.networking;
|
||||||
|
|
||||||
import com.seibel.lod.core.ModInfo;
|
import com.seibel.lod.core.ModInfo;
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers;
|
package com.seibel.lod.common.wrappers;
|
||||||
|
|
||||||
import com.seibel.lod.common.LodCommonMain;
|
import com.seibel.lod.common.LodCommonMain;
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers;
|
package com.seibel.lod.common.wrappers;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 James Seibel
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,7 +21,11 @@ package com.seibel.lod.common.wrappers;
|
|||||||
|
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
|
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
import com.mojang.math.Matrix4f;
|
import com.mojang.math.Matrix4f;
|
||||||
|
#else
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
#endif
|
||||||
import com.seibel.lod.common.wrappers.block.BlockPosWrapper;
|
import com.seibel.lod.common.wrappers.block.BlockPosWrapper;
|
||||||
import com.seibel.lod.core.enums.LodDirection;
|
import com.seibel.lod.core.enums.LodDirection;
|
||||||
import com.seibel.lod.core.objects.math.Mat4f;
|
import com.seibel.lod.core.objects.math.Mat4f;
|
||||||
@@ -39,13 +43,45 @@ import net.minecraft.core.Direction;
|
|||||||
*/
|
*/
|
||||||
public class McObjectConverter
|
public class McObjectConverter
|
||||||
{
|
{
|
||||||
|
private static int bufferIndex(int x, int y) {
|
||||||
|
return y * 4 + x;
|
||||||
|
}
|
||||||
|
/** Taken from Minecraft's com.mojang.math.Matrix4f class from 1.18.2 */
|
||||||
|
public static void storeMatrix(Matrix4f matrix, FloatBuffer buffer) {
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
|
matrix.store(buffer);
|
||||||
|
#else
|
||||||
|
// Mojang starts to use joml's Matrix4f libary in 1.19.3 so we copy their store method and use it here if its newer than 1.19.3
|
||||||
|
buffer.put(bufferIndex(0, 0), matrix.m00());
|
||||||
|
buffer.put(bufferIndex(0, 1), matrix.m01());
|
||||||
|
buffer.put(bufferIndex(0, 2), matrix.m02());
|
||||||
|
buffer.put(bufferIndex(0, 3), matrix.m03());
|
||||||
|
buffer.put(bufferIndex(1, 0), matrix.m10());
|
||||||
|
buffer.put(bufferIndex(1, 1), matrix.m11());
|
||||||
|
buffer.put(bufferIndex(1, 2), matrix.m12());
|
||||||
|
buffer.put(bufferIndex(1, 3), matrix.m13());
|
||||||
|
buffer.put(bufferIndex(2, 0), matrix.m20());
|
||||||
|
buffer.put(bufferIndex(2, 1), matrix.m21());
|
||||||
|
buffer.put(bufferIndex(2, 2), matrix.m22());
|
||||||
|
buffer.put(bufferIndex(2, 3), matrix.m23());
|
||||||
|
buffer.put(bufferIndex(3, 0), matrix.m30());
|
||||||
|
buffer.put(bufferIndex(3, 1), matrix.m31());
|
||||||
|
buffer.put(bufferIndex(3, 2), matrix.m32());
|
||||||
|
buffer.put(bufferIndex(3, 3), matrix.m33());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** 4x4 float matrix converter */
|
/** 4x4 float matrix converter */
|
||||||
public static Mat4f Convert(Matrix4f mcMatrix)
|
public static Mat4f Convert(Matrix4f mcMatrix)
|
||||||
{
|
{
|
||||||
FloatBuffer buffer = FloatBuffer.allocate(16);
|
FloatBuffer buffer = FloatBuffer.allocate(16);
|
||||||
mcMatrix.store(buffer);
|
storeMatrix(mcMatrix, buffer);
|
||||||
Mat4f matrix = new Mat4f(buffer);
|
Mat4f matrix = new Mat4f(buffer);
|
||||||
matrix.transpose();
|
#if PRE_MC_1_19_3
|
||||||
|
matrix.transpose(); // In 1.19.3 and later, we no longer need to transpose it
|
||||||
|
#endif
|
||||||
return matrix;
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +93,10 @@ public class McObjectConverter
|
|||||||
directions = new Direction[lodDirs.length];
|
directions = new Direction[lodDirs.length];
|
||||||
lodDirections = new LodDirection[lodDirs.length];
|
lodDirections = new LodDirection[lodDirs.length];
|
||||||
for (LodDirection lodDir : lodDirs) {
|
for (LodDirection lodDir : lodDirs) {
|
||||||
Direction dir = Direction.byName(lodDir.name());
|
Direction dir = Enum.valueOf(Direction.class, lodDir.name());
|
||||||
|
if (dir == null) {
|
||||||
|
throw new IllegalArgumentException("Invalid direction on init mapping: " + lodDir);
|
||||||
|
}
|
||||||
directions[lodDir.ordinal()] = dir;
|
directions[lodDir.ordinal()] = dir;
|
||||||
lodDirections[dir.ordinal()] = lodDir;
|
lodDirections[dir.ordinal()] = lodDir;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers;
|
package com.seibel.lod.common.wrappers;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 James Seibel
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 James Seibel
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,7 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.block;
|
package com.seibel.lod.common.wrappers.block;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import com.seibel.lod.core.api.ApiShared;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
@@ -14,13 +34,13 @@ public class BlockDetailMap
|
|||||||
private BlockDetailMap() {}
|
private BlockDetailMap() {}
|
||||||
|
|
||||||
public static BlockDetailWrapper getOrMakeBlockDetailCache(BlockState bs, BlockPos pos, LevelReader getter) {
|
public static BlockDetailWrapper getOrMakeBlockDetailCache(BlockState bs, BlockPos pos, LevelReader getter) {
|
||||||
|
if (!bs.getFluidState().isEmpty()) {
|
||||||
|
bs = bs.getFluidState().createLegacyBlock();
|
||||||
|
}
|
||||||
BlockDetailWrapper cache = map.get(bs);
|
BlockDetailWrapper cache = map.get(bs);
|
||||||
if (cache != null) return cache;
|
if (cache != null) return cache;
|
||||||
if (bs.getFluidState().isEmpty()) {
|
|
||||||
cache = BlockDetailWrapper.make(bs, pos, getter);
|
cache = BlockDetailWrapper.make(bs, pos, getter);
|
||||||
} else {
|
//ApiShared.LOGGER.info("New blockDetail cache for {} to {} ", bs, cache);
|
||||||
cache = BlockDetailWrapper.make(bs.getFluidState().createLegacyBlock(), pos, getter);
|
|
||||||
}
|
|
||||||
BlockDetailWrapper cacheCAS = map.putIfAbsent(bs, cache);
|
BlockDetailWrapper cacheCAS = map.putIfAbsent(bs, cache);
|
||||||
return cacheCAS==null ? cache : cacheCAS;
|
return cacheCAS==null ? cache : cacheCAS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.block;
|
package com.seibel.lod.common.wrappers.block;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -49,14 +68,23 @@ import net.minecraft.world.phys.BlockHitResult;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
#if POST_MC_1_19
|
||||||
|
import net.minecraft.util.RandomSource;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-- WARN: This class should NEVER hold reference to anything large,
|
||||||
|
as this is never dealloc until the end of runtime!! --*/
|
||||||
public class BlockDetailWrapper extends IBlockDetailWrapper
|
public class BlockDetailWrapper extends IBlockDetailWrapper
|
||||||
{
|
{
|
||||||
private static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
|
private static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
|
||||||
|
|
||||||
public static final int FLOWER_COLOR_SCALE = 5;
|
public static final int FLOWER_COLOR_SCALE = 5;
|
||||||
|
|
||||||
|
#if PRE_MC_1_19
|
||||||
public static final Random random = new Random(0);
|
public static final Random random = new Random(0);
|
||||||
|
#else
|
||||||
|
public static final RandomSource random = RandomSource.create();
|
||||||
|
#endif
|
||||||
|
|
||||||
enum ColorMode {
|
enum ColorMode {
|
||||||
Default,
|
Default,
|
||||||
@@ -80,9 +108,21 @@ public class BlockDetailWrapper extends IBlockDetailWrapper
|
|||||||
|
|
||||||
{
|
{
|
||||||
// textures normally use u and v instead of x and y
|
// textures normally use u and v instead of x and y
|
||||||
for (int u = 0; u < texture.getWidth(); u++)
|
for (int u = 0; u <
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
|
texture.getWidth();
|
||||||
|
#else
|
||||||
|
texture.contents().width();
|
||||||
|
#endif
|
||||||
|
u++)
|
||||||
{
|
{
|
||||||
for (int v = 0; v < texture.getHeight(); v++)
|
for (int v = 0; v <
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
|
texture.getHeight();
|
||||||
|
#else
|
||||||
|
texture.contents().height();
|
||||||
|
#endif
|
||||||
|
v++)
|
||||||
{
|
{
|
||||||
//note: Minecraft color format is: 0xAA BB GG RR
|
//note: Minecraft color format is: 0xAA BB GG RR
|
||||||
//________ DH mod color format is: 0xAA RR GG BB
|
//________ DH mod color format is: 0xAA RR GG BB
|
||||||
@@ -139,10 +179,6 @@ public class BlockDetailWrapper extends IBlockDetailWrapper
|
|||||||
return tempColor;
|
return tempColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static final Block[] BLOCK_TO_AVOID = {Blocks.AIR, Blocks.CAVE_AIR, Blocks.BARRIER};
|
private static final Block[] BLOCK_TO_AVOID = {Blocks.AIR, Blocks.CAVE_AIR, Blocks.BARRIER};
|
||||||
|
|
||||||
private static final Direction[] DIRECTION_ORDER = {Direction.UP, Direction.NORTH, Direction.EAST, Direction.WEST, Direction.SOUTH, Direction.DOWN};
|
private static final Direction[] DIRECTION_ORDER = {Direction.UP, Direction.NORTH, Direction.EAST, Direction.WEST, Direction.SOUTH, Direction.DOWN};
|
||||||
@@ -154,10 +190,11 @@ public class BlockDetailWrapper extends IBlockDetailWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
final BlockState state;
|
final BlockState state;
|
||||||
final BlockPos samplePos;
|
|
||||||
final LevelReader sampleGetter;
|
|
||||||
|
|
||||||
boolean isShapeResolved = false;
|
//boolean isShapeResolved = false;
|
||||||
|
//^ Shapes no longer lazy resolved due to memory leaks from needing
|
||||||
|
// to keep a reference to the block getter
|
||||||
|
|
||||||
boolean[] dontOccludeFaces = null;
|
boolean[] dontOccludeFaces = null;
|
||||||
boolean noCollision = false;
|
boolean noCollision = false;
|
||||||
boolean noFullFace = false;
|
boolean noFullFace = false;
|
||||||
@@ -172,14 +209,12 @@ public class BlockDetailWrapper extends IBlockDetailWrapper
|
|||||||
|
|
||||||
public BlockDetailWrapper(BlockState state, BlockPos pos, LevelReader getter) {
|
public BlockDetailWrapper(BlockState state, BlockPos pos, LevelReader getter) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.samplePos = pos;
|
resolveShapes(getter, pos);
|
||||||
this.sampleGetter = getter;
|
//ApiShared.LOGGER.info("Created BlockDetailWrapper for blockstate {} at {}", state, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockDetailWrapper() {
|
private BlockDetailWrapper() {
|
||||||
this.state = null;
|
this.state = null;
|
||||||
this.samplePos = null;
|
|
||||||
this.sampleGetter = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static BlockDetailWrapper make(BlockState bs, BlockPos pos, LevelReader getter) {
|
static BlockDetailWrapper make(BlockState bs, BlockPos pos, LevelReader getter) {
|
||||||
@@ -194,8 +229,8 @@ public class BlockDetailWrapper extends IBlockDetailWrapper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resolveShapes() {
|
private void resolveShapes(LevelReader sampleGetter, BlockPos samplePos) {
|
||||||
if (isShapeResolved) return;
|
//if (isShapeResolved) return;
|
||||||
if (state.getFluidState().isEmpty()) {
|
if (state.getFluidState().isEmpty()) {
|
||||||
noCollision = state.getCollisionShape(sampleGetter, samplePos).isEmpty();
|
noCollision = state.getCollisionShape(sampleGetter, samplePos).isEmpty();
|
||||||
dontOccludeFaces = new boolean[6];
|
dontOccludeFaces = new boolean[6];
|
||||||
@@ -222,7 +257,6 @@ public class BlockDetailWrapper extends IBlockDetailWrapper
|
|||||||
} else { // Liquid Block
|
} else { // Liquid Block
|
||||||
dontOccludeFaces = new boolean[6];
|
dontOccludeFaces = new boolean[6];
|
||||||
}
|
}
|
||||||
isShapeResolved = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resolveColors() {
|
private void resolveColors() {
|
||||||
@@ -237,21 +271,31 @@ 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(
|
||||||
|
#if PRE_MC_1_17_1 quads.get(0).sprite,
|
||||||
|
#else quads.get(0).getSprite(), #endif
|
||||||
|
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()));
|
ColorMode.getColorMode(state.getBlock()));
|
||||||
}
|
}
|
||||||
} else { // Liquid Block
|
} else { // Liquid Block
|
||||||
|
|
||||||
needPostTinting = true;
|
needPostTinting = true;
|
||||||
needShade = false;
|
needShade = false;
|
||||||
tintIndex = 0;
|
tintIndex = 0;
|
||||||
baseColor = calculateColorFromTexture(Minecraft.getInstance().getModelManager().getBlockModelShaper().getParticleIcon(state),
|
baseColor = calculateColorFromTexture(Minecraft.getInstance().getModelManager().getBlockModelShaper().getParticleIcon(state),
|
||||||
ColorMode.getColorMode(state.getBlock()));
|
ColorMode.getColorMode(state.getBlock()));
|
||||||
|
|
||||||
}
|
}
|
||||||
isColorResolved = true;
|
isColorResolved = true;
|
||||||
}
|
}
|
||||||
@@ -281,21 +325,21 @@ public class BlockDetailWrapper extends IBlockDetailWrapper
|
|||||||
@Override
|
@Override
|
||||||
public boolean hasFaceCullingFor(LodDirection dir)
|
public boolean hasFaceCullingFor(LodDirection dir)
|
||||||
{
|
{
|
||||||
resolveShapes();
|
//resolveShapes();
|
||||||
return !dontOccludeFaces[dir.ordinal()];
|
return !dontOccludeFaces[dir.ordinal()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNoCollision()
|
public boolean hasNoCollision()
|
||||||
{
|
{
|
||||||
resolveShapes();
|
//resolveShapes();
|
||||||
return noCollision;
|
return noCollision;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean noFaceIsFullFace()
|
public boolean noFaceIsFullFace()
|
||||||
{
|
{
|
||||||
resolveShapes();
|
//resolveShapes();
|
||||||
return noFullFace;
|
return noFullFace;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,4 +356,7 @@ public class BlockDetailWrapper extends IBlockDetailWrapper
|
|||||||
return ((BlockDetailWrapper)iBlockDetail).state.getBlock().equals(state.getBlock());
|
return ((BlockDetailWrapper)iBlockDetail).state.getBlock().equals(state.getBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "BlockDetail{" + state + "}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.block;
|
package com.seibel.lod.common.wrappers.block;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|||||||
+31
-1
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.block;
|
package com.seibel.lod.common.wrappers.block;
|
||||||
|
|
||||||
|
|
||||||
@@ -18,11 +37,22 @@ public class TextureAtlasSpriteWrapper {
|
|||||||
* The code has been modified to use TextureAtlasSprite
|
* The code has been modified to use TextureAtlasSprite
|
||||||
*/
|
*/
|
||||||
public static int getPixelRGBA(TextureAtlasSprite sprite, int frameIndex, int x, int y) {
|
public static int getPixelRGBA(TextureAtlasSprite sprite, int frameIndex, int x, int y) {
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
return sprite.mainImage[0].getPixelRGBA(
|
||||||
|
x + sprite.framesX[frameIndex] * sprite.getWidth(),
|
||||||
|
y + sprite.framesY[frameIndex] * sprite.getHeight());
|
||||||
|
#elif PRE_MC_1_19_3
|
||||||
if (sprite.animatedTexture != null) {
|
if (sprite.animatedTexture != null) {
|
||||||
x += sprite.animatedTexture.getFrameX(frameIndex) * sprite.width;
|
x += sprite.animatedTexture.getFrameX(frameIndex) * sprite.width;
|
||||||
y += sprite.animatedTexture.getFrameY(frameIndex) * sprite.height;
|
y += sprite.animatedTexture.getFrameY(frameIndex) * sprite.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprite.mainImage[0].getPixelRGBA(x, y);
|
return sprite.mainImage[0].getPixelRGBA(x, y);
|
||||||
|
#else
|
||||||
|
if (sprite.contents().animatedTexture != null) {
|
||||||
|
x += sprite.contents().animatedTexture.getFrameX(frameIndex) * sprite.contents().width();
|
||||||
|
y += sprite.contents().animatedTexture.getFrameY(frameIndex) * sprite.contents().width();
|
||||||
|
}
|
||||||
|
return sprite.contents().originalImage.getPixelRGBA(x, y);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+45
-24
@@ -1,5 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.block;
|
package com.seibel.lod.common.wrappers.block;
|
||||||
|
|
||||||
|
import com.seibel.lod.common.LodCommonMain;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.client.color.block.BlockTintCache;
|
import net.minecraft.client.color.block.BlockTintCache;
|
||||||
@@ -27,29 +47,27 @@ 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) {
|
||||||
#if MC_VERSION_1_18_2
|
#if POST_MC_1_18_2
|
||||||
return parent.getBiome(pos).value();
|
return parent.getBiome(pos).value();
|
||||||
#elif MC_VERSION_1_18_1
|
#else
|
||||||
return parent.getBiome(pos);
|
return parent.getBiome(pos);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) {
|
public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver) {
|
||||||
Biome b = _getBiome(blockPos);
|
if (LodCommonMain.forgeMethodCaller != null) {
|
||||||
return tintCaches.get(colorResolver).computeIfAbsent(b, (key) -> colorResolver.getColor(b, blockPos.getX(), blockPos.getZ()));
|
return LodCommonMain.forgeMethodCaller.colorResolverGetColor(colorResolver, _getBiome(blockPos),
|
||||||
|
blockPos.getX(), blockPos.getZ());
|
||||||
|
} else {
|
||||||
|
return colorResolver.getColor(_getBiome(blockPos), blockPos.getX(), blockPos.getZ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -83,10 +101,6 @@ public class TintGetterOverrideFast implements BlockAndTintGetter {
|
|||||||
return parent.getBlockEntity(blockPos);
|
return parent.getBlockEntity(blockPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T extends BlockEntity> Optional<T> getBlockEntity(BlockPos blockPos, BlockEntityType<T> blockEntityType) {
|
|
||||||
return parent.getBlockEntity(blockPos, blockEntityType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlockState(BlockPos blockPos) {
|
public BlockState getBlockState(BlockPos blockPos) {
|
||||||
@@ -113,11 +127,6 @@ public class TintGetterOverrideFast implements BlockAndTintGetter {
|
|||||||
return parent.getBlockStates(aABB);
|
return parent.getBlockStates(aABB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockHitResult isBlockInLine(ClipBlockStateContext clipBlockStateContext) {
|
|
||||||
return parent.isBlockInLine(clipBlockStateContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockHitResult clip(ClipContext clipContext) {
|
public BlockHitResult clip(ClipContext clipContext) {
|
||||||
return parent.clip(clipContext);
|
return parent.clip(clipContext);
|
||||||
@@ -139,6 +148,22 @@ public class TintGetterOverrideFast implements BlockAndTintGetter {
|
|||||||
return parent.getBlockFloorHeight(blockPos);
|
return parent.getBlockFloorHeight(blockPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxBuildHeight() {
|
||||||
|
return parent.getMaxBuildHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if POST_MC_1_17_1
|
||||||
|
@Override
|
||||||
|
public <T extends BlockEntity> Optional<T> getBlockEntity(BlockPos blockPos, BlockEntityType<T> blockEntityType) {
|
||||||
|
return parent.getBlockEntity(blockPos, blockEntityType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockHitResult isBlockInLine(ClipBlockStateContext clipBlockStateContext) {
|
||||||
|
return parent.isBlockInLine(clipBlockStateContext);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
return parent.getHeight();
|
return parent.getHeight();
|
||||||
@@ -149,11 +174,6 @@ public class TintGetterOverrideFast implements BlockAndTintGetter {
|
|||||||
return parent.getMinBuildHeight();
|
return parent.getMinBuildHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxBuildHeight() {
|
|
||||||
return parent.getMaxBuildHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSectionsCount() {
|
public int getSectionsCount() {
|
||||||
return parent.getSectionsCount();
|
return parent.getSectionsCount();
|
||||||
@@ -193,4 +213,5 @@ public class TintGetterOverrideFast implements BlockAndTintGetter {
|
|||||||
public int getSectionYFromSectionIndex(int i) {
|
public int getSectionYFromSectionIndex(int i) {
|
||||||
return parent.getSectionYFromSectionIndex(i);
|
return parent.getSectionYFromSectionIndex(i);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
+48
-26
@@ -1,5 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.block;
|
package com.seibel.lod.common.wrappers.block;
|
||||||
|
|
||||||
|
import com.seibel.lod.common.LodCommonMain;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.client.color.block.BlockTintCache;
|
import net.minecraft.client.color.block.BlockTintCache;
|
||||||
@@ -26,23 +46,17 @@ 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) {
|
||||||
#if MC_VERSION_1_18_2
|
#if POST_MC_1_18_2
|
||||||
return parent.getBiome(pos).value();
|
return parent.getBiome(pos).value();
|
||||||
#elif MC_VERSION_1_18_1
|
#else
|
||||||
return parent.getBiome(pos);
|
return parent.getBiome(pos);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -61,7 +75,14 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter {
|
|||||||
while (cursor3D.advance())
|
while (cursor3D.advance())
|
||||||
{
|
{
|
||||||
mutableBlockPos.set(cursor3D.nextX(), cursor3D.nextY(), cursor3D.nextZ());
|
mutableBlockPos.set(cursor3D.nextX(), cursor3D.nextY(), cursor3D.nextZ());
|
||||||
int n = colorResolver.getColor(_getBiome(mutableBlockPos), mutableBlockPos.getX(), mutableBlockPos.getZ());
|
int n;
|
||||||
|
if (LodCommonMain.forgeMethodCaller != null) {
|
||||||
|
n = LodCommonMain.forgeMethodCaller.colorResolverGetColor(colorResolver, _getBiome(mutableBlockPos),
|
||||||
|
mutableBlockPos.getX(), mutableBlockPos.getZ());
|
||||||
|
} else {
|
||||||
|
n = colorResolver.getColor(_getBiome(mutableBlockPos), mutableBlockPos.getX(), mutableBlockPos.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
k += (n & 0xFF0000) >> 16;
|
k += (n & 0xFF0000) >> 16;
|
||||||
l += (n & 0xFF00) >> 8;
|
l += (n & 0xFF00) >> 8;
|
||||||
m += n & 0xFF;
|
m += n & 0xFF;
|
||||||
@@ -71,8 +92,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
|
||||||
@@ -106,11 +126,6 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter {
|
|||||||
return parent.getBlockEntity(blockPos);
|
return parent.getBlockEntity(blockPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T extends BlockEntity> Optional<T> getBlockEntity(BlockPos blockPos, BlockEntityType<T> blockEntityType) {
|
|
||||||
return parent.getBlockEntity(blockPos, blockEntityType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlockState(BlockPos blockPos) {
|
public BlockState getBlockState(BlockPos blockPos) {
|
||||||
return parent.getBlockState(blockPos);
|
return parent.getBlockState(blockPos);
|
||||||
@@ -136,11 +151,6 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter {
|
|||||||
return parent.getBlockStates(aABB);
|
return parent.getBlockStates(aABB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockHitResult isBlockInLine(ClipBlockStateContext clipBlockStateContext) {
|
|
||||||
return parent.isBlockInLine(clipBlockStateContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockHitResult clip(ClipContext clipContext) {
|
public BlockHitResult clip(ClipContext clipContext) {
|
||||||
return parent.clip(clipContext);
|
return parent.clip(clipContext);
|
||||||
@@ -162,6 +172,22 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter {
|
|||||||
return parent.getBlockFloorHeight(blockPos);
|
return parent.getBlockFloorHeight(blockPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxBuildHeight() {
|
||||||
|
return parent.getMaxBuildHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if POST_MC_1_17_1
|
||||||
|
@Override
|
||||||
|
public <T extends BlockEntity> Optional<T> getBlockEntity(BlockPos blockPos, BlockEntityType<T> blockEntityType) {
|
||||||
|
return parent.getBlockEntity(blockPos, blockEntityType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockHitResult isBlockInLine(ClipBlockStateContext clipBlockStateContext) {
|
||||||
|
return parent.isBlockInLine(clipBlockStateContext);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
return parent.getHeight();
|
return parent.getHeight();
|
||||||
@@ -172,11 +198,6 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter {
|
|||||||
return parent.getMinBuildHeight();
|
return parent.getMinBuildHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxBuildHeight() {
|
|
||||||
return parent.getMaxBuildHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSectionsCount() {
|
public int getSectionsCount() {
|
||||||
return parent.getSectionsCount();
|
return parent.getSectionsCount();
|
||||||
@@ -216,4 +237,5 @@ public class TintGetterOverrideSmooth implements BlockAndTintGetter {
|
|||||||
public int getSectionYFromSectionIndex(int i) {
|
public int getSectionYFromSectionIndex(int i) {
|
||||||
return parent.getSectionYFromSectionIndex(i);
|
return parent.getSectionYFromSectionIndex(i);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.chunk;
|
package com.seibel.lod.common.wrappers.chunk;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -129,7 +148,11 @@ public class ChunkPosWrapper extends AbstractChunkPosWrapper
|
|||||||
public AbstractBlockPosWrapper getWorldPosition()
|
public AbstractBlockPosWrapper getWorldPosition()
|
||||||
{
|
{
|
||||||
// the parameter here is the y position
|
// the parameter here is the y position
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
BlockPos blockPos = chunkPos.getWorldPosition();
|
||||||
|
#else
|
||||||
BlockPos blockPos = chunkPos.getMiddleBlockPosition(0);
|
BlockPos blockPos = chunkPos.getMiddleBlockPosition(0);
|
||||||
|
#endif
|
||||||
return new BlockPosWrapper(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
return new BlockPosWrapper(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.chunk;
|
package com.seibel.lod.common.wrappers.chunk;
|
||||||
|
|
||||||
import com.seibel.lod.common.wrappers.block.BlockDetailWrapper;
|
import com.seibel.lod.common.wrappers.block.BlockDetailWrapper;
|
||||||
@@ -14,7 +33,9 @@ import com.seibel.lod.common.wrappers.world.BiomeWrapper;
|
|||||||
import com.seibel.lod.common.wrappers.worldGeneration.mimicObject.LightedWorldGenRegion;
|
import com.seibel.lod.common.wrappers.worldGeneration.mimicObject.LightedWorldGenRegion;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
#if POST_MC_1_17_1
|
||||||
import net.minecraft.core.QuartPos;
|
import net.minecraft.core.QuartPos;
|
||||||
|
#endif
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
import net.minecraft.world.level.LightLayer;
|
import net.minecraft.world.level.LightLayer;
|
||||||
import net.minecraft.world.level.block.LiquidBlockContainer;
|
import net.minecraft.world.level.block.LiquidBlockContainer;
|
||||||
@@ -45,13 +66,21 @@ public class ChunkWrapper implements IChunkWrapper
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getHeight(){
|
public int getHeight(){
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
return 255;
|
||||||
|
#else
|
||||||
return chunk.getHeight();
|
return chunk.getHeight();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinBuildHeight()
|
public int getMinBuildHeight()
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
return chunk.getMinBuildHeight();
|
return chunk.getMinBuildHeight();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public int getMaxBuildHeight()
|
public int getMaxBuildHeight()
|
||||||
@@ -68,12 +97,18 @@ public class ChunkWrapper implements IChunkWrapper
|
|||||||
@Override
|
@Override
|
||||||
public IBiomeWrapper getBiome(int x, int y, int z)
|
public IBiomeWrapper getBiome(int x, int y, int z)
|
||||||
{
|
{
|
||||||
#if MC_VERSION_1_18_2
|
#if PRE_MC_1_17_1
|
||||||
return BiomeWrapper.getBiomeWrapper(chunk.getNoiseBiome(
|
return BiomeWrapper.getBiomeWrapper(chunk.getBiomes().getNoiseBiome(
|
||||||
QuartPos.fromBlock(x), QuartPos.fromBlock(y), QuartPos.fromBlock(z)).value());
|
x >> 2, y >> 2, z >> 2));
|
||||||
#elif MC_VERSION_1_18_1
|
#elif PRE_MC_1_18_1
|
||||||
|
return BiomeWrapper.getBiomeWrapper(chunk.getBiomes().getNoiseBiome(
|
||||||
|
QuartPos.fromBlock(x), QuartPos.fromBlock(y), QuartPos.fromBlock(z)));
|
||||||
|
#elif PRE_MC_1_18_2
|
||||||
return BiomeWrapper.getBiomeWrapper(chunk.getNoiseBiome(
|
return BiomeWrapper.getBiomeWrapper(chunk.getNoiseBiome(
|
||||||
QuartPos.fromBlock(x), QuartPos.fromBlock(y), QuartPos.fromBlock(z)));
|
QuartPos.fromBlock(x), QuartPos.fromBlock(y), QuartPos.fromBlock(z)));
|
||||||
|
#else
|
||||||
|
return BiomeWrapper.getBiomeWrapper(chunk.getNoiseBiome(
|
||||||
|
QuartPos.fromBlock(x), QuartPos.fromBlock(y), QuartPos.fromBlock(z)).value());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +162,7 @@ public class ChunkWrapper implements IChunkWrapper
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxY(int x, int z) {
|
public int getMaxY(int x, int z) {
|
||||||
return chunk.getHeight(Heightmap.Types.MOTION_BLOCKING, Math.floorMod(x, 16), Math.floorMod(z, 16));
|
return chunk.getHeight(Heightmap.Types.WORLD_SURFACE, Math.floorMod(x, 16), Math.floorMod(z, 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -154,11 +189,14 @@ public class ChunkWrapper implements IChunkWrapper
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLightCorrect(){
|
public boolean isLightCorrect(){
|
||||||
//return true;
|
#if PRE_MC_1_18_1
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
if (chunk instanceof LevelChunk) {
|
if (chunk instanceof LevelChunk) {
|
||||||
return ((LevelChunk) chunk).isClientLightReady();
|
return ((LevelChunk) chunk).isClientLightReady();
|
||||||
}
|
}
|
||||||
return chunk.isLightCorrect();
|
return chunk.isLightCorrect();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWaterLogged(int x, int y, int z)
|
public boolean isWaterLogged(int x, int y, int z)
|
||||||
@@ -205,4 +243,9 @@ public class ChunkWrapper implements IChunkWrapper
|
|||||||
return lightSource;
|
return lightSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return chunk.getClass().getSimpleName() + chunk.getPos();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,10 +47,14 @@ import net.minecraft.client.gui.components.events.GuiEventListener;
|
|||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.network.chat.CommonComponents;
|
import net.minecraft.network.chat.CommonComponents;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
#if PRE_MC_1_19
|
||||||
import net.minecraft.network.chat.TextComponent;
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
|
#endif
|
||||||
import net.minecraft.client.resources.language.I18n; // translation
|
import net.minecraft.client.resources.language.I18n; // translation
|
||||||
import net.minecraft.client.gui.narration.NarratableEntry; // Remove in 1.16
|
#if POST_MC_1_17_1
|
||||||
|
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Based upon TinyConfig
|
* Based upon TinyConfig
|
||||||
@@ -60,29 +64,15 @@ import net.minecraft.client.gui.narration.NarratableEntry; // Remove in 1.16
|
|||||||
*
|
*
|
||||||
* Credits to Motschen
|
* Credits to Motschen
|
||||||
*
|
*
|
||||||
* @author coolGi2007
|
* REMOVED IN a1.7
|
||||||
|
*
|
||||||
|
* @author coolGi
|
||||||
* @version 1-14-2022
|
* @version 1-14-2022
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public abstract class ConfigGui
|
public abstract class ConfigGui
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
TODO list
|
|
||||||
|
|
||||||
Fix floats not working
|
|
||||||
Make a wiki
|
|
||||||
Make it so you can enable and disable buttons from showing
|
|
||||||
Make min and max not final
|
|
||||||
Move the ConfigScreenConfigs class to the config class that extends this
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
List of hacky things that are done that should be done properly
|
|
||||||
|
|
||||||
The buttons that don't show are still loaded but just not rendered
|
|
||||||
The screen with is set to double so the scroll bar doesn't show
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
private static final Pattern INTEGER_ONLY_REGEX = Pattern.compile("(-?[0-9]*)");
|
private static final Pattern INTEGER_ONLY_REGEX = Pattern.compile("(-?[0-9]*)");
|
||||||
private static final Pattern DECIMAL_ONLY_REGEX = Pattern.compile("-?([\\d]+\\.?[\\d]*|[\\d]*\\.?[\\d]+|\\.)");
|
private static final Pattern DECIMAL_ONLY_REGEX = Pattern.compile("-?([\\d]+\\.?[\\d]*|[\\d]*\\.?[\\d]+|\\.)");
|
||||||
|
|
||||||
@@ -121,7 +111,11 @@ public abstract class ConfigGui
|
|||||||
Object value;
|
Object value;
|
||||||
String tempValue;
|
String tempValue;
|
||||||
boolean inLimits = true;
|
boolean inLimits = true;
|
||||||
|
#if PRE_MC_1_19
|
||||||
TranslatableComponent name;
|
TranslatableComponent name;
|
||||||
|
#else
|
||||||
|
Component name;
|
||||||
|
#endif
|
||||||
int index;
|
int index;
|
||||||
/** Hides the button */
|
/** Hides the button */
|
||||||
boolean hideOption = false;
|
boolean hideOption = false;
|
||||||
@@ -218,8 +212,11 @@ public abstract class ConfigGui
|
|||||||
if (entry != null)
|
if (entry != null)
|
||||||
{
|
{
|
||||||
if (!entry.name().equals(""))
|
if (!entry.name().equals(""))
|
||||||
|
#if PRE_MC_1_19
|
||||||
info.name = new TranslatableComponent(entry.name());
|
info.name = new TranslatableComponent(entry.name());
|
||||||
|
#else
|
||||||
|
info.name = Component.translatable(entry.name());
|
||||||
|
#endif
|
||||||
|
|
||||||
if (fieldClass == int.class)
|
if (fieldClass == int.class)
|
||||||
{
|
{
|
||||||
@@ -240,7 +237,11 @@ public abstract class ConfigGui
|
|||||||
else if (fieldClass == boolean.class)
|
else if (fieldClass == boolean.class)
|
||||||
{
|
{
|
||||||
// For boolean
|
// For boolean
|
||||||
|
#if PRE_MC_1_19
|
||||||
Function<Object, Component> func = value -> new TextComponent((Boolean) value ? "True" : "False").withStyle((Boolean) value ? ChatFormatting.GREEN : ChatFormatting.RED);
|
Function<Object, Component> func = value -> new TextComponent((Boolean) value ? "True" : "False").withStyle((Boolean) value ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||||
|
#else
|
||||||
|
Function<Object, Component> func = value -> Component.translatable((Boolean) value ? "True" : "False").withStyle((Boolean) value ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||||
|
#endif
|
||||||
info.widget = new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(button -> {
|
info.widget = new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(button -> {
|
||||||
info.value = !(Boolean) info.value;
|
info.value = !(Boolean) info.value;
|
||||||
button.setMessage(func.apply(info.value));
|
button.setMessage(func.apply(info.value));
|
||||||
@@ -250,7 +251,11 @@ public abstract class ConfigGui
|
|||||||
{
|
{
|
||||||
// For enum
|
// For enum
|
||||||
List<?> values = Arrays.asList(field.getType().getEnumConstants());
|
List<?> values = Arrays.asList(field.getType().getEnumConstants());
|
||||||
|
#if PRE_MC_1_19
|
||||||
Function<Object, Component> func = value -> new TranslatableComponent(MOD_NAME + ".config." + "enum." + fieldClass.getSimpleName() + "." + info.value.toString());
|
Function<Object, Component> func = value -> new TranslatableComponent(MOD_NAME + ".config." + "enum." + fieldClass.getSimpleName() + "." + info.value.toString());
|
||||||
|
#else
|
||||||
|
Function<Object, Component> func = value -> Component.translatable(MOD_NAME + ".config." + "enum." + fieldClass.getSimpleName() + "." + info.value.toString());
|
||||||
|
#endif
|
||||||
info.widget = new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(button -> {
|
info.widget = new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(button -> {
|
||||||
int index = values.indexOf(info.value) + 1;
|
int index = values.indexOf(info.value) + 1;
|
||||||
info.value = values.get(index >= values.size() ? 0 : index);
|
info.value = values.get(index >= values.size() ? 0 : index);
|
||||||
@@ -261,7 +266,12 @@ public abstract class ConfigGui
|
|||||||
else if (screenEntry != null)
|
else if (screenEntry != null)
|
||||||
{
|
{
|
||||||
if (!screenEntry.name().equals(""))
|
if (!screenEntry.name().equals(""))
|
||||||
|
#if PRE_MC_1_19
|
||||||
info.name = new TranslatableComponent(screenEntry.name());
|
info.name = new TranslatableComponent(screenEntry.name());
|
||||||
|
#else
|
||||||
|
info.name = Component.translatable(screenEntry.name());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
info.screenButton = true;
|
info.screenButton = true;
|
||||||
info.gotoScreen = (!info.category.isEmpty() ? info.category + "." : "") + field.getName();
|
info.gotoScreen = (!info.category.isEmpty() ? info.category + "." : "") + field.getName();
|
||||||
@@ -289,7 +299,11 @@ public abstract class ConfigGui
|
|||||||
{
|
{
|
||||||
value = func.apply(stringValue);
|
value = func.apply(stringValue);
|
||||||
inLimits = value.doubleValue() >= minValue && value.doubleValue() <= maxValue;
|
inLimits = value.doubleValue() >= minValue && value.doubleValue() <= maxValue;
|
||||||
|
#if PRE_MC_1_19
|
||||||
info.error = inLimits ? null : new AbstractMap.SimpleEntry<>(editBox, new TextComponent(value.doubleValue() < minValue ?
|
info.error = inLimits ? null : new AbstractMap.SimpleEntry<>(editBox, new TextComponent(value.doubleValue() < minValue ?
|
||||||
|
#else
|
||||||
|
info.error = inLimits ? null : new AbstractMap.SimpleEntry<>(editBox, Component.translatable(value.doubleValue() < minValue ?
|
||||||
|
#endif
|
||||||
"§cMinimum " + "length" + (cast ? " is " + (int) minValue : " is " + minValue) :
|
"§cMinimum " + "length" + (cast ? " is " + (int) minValue : " is " + minValue) :
|
||||||
"§cMaximum " + "length" + (cast ? " is " + (int) maxValue : " is " + maxValue)));
|
"§cMaximum " + "length" + (cast ? " is " + (int) maxValue : " is " + maxValue)));
|
||||||
}
|
}
|
||||||
@@ -329,6 +343,8 @@ public abstract class ConfigGui
|
|||||||
|
|
||||||
// First try to create a config file
|
// First try to create a config file
|
||||||
try {
|
try {
|
||||||
|
if (!configFilePath.getParent().toFile().exists())
|
||||||
|
Files.createDirectory(configFilePath.getParent());
|
||||||
if (!Files.exists(configFilePath))
|
if (!Files.exists(configFilePath))
|
||||||
Files.createFile(configFilePath);
|
Files.createFile(configFilePath);
|
||||||
}
|
}
|
||||||
@@ -341,8 +357,7 @@ public abstract class ConfigGui
|
|||||||
|
|
||||||
|
|
||||||
// Just put this here for the future
|
// Just put this here for the future
|
||||||
config.setComment("_Version", " DONT TOUCH THIS, IF YOU DO THEN CONFIG FILE WOULD BREAK");
|
config.set("_version", 1);
|
||||||
config.set("_Versions", ModInfo.VERSION);
|
|
||||||
|
|
||||||
|
|
||||||
for (EntryInfo info : entries) {
|
for (EntryInfo info : entries) {
|
||||||
@@ -377,8 +392,7 @@ public abstract class ConfigGui
|
|||||||
|
|
||||||
|
|
||||||
// Just put this here for the future
|
// Just put this here for the future
|
||||||
config.setComment("_Version", " DONT TOUCH THIS, IF YOU DO THEN CONFIG FILE WOULD BREAK");
|
config.set("_version", 1);
|
||||||
config.set("_Versions", ModInfo.VERSION);
|
|
||||||
|
|
||||||
|
|
||||||
// Puts everything into its variable
|
// Puts everything into its variable
|
||||||
@@ -449,8 +463,13 @@ public abstract class ConfigGui
|
|||||||
{
|
{
|
||||||
String itemPath = (info.category.isEmpty() ? "" : info.category + ".") + info.field.getName();
|
String itemPath = (info.category.isEmpty() ? "" : info.category + ".") + info.field.getName();
|
||||||
if (config.contains(itemPath)) {
|
if (config.contains(itemPath)) {
|
||||||
if (info.field.getType().isEnum())
|
if (info.field.getType().isEnum()) {
|
||||||
|
try {
|
||||||
info.value = config.getEnum(itemPath, info.varClass);
|
info.value = config.getEnum(itemPath, info.varClass);
|
||||||
|
} catch (IllegalArgumentException ignored) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
info.value = config.get(itemPath);
|
info.value = config.get(itemPath);
|
||||||
} else
|
} else
|
||||||
@@ -496,7 +515,11 @@ public abstract class ConfigGui
|
|||||||
{
|
{
|
||||||
protected ConfigScreen(Screen parent, String category)
|
protected ConfigScreen(Screen parent, String category)
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_19
|
||||||
super(new TranslatableComponent(
|
super(new TranslatableComponent(
|
||||||
|
#else
|
||||||
|
super(Component.translatable(
|
||||||
|
#endif
|
||||||
I18n.exists(MOD_NAME + ".config" + (category.isEmpty()? "." + category : "") + ".title") ?
|
I18n.exists(MOD_NAME + ".config" + (category.isEmpty()? "." + category : "") + ".title") ?
|
||||||
MOD_NAME + ".config.title" :
|
MOD_NAME + ".config.title" :
|
||||||
MOD_NAME + ".config" + (category.isEmpty() ? "" : "." + category) + ".title")
|
MOD_NAME + ".config" + (category.isEmpty() ? "" : "." + category) + ".title")
|
||||||
@@ -528,6 +551,17 @@ public abstract class ConfigGui
|
|||||||
Objects.requireNonNull(minecraft).setScreen(this.parent);
|
Objects.requireNonNull(minecraft).setScreen(this.parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// addRenderableWidget in 1.17 and over
|
||||||
|
// addButton in 1.16 and below
|
||||||
|
private Button addBtn(Button button) {
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
this.addButton(button);
|
||||||
|
#else
|
||||||
|
this.addRenderableWidget(button);
|
||||||
|
#endif
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init()
|
protected void init()
|
||||||
{
|
{
|
||||||
@@ -535,14 +569,11 @@ public abstract class ConfigGui
|
|||||||
if (!reload)
|
if (!reload)
|
||||||
loadFromFile();
|
loadFromFile();
|
||||||
|
|
||||||
// addRenderableWidget in 1.17 and over
|
addBtn(createButton(this.width / 2 - 154, this.height - 28, 150, 20, CommonComponents.GUI_CANCEL, button -> {
|
||||||
// addButton in 1.16 and below
|
|
||||||
this.addRenderableWidget(new Button(this.width / 2 - 154, this.height - 28, 150, 20, CommonComponents.GUI_CANCEL, button -> {
|
|
||||||
loadFromFile();
|
loadFromFile();
|
||||||
Objects.requireNonNull(minecraft).setScreen(parent);
|
Objects.requireNonNull(minecraft).setScreen(parent);
|
||||||
}));
|
}));
|
||||||
|
Button done = addBtn(createButton(this.width / 2 + 4, this.height - 28, 150, 20, CommonComponents.GUI_DONE, (button) -> {
|
||||||
Button done = this.addRenderableWidget(new Button(this.width / 2 + 4, this.height - 28, 150, 20, CommonComponents.GUI_DONE, (button) -> {
|
|
||||||
saveToFile();
|
saveToFile();
|
||||||
Objects.requireNonNull(minecraft).setScreen(parent);
|
Objects.requireNonNull(minecraft).setScreen(parent);
|
||||||
}));
|
}));
|
||||||
@@ -555,8 +586,13 @@ public abstract class ConfigGui
|
|||||||
{
|
{
|
||||||
if (info.category.matches(category) && !info.hideOption)
|
if (info.category.matches(category) && !info.hideOption)
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_19
|
||||||
TranslatableComponent name = (info.name == null ? new TranslatableComponent(translationPrefix + (!info.category.isEmpty() ? info.category + "." : "") + info.field.getName()) : info.name);
|
TranslatableComponent name = (info.name == null ? new TranslatableComponent(translationPrefix + (!info.category.isEmpty() ? info.category + "." : "") + info.field.getName()) : info.name);
|
||||||
Button resetButton = new Button(this.width - ConfigScreenConfigs.SpaceFromRightScreen - info.width - ConfigScreenConfigs.ButtonWidthSpacing - ConfigScreenConfigs.ResetButtonWidth, 0, ConfigScreenConfigs.ResetButtonWidth, 20, new TextComponent("Reset").withStyle(ChatFormatting.RED), (button -> {
|
Button resetButton = new Button(this.width - ConfigScreenConfigs.SpaceFromRightScreen - info.width - ConfigScreenConfigs.ButtonWidthSpacing - ConfigScreenConfigs.ResetButtonWidth, 0, ConfigScreenConfigs.ResetButtonWidth, 20, new TextComponent("Reset").withStyle(ChatFormatting.RED), (button -> {
|
||||||
|
#else
|
||||||
|
Component name = (info.name == null ? Component.translatable(translationPrefix + (!info.category.isEmpty() ? info.category + "." : "") + info.field.getName()) : info.name);
|
||||||
|
Button resetButton = createButton(this.width - ConfigScreenConfigs.SpaceFromRightScreen - info.width - ConfigScreenConfigs.ButtonWidthSpacing - ConfigScreenConfigs.ResetButtonWidth, 0, ConfigScreenConfigs.ResetButtonWidth, 20, Component.translatable("Reset").withStyle(ChatFormatting.RED), (button -> {
|
||||||
|
#endif
|
||||||
info.value = info.defaultValue;
|
info.value = info.defaultValue;
|
||||||
info.tempValue = info.defaultValue.toString();
|
info.tempValue = info.defaultValue.toString();
|
||||||
info.index = 0;
|
info.index = 0;
|
||||||
@@ -568,8 +604,12 @@ public abstract class ConfigGui
|
|||||||
{
|
{
|
||||||
Map.Entry<Button.OnPress, Function<Object, Component>> widget = (Map.Entry<Button.OnPress, Function<Object, Component>>) info.widget;
|
Map.Entry<Button.OnPress, Function<Object, Component>> widget = (Map.Entry<Button.OnPress, Function<Object, Component>>) info.widget;
|
||||||
if (info.field.getType().isEnum())
|
if (info.field.getType().isEnum())
|
||||||
|
#if PRE_MC_1_19
|
||||||
widget.setValue(value -> new TranslatableComponent(translationPrefix + "enum." + info.field.getType().getSimpleName() + "." + info.value.toString()));
|
widget.setValue(value -> new TranslatableComponent(translationPrefix + "enum." + info.field.getType().getSimpleName() + "." + info.value.toString()));
|
||||||
this.list.addButton(new Button(this.width - info.width - ConfigScreenConfigs.SpaceFromRightScreen, 0, info.width, 20, widget.getValue().apply(info.value), widget.getKey()), resetButton, null, name);
|
#else
|
||||||
|
widget.setValue(value -> Component.translatable(translationPrefix + "enum." + info.field.getType().getSimpleName() + "." + info.value.toString()));
|
||||||
|
#endif
|
||||||
|
this.list.addButton(createButton(this.width - info.width - ConfigScreenConfigs.SpaceFromRightScreen, 0, info.width, 20, widget.getValue().apply(info.value), widget.getKey()), resetButton, null, name);
|
||||||
}
|
}
|
||||||
else if (info.field.getType() == List.class)
|
else if (info.field.getType() == List.class)
|
||||||
{
|
{
|
||||||
@@ -584,8 +624,13 @@ public abstract class ConfigGui
|
|||||||
Predicate<String> processor = ((BiFunction<EditBox, Button, Predicate<String>>) info.widget).apply(widget, done);
|
Predicate<String> processor = ((BiFunction<EditBox, Button, Predicate<String>>) info.widget).apply(widget, done);
|
||||||
widget.setFilter(processor);
|
widget.setFilter(processor);
|
||||||
resetButton.setWidth(20);
|
resetButton.setWidth(20);
|
||||||
|
#if PRE_MC_1_19
|
||||||
resetButton.setMessage(new TextComponent("R").withStyle(ChatFormatting.RED));
|
resetButton.setMessage(new TextComponent("R").withStyle(ChatFormatting.RED));
|
||||||
Button cycleButton = new Button(this.width - 185, 0, 20, 20, new TextComponent(String.valueOf(info.index)).withStyle(ChatFormatting.GOLD), (button -> {
|
Button cycleButton = new Button(this.width - 185, 0, 20, 20, new TextComponent(String.valueOf(info.index)).withStyle(ChatFormatting.GOLD), (button -> {
|
||||||
|
#else
|
||||||
|
resetButton.setMessage(Component.translatable("R").withStyle(ChatFormatting.RED));
|
||||||
|
Button cycleButton = createButton(this.width - 185, 0, 20, 20, Component.translatable(String.valueOf(info.index)).withStyle(ChatFormatting.GOLD), (button -> {
|
||||||
|
#endif
|
||||||
((List<String>) info.value).remove("");
|
((List<String>) info.value).remove("");
|
||||||
this.reload = true;
|
this.reload = true;
|
||||||
info.index = info.index + 1;
|
info.index = info.index + 1;
|
||||||
@@ -606,7 +651,7 @@ public abstract class ConfigGui
|
|||||||
}
|
}
|
||||||
else if (info.screenButton)
|
else if (info.screenButton)
|
||||||
{
|
{
|
||||||
Button widget = new Button(this.width / 2 - info.width, this.height - 28, info.width * 2, 20, name, (button -> {
|
Button widget = createButton(this.width / 2 - info.width, this.height - 28, info.width * 2, 20, name, (button -> {
|
||||||
saveToFile();
|
saveToFile();
|
||||||
Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, info.gotoScreen));
|
Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, info.gotoScreen));
|
||||||
}));
|
}));
|
||||||
@@ -634,14 +679,22 @@ public abstract class ConfigGui
|
|||||||
if (list.getHoveredButton(mouseX,mouseY).isPresent()) {
|
if (list.getHoveredButton(mouseX,mouseY).isPresent()) {
|
||||||
AbstractWidget buttonWidget = list.getHoveredButton(mouseX,mouseY).get();
|
AbstractWidget buttonWidget = list.getHoveredButton(mouseX,mouseY).get();
|
||||||
Component text = ButtonEntry.buttonsWithText.get(buttonWidget);
|
Component text = ButtonEntry.buttonsWithText.get(buttonWidget);
|
||||||
|
#if PRE_MC_1_19
|
||||||
TranslatableComponent name = new TranslatableComponent(this.translationPrefix + (info.category.isEmpty() ? "" : info.category + ".") + info.field.getName());
|
TranslatableComponent name = new TranslatableComponent(this.translationPrefix + (info.category.isEmpty() ? "" : info.category + ".") + info.field.getName());
|
||||||
|
#else
|
||||||
|
Component name = Component.translatable(this.translationPrefix + (info.category.isEmpty() ? "" : info.category + ".") + info.field.getName());
|
||||||
|
#endif
|
||||||
String key = translationPrefix + (info.category.isEmpty() ? "" : info.category + ".") + info.field.getName() + ".@tooltip";
|
String key = translationPrefix + (info.category.isEmpty() ? "" : info.category + ".") + info.field.getName() + ".@tooltip";
|
||||||
|
|
||||||
if (info.error != null && text.equals(name)) renderTooltip(matrices, (Component) info.error.getValue(), mouseX, mouseY);
|
if (info.error != null && text.equals(name)) renderTooltip(matrices, (Component) info.error.getValue(), mouseX, mouseY);
|
||||||
else if (I18n.exists(key) && (text != null && text.equals(name))) {
|
else if (I18n.exists(key) && (text != null && text.equals(name))) {
|
||||||
List<Component> list = new ArrayList<>();
|
List<Component> list = new ArrayList<>();
|
||||||
for (String str : I18n.get(key).split("\n"))
|
for (String str : I18n.get(key).split("\n"))
|
||||||
|
#if PRE_MC_1_19
|
||||||
list.add(new TextComponent(str));
|
list.add(new TextComponent(str));
|
||||||
|
#else
|
||||||
|
list.add(Component.translatable(str));
|
||||||
|
#endif
|
||||||
renderComponentTooltip(matrices, list, mouseX, mouseY);
|
renderComponentTooltip(matrices, list, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -728,17 +781,29 @@ public abstract class ConfigGui
|
|||||||
{
|
{
|
||||||
if (button != null)
|
if (button != null)
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
button.y = y;
|
button.y = y;
|
||||||
|
#else
|
||||||
|
button.setY(y);
|
||||||
|
#endif
|
||||||
button.render(matrices, mouseX, mouseY, tickDelta);
|
button.render(matrices, mouseX, mouseY, tickDelta);
|
||||||
}
|
}
|
||||||
if (resetButton != null)
|
if (resetButton != null)
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
resetButton.y = y;
|
resetButton.y = y;
|
||||||
|
#else
|
||||||
|
resetButton.setY(y);
|
||||||
|
#endif
|
||||||
resetButton.render(matrices, mouseX, mouseY, tickDelta);
|
resetButton.render(matrices, mouseX, mouseY, tickDelta);
|
||||||
}
|
}
|
||||||
if (indexButton != null)
|
if (indexButton != null)
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
indexButton.y = y;
|
indexButton.y = y;
|
||||||
|
#else
|
||||||
|
indexButton.setY(y);
|
||||||
|
#endif
|
||||||
indexButton.render(matrices, mouseX, mouseY, tickDelta);
|
indexButton.render(matrices, mouseX, mouseY, tickDelta);
|
||||||
}
|
}
|
||||||
if (text != null && (!text.getString().contains("spacer") || button != null))
|
if (text != null && (!text.getString().contains("spacer") || button != null))
|
||||||
@@ -753,10 +818,24 @@ public abstract class ConfigGui
|
|||||||
|
|
||||||
// Only for 1.17 and over
|
// Only for 1.17 and over
|
||||||
// Remove in 1.16 and below
|
// Remove in 1.16 and below
|
||||||
|
#if POST_MC_1_17_1
|
||||||
@Override
|
@Override
|
||||||
public List<? extends NarratableEntry> narratables()
|
public List<? extends NarratableEntry> narratables()
|
||||||
{
|
{
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static Button createButton(int x, int y, int width, int height, Component component, Button.OnPress onPress) {
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
|
return new Button(x, y, width, height, component, onPress);
|
||||||
|
#else
|
||||||
|
return Button.builder(component, onPress)
|
||||||
|
.bounds(x, y, width, height)
|
||||||
|
.build();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+190
-10
@@ -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,43 @@ 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");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getEarthCurveRatio()
|
||||||
|
{
|
||||||
|
return (int) ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.earthCurveRatio").value;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void setEarthCurveRatio(int newEarthCurveRatio)
|
||||||
|
{
|
||||||
|
if (newEarthCurveRatio < 50) newEarthCurveRatio = 0;
|
||||||
|
ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.earthCurveRatio").value = newEarthCurveRatio;
|
||||||
|
ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.earthCurveRatio");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -668,12 +716,12 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
|||||||
public static class Threading implements IThreading
|
public static class Threading implements IThreading
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public int getNumberOfWorldGenerationThreads()
|
public double getNumberOfWorldGenerationThreads()
|
||||||
{
|
{
|
||||||
return Config.Client.Advanced.Threading.numberOfWorldGenerationThreads;
|
return Config.Client.Advanced.Threading.numberOfWorldGenerationThreads;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void setNumberOfWorldGenerationThreads(int newNumberOfWorldGenerationThreads)
|
public void setNumberOfWorldGenerationThreads(double newNumberOfWorldGenerationThreads)
|
||||||
{
|
{
|
||||||
ConfigGui.editSingleOption.getEntry("client.advanced.threading.numberOfWorldGenerationThreads").value = newNumberOfWorldGenerationThreads;
|
ConfigGui.editSingleOption.getEntry("client.advanced.threading.numberOfWorldGenerationThreads").value = newNumberOfWorldGenerationThreads;
|
||||||
ConfigGui.editSingleOption.saveOption("client.advanced.threading.numberOfWorldGenerationThreads");
|
ConfigGui.editSingleOption.saveOption("client.advanced.threading.numberOfWorldGenerationThreads");
|
||||||
@@ -701,18 +749,28 @@ 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;
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void setDrawLods(boolean newDrawLods)
|
|
||||||
{
|
|
||||||
ConfigGui.editSingleOption.getEntry("client.advanced.debugging.drawLods").value = newDrawLods;
|
|
||||||
ConfigGui.editSingleOption.saveOption("client.advanced.debugging.drawLods");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* RendererType:
|
||||||
|
* DEFAULT
|
||||||
|
* DEBUG
|
||||||
|
* DISABLED
|
||||||
|
* */
|
||||||
|
@Override
|
||||||
|
public RendererType getRendererType() {
|
||||||
|
return (RendererType) ConfigGui.editSingleOption.getEntry("client.advanced.debugging.rendererType").value;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void setRendererType(RendererType newRenderType) {
|
||||||
|
ConfigGui.editSingleOption.getEntry("client.advanced.debugging.rendererType").value = newRenderType;
|
||||||
|
ConfigGui.editSingleOption.saveOption("client.advanced.debugging.rendererType");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DebugMode getDebugMode()
|
public DebugMode getDebugMode()
|
||||||
@@ -738,6 +796,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 +949,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");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+59
-3
@@ -1,7 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.config;
|
package com.seibel.lod.common.wrappers.config;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.components.ImageButton;
|
import net.minecraft.client.gui.components.ImageButton;
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
@@ -11,9 +31,12 @@ import net.minecraft.resources.ResourceLocation;
|
|||||||
* Creates a button with a texture on it
|
* Creates a button with a texture on it
|
||||||
*/
|
*/
|
||||||
public class TexturedButtonWidget extends ImageButton {
|
public class TexturedButtonWidget extends ImageButton {
|
||||||
|
#if POST_MC_1_17_1
|
||||||
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, ResourceLocation texture, OnPress pressAction) {
|
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, ResourceLocation texture, OnPress pressAction) {
|
||||||
super(x, y, width, height, u, v, texture, pressAction);
|
super(x, y, width, height, u, v, texture, pressAction);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, ResourceLocation texture, int textureWidth, int textureHeight, OnPress pressAction) {
|
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, ResourceLocation texture, int textureWidth, int textureHeight, OnPress pressAction) {
|
||||||
super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction);
|
super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction);
|
||||||
}
|
}
|
||||||
@@ -22,22 +45,55 @@ public class TexturedButtonWidget extends ImageButton {
|
|||||||
super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, text);
|
super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, ResourceLocation texture, int textureWidth, int textureHeight, OnPress pressAction, OnTooltip tooltipSupplier, Component text) {
|
// public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, ResourceLocation texture, int textureWidth, int textureHeight, OnPress pressAction, OnTooltip tooltipSupplier, Component text) {
|
||||||
super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, tooltipSupplier, text);
|
// super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, tooltipSupplier, text);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
#if PRE_MC_1_19_4
|
||||||
@Override
|
@Override
|
||||||
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
|
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
Minecraft.getInstance().getTextureManager().bind(WIDGETS_LOCATION);
|
||||||
|
RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
|
||||||
|
#else
|
||||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||||
RenderSystem.setShaderTexture(0, WIDGETS_LOCATION);
|
RenderSystem.setShaderTexture(0, WIDGETS_LOCATION);
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.alpha);
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.alpha);
|
||||||
|
#endif
|
||||||
|
|
||||||
int i = this.getYImage(this.isHovered);
|
int i = this.getYImage(this.isHovered);
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
RenderSystem.enableDepthTest();
|
RenderSystem.enableDepthTest();
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
this.blit(matrices, this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height);
|
this.blit(matrices, this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height);
|
||||||
this.blit(matrices, this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
this.blit(matrices, this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
||||||
|
#else
|
||||||
|
this.blit(matrices, this.getX(), this.getY(), 0, 46 + i * 20, this.getWidth() / 2, this.getHeight());
|
||||||
|
this.blit(matrices, this.getX() + this.getWidth() / 2, this.getY(), 200 - this.width / 2, 46 + i * 20, this.getWidth() / 2, this.getHeight());
|
||||||
|
#endif
|
||||||
|
|
||||||
super.renderButton(matrices, mouseX, mouseY, delta);
|
super.renderButton(matrices, mouseX, mouseY, delta);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
@Override
|
||||||
|
public void renderWidget(PoseStack matrices, int mouseX, int mouseY, float delta) {
|
||||||
|
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||||
|
RenderSystem.setShaderTexture(0, WIDGETS_LOCATION);
|
||||||
|
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.alpha);
|
||||||
|
|
||||||
|
int i = 1;
|
||||||
|
if (!this.active)
|
||||||
|
i = 0;
|
||||||
|
else if (this.isHovered)
|
||||||
|
i = 2;
|
||||||
|
RenderSystem.enableBlend();
|
||||||
|
RenderSystem.defaultBlendFunc();
|
||||||
|
RenderSystem.enableDepthTest();
|
||||||
|
this.blit(matrices, this.getX(), this.getY(), 0, 46 + i * 20, this.getWidth() / 2, this.getHeight());
|
||||||
|
this.blit(matrices, this.getX() + this.getWidth() / 2, this.getY(), 200 - this.width / 2, 46 + i * 20, this.getWidth() / 2, this.getHeight());
|
||||||
|
|
||||||
|
super.renderWidget(matrices, mouseX, mouseY, delta);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-55
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 James Seibel
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -55,16 +55,19 @@ import net.minecraft.client.resources.model.ModelManager;
|
|||||||
import net.minecraft.client.server.IntegratedServer;
|
import net.minecraft.client.server.IntegratedServer;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
#if PRE_MC_1_19
|
||||||
import net.minecraft.network.chat.TextComponent;
|
import net.minecraft.network.chat.TextComponent;
|
||||||
|
#endif
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
|
import net.minecraft.world.level.LightLayer;
|
||||||
import net.minecraft.world.level.dimension.DimensionType;
|
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
|
||||||
@@ -164,57 +167,6 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper
|
|||||||
return LodUtil.getDimensionIDFromWorld(WorldWrapper.getWorldWrapper(mc.level));
|
return LodUtil.getDimensionIDFromWorld(WorldWrapper.getWorldWrapper(mc.level));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This texture changes every frame */
|
|
||||||
@Override
|
|
||||||
public ILightMapWrapper getCurrentLightMap()
|
|
||||||
{
|
|
||||||
// get the current lightMap if the cache is empty
|
|
||||||
if (lightMap == null)
|
|
||||||
{
|
|
||||||
LightTexture tex = mc.gameRenderer.lightTexture();
|
|
||||||
lightMap = tex.lightPixels;
|
|
||||||
}
|
|
||||||
return new LightMapWrapper(lightMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the color int 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 int getColorIntFromLightMap(int blockLight, int skyLight)
|
|
||||||
{
|
|
||||||
if (lightMap == null)
|
|
||||||
{
|
|
||||||
sendChatMessage("new");
|
|
||||||
// make sure the lightMap is up-to-date
|
|
||||||
getCurrentLightMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=============//
|
//=============//
|
||||||
// Simple gets //
|
// Simple gets //
|
||||||
//=============//
|
//=============//
|
||||||
@@ -240,7 +192,11 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper
|
|||||||
@Override
|
@Override
|
||||||
public ChunkPosWrapper getPlayerChunkPos()
|
public ChunkPosWrapper getPlayerChunkPos()
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
ChunkPos playerPos = new ChunkPos(getPlayer().blockPosition());
|
||||||
|
#else
|
||||||
ChunkPos playerPos = getPlayer().chunkPosition();
|
ChunkPos playerPos = getPlayer().chunkPosition();
|
||||||
|
#endif
|
||||||
return new ChunkPosWrapper(playerPos.x, playerPos.z);
|
return new ChunkPosWrapper(playerPos.x, playerPos.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,6 +330,14 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper
|
|||||||
return mc.getCurrentServer() != null;
|
return mc.getCurrentServer() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPlayerSkylight() {
|
||||||
|
if (mc.level == null) return -1;
|
||||||
|
if (mc.player == null) return -1;
|
||||||
|
if (mc.player.blockPosition() == null) return -1;
|
||||||
|
return mc.level.getBrightness(LightLayer.SKY, mc.player.blockPosition());
|
||||||
|
}
|
||||||
|
|
||||||
public ServerData getCurrentServer()
|
public ServerData getCurrentServer()
|
||||||
{
|
{
|
||||||
return mc.getCurrentServer();
|
return mc.getCurrentServer();
|
||||||
@@ -404,7 +368,11 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper
|
|||||||
@Override
|
@Override
|
||||||
public void sendChatMessage(String string)
|
public void sendChatMessage(String string)
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_19
|
||||||
getPlayer().sendMessage(new TextComponent(string), getPlayer().getUUID());
|
getPlayer().sendMessage(new TextComponent(string), getPlayer().getUUID());
|
||||||
|
#else
|
||||||
|
getPlayer().sendSystemMessage(Component.translatable(string));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+89
-112
@@ -1,6 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.minecraft;
|
package com.seibel.lod.common.wrappers.minecraft;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -15,9 +35,13 @@ import com.seibel.lod.core.handlers.dependencyInjection.ModAccessorHandler;
|
|||||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
|
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
|
||||||
import com.seibel.lod.core.util.LodUtil;
|
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;
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
import com.mojang.math.Vector3f;
|
import com.mojang.math.Vector3f;
|
||||||
|
#else
|
||||||
|
import org.joml.Vector3f;
|
||||||
|
#endif
|
||||||
import com.seibel.lod.core.objects.math.Mat4f;
|
import com.seibel.lod.core.objects.math.Mat4f;
|
||||||
import com.seibel.lod.core.objects.math.Vec3d;
|
import com.seibel.lod.core.objects.math.Vec3d;
|
||||||
import com.seibel.lod.core.objects.math.Vec3f;
|
import com.seibel.lod.core.objects.math.Vec3f;
|
||||||
@@ -40,9 +64,15 @@ import net.minecraft.core.BlockPos;
|
|||||||
import net.minecraft.world.effect.MobEffects;
|
import net.minecraft.world.effect.MobEffects;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
import net.minecraft.tags.FluidTags;
|
||||||
|
import net.minecraft.world.level.material.FluidState;
|
||||||
|
#else
|
||||||
import net.minecraft.world.level.material.FogType;
|
import net.minecraft.world.level.material.FogType;
|
||||||
|
#endif
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import org.lwjgl.opengl.GL15;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,6 +90,8 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
private static final GameRenderer GAME_RENDERER = MC.gameRenderer;
|
private static final GameRenderer GAME_RENDERER = MC.gameRenderer;
|
||||||
private static final IWrapperFactory FACTORY = WrapperFactory.INSTANCE;
|
private static final IWrapperFactory FACTORY = WrapperFactory.INSTANCE;
|
||||||
|
|
||||||
|
public LightMapWrapper lightmap = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3f getLookAtVector()
|
public Vec3f getLookAtVector()
|
||||||
{
|
{
|
||||||
@@ -94,19 +126,33 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
@Override
|
@Override
|
||||||
public Mat4f getDefaultProjectionMatrix(float partialTicks)
|
public Mat4f getDefaultProjectionMatrix(float partialTicks)
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
return McObjectConverter.Convert(GAME_RENDERER.getProjectionMatrix(GAME_RENDERER.getMainCamera(), partialTicks, true));
|
||||||
|
#else
|
||||||
return McObjectConverter.Convert(GAME_RENDERER.getProjectionMatrix(GAME_RENDERER.getFov(GAME_RENDERER.getMainCamera(), partialTicks, true)));
|
return McObjectConverter.Convert(GAME_RENDERER.getProjectionMatrix(GAME_RENDERER.getFov(GAME_RENDERER.getMainCamera(), partialTicks, true)));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getGamma()
|
public double getGamma()
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_19
|
||||||
return MC.options.gamma;
|
return MC.options.gamma;
|
||||||
|
#else
|
||||||
|
return MC.options.gamma().get();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Color getFogColor(float partialTicks) {
|
public Color getFogColor(float partialTicks) {
|
||||||
|
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
float[] colorValues = new float[4];
|
||||||
|
GL15.glGetFloatv(GL15.GL_FOG_COLOR, colorValues);
|
||||||
|
#else
|
||||||
FogRenderer.setupColor(GAME_RENDERER.getMainCamera(), partialTicks, MC.level, 1, GAME_RENDERER.getDarkenWorldAmount(partialTicks));
|
FogRenderer.setupColor(GAME_RENDERER.getMainCamera(), partialTicks, MC.level, 1, GAME_RENDERER.getDarkenWorldAmount(partialTicks));
|
||||||
float[] colorValues = RenderSystem.getShaderFogColor();
|
float[] colorValues = RenderSystem.getShaderFogColor();
|
||||||
|
#endif
|
||||||
return new Color(colorValues[0], colorValues[1], colorValues[2], colorValues[3]);
|
return new Color(colorValues[0], colorValues[1], colorValues[2], colorValues[3]);
|
||||||
}
|
}
|
||||||
// getSpecialFogColor() is the same as getFogColor()
|
// getSpecialFogColor() is the same as getFogColor()
|
||||||
@@ -114,7 +160,11 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
@Override
|
@Override
|
||||||
public Color getSkyColor() {
|
public Color getSkyColor() {
|
||||||
if (MC.level.dimensionType().hasSkyLight()) {
|
if (MC.level.dimensionType().hasSkyLight()) {
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getBlockPosition(), MC.getFrameTime());
|
||||||
|
#else
|
||||||
Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), MC.getFrameTime());
|
Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), MC.getFrameTime());
|
||||||
|
#endif
|
||||||
return new Color((float) colorValues.x, (float) colorValues.y, (float) colorValues.z);
|
return new Color((float) colorValues.x, (float) colorValues.y, (float) colorValues.z);
|
||||||
} else
|
} else
|
||||||
return new Color(0, 0, 0);
|
return new Color(0, 0, 0);
|
||||||
@@ -130,7 +180,12 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
@Override
|
@Override
|
||||||
public int getRenderDistance()
|
public int getRenderDistance()
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_18_1
|
||||||
|
//FIXME: How to resolve this?
|
||||||
|
return MC.options.renderDistance;
|
||||||
|
#else
|
||||||
return MC.options.getEffectiveRenderDistance();
|
return MC.options.getEffectiveRenderDistance();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -170,18 +225,15 @@ 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() {
|
||||||
{
|
|
||||||
ISodiumAccessor sodium = ModAccessorHandler.get(ISodiumAccessor.class);
|
ISodiumAccessor sodium = ModAccessorHandler.get(ISodiumAccessor.class);
|
||||||
if (sodium != null)
|
if (sodium != null) {
|
||||||
{
|
|
||||||
return sodium.getNormalRenderedChunks();
|
return sodium.getNormalRenderedChunks();
|
||||||
}
|
}
|
||||||
IOptifineAccessor optifine = ModAccessorHandler.get(IOptifineAccessor.class);
|
IOptifineAccessor optifine = ModAccessorHandler.get(IOptifineAccessor.class);
|
||||||
if (optifine != null)
|
if (optifine != null) {
|
||||||
{
|
|
||||||
HashSet<AbstractChunkPosWrapper> pos = optifine.getNormalRenderedChunks();
|
HashSet<AbstractChunkPosWrapper> pos = optifine.getNormalRenderedChunks();
|
||||||
if (pos == null)
|
if (pos == null)
|
||||||
pos = getMaximumRenderedChunks();
|
pos = getMaximumRenderedChunks();
|
||||||
@@ -190,13 +242,14 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
if (!usingBackupGetVanillaRenderedChunks) {
|
if (!usingBackupGetVanillaRenderedChunks) {
|
||||||
try {
|
try {
|
||||||
LevelRenderer levelRenderer = MC.levelRenderer;
|
LevelRenderer levelRenderer = MC.levelRenderer;
|
||||||
LinkedHashSet<LevelRenderer.RenderChunkInfo> chunks = levelRenderer.renderChunkStorage.get().renderChunks;
|
Collection<LevelRenderer.RenderChunkInfo> chunks =
|
||||||
|
#if PRE_MC_1_18_1 levelRenderer.renderChunks;
|
||||||
|
#else levelRenderer.renderChunkStorage.get().renderChunks; #endif
|
||||||
|
|
||||||
return (chunks.stream().map((chunk) -> {
|
return (chunks.stream().map((chunk) -> {
|
||||||
#if MC_VERSION_1_18_2
|
AABB chunkBoundingBox =
|
||||||
AABB chunkBoundingBox = chunk.chunk.getBoundingBox();
|
#if PRE_MC_1_18_2 chunk.chunk.bb;
|
||||||
#elif MC_VERSION_1_18_1
|
#else chunk.chunk.getBoundingBox(); #endif
|
||||||
AABB chunkBoundingBox = chunk.chunk.bb;
|
|
||||||
#endif
|
|
||||||
return FACTORY.createChunkPos(Math.floorDiv((int) chunkBoundingBox.minX, 16),
|
return FACTORY.createChunkPos(Math.floorDiv((int) chunkBoundingBox.minX, 16),
|
||||||
Math.floorDiv((int) chunkBoundingBox.minZ, 16));
|
Math.floorDiv((int) chunkBoundingBox.minZ, 16));
|
||||||
}).collect(Collectors.toCollection(HashSet::new)));
|
}).collect(Collectors.toCollection(HashSet::new)));
|
||||||
@@ -207,7 +260,8 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
+ " Using Backup Method.");
|
+ " Using Backup Method.");
|
||||||
MinecraftClientWrapper.INSTANCE.sendChatMessage(
|
MinecraftClientWrapper.INSTANCE.sendChatMessage(
|
||||||
"\u00A7eOverdraw prevention will be worse than normal.");
|
"\u00A7eOverdraw prevention will be worse than normal.");
|
||||||
} catch (Exception e2) {}
|
} catch (Exception e2) {
|
||||||
|
}
|
||||||
ApiShared.LOGGER.error("getVanillaRenderedChunks Error: ", e);
|
ApiShared.LOGGER.error("getVanillaRenderedChunks Error: ", e);
|
||||||
usingBackupGetVanillaRenderedChunks = true;
|
usingBackupGetVanillaRenderedChunks = true;
|
||||||
}
|
}
|
||||||
@@ -216,113 +270,36 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getLightmapPixels()
|
public ILightMapWrapper getLightmapWrapper() {
|
||||||
{
|
return lightmap;
|
||||||
LightTexture tex = GAME_RENDERER.lightTexture();
|
|
||||||
tex.tick(); // This call makes no sense, but it fixes pause menu flicker bug
|
|
||||||
NativeImage lightMapPixels = tex.lightPixels;
|
|
||||||
LightMapWrapper lightMap = new LightMapWrapper(lightMapPixels);
|
|
||||||
|
|
||||||
|
|
||||||
int lightMapHeight = getLightmapTextureHeight();
|
|
||||||
int lightMapWidth = getLightmapTextureWidth();
|
|
||||||
|
|
||||||
int[] pixels = new int[lightMapWidth * lightMapHeight];
|
|
||||||
for (int u = 0; u < lightMapWidth; u++)
|
|
||||||
{
|
|
||||||
for (int v = 0; v < lightMapWidth; v++)
|
|
||||||
{
|
|
||||||
// this could probably be kept as a int, but
|
|
||||||
// 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.
|
|
||||||
Color c = LodUtil.intToColor(lightMap.getLightValue(u, v));
|
|
||||||
|
|
||||||
// these should both create a totally white image
|
|
||||||
// int col =
|
|
||||||
// Integer.MAX_VALUE;
|
|
||||||
// int col =
|
|
||||||
// 0b11111111 + // red
|
|
||||||
// (0b11111111 << 8) + // green
|
|
||||||
// (0b11111111 << 16) + // blue
|
|
||||||
// (0b11111111 << 24); // blue
|
|
||||||
|
|
||||||
int col =
|
|
||||||
((c.getRed() & 0xFF) << 16) | // blue
|
|
||||||
((c.getGreen() & 0xFF) << 8) | // green
|
|
||||||
((c.getBlue() & 0xFF)) | // red
|
|
||||||
((c.getAlpha() & 0xFF) << 24); // alpha
|
|
||||||
|
|
||||||
// 2D array stored in a 1D array.
|
|
||||||
// Thank you Tim from College ;)
|
|
||||||
pixels[u * lightMapWidth + v] = col;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pixels;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLightmapTextureHeight()
|
|
||||||
{
|
|
||||||
int height = -1;
|
|
||||||
|
|
||||||
LightTexture lightTexture = GAME_RENDERER.lightTexture();
|
|
||||||
if (lightTexture != null)
|
|
||||||
{
|
|
||||||
NativeImage tex = lightTexture.lightPixels;
|
|
||||||
if (tex != null)
|
|
||||||
{
|
|
||||||
height = tex.getHeight();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLightmapTextureWidth()
|
|
||||||
{
|
|
||||||
int width = -1;
|
|
||||||
|
|
||||||
LightTexture lightTexture = GAME_RENDERER.lightTexture();
|
|
||||||
if (lightTexture != null)
|
|
||||||
{
|
|
||||||
NativeImage tex = lightTexture.lightPixels;
|
|
||||||
if (tex != null)
|
|
||||||
{
|
|
||||||
width = tex.getWidth();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getLightmapGLFormat() {
|
|
||||||
int glFormat = -1;
|
|
||||||
|
|
||||||
LightTexture lightTexture = GAME_RENDERER.lightTexture();
|
|
||||||
if (lightTexture != null) {
|
|
||||||
NativeImage tex = lightTexture.lightPixels;
|
|
||||||
if (tex != null) {
|
|
||||||
glFormat = tex.format().glFormat();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return glFormat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFogStateSpecial() {
|
public boolean isFogStateSpecial() {
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
Camera camera = GAME_RENDERER.getMainCamera();
|
||||||
|
FluidState fluidState = camera.getFluidInCamera();
|
||||||
|
Entity entity = camera.getEntity();
|
||||||
|
boolean isUnderWater = (entity instanceof LivingEntity) && ((LivingEntity)entity).hasEffect(MobEffects.BLINDNESS);
|
||||||
|
isUnderWater |= fluidState.is(FluidTags.WATER);
|
||||||
|
isUnderWater |= fluidState.is(FluidTags.LAVA);
|
||||||
|
return isUnderWater;
|
||||||
|
#else
|
||||||
Entity entity = GAME_RENDERER.getMainCamera().getEntity();
|
Entity entity = GAME_RENDERER.getMainCamera().getEntity();
|
||||||
boolean isBlind = (entity instanceof LivingEntity) && ((LivingEntity)entity).hasEffect(MobEffects.BLINDNESS);
|
boolean isBlind = (entity instanceof LivingEntity) && ((LivingEntity)entity).hasEffect(MobEffects.BLINDNESS);
|
||||||
return GAME_RENDERER.getMainCamera().getFluidInCamera() != FogType.NONE || isBlind;
|
return GAME_RENDERER.getMainCamera().getFluidInCamera() != FogType.NONE || isBlind;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean tryDisableVanillaFog() {
|
public boolean tryDisableVanillaFog() {
|
||||||
return true; // Handled via MixinFogRenderer in both forge and fabric
|
return true; // Handled via MixinFogRenderer in both forge and fabric
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateLightmap(NativeImage lightPixels) {
|
||||||
|
if (lightmap== null) {
|
||||||
|
lightmap = new LightMapWrapper();
|
||||||
|
}
|
||||||
|
lightmap.uploadLightmap(lightPixels);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.minecraft;
|
package com.seibel.lod.common.wrappers.minecraft;
|
||||||
|
|
||||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
import com.seibel.lod.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||||
|
|||||||
@@ -1,7 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.misc;
|
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.GL;
|
||||||
|
import org.lwjgl.opengl.GL32;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author James Seibel
|
* @author James Seibel
|
||||||
@@ -9,21 +33,39 @@ import com.seibel.lod.core.wrapperInterfaces.misc.ILightMapWrapper;
|
|||||||
*/
|
*/
|
||||||
public class LightMapWrapper implements ILightMapWrapper
|
public class LightMapWrapper implements ILightMapWrapper
|
||||||
{
|
{
|
||||||
static NativeImage lightMap = null;
|
private int textureId = 0;
|
||||||
|
|
||||||
public LightMapWrapper(NativeImage newLightMap)
|
public LightMapWrapper()
|
||||||
{
|
{
|
||||||
lightMap = newLightMap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setLightMap(NativeImage newLightMap)
|
private void createLightmap(NativeImage image)
|
||||||
{
|
{
|
||||||
lightMap = newLightMap;
|
textureId = GL32.glGenTextures();
|
||||||
|
GL32.glBindTexture(GL32.GL_TEXTURE_2D, textureId);
|
||||||
|
GL32.glTexImage2D(GL32.GL_TEXTURE_2D, 0, image.format().glFormat(), image.getWidth(), image.getHeight(),
|
||||||
|
0, image.format().glFormat(), GL32.GL_UNSIGNED_BYTE, (ByteBuffer) null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void uploadLightmap(NativeImage image)
|
||||||
|
{
|
||||||
|
int currentBind = GL32.glGetInteger(GL32.GL_TEXTURE_BINDING_2D);
|
||||||
|
GL32.glBindTexture(GL32.GL_TEXTURE_2D, textureId);
|
||||||
|
if (textureId == 0) {
|
||||||
|
createLightmap(image);
|
||||||
|
}
|
||||||
|
// NativeImage::upload(int levelOfDetail, int xOffset, int yOffset, bool shouldCleanup?)
|
||||||
|
image.upload(0, 0, 0, false);
|
||||||
|
GL32.glBindTexture(GL32.GL_TEXTURE_2D, currentBind);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(int skyLight, int blockLight)
|
public void bind() {
|
||||||
{
|
GL32.glBindTexture(GL32.GL_TEXTURE_2D, textureId);
|
||||||
return lightMap.getPixelRGBA(skyLight, blockLight);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unbind() {
|
||||||
|
GL32.glBindTexture(GL32.GL_TEXTURE_2D, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 James Seibel
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,14 +20,35 @@
|
|||||||
package com.seibel.lod.common.wrappers.world;
|
package com.seibel.lod.common.wrappers.world;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableBiMap;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.seibel.lod.core.util.LodUtil;
|
import com.seibel.lod.core.util.LodUtil;
|
||||||
import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper;
|
import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||||
|
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
|
import net.minecraft.data.BuiltinRegistries;
|
||||||
|
#else
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
|
import com.seibel.lod.core.api.ApiShared;
|
||||||
|
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if POST_MC_1_19
|
||||||
|
import net.minecraft.data.worldgen.biome.EndBiomes;
|
||||||
|
import net.minecraft.data.worldgen.biome.NetherBiomes;
|
||||||
|
#endif
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
|
import net.minecraft.world.level.biome.Biomes;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.material.MaterialColor;
|
import net.minecraft.world.level.material.MaterialColor;
|
||||||
|
|
||||||
@@ -58,13 +79,12 @@ public class BiomeWrapper implements IBiomeWrapper
|
|||||||
return biomeWrapper;
|
return biomeWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Returns a color int for the given biome. */
|
/** Returns a color int for the given biome. */
|
||||||
|
#if PRE_MC_1_19
|
||||||
@Override
|
@Override
|
||||||
public int getColorForBiome(int x, int z)
|
public int getColorForBiome(int x, int z)
|
||||||
{
|
{
|
||||||
int colorInt;
|
int colorInt;
|
||||||
|
|
||||||
switch (biome.biomeCategory)
|
switch (biome.biomeCategory)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -110,16 +130,158 @@ 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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return colorInt;
|
return colorInt;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
|
||||||
|
private static int _colorEnd(Biome b) {
|
||||||
|
return Blocks.END_STONE.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorNether(Biome b) {
|
||||||
|
return Blocks.NETHERRACK.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorSand(Biome b) {
|
||||||
|
return Blocks.SAND.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorStone(Biome b) {
|
||||||
|
return Blocks.STONE.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorGravel(Biome b) {
|
||||||
|
return Blocks.GRAVEL.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorDripStone(Biome b) {
|
||||||
|
return Blocks.DRIPSTONE_BLOCK.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorMoss(Biome b) {
|
||||||
|
return Blocks.MOSS_BLOCK.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorSculk(Biome b) {
|
||||||
|
return Blocks.SCULK.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorMushoom(Biome b) {
|
||||||
|
return Blocks.MYCELIUM.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorBamboo(Biome b) {
|
||||||
|
return Blocks.BAMBOO.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorSnow(Biome b) {
|
||||||
|
return Blocks.SNOW.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorIce(Biome b) {
|
||||||
|
return Blocks.ICE.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorRedSand(Biome b) {
|
||||||
|
return Blocks.RED_SAND.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorSoulSand(Biome b) {
|
||||||
|
return Blocks.SOUL_SAND.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorBasalt(Biome b) {
|
||||||
|
return Blocks.BASALT.defaultMaterialColor().col;
|
||||||
|
}
|
||||||
|
private static int _colorWater(Biome b) {
|
||||||
|
return b.getWaterColor();
|
||||||
|
}
|
||||||
|
private static int _colorFoliage(Biome b) {
|
||||||
|
return b.getFoliageColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Biome _get(ResourceKey<Biome> r) {
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
|
return BuiltinRegistries.BIOME.getOrThrow(r);
|
||||||
|
#else
|
||||||
|
// The fix below is a hacky and convoluted way of doing the thing above so...
|
||||||
|
// TODO[1.19.3]: Find a less convoluted method to get the Minecraft's registryAccess
|
||||||
|
return (((ServerLevel) ((WorldWrapper) LodUtil.getServerWorldFromDimension(ApiShared.lodWorld.getLodDimension(SingletonHandler.get(IMinecraftClientWrapper.class).getCurrentDimension()).dimension)).getWorld()).getServer().registryAccess()) // This entire mess is just to get Minecraft's registryAccess (FIND A BETTER WAY LATER)
|
||||||
|
.registryOrThrow(Registries.BIOME).getOrThrow(r); // Once youve gotten the registryAccess, the rest is easy
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//FIXME: THIS IS HELL!
|
||||||
|
private static final ImmutableBiMap<Biome, Function<Biome, Integer>> BIOME_COLOR_MAP =
|
||||||
|
ImmutableBiMap.<Biome, Function<Biome, Integer>>builder()
|
||||||
|
.put(_get(Biomes.SNOWY_PLAINS), BiomeWrapper::_colorSnow)
|
||||||
|
.put(_get(Biomes.ICE_SPIKES), BiomeWrapper::_colorIce)
|
||||||
|
.put(_get(Biomes.DESERT), BiomeWrapper::_colorSand)
|
||||||
|
.put(_get(Biomes.SWAMP), BiomeWrapper::_colorWater)
|
||||||
|
.put(_get(Biomes.MANGROVE_SWAMP), BiomeWrapper::_colorWater)
|
||||||
|
.put(_get(Biomes.FOREST), BiomeWrapper::_colorFoliage)
|
||||||
|
.put(_get(Biomes.FLOWER_FOREST), BiomeWrapper::_colorFoliage)
|
||||||
|
.put(_get(Biomes.BIRCH_FOREST), BiomeWrapper::_colorFoliage)
|
||||||
|
.put(_get(Biomes.DARK_FOREST), BiomeWrapper::_colorFoliage)
|
||||||
|
.put(_get(Biomes.OLD_GROWTH_BIRCH_FOREST), BiomeWrapper::_colorFoliage)
|
||||||
|
.put(_get(Biomes.OLD_GROWTH_PINE_TAIGA), BiomeWrapper::_colorFoliage)
|
||||||
|
.put(_get(Biomes.OLD_GROWTH_SPRUCE_TAIGA), BiomeWrapper::_colorFoliage)
|
||||||
|
.put(_get(Biomes.TAIGA), BiomeWrapper::_colorFoliage)
|
||||||
|
.put(_get(Biomes.SNOWY_TAIGA), BiomeWrapper::_colorSnow)
|
||||||
|
.put(_get(Biomes.WINDSWEPT_GRAVELLY_HILLS), BiomeWrapper::_colorGravel)
|
||||||
|
.put(_get(Biomes.WINDSWEPT_FOREST), BiomeWrapper::_colorFoliage)
|
||||||
|
.put(_get(Biomes.JUNGLE), BiomeWrapper::_colorFoliage)
|
||||||
|
.put(_get(Biomes.BAMBOO_JUNGLE), BiomeWrapper::_colorBamboo)
|
||||||
|
.put(_get(Biomes.BADLANDS), BiomeWrapper::_colorRedSand)
|
||||||
|
.put(_get(Biomes.ERODED_BADLANDS), BiomeWrapper::_colorRedSand)
|
||||||
|
.put(_get(Biomes.WOODED_BADLANDS), BiomeWrapper::_colorStone)
|
||||||
|
.put(_get(Biomes.GROVE), BiomeWrapper::_colorSnow)
|
||||||
|
.put(_get(Biomes.SNOWY_SLOPES), BiomeWrapper::_colorSnow)
|
||||||
|
.put(_get(Biomes.FROZEN_PEAKS), BiomeWrapper::_colorIce)
|
||||||
|
.put(_get(Biomes.JAGGED_PEAKS), BiomeWrapper::_colorSnow)
|
||||||
|
.put(_get(Biomes.STONY_PEAKS), BiomeWrapper::_colorStone)
|
||||||
|
.put(_get(Biomes.RIVER), BiomeWrapper::_colorWater)
|
||||||
|
.put(_get(Biomes.FROZEN_RIVER), BiomeWrapper::_colorIce)
|
||||||
|
.put(_get(Biomes.BEACH), BiomeWrapper::_colorSand)
|
||||||
|
.put(_get(Biomes.SNOWY_BEACH), BiomeWrapper::_colorSnow)
|
||||||
|
.put(_get(Biomes.STONY_SHORE), BiomeWrapper::_colorStone)
|
||||||
|
.put(_get(Biomes.WARM_OCEAN), BiomeWrapper::_colorWater)
|
||||||
|
.put(_get(Biomes.LUKEWARM_OCEAN), BiomeWrapper::_colorWater)
|
||||||
|
.put(_get(Biomes.DEEP_LUKEWARM_OCEAN), BiomeWrapper::_colorWater)
|
||||||
|
.put(_get(Biomes.OCEAN), BiomeWrapper::_colorWater)
|
||||||
|
.put(_get(Biomes.DEEP_OCEAN), BiomeWrapper::_colorWater)
|
||||||
|
.put(_get(Biomes.COLD_OCEAN), BiomeWrapper::_colorWater)
|
||||||
|
.put(_get(Biomes.DEEP_COLD_OCEAN), BiomeWrapper::_colorWater)
|
||||||
|
.put(_get(Biomes.FROZEN_OCEAN), BiomeWrapper::_colorIce)
|
||||||
|
.put(_get(Biomes.DEEP_FROZEN_OCEAN), BiomeWrapper::_colorIce)
|
||||||
|
.put(_get(Biomes.MUSHROOM_FIELDS), BiomeWrapper::_colorMushoom)
|
||||||
|
.put(_get(Biomes.DRIPSTONE_CAVES), BiomeWrapper::_colorDripStone)
|
||||||
|
.put(_get(Biomes.LUSH_CAVES), BiomeWrapper::_colorMoss)
|
||||||
|
.put(_get(Biomes.DEEP_DARK), BiomeWrapper::_colorSculk)
|
||||||
|
.put(_get(Biomes.NETHER_WASTES), BiomeWrapper::_colorNether)
|
||||||
|
.put(_get(Biomes.WARPED_FOREST), BiomeWrapper::_colorNether)
|
||||||
|
.put(_get(Biomes.CRIMSON_FOREST), BiomeWrapper::_colorNether)
|
||||||
|
.put(_get(Biomes.SOUL_SAND_VALLEY), BiomeWrapper::_colorSoulSand)
|
||||||
|
.put(_get(Biomes.BASALT_DELTAS), BiomeWrapper::_colorBasalt)
|
||||||
|
.put(_get(Biomes.THE_END), BiomeWrapper::_colorEnd)
|
||||||
|
.put(_get(Biomes.END_HIGHLANDS), BiomeWrapper::_colorEnd)
|
||||||
|
.put(_get(Biomes.END_MIDLANDS), BiomeWrapper::_colorEnd)
|
||||||
|
.put(_get(Biomes.SMALL_END_ISLANDS), BiomeWrapper::_colorEnd)
|
||||||
|
.put(_get(Biomes.END_BARRENS), BiomeWrapper::_colorEnd)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getColorForBiome(int x, int z)
|
||||||
|
{
|
||||||
|
int colorInt;
|
||||||
|
Function<Biome, Integer> colorFunction = BIOME_COLOR_MAP.get(biome);
|
||||||
|
if (colorFunction != null)
|
||||||
|
{
|
||||||
|
colorInt = colorFunction.apply(biome);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
colorInt = biome.getGrassColor(x, z);
|
||||||
|
}
|
||||||
|
return colorInt;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@Override public String getName()
|
@Override public String getName()
|
||||||
{
|
{
|
||||||
return biome.toString();
|
return biome.toString();
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 James Seibel
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 James Seibel
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -138,7 +138,11 @@ public class WorldWrapper implements IWorldWrapper
|
|||||||
@Override
|
@Override
|
||||||
public short getMinHeight()
|
public short getMinHeight()
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
return (short) 0;
|
||||||
|
#else
|
||||||
return (short) world.getMinBuildHeight();
|
return (short) world.getMinBuildHeight();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @throws UnsupportedOperationException if the WorldWrapper isn't for a ServerWorld */
|
/** @throws UnsupportedOperationException if the WorldWrapper isn't for a ServerWorld */
|
||||||
@@ -182,6 +186,4 @@ public class WorldWrapper implements IWorldWrapper
|
|||||||
ChunkSource source = world.getChunkSource();
|
ChunkSource source = world.getChunkSource();
|
||||||
return source.hasChunk(chunkX, chunkZ);
|
return source.hasChunk(chunkX, chunkZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+84
-43
@@ -1,8 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2021 Tom Lee (TomTheFurry)
|
* Copyright (C) 2021 Tom Lee (TomTheFurry)
|
||||||
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,9 +18,11 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
@@ -56,6 +59,9 @@ import com.seibel.lod.common.wrappers.worldGeneration.step.StepStructureReferenc
|
|||||||
import com.seibel.lod.common.wrappers.worldGeneration.step.StepStructureStart;
|
import com.seibel.lod.common.wrappers.worldGeneration.step.StepStructureStart;
|
||||||
import com.seibel.lod.common.wrappers.worldGeneration.step.StepSurface;
|
import com.seibel.lod.common.wrappers.worldGeneration.step.StepSurface;
|
||||||
|
|
||||||
|
#if POST_MC_1_19_3
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
#endif
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
@@ -70,6 +76,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 +94,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 +239,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;
|
||||||
@@ -245,13 +259,12 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ExecutorService executors = Executors.newFixedThreadPool(
|
public ExecutorService executors = Executors.newFixedThreadPool(
|
||||||
CONFIG.client().advanced().threading().getNumberOfWorldGenerationThreads(), threadFactory);
|
CONFIG.client().advanced().threading()._getWorldGenerationThreadPoolSize(), threadFactory);
|
||||||
|
|
||||||
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();
|
||||||
@@ -263,7 +276,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
|||||||
new LodThreadFactory("Gen-Worker-Thread", Thread.MIN_PRIORITY));
|
new LodThreadFactory("Gen-Worker-Thread", Thread.MIN_PRIORITY));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tryAddPoint(int px, int pz, int range, Steps target, boolean genAllDetails)
|
public boolean tryAddPoint(int px, int pz, int range, Steps target, boolean genAllDetails, double runTimeRatio)
|
||||||
{
|
{
|
||||||
int boxSize = range * 2 + 1;
|
int boxSize = range * 2 + 1;
|
||||||
int x = Math.floorDiv(px, boxSize) * boxSize + range;
|
int x = Math.floorDiv(px, boxSize) * boxSize + range;
|
||||||
@@ -275,7 +288,7 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// System.out.println(x + ", "+z);
|
// System.out.println(x + ", "+z);
|
||||||
events.add(new GenerationEvent(new ChunkPos(x, z), range, this, target, genAllDetails));
|
events.add(new GenerationEvent(new ChunkPos(x, z), range, this, target, genAllDetails, runTimeRatio));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,8 +313,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 +325,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 +339,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 +348,18 @@ 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!");
|
if (generator.getClass().toString().equals("class com.terraforged.mod.chunk.TFChunkGenerator")) {
|
||||||
MC.sendChatMessage("\u00A7eIf it does crash, set Distant Generation to OFF or Generation Mode to None.");
|
EVENT_LOGGER.info("TerraForge Chunk Generator detected: [{}], Distant Generation will try its best to support it.", generator.getClass());
|
||||||
ApiShared.LOGGER.warn("Unknown Chunk Generator detected: {}", generator.getClass());
|
EVENT_LOGGER.info("If it does crash, set Distant Generation to OFF or Generation Mode to None.");
|
||||||
|
} else {
|
||||||
|
EVENT_LOGGER.warn("Unknown Chunk Generator detected: [{}], Distant Generation May Fail!", generator.getClass());
|
||||||
|
EVENT_LOGGER.warn("If it does crash, set Distant Generation to OFF or Generation Mode to None.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
params = new GlobalParameters((ServerLevel) ((WorldWrapper) serverlevel).getWorld(), lodBuilder, lodDim);
|
params = new GlobalParameters((ServerLevel) ((WorldWrapper) serverlevel).getWorld(), lodBuilder, lodDim);
|
||||||
}
|
}
|
||||||
@@ -356,23 +370,45 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
|||||||
CompoundTag chunkData = null;
|
CompoundTag chunkData = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#if POST_MC_1_19
|
||||||
|
chunkData = level.getChunkSource().chunkMap.readChunk(chunkPos).get().orElse(null);
|
||||||
|
#else
|
||||||
chunkData = level.getChunkSource().chunkMap.readChunk(chunkPos);
|
chunkData = level.getChunkSource().chunkMap.readChunk(chunkPos);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
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)
|
||||||
{
|
{
|
||||||
return new ProtoChunk(chunkPos, UpgradeData.EMPTY, level, level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), null);
|
return new ProtoChunk(chunkPos, UpgradeData.EMPTY
|
||||||
|
#if POST_MC_1_17_1, level #endif
|
||||||
|
#if POST_MC_1_18_1, level.registryAccess().registryOrThrow(
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
|
Registry.BIOME_REGISTRY
|
||||||
|
#else
|
||||||
|
Registries.BIOME
|
||||||
|
#endif
|
||||||
|
), null #endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
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
|
||||||
|
#if POST_MC_1_17_1, level #endif
|
||||||
|
#if POST_MC_1_18_1, level.registryAccess().registryOrThrow(
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
|
Registry.BIOME_REGISTRY
|
||||||
|
#else
|
||||||
|
Registries.BIOME
|
||||||
|
#endif
|
||||||
|
), null #endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,8 +416,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;
|
||||||
@@ -411,8 +446,10 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
|||||||
// Continue...
|
// Continue...
|
||||||
}
|
}
|
||||||
if (target == null)
|
if (target == null)
|
||||||
target = new ProtoChunk(chunkPos, UpgradeData.EMPTY, params.level,
|
target = new ProtoChunk(chunkPos, UpgradeData.EMPTY
|
||||||
params.biomes, null);
|
#if POST_MC_1_17_1, params.level #endif
|
||||||
|
#if POST_MC_1_18_1, params.biomes, null #endif
|
||||||
|
);
|
||||||
return target;
|
return target;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -424,7 +461,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);
|
||||||
@@ -471,21 +508,23 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean isFull = target.getStatus() == ChunkStatus.FULL || target instanceof LevelChunk;
|
boolean isFull = target.getStatus() == ChunkStatus.FULL || target instanceof LevelChunk;
|
||||||
|
#if POST_MC_1_18_1
|
||||||
boolean isPartial = target.isOldNoiseGeneration();
|
boolean isPartial = target.isOldNoiseGeneration();
|
||||||
|
#endif
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
#if POST_MC_1_18_1
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else if (target.getStatus() == ChunkStatus.EMPTY && generationMode == DistanceGenerationMode.NONE)
|
else if (target.getStatus() == ChunkStatus.EMPTY && generationMode == DistanceGenerationMode.NONE)
|
||||||
{
|
{
|
||||||
params.lodBuilder.generateLodNodeFromChunk(params.lodDim,wrappedChunk,
|
params.lodBuilder.generateLodNodeFromChunk(params.lodDim,wrappedChunk,
|
||||||
@@ -505,10 +544,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -570,10 +609,12 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
|||||||
{
|
{
|
||||||
if (p instanceof ProtoChunk)
|
if (p instanceof ProtoChunk)
|
||||||
((ProtoChunk) p).setLightCorrect(true);
|
((ProtoChunk) p).setLightCorrect(true);
|
||||||
|
#if POST_MC_1_18_1
|
||||||
if (p instanceof LevelChunk) {
|
if (p instanceof LevelChunk) {
|
||||||
((LevelChunk) p).setLightCorrect(true);
|
((LevelChunk) p).setLightCorrect(true);
|
||||||
((LevelChunk) p).setClientLightReady(true);
|
((LevelChunk) p).setClientLightReady(true);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -594,14 +635,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+36
-5
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration;
|
package com.seibel.lod.common.wrappers.worldGeneration;
|
||||||
|
|
||||||
@@ -25,16 +43,19 @@ public final class GenerationEvent
|
|||||||
final ChunkPos pos;
|
final ChunkPos pos;
|
||||||
final int range;
|
final int range;
|
||||||
final Future<?> future;
|
final Future<?> future;
|
||||||
long nanotime;
|
long creationNanotime;
|
||||||
final int id;
|
final int id;
|
||||||
final Steps target;
|
final Steps target;
|
||||||
final LightGenerationMode lightMode;
|
final LightGenerationMode lightMode;
|
||||||
final PrefEvent pEvent = new PrefEvent();
|
final PrefEvent pEvent = new PrefEvent();
|
||||||
final boolean genAllDetails;
|
final boolean genAllDetails;
|
||||||
|
|
||||||
public GenerationEvent(ChunkPos pos, int range, BatchGenerationEnvironment generationGroup, Steps target, boolean genAllDetails)
|
final double runTimeRatio;
|
||||||
|
|
||||||
|
public GenerationEvent(ChunkPos pos, int range, BatchGenerationEnvironment generationGroup,
|
||||||
|
Steps target, boolean genAllDetails, double runTimeRatio)
|
||||||
{
|
{
|
||||||
nanotime = System.nanoTime();
|
creationNanotime = System.nanoTime();
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
this.range = range;
|
this.range = range;
|
||||||
id = generationFutureDebugIDs++;
|
id = generationFutureDebugIDs++;
|
||||||
@@ -44,14 +65,24 @@ public final class GenerationEvent
|
|||||||
|
|
||||||
this.lightMode = mode;
|
this.lightMode = mode;
|
||||||
this.genAllDetails = genAllDetails;
|
this.genAllDetails = genAllDetails;
|
||||||
|
this.runTimeRatio = runTimeRatio;
|
||||||
|
|
||||||
future = generationGroup.executors.submit(() ->
|
future = generationGroup.executors.submit(() ->
|
||||||
{
|
{
|
||||||
|
long startTime = System.nanoTime();
|
||||||
BatchGenerationEnvironment.isDistantGeneratorThread.set(true);
|
BatchGenerationEnvironment.isDistantGeneratorThread.set(true);
|
||||||
try {
|
try {
|
||||||
generationGroup.generateLodFromList(this);
|
generationGroup.generateLodFromList(this);
|
||||||
} finally {
|
} finally {
|
||||||
BatchGenerationEnvironment.isDistantGeneratorThread.remove();
|
BatchGenerationEnvironment.isDistantGeneratorThread.remove();
|
||||||
|
if (!Thread.interrupted() && runTimeRatio < 1.0) {
|
||||||
|
long endTime = System.nanoTime();
|
||||||
|
try {
|
||||||
|
long deltaMs = TimeUnit.NANOSECONDS.toMillis(endTime - startTime);
|
||||||
|
Thread.sleep((long) (deltaMs/runTimeRatio - deltaMs));
|
||||||
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -64,7 +95,7 @@ public final class GenerationEvent
|
|||||||
public boolean hasTimeout(int duration, TimeUnit unit)
|
public boolean hasTimeout(int duration, TimeUnit unit)
|
||||||
{
|
{
|
||||||
long currentTime = System.nanoTime();
|
long currentTime = System.nanoTime();
|
||||||
long delta = currentTime - nanotime;
|
long delta = currentTime - creationNanotime;
|
||||||
return (delta > TimeUnit.NANOSECONDS.convert(duration, unit));
|
return (delta > TimeUnit.NANOSECONDS.convert(duration, unit));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +130,7 @@ public final class GenerationEvent
|
|||||||
|
|
||||||
public void refreshTimeout()
|
public void refreshTimeout()
|
||||||
{
|
{
|
||||||
nanotime = System.nanoTime();
|
creationNanotime = System.nanoTime();
|
||||||
LodUtil.checkInterruptsUnchecked();
|
LodUtil.checkInterruptsUnchecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+55
-8
@@ -1,9 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration;
|
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;
|
||||||
@@ -14,29 +31,48 @@ import net.minecraft.server.level.ThreadedLevelLightEngine;
|
|||||||
import net.minecraft.world.level.biome.Biome;
|
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;
|
||||||
|
#if POST_MC_1_18_1
|
||||||
import net.minecraft.world.level.chunk.storage.ChunkScanAccess;
|
import net.minecraft.world.level.chunk.storage.ChunkScanAccess;
|
||||||
import net.minecraft.world.level.levelgen.DebugLevelSource;
|
#endif
|
||||||
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;
|
||||||
|
#if PRE_MC_1_19
|
||||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
|
||||||
|
import net.minecraft.world.level.levelgen.RandomState;
|
||||||
|
#if POST_MC_1_19_3
|
||||||
|
import net.minecraft.world.level.levelgen.WorldOptions;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
import net.minecraft.world.level.storage.WorldData;
|
import net.minecraft.world.level.storage.WorldData;
|
||||||
|
|
||||||
public final class GlobalParameters
|
public final class GlobalParameters
|
||||||
{
|
{
|
||||||
public final ChunkGenerator generator;
|
public final ChunkGenerator generator;
|
||||||
|
#if PRE_MC_1_19
|
||||||
public final StructureManager structures;
|
public final StructureManager structures;
|
||||||
public final BiomeManager biomeManager;
|
#else
|
||||||
|
public final StructureTemplateManager structures;
|
||||||
|
public final RandomState randomState;
|
||||||
|
#endif
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
public final WorldGenSettings worldGenSettings;
|
public final WorldGenSettings worldGenSettings;
|
||||||
|
#else
|
||||||
|
public final WorldOptions worldOptions;
|
||||||
|
#endif
|
||||||
public final ThreadedLevelLightEngine lightEngine;
|
public final ThreadedLevelLightEngine lightEngine;
|
||||||
public final LodBuilder lodBuilder;
|
public final LodBuilder lodBuilder;
|
||||||
public final LodDimension lodDim;
|
public final LodDimension lodDim;
|
||||||
public final Registry<Biome> biomes;
|
public final Registry<Biome> biomes;
|
||||||
public final RegistryAccess registry;
|
public final RegistryAccess registry;
|
||||||
public final long worldSeed;
|
public final long worldSeed;
|
||||||
public final ChunkScanAccess chunkScanner;
|
|
||||||
public final ServerLevel level; // TODO: Figure out a way to remove this. Maybe ClientLevel also works?
|
public final ServerLevel level; // TODO: Figure out a way to remove this. Maybe ClientLevel also works?
|
||||||
public final DataFixer fixerUpper;
|
public final DataFixer fixerUpper;
|
||||||
|
#if POST_MC_1_18_1
|
||||||
|
public final BiomeManager biomeManager;
|
||||||
|
public final ChunkScanAccess chunkScanner; // FIXME: Figure out if this is actually needed
|
||||||
|
#endif
|
||||||
|
|
||||||
public GlobalParameters(ServerLevel level, LodBuilder lodBuilder, LodDimension lodDim)
|
public GlobalParameters(ServerLevel level, LodBuilder lodBuilder, LodDimension lodDim)
|
||||||
{
|
{
|
||||||
@@ -46,14 +82,25 @@ public final class GlobalParameters
|
|||||||
lightEngine = (ThreadedLevelLightEngine) level.getLightEngine();
|
lightEngine = (ThreadedLevelLightEngine) level.getLightEngine();
|
||||||
MinecraftServer server = level.getServer();
|
MinecraftServer server = level.getServer();
|
||||||
WorldData worldData = server.getWorldData();
|
WorldData worldData = server.getWorldData();
|
||||||
worldGenSettings = worldData.worldGenSettings();
|
|
||||||
registry = server.registryAccess();
|
registry = server.registryAccess();
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
|
worldGenSettings = worldData.worldGenSettings();
|
||||||
biomes = registry.registryOrThrow(Registry.BIOME_REGISTRY);
|
biomes = registry.registryOrThrow(Registry.BIOME_REGISTRY);
|
||||||
worldSeed = worldGenSettings.seed();
|
worldSeed = worldGenSettings.seed();
|
||||||
|
#else
|
||||||
|
worldOptions = worldData.worldGenOptions();
|
||||||
|
biomes = registry.registryOrThrow(Registries.BIOME);
|
||||||
|
worldSeed = worldOptions.seed();
|
||||||
|
#endif
|
||||||
|
#if POST_MC_1_18_1
|
||||||
biomeManager = new BiomeManager(level, BiomeManager.obfuscateSeed(worldSeed));
|
biomeManager = new BiomeManager(level, BiomeManager.obfuscateSeed(worldSeed));
|
||||||
|
chunkScanner = level.getChunkSource().chunkScanner();
|
||||||
|
#endif
|
||||||
structures = server.getStructureManager();
|
structures = server.getStructureManager();
|
||||||
generator = level.getChunkSource().getGenerator();
|
generator = level.getChunkSource().getGenerator();
|
||||||
chunkScanner = level.getChunkSource().chunkScanner();
|
|
||||||
fixerUpper = server.getFixerUpper();
|
fixerUpper = server.getFixerUpper();
|
||||||
|
#if POST_MC_1_19
|
||||||
|
randomState = level.getChunkSource().randomState();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration;
|
package com.seibel.lod.common.wrappers.worldGeneration;
|
||||||
|
|
||||||
|
|||||||
+38
-5
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration;
|
package com.seibel.lod.common.wrappers.worldGeneration;
|
||||||
|
|
||||||
@@ -6,14 +25,18 @@ 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;
|
||||||
|
#if POST_MC_1_18_1
|
||||||
import net.minecraft.world.level.levelgen.structure.StructureCheck;
|
import net.minecraft.world.level.levelgen.structure.StructureCheck;
|
||||||
|
#endif
|
||||||
|
|
||||||
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;
|
||||||
|
#if POST_MC_1_18_1
|
||||||
public final StructureCheck structCheck;
|
public final StructureCheck structCheck;
|
||||||
|
#endif
|
||||||
boolean isValid = true;
|
boolean isValid = true;
|
||||||
public final PerfCalculator perf = new PerfCalculator();
|
public final PerfCalculator perf = new PerfCalculator();
|
||||||
|
|
||||||
@@ -35,14 +58,24 @@ public final class ThreadedParameters
|
|||||||
private ThreadedParameters(GlobalParameters param)
|
private ThreadedParameters(GlobalParameters param)
|
||||||
{
|
{
|
||||||
level = param.level;
|
level = param.level;
|
||||||
|
#if PRE_MC_1_18_1
|
||||||
|
structFeat = new WorldGenStructFeatManager(param.worldGenSettings, level);
|
||||||
|
#elif PRE_MC_1_19
|
||||||
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);
|
#else
|
||||||
|
structCheck = new StructureCheck(param.chunkScanner, param.registry, param.structures,
|
||||||
|
param.level.dimension(), param.generator, param.randomState, level, param.generator.getBiomeSource(), param.worldSeed,
|
||||||
|
param.fixerUpper);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void makeStructFeat(WorldGenLevel genLevel)
|
public void makeStructFeat(WorldGenLevel genLevel, GlobalParameters param) {
|
||||||
{
|
#if PRE_MC_1_19_3
|
||||||
structFeat.setGenLevel(genLevel);
|
structFeat = new WorldGenStructFeatManager(param.worldGenSettings, genLevel #if POST_MC_1_18_1, structCheck #endif);
|
||||||
|
#else
|
||||||
|
structFeat = new WorldGenStructFeatManager(param.worldOptions, genLevel #if POST_MC_1_18_1, structCheck #endif);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+159
-169
@@ -1,12 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration.mimicObject;
|
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;
|
||||||
@@ -15,52 +34,64 @@ import java.util.Locale;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
#if MC_VERSION_1_18_2
|
|
||||||
import net.minecraft.core.Holder;
|
|
||||||
import net.minecraft.core.RegistryAccess;
|
|
||||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.core.SectionPos;
|
import net.minecraft.core.SectionPos;
|
||||||
|
#if POST_MC_1_19_3
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
#endif
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.NbtOps;
|
import net.minecraft.nbt.NbtOps;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.*;
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
|
||||||
import net.minecraft.world.level.LightLayer;
|
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.biome.Biomes;
|
import net.minecraft.world.level.biome.Biomes;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
import net.minecraft.world.level.chunk.*;
|
||||||
import net.minecraft.world.level.chunk.DataLayer;
|
import net.minecraft.world.level.chunk.storage.ChunkSerializer;
|
||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
|
||||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
|
||||||
import net.minecraft.world.level.chunk.PalettedContainer;
|
|
||||||
import net.minecraft.world.level.chunk.UpgradeData;
|
|
||||||
import net.minecraft.world.level.levelgen.Heightmap;
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
|
#if POST_MC_1_18_1
|
||||||
import net.minecraft.world.level.levelgen.blending.BlendingData;
|
import net.minecraft.world.level.levelgen.blending.BlendingData;
|
||||||
|
#if PRE_MC_1_19
|
||||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||||
|
#endif
|
||||||
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
||||||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||||
|
import net.minecraft.world.ticks.LevelChunkTicks;
|
||||||
|
#endif
|
||||||
|
#if POST_MC_1_18_2
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
|
import net.minecraft.core.RegistryAccess;
|
||||||
|
#if PRE_MC_1_19
|
||||||
|
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||||
import net.minecraft.world.level.material.Fluid;
|
import net.minecraft.world.level.material.Fluid;
|
||||||
import net.minecraft.world.ticks.LevelChunkTicks;
|
import net.minecraft.world.level.material.Fluids;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
public class ChunkLoader
|
public class ChunkLoader
|
||||||
{
|
{
|
||||||
|
#if POST_MC_1_19
|
||||||
|
private static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState());
|
||||||
|
#elif POST_MC_1_18_1
|
||||||
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;
|
#endif
|
||||||
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_18 = "block_ticks";
|
||||||
private static final String FLUID_TICKS_TAG = "fluid_ticks";
|
private static final String FLUID_TICKS_TAG_18 = "fluid_ticks";
|
||||||
|
private static final String BLOCK_TICKS_TAG_PRE18 = "TileTicks";
|
||||||
|
private static final String FLUID_TICKS_TAG_PRE18 = "LiquidTicks";
|
||||||
|
private static final ConfigBasedLogger LOGGER = BatchGenerationEnvironment.LOAD_LOGGER;
|
||||||
|
|
||||||
|
#if POST_MC_1_18_1
|
||||||
private static BlendingData readBlendingData(CompoundTag chunkData)
|
private static BlendingData readBlendingData(CompoundTag chunkData)
|
||||||
{
|
{
|
||||||
BlendingData blendingData = null;
|
BlendingData blendingData = null;
|
||||||
@@ -72,36 +103,58 @@ public class ChunkLoader
|
|||||||
}
|
}
|
||||||
return blendingData;
|
return blendingData;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private static LevelChunkSection[] readSections(LevelAccessor level, LevelLightEngine lightEngine, ChunkPos chunkPos, CompoundTag chunkData)
|
private static LevelChunkSection[] readSections(LevelAccessor level, LevelLightEngine lightEngine, ChunkPos chunkPos, CompoundTag chunkData)
|
||||||
{
|
{
|
||||||
|
#if POST_MC_1_18_1
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
Registry<Biome> biomes = level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY);
|
Registry<Biome> biomes = level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY);
|
||||||
#if MC_VERSION_1_18_1
|
#else
|
||||||
|
Registry<Biome> biomes = level.registryAccess().registryOrThrow(Registries.BIOME);
|
||||||
|
#endif
|
||||||
|
#if PRE_MC_1_18_2
|
||||||
Codec<PalettedContainer<Biome>> biomeCodec = PalettedContainer.codec(
|
Codec<PalettedContainer<Biome>> biomeCodec = PalettedContainer.codec(
|
||||||
biomes, biomes.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getOrThrow(Biomes.PLAINS));
|
biomes, biomes.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getOrThrow(Biomes.PLAINS));
|
||||||
#elif MC_VERSION_1_18_2
|
#elif PRE_MC_1_19
|
||||||
Codec<PalettedContainer<Holder<Biome>>> biomeCodec = PalettedContainer.codec(
|
Codec<PalettedContainer<Holder<Biome>>> biomeCodec = PalettedContainer.codec(
|
||||||
biomes.asHolderIdMap(), biomes.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getHolderOrThrow(Biomes.PLAINS));
|
biomes.asHolderIdMap(), biomes.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getHolderOrThrow(Biomes.PLAINS));
|
||||||
|
#else
|
||||||
|
Codec<PalettedContainer<Holder<Biome>>> biomeCodec = PalettedContainer.codecRW(
|
||||||
|
biomes.asHolderIdMap(), biomes.holderByNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getHolderOrThrow(Biomes.PLAINS));
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
int i = level.getSectionsCount();
|
int i = #if PRE_MC_1_17_1 16; #else level.getSectionsCount(); #endif
|
||||||
LevelChunkSection[] chunkSections = new LevelChunkSection[i];
|
LevelChunkSection[] chunkSections = new LevelChunkSection[i];
|
||||||
|
|
||||||
boolean isLightOn = chunkData.getBoolean("isLightOn");
|
boolean isLightOn = chunkData.getBoolean("isLightOn");
|
||||||
boolean hasSkyLight = level.dimensionType().hasSkyLight();
|
boolean hasSkyLight = level.dimensionType().hasSkyLight();
|
||||||
ListTag tagSections = chunkData.getList("sections", 10);
|
ListTag tagSections = chunkData.getList("Sections", 10);
|
||||||
|
if (tagSections.isEmpty()) tagSections = chunkData.getList("sections", 10);
|
||||||
|
|
||||||
for (int j = 0; j < tagSections.size(); ++j)
|
for (int j = 0; j < tagSections.size(); ++j)
|
||||||
{
|
{
|
||||||
CompoundTag tagSection = tagSections.getCompound(j);
|
CompoundTag tagSection = tagSections.getCompound(j);
|
||||||
byte sectionYPos = tagSection.getByte("Y");
|
int sectionYPos = tagSection.getByte("Y");
|
||||||
|
|
||||||
|
#if PRE_MC_1_18_1
|
||||||
|
if (tagSection.contains("Palette", 9) && tagSection.contains("BlockStates", 12)) {
|
||||||
|
LevelChunkSection levelChunkSection = new LevelChunkSection(sectionYPos << 4);
|
||||||
|
levelChunkSection.getStates().read(tagSection.getList("Palette", 10),
|
||||||
|
tagSection.getLongArray("BlockStates"));
|
||||||
|
levelChunkSection.recalcBlockCounts();
|
||||||
|
if (!levelChunkSection.isEmpty())
|
||||||
|
chunkSections[#if PRE_MC_1_17_1 sectionYPos #else level.getSectionIndexFromSectionY(sectionYPos) #endif]
|
||||||
|
= levelChunkSection;
|
||||||
|
}
|
||||||
|
#else
|
||||||
int sectionId = level.getSectionIndexFromSectionY(sectionYPos);
|
int sectionId = level.getSectionIndexFromSectionY(sectionYPos);
|
||||||
if (sectionId >= 0 && sectionId < chunkSections.length)
|
if (sectionId >= 0 && sectionId < chunkSections.length)
|
||||||
{
|
{
|
||||||
PalettedContainer<BlockState> blockStateContainer;
|
PalettedContainer<BlockState> blockStateContainer;
|
||||||
#if MC_VERSION_1_18_1
|
#if PRE_MC_1_18_2
|
||||||
PalettedContainer<Biome> biomeContainer;
|
PalettedContainer<Biome> biomeContainer;
|
||||||
#elif MC_VERSION_1_18_2
|
#else
|
||||||
PalettedContainer<Holder<Biome>> biomeContainer;
|
PalettedContainer<Holder<Biome>> biomeContainer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -109,27 +162,26 @@ public class ChunkLoader
|
|||||||
? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error)
|
? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error)
|
||||||
: new PalettedContainer<BlockState>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES);
|
: new PalettedContainer<BlockState>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES);
|
||||||
|
|
||||||
#if MC_VERSION_1_18_1
|
#if PRE_MC_1_18_2
|
||||||
biomeContainer = tagSection.contains("biomes", 10)
|
biomeContainer = tagSection.contains("biomes", 10)
|
||||||
? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error)
|
? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error)
|
||||||
: new PalettedContainer<Biome>(biomes, biomes.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
|
: new PalettedContainer<Biome>(biomes, biomes.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
|
||||||
#elif MC_VERSION_1_18_2
|
#else
|
||||||
biomeContainer = tagSection.contains("biomes", 10)
|
biomeContainer = tagSection.contains("biomes", 10)
|
||||||
? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, i, (String) string)).getOrThrow(false, LOGGER::error)
|
? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, i, (String) string)).getOrThrow(false, LOGGER::error)
|
||||||
: new PalettedContainer<Holder<Biome>>(biomes.asHolderIdMap(), biomes.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
|
: new PalettedContainer<Holder<Biome>>(biomes.asHolderIdMap(), biomes.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
chunkSections[sectionId] = new LevelChunkSection(sectionYPos, blockStateContainer, biomeContainer);
|
chunkSections[sectionId] = new LevelChunkSection(sectionYPos, blockStateContainer, biomeContainer);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!isLightOn)
|
if (!isLightOn) continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
if (tagSection.contains("BlockLight", 7))
|
if (tagSection.contains("BlockLight", 7))
|
||||||
lightEngine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkPos, sectionYPos), new DataLayer(tagSection.getByteArray("BlockLight")), true);
|
lightEngine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkPos, sectionYPos),
|
||||||
|
new DataLayer(tagSection.getByteArray("BlockLight")), true);
|
||||||
if (hasSkyLight && tagSection.contains("SkyLight", 7))
|
if (hasSkyLight && tagSection.contains("SkyLight", 7))
|
||||||
lightEngine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkPos, sectionYPos), new DataLayer(tagSection.getByteArray("SkyLight")), true);
|
lightEngine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkPos, sectionYPos),
|
||||||
|
new DataLayer(tagSection.getByteArray("SkyLight")), true);
|
||||||
}
|
}
|
||||||
return chunkSections;
|
return chunkSections;
|
||||||
}
|
}
|
||||||
@@ -146,115 +198,6 @@ public class ChunkLoader
|
|||||||
Heightmap.primeHeightmaps(chunk, ChunkStatus.FULL.heightmapsAfter());
|
Heightmap.primeHeightmaps(chunk, ChunkStatus.FULL.heightmapsAfter());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MC_VERSION_1_18_1
|
|
||||||
private static Map<StructureFeature<?>, StructureStart<?>> unpackStructureStart(StructurePieceSerializationContext structurePieceSerializationContext, CompoundTag compoundTag, long l)
|
|
||||||
{
|
|
||||||
HashMap<StructureFeature<?>, StructureStart<?>> map = Maps.newHashMap();
|
|
||||||
CompoundTag compoundTag2 = compoundTag.getCompound("starts");
|
|
||||||
for (String string : compoundTag2.getAllKeys())
|
|
||||||
{
|
|
||||||
String string2 = string.toLowerCase(Locale.ROOT);
|
|
||||||
StructureFeature<?> structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(string2);
|
|
||||||
if (structureFeature == null)
|
|
||||||
{
|
|
||||||
LOGGER.error("Unknown structure start: {}", (Object) string2);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
StructureStart<?> structureStart = StructureFeature.loadStaticStart(structurePieceSerializationContext, compoundTag2.getCompound(string), l);
|
|
||||||
if (structureStart == null)
|
|
||||||
continue;
|
|
||||||
map.put(structureFeature, structureStart);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Map<StructureFeature<?>, LongSet> unpackStructureReferences(ChunkPos chunkPos, CompoundTag compoundTag)
|
|
||||||
{
|
|
||||||
HashMap<StructureFeature<?>, LongSet> map = Maps.newHashMap();
|
|
||||||
CompoundTag compoundTag2 = compoundTag.getCompound("References");
|
|
||||||
for (String string : compoundTag2.getAllKeys())
|
|
||||||
{
|
|
||||||
String string2 = string.toLowerCase(Locale.ROOT);
|
|
||||||
StructureFeature<?> structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(string2);
|
|
||||||
if (structureFeature == null)
|
|
||||||
{
|
|
||||||
LOGGER.warn("Found reference to unknown structure '{}' in chunk {}, discarding", (Object) string2, (Object) chunkPos);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
map.put(structureFeature, new LongOpenHashSet(Arrays.stream(compoundTag2.getLongArray(string)).filter(l ->
|
|
||||||
{
|
|
||||||
ChunkPos chunkPos2 = new ChunkPos(l);
|
|
||||||
if (chunkPos2.getChessboardDistance(chunkPos) > 8)
|
|
||||||
{
|
|
||||||
LOGGER.warn("Found invalid structure reference [ {} @ {} ] for chunk {}.", (Object) string2, (Object) chunkPos2, (Object) chunkPos);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}).toArray()));
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
#elif MC_VERSION_1_18_2
|
|
||||||
private static Map<ConfiguredStructureFeature<?, ?>, StructureStart> unpackStructureStart(StructurePieceSerializationContext structurePieceSerializationContext, CompoundTag compoundTag, long l) {
|
|
||||||
Map<ConfiguredStructureFeature<?, ?>, StructureStart> map = Maps.newHashMap();
|
|
||||||
Registry<ConfiguredStructureFeature<?, ?>> structStartRegistry = structurePieceSerializationContext.registryAccess().registryOrThrow(Registry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY);
|
|
||||||
CompoundTag compoundTag2 = compoundTag.getCompound("starts");
|
|
||||||
for (String string : compoundTag2.getAllKeys()) {
|
|
||||||
ResourceLocation resourceLocation = ResourceLocation.tryParse(string);
|
|
||||||
ConfiguredStructureFeature<?, ?> structureFeature = structStartRegistry.get(resourceLocation);
|
|
||||||
// String string2 = string.toLowerCase(Locale.ROOT);
|
|
||||||
// ConfiguredStructureFeature<?, ?> structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(string2);
|
|
||||||
if (structureFeature == null) {
|
|
||||||
LOGGER.error("Unknown structure start: {}", resourceLocation);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
StructureStart structureStart = StructureFeature.loadStaticStart(structurePieceSerializationContext, compoundTag2.getCompound(string), l);
|
|
||||||
if (structureStart == null)
|
|
||||||
continue;
|
|
||||||
map.put(structureFeature, structureStart);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Map<ConfiguredStructureFeature<?, ?>, LongSet> unpackStructureReferences(RegistryAccess registryAccess, ChunkPos chunkPos, CompoundTag compoundTag)
|
|
||||||
{
|
|
||||||
Map<ConfiguredStructureFeature<?, ?>, LongSet> map = Maps.newHashMap();
|
|
||||||
Registry<ConfiguredStructureFeature<?, ?>> structRegistry = registryAccess.registryOrThrow(Registry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY);
|
|
||||||
CompoundTag compoundTag2 = compoundTag.getCompound("References");
|
|
||||||
for (String string : compoundTag2.getAllKeys())
|
|
||||||
{
|
|
||||||
ResourceLocation resourceLocation = ResourceLocation.tryParse(string);
|
|
||||||
ConfiguredStructureFeature<?, ?> structureFeature = structRegistry.get(resourceLocation);
|
|
||||||
// String string2 = string.toLowerCase(Locale.ROOT);
|
|
||||||
// ConfiguredStructureFeature<?, ?> structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(string2);
|
|
||||||
if (structureFeature == null)
|
|
||||||
{
|
|
||||||
LOGGER.warn("Found reference to unknown structure '{}' in chunk {}, discarding", resourceLocation, chunkPos);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
map.put(structureFeature, new LongOpenHashSet(Arrays.stream(compoundTag2.getLongArray(string)).filter(l ->
|
|
||||||
{
|
|
||||||
ChunkPos chunkPos2 = new ChunkPos(l);
|
|
||||||
if (chunkPos2.getChessboardDistance(chunkPos) > 8)
|
|
||||||
{
|
|
||||||
LOGGER.warn("Found invalid structure reference [ {} @ {} ] for chunk {}.", resourceLocation, chunkPos2, chunkPos);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}).toArray()));
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private static void readStructures(WorldGenLevel level, LevelChunk chunk, CompoundTag chunkData)
|
|
||||||
{
|
|
||||||
CompoundTag tagStructures = chunkData.getCompound("structures");
|
|
||||||
chunk.setAllStarts(
|
|
||||||
unpackStructureStart(StructurePieceSerializationContext.fromLevel(level.getLevel()), tagStructures, level.getSeed()));
|
|
||||||
chunk.setAllReferences(unpackStructureReferences(#if MC_VERSION_1_18_2 level.registryAccess() ,#endif chunk.getPos(), tagStructures));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void readPostPocessings(LevelChunk chunk, CompoundTag chunkData)
|
private static void readPostPocessings(LevelChunk chunk, CompoundTag chunkData)
|
||||||
{
|
{
|
||||||
ListTag tagPostProcessings = chunkData.getList("PostProcessing", 9);
|
ListTag tagPostProcessings = chunkData.getList("PostProcessing", 9);
|
||||||
@@ -268,49 +211,96 @@ public class ChunkLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChunkStatus.ChunkType readChunkType(CompoundTag compoundTag)
|
public static ChunkStatus.ChunkType readChunkType(CompoundTag tagLevel)
|
||||||
{
|
{
|
||||||
return ChunkStatus.byName(compoundTag.getString("Status")).getChunkType();
|
ChunkStatus chunkStatus = ChunkStatus.byName(tagLevel.getString("Status"));
|
||||||
|
if (chunkStatus != null) {
|
||||||
|
return chunkStatus.getChunkType();
|
||||||
|
}
|
||||||
|
return ChunkStatus.ChunkType.PROTOCHUNK;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LevelChunk read(WorldGenLevel level, LevelLightEngine lightEngine, ChunkPos chunkPos, CompoundTag chunkData)
|
public static LevelChunk read(WorldGenLevel level, LevelLightEngine lightEngine, ChunkPos chunkPos, CompoundTag chunkData)
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_18_1
|
||||||
|
CompoundTag tagLevel = chunkData.getCompound("Level");
|
||||||
|
#else
|
||||||
|
CompoundTag tagLevel = chunkData;
|
||||||
|
#endif
|
||||||
|
|
||||||
ChunkPos actualPos = new ChunkPos(chunkData.getInt("xPos"), chunkData.getInt("zPos"));
|
ChunkPos actualPos = new ChunkPos(tagLevel.getInt("xPos"), tagLevel.getInt("zPos"));
|
||||||
if (!Objects.equals(chunkPos, actualPos))
|
if (!Objects.equals(chunkPos, actualPos)) {
|
||||||
{
|
LOGGER.error("Chunk file at {} is in the wrong location; Ignoring. (Expected {}, got {})", chunkPos, chunkPos, actualPos);
|
||||||
LOGGER.error("Distant Horizons: Chunk file at {} is in the wrong location; Ignoring. (Expected {}, got {})", (Object) chunkPos, (Object) chunkPos, (Object) actualPos);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChunkStatus.ChunkType chunkType = readChunkType(chunkData);
|
ChunkStatus.ChunkType chunkType = readChunkType(tagLevel);
|
||||||
BlendingData blendingData = readBlendingData(chunkData);
|
#if PRE_MC_1_18_1
|
||||||
|
if (chunkType != ChunkStatus.ChunkType.LEVELCHUNK)
|
||||||
|
return null;
|
||||||
|
#else
|
||||||
|
BlendingData blendingData = readBlendingData(tagLevel);
|
||||||
|
#if PRE_MC_1_19
|
||||||
if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && (blendingData == null || !blendingData.oldNoise()))
|
if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && (blendingData == null || !blendingData.oldNoise()))
|
||||||
return null;
|
return null;
|
||||||
|
#else
|
||||||
|
if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && (blendingData == null || level.getChunk(chunkPos.getMiddleBlockX(),chunkPos.getMiddleBlockZ()).isOldNoiseGeneration()))
|
||||||
|
return null;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Prepare the light engine
|
long inhabitedTime = tagLevel.getLong("InhabitedTime");
|
||||||
boolean isLightOn = chunkData.getBoolean("isLightOn");
|
|
||||||
if (isLightOn)
|
|
||||||
level.getLightEngine().retainData(chunkPos, true);
|
|
||||||
|
|
||||||
// Read params for making the LevelChunk
|
//================== Read params for making the LevelChunk ==================
|
||||||
UpgradeData upgradeData = chunkData.contains(TAG_UPGRADE_DATA, 10)
|
UpgradeData upgradeData = tagLevel.contains(TAG_UPGRADE_DATA, 10)
|
||||||
? new UpgradeData(chunkData.getCompound(TAG_UPGRADE_DATA), level)
|
? new UpgradeData(tagLevel.getCompound(TAG_UPGRADE_DATA)#if POST_MC_1_17_1, level #endif)
|
||||||
: UpgradeData.EMPTY;
|
: UpgradeData.EMPTY;
|
||||||
LevelChunkTicks<Block> blockTicks = LevelChunkTicks.load(chunkData.getList(BLOCK_TICKS_TAG, 10),
|
|
||||||
|
boolean isLightOn = tagLevel.getBoolean("isLightOn");
|
||||||
|
if (isLightOn) lightEngine.retainData(chunkPos, true);
|
||||||
|
#if PRE_MC_1_18_1
|
||||||
|
ChunkBiomeContainer chunkBiomeContainer = new ChunkBiomeContainer(
|
||||||
|
level.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY)#if POST_MC_1_17_1, level #endif,
|
||||||
|
chunkPos, level.getLevel().getChunkSource().getGenerator().getBiomeSource(),
|
||||||
|
tagLevel.contains("Biomes", 11) ? tagLevel.getIntArray("Biomes") : null);
|
||||||
|
|
||||||
|
TickList<Block> blockTicks = tagLevel.contains(BLOCK_TICKS_TAG_PRE18, 9)
|
||||||
|
? ChunkTickList.create(tagLevel.getList(BLOCK_TICKS_TAG_PRE18, 10), Registry.BLOCK::getKey, Registry.BLOCK::get)
|
||||||
|
: new ProtoTickList<Block>(block -> (block == null || block.defaultBlockState().isAir()), chunkPos,
|
||||||
|
tagLevel.getList("ToBeTicked", 9)#if POST_MC_1_17_1, level #endif);
|
||||||
|
|
||||||
|
TickList<Fluid> fluidTicks = tagLevel.contains(FLUID_TICKS_TAG_PRE18, 9)
|
||||||
|
? ChunkTickList.create(tagLevel.getList(FLUID_TICKS_TAG_PRE18, 10), Registry.FLUID::getKey, Registry.FLUID::get)
|
||||||
|
: new ProtoTickList<Fluid>(fluid -> (fluid == null || fluid == Fluids.EMPTY), chunkPos,
|
||||||
|
tagLevel.getList("LiquidsToBeTicked", 9)#if POST_MC_1_17_1, level #endif);
|
||||||
|
#else
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
|
LevelChunkTicks<Block> blockTicks = LevelChunkTicks.load(tagLevel.getList(BLOCK_TICKS_TAG_18, 10),
|
||||||
string -> Registry.BLOCK.getOptional(ResourceLocation.tryParse(string)), chunkPos);
|
string -> Registry.BLOCK.getOptional(ResourceLocation.tryParse(string)), chunkPos);
|
||||||
LevelChunkTicks<Fluid> fluidTicks = LevelChunkTicks.load(chunkData.getList(FLUID_TICKS_TAG, 10),
|
LevelChunkTicks<Fluid> fluidTicks = LevelChunkTicks.load(tagLevel.getList(FLUID_TICKS_TAG_18, 10),
|
||||||
string -> Registry.FLUID.getOptional(ResourceLocation.tryParse(string)), chunkPos);
|
string -> Registry.FLUID.getOptional(ResourceLocation.tryParse(string)), chunkPos);
|
||||||
long inhabitedTime = chunkData.getLong("InhabitedTime");
|
#else
|
||||||
LevelChunkSection[] chunkSections = readSections(level, lightEngine, actualPos, chunkData);
|
LevelChunkTicks<Block> blockTicks = LevelChunkTicks.load(tagLevel.getList(BLOCK_TICKS_TAG_18, 10),
|
||||||
|
(string -> BuiltInRegistries.BLOCK.getOptional(ResourceLocation.tryParse(string))), chunkPos);
|
||||||
|
LevelChunkTicks<Fluid> fluidTicks = LevelChunkTicks.load(tagLevel.getList(FLUID_TICKS_TAG_18, 10),
|
||||||
|
string -> BuiltInRegistries.FLUID.getOptional(ResourceLocation.tryParse(string)), chunkPos);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Make chunk
|
LevelChunkSection[] levelChunkSections = readSections(level, lightEngine, chunkPos, tagLevel);
|
||||||
LevelChunk chunk = new LevelChunk((Level) level, chunkPos, upgradeData, blockTicks, fluidTicks, inhabitedTime, chunkSections, null, blendingData);
|
|
||||||
|
|
||||||
|
// ====================== Make the chunk =========================
|
||||||
|
#if PRE_MC_1_18_1
|
||||||
|
LevelChunk chunk = new LevelChunk((Level) level.getLevel(), chunkPos, chunkBiomeContainer, upgradeData, blockTicks,
|
||||||
|
fluidTicks, inhabitedTime, levelChunkSections, null);
|
||||||
|
#else
|
||||||
|
|
||||||
|
LevelChunk chunk = new LevelChunk((Level) level, chunkPos, upgradeData, blockTicks,
|
||||||
|
fluidTicks, inhabitedTime, levelChunkSections, null, blendingData);
|
||||||
|
#endif
|
||||||
// Set some states after object creation
|
// Set some states after object creation
|
||||||
chunk.setLightCorrect(isLightOn);
|
chunk.setLightCorrect(isLightOn);
|
||||||
readHeightmaps(chunk, chunkData);
|
readHeightmaps(chunk, chunkData);
|
||||||
readStructures(level, chunk, chunkData);
|
|
||||||
readPostPocessings(chunk, chunkData);
|
readPostPocessings(chunk, chunkData);
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
|
|||||||
+24
@@ -1,10 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration.mimicObject;
|
package com.seibel.lod.common.wrappers.worldGeneration.mimicObject;
|
||||||
|
|
||||||
import com.seibel.lod.core.handlers.dependencyInjection.ModAccessorHandler;
|
import com.seibel.lod.core.handlers.dependencyInjection.ModAccessorHandler;
|
||||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
|
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
|
||||||
|
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
|
#if POST_MC_1_17_1
|
||||||
import net.minecraft.world.level.LevelHeightAccessor;
|
import net.minecraft.world.level.LevelHeightAccessor;
|
||||||
|
#endif
|
||||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||||
import net.minecraft.world.level.chunk.LightChunkGetter;
|
import net.minecraft.world.level.chunk.LightChunkGetter;
|
||||||
|
|
||||||
@@ -34,7 +55,10 @@ public class LightGetterAdaptor implements LightChunkGetter {
|
|||||||
public BlockGetter getLevel() {
|
public BlockGetter getLevel() {
|
||||||
return shouldReturnNull ? null : (genRegion != null ? genRegion : heightGetter);
|
return shouldReturnNull ? null : (genRegion != null ? genRegion : heightGetter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if POST_MC_1_17_1
|
||||||
public LevelHeightAccessor getLevelHeightAccessor() {
|
public LevelHeightAccessor getLevelHeightAccessor() {
|
||||||
return heightGetter;
|
return heightGetter;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
+56
-18
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration.mimicObject;
|
package com.seibel.lod.common.wrappers.worldGeneration.mimicObject;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -6,7 +25,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;
|
||||||
@@ -24,9 +42,14 @@ import net.minecraft.util.Mth;
|
|||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.ColorResolver;
|
import net.minecraft.world.level.ColorResolver;
|
||||||
|
#if POST_MC_1_17_1
|
||||||
import net.minecraft.world.level.LevelHeightAccessor;
|
import net.minecraft.world.level.LevelHeightAccessor;
|
||||||
|
#endif
|
||||||
import net.minecraft.world.level.LightLayer;
|
import net.minecraft.world.level.LightLayer;
|
||||||
|
#if PRE_MC_1_19
|
||||||
import net.minecraft.world.level.StructureFeatureManager;
|
import net.minecraft.world.level.StructureFeatureManager;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||||
|
#endif
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
@@ -36,7 +59,6 @@ import net.minecraft.world.level.chunk.ChunkStatus;
|
|||||||
import net.minecraft.world.level.chunk.ImposterProtoChunk;
|
import net.minecraft.world.level.chunk.ImposterProtoChunk;
|
||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
import net.minecraft.world.level.chunk.LevelChunk;
|
||||||
import net.minecraft.world.level.levelgen.Heightmap;
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
|
||||||
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
||||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||||
|
|
||||||
@@ -49,11 +71,30 @@ public class LightedWorldGenRegion extends WorldGenRegion {
|
|||||||
private final ChunkPos firstPos;
|
private final ChunkPos firstPos;
|
||||||
private final List<ChunkAccess> cache;
|
private final List<ChunkAccess> cache;
|
||||||
Long2ObjectOpenHashMap<ChunkAccess> chunkMap = new Long2ObjectOpenHashMap<ChunkAccess>();
|
Long2ObjectOpenHashMap<ChunkAccess> chunkMap = new Long2ObjectOpenHashMap<ChunkAccess>();
|
||||||
|
#if PRE_MC_1_18_1
|
||||||
|
private ChunkPos overrideCenterPos = null;
|
||||||
|
public void setOverrideCenter(ChunkPos pos) {overrideCenterPos = pos;}
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
@Override
|
||||||
|
public int getCenterX() {
|
||||||
|
return overrideCenterPos==null ? super.getCenterX() : overrideCenterPos.x;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getCenterZ() {
|
||||||
|
return overrideCenterPos==null ? super.getCenterX() : overrideCenterPos.z;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
@Override
|
||||||
|
public ChunkPos getCenter() {
|
||||||
|
return overrideCenterPos==null ? super.getCenter() : overrideCenterPos;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
public LightedWorldGenRegion(ServerLevel serverLevel, WorldGenLevelLightEngine lightEngine,
|
public LightedWorldGenRegion(ServerLevel serverLevel, WorldGenLevelLightEngine lightEngine,
|
||||||
List<ChunkAccess> list, ChunkStatus chunkStatus, int i,
|
List<ChunkAccess> list, ChunkStatus chunkStatus, int i,
|
||||||
LightGenerationMode lightMode, EmptyChunkGenerator generator) {
|
LightGenerationMode lightMode, EmptyChunkGenerator generator) {
|
||||||
super(serverLevel, list, chunkStatus, i);
|
super(serverLevel, list #if POST_MC_1_17_1, chunkStatus, i #endif);
|
||||||
this.lightMode = lightMode;
|
this.lightMode = lightMode;
|
||||||
this.firstPos = list.get(0).getPos();
|
this.firstPos = list.get(0).getPos();
|
||||||
this.generator = generator;
|
this.generator = generator;
|
||||||
@@ -61,14 +102,9 @@ public class LightedWorldGenRegion extends WorldGenRegion {
|
|||||||
writeRadius = i;
|
writeRadius = i;
|
||||||
cache = list;
|
cache = list;
|
||||||
size = Mth.floor(Math.sqrt(list.size()));
|
size = Mth.floor(Math.sqrt(list.size()));
|
||||||
|
|
||||||
this.tintCaches = Util.make(new Object2ObjectArrayMap(3), object2ObjectArrayMap -> {
|
|
||||||
object2ObjectArrayMap.put(BiomeColors.GRASS_COLOR_RESOLVER, new BlockTintCache((pos) -> {return calculateBlockTint(pos, BiomeColors.GRASS_COLOR_RESOLVER);}));
|
|
||||||
object2ObjectArrayMap.put(BiomeColors.FOLIAGE_COLOR_RESOLVER, new BlockTintCache((pos) -> {return calculateBlockTint(pos, BiomeColors.FOLIAGE_COLOR_RESOLVER);}));
|
|
||||||
object2ObjectArrayMap.put(BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache((pos) -> {return calculateBlockTint(pos, BiomeColors.WATER_COLOR_RESOLVER);}));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if POST_MC_1_17_1
|
||||||
// Bypass BCLib mixin overrides.
|
// Bypass BCLib mixin overrides.
|
||||||
@Override
|
@Override
|
||||||
public boolean ensureCanWrite(BlockPos blockPos) {
|
public boolean ensureCanWrite(BlockPos blockPos) {
|
||||||
@@ -81,14 +117,17 @@ public class LightedWorldGenRegion extends WorldGenRegion {
|
|||||||
if (k > this.writeRadius || l > this.writeRadius) {
|
if (k > this.writeRadius || l > this.writeRadius) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#if POST_MC_1_18_1
|
||||||
if (center.isUpgrading()) {
|
if (center.isUpgrading()) {
|
||||||
LevelHeightAccessor levelHeightAccessor = center.getHeightAccessorForGeneration();
|
LevelHeightAccessor levelHeightAccessor = center.getHeightAccessorForGeneration();
|
||||||
if (blockPos.getY() < levelHeightAccessor.getMinBuildHeight() || blockPos.getY() >= levelHeightAccessor.getMaxBuildHeight()) {
|
if (blockPos.getY() < levelHeightAccessor.getMinBuildHeight() || blockPos.getY() >= levelHeightAccessor.getMaxBuildHeight()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO Check this
|
// TODO Check this
|
||||||
// @Override
|
// @Override
|
||||||
@@ -173,7 +212,7 @@ public class LightedWorldGenRegion extends WorldGenRegion {
|
|||||||
public ChunkAccess getChunk(int i, int j, ChunkStatus chunkStatus, boolean bl) {
|
public ChunkAccess getChunk(int i, int j, ChunkStatus chunkStatus, boolean bl) {
|
||||||
ChunkAccess chunk = getChunkAccess(i, j, chunkStatus, bl);
|
ChunkAccess chunk = getChunkAccess(i, j, chunkStatus, bl);
|
||||||
if (chunk instanceof LevelChunk) {
|
if (chunk instanceof LevelChunk) {
|
||||||
chunk = new ImposterProtoChunk((LevelChunk) chunk, true);
|
chunk = new ImposterProtoChunk((LevelChunk) chunk #if POST_MC_1_18_1, true #endif);
|
||||||
}
|
}
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
@@ -238,27 +277,26 @@ public class LightedWorldGenRegion extends WorldGenRegion {
|
|||||||
return (getBrightness(LightLayer.SKY, blockPos) >= getMaxLightLevel());
|
return (getBrightness(LightLayer.SKY, blockPos) >= getMaxLightLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private final Object2ObjectArrayMap<ColorResolver, BlockTintCache> tintCaches;
|
|
||||||
|
|
||||||
public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver)
|
public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver)
|
||||||
{
|
{
|
||||||
BlockTintCache blockTintCache = (BlockTintCache) this.tintCaches.get(colorResolver);
|
return calculateBlockTint(blockPos, colorResolver);
|
||||||
return blockTintCache.getColor(blockPos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Biome _getBiome(BlockPos pos) {
|
private Biome _getBiome(BlockPos pos) {
|
||||||
#if MC_VERSION_1_18_2
|
#if POST_MC_1_18_2
|
||||||
return getBiome(pos).value();
|
return getBiome(pos).value();
|
||||||
#elif MC_VERSION_1_18_1
|
#else
|
||||||
return getBiome(pos);
|
return getBiome(pos);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public int calculateBlockTint(BlockPos blockPos, ColorResolver colorResolver)
|
public int calculateBlockTint(BlockPos blockPos, ColorResolver colorResolver)
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_19
|
||||||
int i = (Minecraft.getInstance()).options.biomeBlendRadius;
|
int i = (Minecraft.getInstance()).options.biomeBlendRadius;
|
||||||
|
#else
|
||||||
|
int i = (Minecraft.getInstance()).options.biomeBlendRadius().get();
|
||||||
|
#endif
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
return colorResolver.getColor((Biome) _getBiome(blockPos), blockPos.getX(), blockPos.getZ());
|
return colorResolver.getColor((Biome) _getBiome(blockPos), blockPos.getX(), blockPos.getZ());
|
||||||
int j = (i * 2 + 1) * (i * 2 + 1);
|
int j = (i * 2 + 1) * (i * 2 + 1);
|
||||||
|
|||||||
+46
-1
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration.mimicObject;
|
package com.seibel.lod.common.wrappers.worldGeneration.mimicObject;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -5,7 +24,9 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.SectionPos;
|
import net.minecraft.core.SectionPos;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
|
#if POST_MC_1_17_1
|
||||||
import net.minecraft.world.level.LevelHeightAccessor;
|
import net.minecraft.world.level.LevelHeightAccessor;
|
||||||
|
#endif
|
||||||
import net.minecraft.world.level.LightLayer;
|
import net.minecraft.world.level.LightLayer;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.DataLayer;
|
import net.minecraft.world.level.chunk.DataLayer;
|
||||||
@@ -18,7 +39,9 @@ import net.minecraft.world.level.lighting.SkyLightEngine;
|
|||||||
public class WorldGenLevelLightEngine extends LevelLightEngine {
|
public class WorldGenLevelLightEngine extends LevelLightEngine {
|
||||||
public static final int MAX_SOURCE_LEVEL = 15;
|
public static final int MAX_SOURCE_LEVEL = 15;
|
||||||
public static final int LIGHT_SECTION_PADDING = 1;
|
public static final int LIGHT_SECTION_PADDING = 1;
|
||||||
|
#if POST_MC_1_17_1
|
||||||
protected final LevelHeightAccessor levelHeightAccessor;
|
protected final LevelHeightAccessor levelHeightAccessor;
|
||||||
|
#endif
|
||||||
@Nullable
|
@Nullable
|
||||||
public final BlockLightEngine blockEngine;
|
public final BlockLightEngine blockEngine;
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -26,7 +49,9 @@ public class WorldGenLevelLightEngine extends LevelLightEngine {
|
|||||||
|
|
||||||
public WorldGenLevelLightEngine(LightGetterAdaptor genRegion) {
|
public WorldGenLevelLightEngine(LightGetterAdaptor genRegion) {
|
||||||
super(genRegion, false, false);
|
super(genRegion, false, false);
|
||||||
|
#if POST_MC_1_17_1
|
||||||
this.levelHeightAccessor = genRegion.getLevelHeightAccessor();
|
this.levelHeightAccessor = genRegion.getLevelHeightAccessor();
|
||||||
|
#endif
|
||||||
this.blockEngine = new BlockLightEngine(genRegion);
|
this.blockEngine = new BlockLightEngine(genRegion);
|
||||||
this.skyEngine = new SkyLightEngine(genRegion);
|
this.skyEngine = new SkyLightEngine(genRegion);
|
||||||
}
|
}
|
||||||
@@ -123,11 +148,28 @@ public class WorldGenLevelLightEngine extends LevelLightEngine {
|
|||||||
chunkAccess.setLightCorrect(false);
|
chunkAccess.setLightCorrect(false);
|
||||||
|
|
||||||
LevelChunkSection[] levelChunkSections = chunkAccess.getSections();
|
LevelChunkSection[] levelChunkSections = chunkAccess.getSections();
|
||||||
for (int i = 0; i < chunkAccess.getSectionsCount(); ++i) {
|
for (int i = 0; i <
|
||||||
|
#if POST_MC_1_17_1
|
||||||
|
chunkAccess.getSectionsCount()
|
||||||
|
#else
|
||||||
|
16
|
||||||
|
#endif
|
||||||
|
; ++i) {
|
||||||
LevelChunkSection levelChunkSection = levelChunkSections[i];
|
LevelChunkSection levelChunkSection = levelChunkSections[i];
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
if (!LevelChunkSection.isEmpty(levelChunkSection)) {
|
||||||
|
updateSectionStatus(SectionPos.of(chunkPos, i), false);
|
||||||
|
}
|
||||||
|
#elif PRE_MC_1_18_1
|
||||||
|
if (!LevelChunkSection.isEmpty(levelChunkSection)) {
|
||||||
|
int j = this.levelHeightAccessor.getSectionYFromSectionIndex(i);
|
||||||
|
updateSectionStatus(SectionPos.of(chunkPos, j), false);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (levelChunkSection.hasOnlyAir()) continue;
|
if (levelChunkSection.hasOnlyAir()) continue;
|
||||||
int j = this.levelHeightAccessor.getSectionYFromSectionIndex(i);
|
int j = this.levelHeightAccessor.getSectionYFromSectionIndex(i);
|
||||||
updateSectionStatus(SectionPos.of(chunkPos, j), false);
|
updateSectionStatus(SectionPos.of(chunkPos, j), false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
enableLightSources(chunkPos, true);
|
enableLightSources(chunkPos, true);
|
||||||
if (needLightBlockUpdate) {
|
if (needLightBlockUpdate) {
|
||||||
@@ -161,6 +203,8 @@ public class WorldGenLevelLightEngine extends LevelLightEngine {
|
|||||||
this.skyEngine.retainData(chunkPos, bl);
|
this.skyEngine.retainData(chunkPos, bl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if POST_MC_1_17_1
|
||||||
@Override
|
@Override
|
||||||
public int getLightSectionCount() {
|
public int getLightSectionCount() {
|
||||||
throw new UnsupportedOperationException("This should never be used!");
|
throw new UnsupportedOperationException("This should never be used!");
|
||||||
@@ -173,4 +217,5 @@ public class WorldGenLevelLightEngine extends LevelLightEngine {
|
|||||||
public int getMaxLightSection() {
|
public int getMaxLightSection() {
|
||||||
throw new UnsupportedOperationException("This should never be used!");
|
throw new UnsupportedOperationException("This should never be used!");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
+189
-23
@@ -1,6 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
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.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@@ -12,27 +37,57 @@ import net.minecraft.core.SectionPos;
|
|||||||
import net.minecraft.server.level.WorldGenRegion;
|
import net.minecraft.server.level.WorldGenRegion;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
import net.minecraft.world.level.StructureFeatureManager;
|
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
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;
|
||||||
|
#if PRE_MC_1_19
|
||||||
|
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.StructureFeatureManager;
|
||||||
|
#else
|
||||||
|
#if POST_MC_1_19_3
|
||||||
|
import net.minecraft.world.level.levelgen.WorldOptions;
|
||||||
|
#endif
|
||||||
|
import net.minecraft.world.level.levelgen.structure.Structure;
|
||||||
|
import net.minecraft.world.level.StructureManager;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if POST_MC_1_18_1
|
||||||
import net.minecraft.world.level.levelgen.structure.StructureCheck;
|
import net.minecraft.world.level.levelgen.structure.StructureCheck;
|
||||||
|
#endif
|
||||||
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
||||||
|
|
||||||
|
#if PRE_MC_1_19
|
||||||
public class WorldGenStructFeatManager extends StructureFeatureManager {
|
public class WorldGenStructFeatManager extends StructureFeatureManager {
|
||||||
WorldGenLevel genLevel;
|
#else
|
||||||
|
public class WorldGenStructFeatManager extends StructureManager {
|
||||||
|
#endif
|
||||||
|
final WorldGenLevel genLevel;
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
WorldGenSettings worldGenSettings;
|
WorldGenSettings worldGenSettings;
|
||||||
|
#else
|
||||||
|
WorldOptions worldOptions;
|
||||||
|
#endif
|
||||||
|
#if POST_MC_1_18_1
|
||||||
StructureCheck structureCheck;
|
StructureCheck structureCheck;
|
||||||
public WorldGenStructFeatManager(LevelAccessor levelAccessor, WorldGenSettings worldGenSettings,
|
#endif
|
||||||
WorldGenLevel genLevel, StructureCheck structureCheck) {
|
#if PRE_MC_1_19_3
|
||||||
super(levelAccessor, worldGenSettings, structureCheck);
|
public WorldGenStructFeatManager(WorldGenSettings worldGenSettings,
|
||||||
this.genLevel = genLevel;
|
WorldGenLevel genLevel #if POST_MC_1_18_1, StructureCheck structureCheck #endif) {
|
||||||
this.worldGenSettings = worldGenSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGenLevel(WorldGenLevel genLevel) {
|
super(genLevel,
|
||||||
|
worldGenSettings #if POST_MC_1_19_3 .options() #endif
|
||||||
|
#if POST_MC_1_18_1, structureCheck #endif
|
||||||
|
);
|
||||||
|
this.worldGenSettings = worldGenSettings;
|
||||||
|
#else
|
||||||
|
public WorldGenStructFeatManager(WorldOptions worldOptions,
|
||||||
|
WorldGenLevel genLevel #if POST_MC_1_18_1, StructureCheck structureCheck #endif) {
|
||||||
|
|
||||||
|
super(genLevel, worldOptions, structureCheck);
|
||||||
|
this.worldOptions = worldOptions;
|
||||||
|
#endif
|
||||||
this.genLevel = genLevel;
|
this.genLevel = genLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,37 +95,55 @@ public class WorldGenStructFeatManager extends StructureFeatureManager {
|
|||||||
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(
|
||||||
|
#if PRE_MC_1_19_3 worldGenSettings #else worldOptions #endif
|
||||||
|
, worldGenRegion #if POST_MC_1_18_1, structureCheck #endif);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ChunkAccess _getChunk(int x, int z, ChunkStatus status) {
|
||||||
|
if (genLevel == null) return null;
|
||||||
|
return genLevel.getChunk(x, z, status, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if PRE_MC_1_18_1
|
||||||
|
@Override
|
||||||
|
public Stream<? extends StructureStart<?>> startsForFeature(SectionPos sectionPos2,
|
||||||
|
StructureFeature<?> structureFeature) {
|
||||||
|
ChunkAccess chunk = _getChunk(sectionPos2.x(), sectionPos2.z(), ChunkStatus.STRUCTURE_REFERENCES);
|
||||||
|
if (chunk == null) return Stream.empty();
|
||||||
|
|
||||||
|
return chunk.getReferencesForFeature(structureFeature).stream().map(pos -> {
|
||||||
|
SectionPos sectPos = SectionPos.of(ChunkPos.getX(pos), 0, ChunkPos.getZ(pos));
|
||||||
|
ChunkAccess startChunk = _getChunk(sectPos.x(), sectPos.z(), ChunkStatus.STRUCTURE_STARTS);
|
||||||
|
if (startChunk == null) return null;
|
||||||
|
return this.getStartForFeature(sectPos, structureFeature, startChunk);
|
||||||
|
}).filter(structureStart -> structureStart != null && structureStart.isValid());
|
||||||
|
}
|
||||||
|
#else
|
||||||
@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();
|
||||||
}
|
}
|
||||||
|
#if MC_1_18_1
|
||||||
// TODO Check this
|
|
||||||
/*
|
|
||||||
@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 +151,98 @@ public class WorldGenStructFeatManager extends StructureFeatureManager {
|
|||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
*/
|
#else
|
||||||
|
#if PRE_MC_1_19
|
||||||
|
@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<StructureStart>) Stream.empty();
|
||||||
|
|
||||||
|
// 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<ConfiguredStructureFeature<?, ?>, LongSet>) Stream.empty();
|
||||||
|
return chunk.getAllReferences();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
@Override
|
||||||
|
public List<StructureStart> startsForStructure(ChunkPos sectionPos, Predicate<Structure> predicate) {
|
||||||
|
ChunkAccess chunk = _getChunk(sectionPos.x, sectionPos.z, ChunkStatus.STRUCTURE_REFERENCES);
|
||||||
|
if (chunk == null) return List.of();
|
||||||
|
|
||||||
|
// Copied from StructureFeatureManager::startsForFeature(...)
|
||||||
|
Map<Structure, LongSet> map = chunk.getAllReferences();
|
||||||
|
|
||||||
|
ImmutableList.Builder<StructureStart> builder = ImmutableList.builder();
|
||||||
|
Iterator<Map.Entry<Structure, LongSet>> var5 = map.entrySet().iterator();
|
||||||
|
|
||||||
|
while(var5.hasNext()) {
|
||||||
|
Map.Entry<Structure, LongSet> entry = var5.next();
|
||||||
|
Structure configuredStructureFeature = entry.getKey();
|
||||||
|
if (predicate.test(configuredStructureFeature)) {
|
||||||
|
LongSet var10002 = (LongSet)entry.getValue();
|
||||||
|
Objects.requireNonNull(builder);
|
||||||
|
this.fillStartsForStructure(configuredStructureFeature, var10002, builder::add);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StructureStart> startsForStructure(SectionPos sectionPos, Structure structure) {
|
||||||
|
ChunkAccess chunk = _getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_REFERENCES);
|
||||||
|
if (chunk == null) return (List<StructureStart>) Stream.empty();
|
||||||
|
|
||||||
|
// Copied from StructureFeatureManager::startsForFeature(...)
|
||||||
|
LongSet longSet = chunk.getReferencesForStructure(structure);
|
||||||
|
ImmutableList.Builder<StructureStart> builder = ImmutableList.builder();
|
||||||
|
Objects.requireNonNull(builder);
|
||||||
|
this.fillStartsForStructure(structure, longSet, builder::add);
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Structure, LongSet> getAllStructuresAt(BlockPos blockPos) {
|
||||||
|
SectionPos sectionPos = SectionPos.of(blockPos);
|
||||||
|
ChunkAccess chunk = _getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_REFERENCES);
|
||||||
|
if (chunk == null) return (Map<Structure, LongSet>) Stream.empty();
|
||||||
|
return chunk.getAllReferences();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
+33
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -8,7 +27,9 @@ import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
|||||||
|
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.server.level.WorldGenRegion;
|
import net.minecraft.server.level.WorldGenRegion;
|
||||||
|
#if PRE_MC_1_19
|
||||||
import net.minecraft.world.level.StructureFeatureManager;
|
import net.minecraft.world.level.StructureFeatureManager;
|
||||||
|
#endif
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
@@ -17,7 +38,9 @@ import net.minecraft.world.level.chunk.ProtoChunk;
|
|||||||
import net.minecraft.world.level.levelgen.DebugLevelSource;
|
import net.minecraft.world.level.levelgen.DebugLevelSource;
|
||||||
import net.minecraft.world.level.levelgen.FlatLevelSource;
|
import net.minecraft.world.level.levelgen.FlatLevelSource;
|
||||||
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
||||||
|
#if POST_MC_1_18_1
|
||||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||||
|
#endif
|
||||||
|
|
||||||
public final class StepBiomes {
|
public final class StepBiomes {
|
||||||
/**
|
/**
|
||||||
@@ -48,8 +71,18 @@ public final class StepBiomes {
|
|||||||
|
|
||||||
for (ChunkAccess chunk : chunksToDo) {
|
for (ChunkAccess chunk : chunksToDo) {
|
||||||
// System.out.println("StepBiomes: "+chunk.getPos());
|
// System.out.println("StepBiomes: "+chunk.getPos());
|
||||||
|
#if PRE_MC_1_18_1
|
||||||
|
environment.params.generator.createBiomes(environment.params.biomes, chunk);
|
||||||
|
#elif PRE_MC_1_19
|
||||||
chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, Blender.of(worldGenRegion),
|
chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, Blender.of(worldGenRegion),
|
||||||
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
||||||
|
#elif PRE_MC_1_19_3
|
||||||
|
chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, environment.params.randomState, Blender.of(worldGenRegion),
|
||||||
|
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
||||||
|
#else
|
||||||
|
chunk = environment.joinSync(environment.params.generator.createBiomes(Runnable::run, environment.params.randomState, Blender.of(worldGenRegion),
|
||||||
|
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+34
-11
@@ -1,9 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||||
|
import com.seibel.lod.common.wrappers.worldGeneration.mimicObject.LightedWorldGenRegion;
|
||||||
import com.seibel.lod.core.util.gridList.ArrayGridList;
|
import com.seibel.lod.core.util.gridList.ArrayGridList;
|
||||||
|
|
||||||
import net.minecraft.ReportedException;
|
import net.minecraft.ReportedException;
|
||||||
@@ -11,7 +31,10 @@ import net.minecraft.server.level.WorldGenRegion;
|
|||||||
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.chunk.ProtoChunk;
|
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||||
|
import net.minecraft.world.level.levelgen.Heightmap;
|
||||||
|
#if POST_MC_1_18_1
|
||||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||||
|
#endif
|
||||||
|
|
||||||
public final class StepFeatures {
|
public final class StepFeatures {
|
||||||
/**
|
/**
|
||||||
@@ -29,7 +52,7 @@ public final class StepFeatures {
|
|||||||
|
|
||||||
public final ChunkStatus STATUS = ChunkStatus.FEATURES;
|
public final ChunkStatus STATUS = ChunkStatus.FEATURES;
|
||||||
|
|
||||||
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
|
public void generateGroup(ThreadedParameters tParams, LightedWorldGenRegion worldGenRegion,
|
||||||
ArrayGridList<ChunkAccess> chunks) {
|
ArrayGridList<ChunkAccess> chunks) {
|
||||||
ArrayList<ChunkAccess> chunksToDo = new ArrayList<ChunkAccess>();
|
ArrayList<ChunkAccess> chunksToDo = new ArrayList<ChunkAccess>();
|
||||||
|
|
||||||
@@ -41,20 +64,20 @@ public final class StepFeatures {
|
|||||||
|
|
||||||
for (ChunkAccess chunk : chunksToDo) {
|
for (ChunkAccess chunk : chunksToDo) {
|
||||||
try {
|
try {
|
||||||
|
#if PRE_MC_1_18_1
|
||||||
|
worldGenRegion.setOverrideCenter(chunk.getPos());
|
||||||
|
Heightmap.primeHeightmaps(chunk, STATUS.heightmapsAfter());
|
||||||
|
environment.params.generator.applyBiomeDecoration(worldGenRegion, tParams.structFeat);
|
||||||
|
#else
|
||||||
|
Heightmap.primeHeightmaps(chunk, STATUS.heightmapsAfter());
|
||||||
environment.params.generator.applyBiomeDecoration(worldGenRegion, chunk,
|
environment.params.generator.applyBiomeDecoration(worldGenRegion, chunk,
|
||||||
tParams.structFeat.forWorldGenRegion(worldGenRegion));
|
tParams.structFeat.forWorldGenRegion(worldGenRegion));
|
||||||
Blender.generateBorderTicks(worldGenRegion, chunk);
|
#endif
|
||||||
} catch (ReportedException e) {
|
} catch (ReportedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
// FIXME: Features concurrent modification issue. Something about cocobeans just
|
// FIXME: Features concurrent modification issue. Something about cocobeans might just
|
||||||
// aren't happy
|
// error out. For now just retry.
|
||||||
// For now just retry.
|
}
|
||||||
}
|
}
|
||||||
}/*
|
|
||||||
for (ChunkAccess chunk : chunks) {
|
|
||||||
Heightmap.primeHeightmaps(chunk,
|
|
||||||
EnumSet.of(Heightmap.Types.MOTION_BLOCKING, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES,
|
|
||||||
Heightmap.Types.OCEAN_FLOOR, Heightmap.Types.WORLD_SURFACE));
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+25
-2
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
||||||
|
|
||||||
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||||
@@ -9,6 +28,7 @@ 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.chunk.LevelChunk;
|
import net.minecraft.world.level.chunk.LevelChunk;
|
||||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||||
|
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||||
import net.minecraft.world.level.lighting.LightEventListener;
|
import net.minecraft.world.level.lighting.LightEventListener;
|
||||||
|
|
||||||
public final class StepLight {
|
public final class StepLight {
|
||||||
@@ -27,9 +47,10 @@ public final class StepLight {
|
|||||||
|
|
||||||
public final ChunkStatus STATUS = ChunkStatus.LIGHT;
|
public final ChunkStatus STATUS = ChunkStatus.LIGHT;
|
||||||
|
|
||||||
public void generateGroup(LightEventListener lightEngine,
|
public void generateGroup(
|
||||||
|
#if PRE_MC_1_17_1 LevelLightEngine lightEngine,
|
||||||
|
#else LightEventListener lightEngine, #endif
|
||||||
ArrayGridList<ChunkAccess> chunks) {
|
ArrayGridList<ChunkAccess> chunks) {
|
||||||
//ArrayList<ChunkAccess> chunksToDo = new ArrayList<ChunkAccess>();
|
|
||||||
|
|
||||||
for (ChunkAccess chunk : chunks) {
|
for (ChunkAccess chunk : chunks) {
|
||||||
if (chunk.getStatus().isOrAfter(STATUS)) continue;
|
if (chunk.getStatus().isOrAfter(STATUS)) continue;
|
||||||
@@ -52,7 +73,9 @@ public final class StepLight {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
#if POST_MC_1_18_1
|
||||||
if (chunk instanceof LevelChunk) ((LevelChunk)chunk).setClientLightReady(true);
|
if (chunk instanceof LevelChunk) ((LevelChunk)chunk).setClientLightReady(true);
|
||||||
|
#endif
|
||||||
chunk.setLightCorrect(true);
|
chunk.setLightCorrect(true);
|
||||||
}
|
}
|
||||||
lightEngine.runUpdates(Integer.MAX_VALUE, true, true);
|
lightEngine.runUpdates(Integer.MAX_VALUE, true, true);
|
||||||
|
|||||||
+37
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -9,17 +28,24 @@ import com.google.common.collect.Sets;
|
|||||||
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||||
|
|
||||||
|
import com.seibel.lod.core.util.LodUtil;
|
||||||
import net.minecraft.server.level.WorldGenRegion;
|
import net.minecraft.server.level.WorldGenRegion;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
|
#if POST_MC_1_17_1
|
||||||
import net.minecraft.world.level.LevelHeightAccessor;
|
import net.minecraft.world.level.LevelHeightAccessor;
|
||||||
|
#endif
|
||||||
|
#if PRE_MC_1_19
|
||||||
import net.minecraft.world.level.StructureFeatureManager;
|
import net.minecraft.world.level.StructureFeatureManager;
|
||||||
|
#endif
|
||||||
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.chunk.LevelChunkSection;
|
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||||
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
||||||
import net.minecraft.world.level.levelgen.NoiseSettings;
|
import net.minecraft.world.level.levelgen.NoiseSettings;
|
||||||
|
#if POST_MC_1_18_1
|
||||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||||
|
#endif
|
||||||
|
|
||||||
public final class StepNoise {
|
public final class StepNoise {
|
||||||
/**
|
/**
|
||||||
@@ -50,8 +76,19 @@ public final class StepNoise {
|
|||||||
|
|
||||||
for (ChunkAccess chunk : chunksToDo) {
|
for (ChunkAccess chunk : chunksToDo) {
|
||||||
// System.out.println("StepNoise: "+chunk.getPos());
|
// System.out.println("StepNoise: "+chunk.getPos());
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
environment.params.generator.fillFromNoise(worldGenRegion, tParams.structFeat, chunk);
|
||||||
|
#elif PRE_MC_1_18_1
|
||||||
|
chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run,
|
||||||
|
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
||||||
|
#elif PRE_MC_1_19
|
||||||
chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run, Blender.of(worldGenRegion),
|
chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run, Blender.of(worldGenRegion),
|
||||||
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
||||||
|
#else
|
||||||
|
chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run, Blender.of(worldGenRegion), environment.params.randomState,
|
||||||
|
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
||||||
|
#endif
|
||||||
|
LodUtil.checkInterruptsUnchecked(); // Speed up termination responsiveness
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+21
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -13,7 +32,9 @@ import net.minecraft.core.Registry;
|
|||||||
import net.minecraft.core.SectionPos;
|
import net.minecraft.core.SectionPos;
|
||||||
import net.minecraft.server.level.WorldGenRegion;
|
import net.minecraft.server.level.WorldGenRegion;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
import net.minecraft.world.level.ChunkPos;
|
||||||
|
#if PRE_MC_1_19
|
||||||
import net.minecraft.world.level.StructureFeatureManager;
|
import net.minecraft.world.level.StructureFeatureManager;
|
||||||
|
#endif
|
||||||
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.chunk.ProtoChunk;
|
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||||
|
|||||||
+36
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -48,11 +67,27 @@ public final class StepStructureStart {
|
|||||||
chunksToDo.add(chunk);
|
chunksToDo.add(chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if PRE_MC_1_19
|
||||||
if (environment.params.worldGenSettings.generateFeatures()) {
|
if (environment.params.worldGenSettings.generateFeatures()) {
|
||||||
|
#elif PRE_MC_1_19_3
|
||||||
|
if (environment.params.worldGenSettings.generateStructures()) {
|
||||||
|
#else
|
||||||
|
if (environment.params.worldOptions.generateStructures()) {
|
||||||
|
#endif
|
||||||
for (ChunkAccess chunk : chunksToDo) {
|
for (ChunkAccess chunk : chunksToDo) {
|
||||||
// System.out.println("StepStructureStart: "+chunk.getPos());
|
// System.out.println("StepStructureStart: "+chunk.getPos());
|
||||||
|
#if PRE_MC_1_19
|
||||||
environment.params.generator.createStructures(environment.params.registry, tParams.structFeat, chunk, environment.params.structures,
|
environment.params.generator.createStructures(environment.params.registry, tParams.structFeat, chunk, environment.params.structures,
|
||||||
environment.params.worldSeed);
|
environment.params.worldSeed);
|
||||||
|
#elif PRE_MC_1_19_3
|
||||||
|
environment.params.generator.createStructures(environment.params.registry, environment.params.randomState, tParams.structFeat, chunk, environment.params.structures,
|
||||||
|
environment.params.worldSeed);
|
||||||
|
#else
|
||||||
|
environment.params.generator.createStructures(environment.params.registry,
|
||||||
|
environment.params.level.getChunkSource().getGeneratorState(),
|
||||||
|
tParams.structFeat, chunk, environment.params.structures);
|
||||||
|
#endif
|
||||||
|
#if POST_MC_1_18_1
|
||||||
try {
|
try {
|
||||||
tParams.structCheck.onStructureLoad(chunk.getPos(), chunk.getAllStarts());
|
tParams.structCheck.onStructureLoad(chunk.getPos(), chunk.getAllStarts());
|
||||||
} catch (ArrayIndexOutOfBoundsException e) {
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
@@ -61,6 +96,7 @@ public final class StepStructureStart {
|
|||||||
// TODO: Figure out in the future why this happens even though I am using new structFeat
|
// TODO: Figure out in the future why this happens even though I am using new structFeat
|
||||||
throw new StepStructureStart.StructStartCorruptedException(e);
|
throw new StepStructureStart.StructStartCorruptedException(e);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-2
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -39,8 +58,13 @@ public final class StepSurface {
|
|||||||
|
|
||||||
for (ChunkAccess chunk : chunksToDo) {
|
for (ChunkAccess chunk : chunksToDo) {
|
||||||
// System.out.println("StepSurface: "+chunk.getPos());
|
// System.out.println("StepSurface: "+chunk.getPos());
|
||||||
environment.params.generator.buildSurface(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion),
|
#if PRE_MC_1_18_1
|
||||||
chunk);
|
environment.params.generator.buildSurfaceAndBedrock(worldGenRegion, chunk);
|
||||||
|
#elif PRE_MC_1_19
|
||||||
|
environment.params.generator.buildSurface(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk);
|
||||||
|
#else
|
||||||
|
environment.params.generator.buildSurface(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion), environment.params.randomState, chunk);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
accessWidener v1 named
|
||||||
|
|
||||||
|
# used when determining where to save files to
|
||||||
|
accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/io/File;
|
||||||
|
|
||||||
|
# used when rendering
|
||||||
|
accessible field com/mojang/blaze3d/vertex/VertexBuffer vertexCount I
|
||||||
|
accessible field com/mojang/blaze3d/vertex/VertexBuffer id I
|
||||||
|
accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecraft/client/Camera;FZ)D
|
||||||
|
|
||||||
|
# pre-render setup
|
||||||
|
accessible field net/minecraft/client/renderer/LevelRenderer renderChunks Lit/unimi/dsi/fastutil/objects/ObjectList;
|
||||||
|
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo
|
||||||
|
accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chunk Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;
|
||||||
|
|
||||||
|
# used for grabbing vanilla rendered chunks
|
||||||
|
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo
|
||||||
|
accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chunk Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;
|
||||||
|
#accessible field net/minecraft/world/entity/Entity blockPosition Lnet/minecraft/core/BlockPos;
|
||||||
|
|
||||||
|
# lighting
|
||||||
|
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 skyEngine Lnet/minecraft/world/level/lighting/LayerLightEngine;
|
||||||
|
|
||||||
|
# world generation
|
||||||
|
accessible method net/minecraft/world/level/levelgen/Heightmap setHeight (III)V
|
||||||
|
accessible field net/minecraft/world/level/biome/Biome generationSettings Lnet/minecraft/world/level/biome/BiomeGenerationSettings;
|
||||||
|
accessible field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory;
|
||||||
|
#accessible field net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator settings Lnet/minecraft/core/Holder;
|
||||||
|
#accessible method net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator doCreateBiomes (Lnet/minecraft/core/Registry;Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;)V
|
||||||
|
accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
|
||||||
|
|
||||||
|
# lod generation from save file
|
||||||
|
accessible field net/minecraft/server/level/ChunkMap mainThreadExecutor Lnet/minecraft/util/thread/BlockableEventLoop;
|
||||||
|
accessible method net/minecraft/server/level/ChunkMap readChunk (Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/nbt/CompoundTag;
|
||||||
|
|
||||||
|
# grabbing textures
|
||||||
|
accessible field net/minecraft/client/renderer/block/model/BakedQuad sprite Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;
|
||||||
|
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite framesX [I
|
||||||
|
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite framesY [I
|
||||||
|
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite mainImage [Lcom/mojang/blaze3d/platform/NativeImage;
|
||||||
|
|
||||||
|
extendable class com/mojang/math/Matrix4f
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
accessWidener v1 named
|
||||||
|
|
||||||
|
|
||||||
|
# used when determining where to save files to
|
||||||
|
accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/io/File;
|
||||||
|
|
||||||
|
# used when rendering
|
||||||
|
accessible field com/mojang/blaze3d/vertex/VertexBuffer indexCount I
|
||||||
|
accessible field com/mojang/blaze3d/vertex/VertexBuffer vertextBufferId I
|
||||||
|
accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecraft/client/Camera;FZ)D
|
||||||
|
|
||||||
|
# pre-render setup
|
||||||
|
accessible field net/minecraft/client/renderer/LevelRenderer renderChunks Lit/unimi/dsi/fastutil/objects/ObjectArrayList;
|
||||||
|
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo
|
||||||
|
accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chunk Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;
|
||||||
|
|
||||||
|
# used for grabbing vanilla rendered chunks
|
||||||
|
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo
|
||||||
|
accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chunk Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;
|
||||||
|
|
||||||
|
# lighting
|
||||||
|
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 skyEngine Lnet/minecraft/world/level/lighting/LayerLightEngine;
|
||||||
|
|
||||||
|
# world generation
|
||||||
|
accessible method net/minecraft/world/level/levelgen/Heightmap setHeight (III)V
|
||||||
|
accessible field net/minecraft/world/level/biome/Biome generationSettings Lnet/minecraft/world/level/biome/BiomeGenerationSettings;
|
||||||
|
accessible field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory;
|
||||||
|
# accessible field net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator settings Lnet/minecraft/core/Holder;
|
||||||
|
#accessible method net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator doCreateBiomes (Lnet/minecraft/core/Registry;Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;)V
|
||||||
|
accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
|
||||||
|
|
||||||
|
# lod generation from save file
|
||||||
|
accessible field net/minecraft/server/level/ChunkMap mainThreadExecutor Lnet/minecraft/util/thread/BlockableEventLoop;
|
||||||
|
accessible method net/minecraft/server/level/ChunkMap readChunk (Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/nbt/CompoundTag;
|
||||||
|
|
||||||
|
|
||||||
|
# grabbing textures
|
||||||
|
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite animatedTexture Lnet/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture;
|
||||||
|
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite width I
|
||||||
|
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite height I
|
||||||
|
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite mainImage [Lcom/mojang/blaze3d/platform/NativeImage;
|
||||||
|
accessible class net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture
|
||||||
|
accessible method net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture getFrameX (I)I
|
||||||
|
accessible method net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture getFrameY (I)I
|
||||||
|
extendable class com/mojang/math/Matrix4f
|
||||||
+2
@@ -1,5 +1,6 @@
|
|||||||
accessWidener v1 named
|
accessWidener v1 named
|
||||||
|
|
||||||
|
|
||||||
# used when determining where to save files to
|
# used when determining where to save files to
|
||||||
accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/io/File;
|
accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/io/File;
|
||||||
|
|
||||||
@@ -16,6 +17,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;
|
||||||
|
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
accessWidener v1 named
|
||||||
|
|
||||||
|
|
||||||
|
# used when determining where to save files to
|
||||||
|
accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/io/File;
|
||||||
|
|
||||||
|
# used when rendering
|
||||||
|
accessible field com/mojang/blaze3d/vertex/VertexBuffer indexCount I
|
||||||
|
accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecraft/client/Camera;FZ)D
|
||||||
|
|
||||||
|
# used for grabbing vanilla rendered chunks
|
||||||
|
accessible field net/minecraft/client/renderer/LevelRenderer renderChunkStorage Ljava/util/concurrent/atomic/AtomicReference;
|
||||||
|
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkStorage
|
||||||
|
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo
|
||||||
|
accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chunk Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;
|
||||||
|
|
||||||
|
# lighting
|
||||||
|
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 skyEngine Lnet/minecraft/world/level/lighting/LayerLightEngine;
|
||||||
|
|
||||||
|
# world generation
|
||||||
|
accessible method net/minecraft/world/level/levelgen/Heightmap setHeight (III)V
|
||||||
|
accessible field net/minecraft/world/level/biome/Biome generationSettings Lnet/minecraft/world/level/biome/BiomeGenerationSettings;
|
||||||
|
# accessible field net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator settings Lnet/minecraft/core/Holder;
|
||||||
|
accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
|
||||||
|
accessible method net/minecraft/server/level/ChunkMap readChunk (Lnet/minecraft/world/level/ChunkPos;)Ljava/util/concurrent/CompletableFuture;
|
||||||
|
|
||||||
|
|
||||||
|
# lod generation from save file
|
||||||
|
accessible field net/minecraft/server/level/ChunkMap mainThreadExecutor Lnet/minecraft/util/thread/BlockableEventLoop;
|
||||||
|
|
||||||
|
|
||||||
|
# grabbing textures
|
||||||
|
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite animatedTexture Lnet/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture;
|
||||||
|
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite width I
|
||||||
|
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite height I
|
||||||
|
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite mainImage [Lcom/mojang/blaze3d/platform/NativeImage;
|
||||||
|
accessible class net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture
|
||||||
|
accessible method net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture getFrameX (I)I
|
||||||
|
accessible method net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture getFrameY (I)I
|
||||||
|
extendable class com/mojang/math/Matrix4f
|
||||||
|
|
||||||
|
# hacky stuff
|
||||||
|
accessible field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore;
|
||||||
|
mutable field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore;
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
accessWidener v1 named
|
||||||
|
|
||||||
|
|
||||||
|
# used when determining where to save files to
|
||||||
|
accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/io/File;
|
||||||
|
|
||||||
|
# used when rendering
|
||||||
|
accessible field com/mojang/blaze3d/vertex/VertexBuffer indexCount I
|
||||||
|
accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecraft/client/Camera;FZ)D
|
||||||
|
|
||||||
|
# used for grabbing vanilla rendered chunks
|
||||||
|
accessible field net/minecraft/client/renderer/LevelRenderer renderChunkStorage Ljava/util/concurrent/atomic/AtomicReference;
|
||||||
|
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkStorage
|
||||||
|
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo
|
||||||
|
accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chunk Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;
|
||||||
|
|
||||||
|
# lighting
|
||||||
|
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 skyEngine Lnet/minecraft/world/level/lighting/LayerLightEngine;
|
||||||
|
|
||||||
|
# world generation
|
||||||
|
accessible method net/minecraft/world/level/levelgen/Heightmap setHeight (III)V
|
||||||
|
accessible field net/minecraft/world/level/biome/Biome generationSettings Lnet/minecraft/world/level/biome/BiomeGenerationSettings;
|
||||||
|
# accessible field net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator settings Lnet/minecraft/core/Holder;
|
||||||
|
accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
|
||||||
|
accessible method net/minecraft/server/level/ChunkMap readChunk (Lnet/minecraft/world/level/ChunkPos;)Ljava/util/concurrent/CompletableFuture;
|
||||||
|
|
||||||
|
|
||||||
|
# lod generation from save file
|
||||||
|
accessible field net/minecraft/server/level/ChunkMap mainThreadExecutor Lnet/minecraft/util/thread/BlockableEventLoop;
|
||||||
|
|
||||||
|
|
||||||
|
# grabbing textures
|
||||||
|
accessible class net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture
|
||||||
|
accessible method net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture getFrameX (I)I
|
||||||
|
accessible method net/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture getFrameY (I)I
|
||||||
|
accessible field net/minecraft/client/renderer/texture/SpriteContents animatedTexture Lnet/minecraft/client/renderer/texture/SpriteContents$AnimatedTexture;
|
||||||
|
accessible field net/minecraft/client/renderer/texture/SpriteContents originalImage Lcom/mojang/blaze3d/platform/NativeImage;
|
||||||
|
|
||||||
|
# hacky stuff
|
||||||
|
accessible field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore;
|
||||||
|
mutable field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore;
|
||||||
+1
-1
Submodule core updated: 6cd0281d0e...131ba164cf
+201
-19
@@ -2,26 +2,95 @@ plugins {
|
|||||||
id "com.github.johnrengelman.shadow" version "7.1.0"
|
id "com.github.johnrengelman.shadow" version "7.1.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// From parent
|
||||||
|
apply plugin: "java"
|
||||||
|
apply plugin: "architectury-plugin"
|
||||||
|
apply plugin: "maven-publish"
|
||||||
|
apply plugin: "dev.architectury.loom"
|
||||||
|
|
||||||
|
archivesBaseName = rootProject.archives_base_name
|
||||||
|
version = rootProject.mod_version //FIXME: Redef
|
||||||
|
group = rootProject.maven_group
|
||||||
|
|
||||||
version = rootProject.mod_version+"-"+rootProject.minecraft_version+"-"+new Date().format("yyyy_MM_dd_HH_mm")
|
version = rootProject.mod_version+"-"+rootProject.minecraft_version+"-"+new Date().format("yyyy_MM_dd_HH_mm")
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
accessWidenerPath.set(project(":common").file("src/main/resources/lod.accesswidener"))
|
silentMojangMappingsLicense()
|
||||||
|
accessWidenerPath.set(project(":common").file("src/main/resources/${acsessWidenerVersion}.lod.accesswidener"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
architectury {
|
architectury {
|
||||||
platformSetupLoomIde()
|
platformSetupLoomIde()
|
||||||
fabric()
|
fabric()
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
|
common
|
||||||
|
shadowMe
|
||||||
|
implementation.extendsFrom shadowMe
|
||||||
|
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
jar.dependsOn(project(":core").remapJar)
|
||||||
|
remapSourcesJar.dependsOn(project(":core").remapJar)
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// Required for ModMenu
|
// Required for ModMenu
|
||||||
maven { url "https://maven.terraformersmc.com/" }
|
maven { url "https://maven.terraformersmc.com/" }
|
||||||
|
|
||||||
|
mavenCentral()
|
||||||
|
|
||||||
|
// For parchment mappings
|
||||||
|
maven { url "https://maven.parchmentmc.org" }
|
||||||
|
|
||||||
|
// used to download and compile dependencies from git repos
|
||||||
|
maven { url 'https://jitpack.io' }
|
||||||
|
|
||||||
|
// For Manifold Preprocessor
|
||||||
|
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
||||||
|
|
||||||
|
// Required for importing Modrinth mods
|
||||||
|
maven {
|
||||||
|
name = "Modrinth"
|
||||||
|
url = "https://api.modrinth.com/maven"
|
||||||
|
content {
|
||||||
|
includeGroup "maven.modrinth"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required for importing CursedForge mods
|
||||||
|
maven {
|
||||||
|
url "https://www.cursemaven.com"
|
||||||
|
content {
|
||||||
|
includeGroup "curse.maven"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// These 2 are for importing mods that arnt on CursedForge, Modrinth, GitHub, GitLab or anywhere opensource
|
||||||
|
flatDir {
|
||||||
|
dirs "${rootDir}/mods/fabric"
|
||||||
|
content {
|
||||||
|
includeGroup "fabric-mod"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
flatDir {
|
||||||
|
dirs "${rootDir}/mods/forge"
|
||||||
|
content {
|
||||||
|
includeGroup "forge-mod"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def addMod(path, enabled) {
|
def addMod(path, enabled) {
|
||||||
@@ -32,23 +101,62 @@ def addMod(path, enabled) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
||||||
|
// The following line declares the mojmap mappings & parchment mappings
|
||||||
|
mappings loom.layered() {
|
||||||
|
// Mojmap mappings
|
||||||
|
officialMojangMappings()
|
||||||
|
// Parchment mappings (it adds parameter mappings & javadoc)
|
||||||
|
if (
|
||||||
|
rootProject.minecraft_version != "1.19"
|
||||||
|
&& rootProject.minecraft_version != "1.19.1"
|
||||||
|
&& rootProject.minecraft_version != "1.19.2"
|
||||||
|
&& rootProject.minecraft_version != "1.19.3"
|
||||||
|
&& rootProject.minecraft_version != "1.19.4"
|
||||||
|
) // We are not gonna use this build script anymore so dont bother fixing this
|
||||||
|
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip")
|
||||||
|
else
|
||||||
|
parchment("org.parchmentmc.data:parchment-1.18.2:${rootProject.parchment_version}@zip") // As 1.19.x or higher doesnt have parchment mappings yet, we use 1.18.2 mapping
|
||||||
|
// Note: parchment may have later mappings at the time you are reading this, but at the time this was written, it didnt
|
||||||
|
// Check the main branch for the new build system, with the working mappings
|
||||||
|
}
|
||||||
|
|
||||||
|
//Manifold
|
||||||
|
annotationProcessor "systems.manifold:manifold-preprocessor:${rootProject.manifold_version}"
|
||||||
|
|
||||||
|
// Toml
|
||||||
|
implementation("com.electronwill.night-config:toml:${rootProject.toml_version}")
|
||||||
|
|
||||||
|
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
||||||
|
// Do NOT use other classes from fabric loader unless working with fabric
|
||||||
|
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||||
|
|
||||||
|
common(project(":core"))
|
||||||
|
|
||||||
// Fabric loader
|
// Fabric loader
|
||||||
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-resource-loader-v0", 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))
|
||||||
|
addModJar(fabricApi.module("fabric-api-base", 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("maven.modrinth:sodium:${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)
|
||||||
@@ -75,13 +183,12 @@ dependencies {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Toml
|
// Toml
|
||||||
shadowMe("com.electronwill.night-config:toml:${rootProject.toml_version}") {}
|
shadowMe("com.electronwill.night-config:toml:${rootProject.toml_version}") {}
|
||||||
|
|
||||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||||
shadowMe(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
shadowMe(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
||||||
|
shadowMe files(project(":core").file("build/libs/DistantHorizons-${rootProject.mod_version}.jar"))
|
||||||
|
|
||||||
// Compression
|
// Compression
|
||||||
common 'org.tukaani:xz:1.9'
|
common 'org.tukaani:xz:1.9'
|
||||||
@@ -90,10 +197,14 @@ dependencies {
|
|||||||
shadowMe 'org.apache.commons:commons-compress:1.21'
|
shadowMe 'org.apache.commons:commons-compress:1.21'
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method copies the access wideners from the common project to the fabric project. And it was generated by Github Copilot
|
task deleteResources(type: Delete) {
|
||||||
|
delete file("build/resources/main")
|
||||||
|
}
|
||||||
|
// Copies the correct accesswidener and renames it
|
||||||
task copyAccessWidener(type: Copy) {
|
task copyAccessWidener(type: Copy) {
|
||||||
from project(":common").file("src/main/resources/lod.accesswidener")
|
from project(":common").file("src/main/resources/${rootProject.acsessWidenerVersion}.lod.accesswidener")
|
||||||
into file("src/generated/resources")
|
into(file("build/resources/main"))
|
||||||
|
rename "${rootProject.acsessWidenerVersion}.lod.accesswidener", "lod.accesswidener"
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyCoreResources(type: Copy) {
|
task copyCoreResources(type: Copy) {
|
||||||
@@ -101,26 +212,60 @@ task copyCoreResources(type: Copy) {
|
|||||||
into file("build/resources/main")
|
into file("build/resources/main")
|
||||||
}
|
}
|
||||||
|
|
||||||
task deleteResources(type: Delete) {
|
|
||||||
delete file("build/resources/main")
|
|
||||||
}
|
|
||||||
|
|
||||||
task copyCommonResources(type: Copy) {
|
task copyCommonResources(type: Copy) {
|
||||||
from fileTree(project(":common").file("src/main/resources"))
|
from fileTree(project(":common").file("src/main/resources"))
|
||||||
into file("build/resources/main")
|
into file("build/resources/main")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
dependsOn(copyCoreResources)
|
||||||
|
dependsOn(copyCommonResources)
|
||||||
|
dependsOn(copyAccessWidener)
|
||||||
|
|
||||||
|
def resourceTargets = ["fabric.mod.json", "META-INF/mods.toml"] // Location of where to put
|
||||||
|
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
||||||
|
def replaceProperties = [
|
||||||
|
version : mod_version,
|
||||||
|
mod_name : mod_name,
|
||||||
|
authors : mod_authors,
|
||||||
|
description : mod_description,
|
||||||
|
homepage : mod_homepage,
|
||||||
|
source : mod_source,
|
||||||
|
issues : mod_issues,
|
||||||
|
minecraft_version : minecraft_version,
|
||||||
|
compatible_minecraft_versions: compatible_minecraft_versions,
|
||||||
|
java_version : java_version
|
||||||
|
]
|
||||||
|
// The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties
|
||||||
|
//TODO: Make Forge loader version also be relaced with non hardcoded value instead of "[36,42)"
|
||||||
|
|
||||||
|
inputs.properties replaceProperties
|
||||||
|
replaceProperties.put 'project', project
|
||||||
|
filesMatching(resourceTargets) {
|
||||||
|
expand replaceProperties
|
||||||
|
}
|
||||||
|
|
||||||
|
intoTargets.each { target ->
|
||||||
|
if (file(target).exists()) {
|
||||||
|
copy {
|
||||||
|
from(sourceSets.main.resources) {
|
||||||
|
include resourceTargets
|
||||||
|
expand replaceProperties
|
||||||
|
}
|
||||||
|
into target
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
runClient {
|
runClient {
|
||||||
dependsOn(copyCoreResources)
|
dependsOn(copyCoreResources)
|
||||||
dependsOn(copyCommonResources)
|
dependsOn(copyCommonResources)
|
||||||
|
dependsOn(copyAccessWidener)
|
||||||
jvmArgs "-XX:-OmitStackTraceInFastThrow"
|
jvmArgs "-XX:-OmitStackTraceInFastThrow"
|
||||||
finalizedBy(deleteResources)
|
finalizedBy(deleteResources)
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
|
||||||
dependsOn(copyAccessWidener)
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
configurations = [project.configurations.shadowMe]
|
configurations = [project.configurations.shadowMe]
|
||||||
relocate 'org.tukaani', 'shaded.tukaani'
|
relocate 'org.tukaani', 'shaded.tukaani'
|
||||||
@@ -139,6 +284,11 @@ remapJar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
manifest {
|
||||||
|
attributes 'Implementation-Title': rootProject.archives_base_name,
|
||||||
|
'Implementation-Version': rootProject.mod_version,
|
||||||
|
'Main-Class': 'com.seibel.lod.core.JarMain' // When changing the main of the jar change this line
|
||||||
|
}
|
||||||
classifier "dev"
|
classifier "dev"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,3 +317,35 @@ publishing {
|
|||||||
// Add repositories to publish to here.
|
// Add repositories to publish to here.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task printConfigurations {
|
||||||
|
doLast {task ->
|
||||||
|
println "Project Name: $name configurations:"
|
||||||
|
configurations.each {
|
||||||
|
println " $it.name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
// Add Manifold Preprocessor
|
||||||
|
// def excapedMCVersion = rootProject.minecraft_version.replace(".", "_")
|
||||||
|
// options.compilerArgs += ['-Xplugin:Manifold', "-AMC_VERSION_${excapedMCVersion}"]
|
||||||
|
//
|
||||||
|
//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
|
||||||
|
|
||||||
|
// Set the java version
|
||||||
|
options.compilerArgs += ['-Xplugin:Manifold']
|
||||||
|
options.release = rootProject.java_version as Integer
|
||||||
|
// TODO: make everything use java 8
|
||||||
|
// options.release = 8 // Use Java 8 for everything so back porting is easier
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 James Seibel
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -31,12 +31,14 @@ import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
|
|||||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||||
|
|
||||||
import com.seibel.lod.fabric.mixins.MixinUtilBackgroudThread;
|
import com.seibel.lod.fabric.mixins.MixinUtilBackgroudThread;
|
||||||
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientChunkEvents;
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
|
||||||
import net.minecraft.client.KeyMapping;
|
import net.minecraft.client.KeyMapping;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.screens.TitleScreen;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
@@ -53,7 +55,7 @@ import org.lwjgl.glfw.GLFW;
|
|||||||
* This handles all events sent to the client,
|
* This handles all events sent to the client,
|
||||||
* and is the starting point for most of the mod.
|
* and is the starting point for most of the mod.
|
||||||
*
|
*
|
||||||
* @author coolGi2007
|
* @author coolGi
|
||||||
* @author Ran
|
* @author Ran
|
||||||
* @version 11-23-2021
|
* @version 11-23-2021
|
||||||
*/
|
*/
|
||||||
@@ -77,7 +79,9 @@ public class ClientProxy
|
|||||||
|
|
||||||
/* World Events */
|
/* World Events */
|
||||||
//ServerChunkEvents.CHUNK_LOAD.register(this::chunkLoadEvent);
|
//ServerChunkEvents.CHUNK_LOAD.register(this::chunkLoadEvent);
|
||||||
//ClientChunkEvents.CHUNK_LOAD.register(this::chunkLoadEvent);
|
#if PRE_MC_1_18_1 // in 1.18+, we use mixin hook in setClientLightReady(true)
|
||||||
|
ClientChunkEvents.CHUNK_LOAD.register(this::chunkLoadEvent);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* World Events */
|
/* World Events */
|
||||||
ServerWorldEvents.LOAD.register((server, level) -> this.worldLoadEvent(level));
|
ServerWorldEvents.LOAD.register((server, level) -> this.worldLoadEvent(level));
|
||||||
@@ -116,6 +120,8 @@ public class ClientProxy
|
|||||||
/** This is also called when a new dimension loads */
|
/** This is also called when a new dimension loads */
|
||||||
public void worldLoadEvent(Level level)
|
public void worldLoadEvent(Level level)
|
||||||
{
|
{
|
||||||
|
if (Minecraft.getInstance().screen instanceof TitleScreen) return;
|
||||||
|
if (Minecraft.getInstance().getConnection() == null) return; // In 1.19.3, the multiplayer world load is called twice. The first time is before it actually connects to the multiplayer server (so stuff like ip and name arent sent out yet)
|
||||||
if (level != null) {
|
if (level != null) {
|
||||||
eventApi.worldLoadEvent(WorldWrapper.getWorldWrapper(level));
|
eventApi.worldLoadEvent(WorldWrapper.getWorldWrapper(level));
|
||||||
}
|
}
|
||||||
@@ -156,7 +162,7 @@ public class ClientProxy
|
|||||||
eventApi.blockChangeEvent(chunk, dimType);
|
eventApi.blockChangeEvent(chunk, dimType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final List<Integer> KEY_TO_CHECK_FOR = List.of(GLFW.GLFW_KEY_F6, GLFW.GLFW_KEY_F8);
|
private static final int[] KEY_TO_CHECK_FOR = {GLFW.GLFW_KEY_F6, GLFW.GLFW_KEY_F8};
|
||||||
|
|
||||||
HashSet<Integer> previousKeyDown = new HashSet<Integer>();
|
HashSet<Integer> previousKeyDown = new HashSet<Integer>();
|
||||||
|
|
||||||
@@ -169,7 +175,7 @@ public class ClientProxy
|
|||||||
// Note: Minecraft's InputConstants is same as GLFW Key values
|
// Note: Minecraft's InputConstants is same as GLFW Key values
|
||||||
//TODO: Use mixin to hook directly into the GLFW Keyboard event in minecraft KeyboardHandler
|
//TODO: Use mixin to hook directly into the GLFW Keyboard event in minecraft KeyboardHandler
|
||||||
// Check all keys we need
|
// Check all keys we need
|
||||||
for (int i = InputConstants.KEY_A; i <= InputConstants.KEY_Z; i++) {
|
for (int i = GLFW.GLFW_KEY_A; i <= GLFW.GLFW_KEY_Z; i++) {
|
||||||
if (InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), i)) {
|
if (InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), i)) {
|
||||||
currectKeyDown.add(i);
|
currectKeyDown.add(i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 James Seibel
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -29,7 +29,6 @@ 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.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
|
import com.seibel.lod.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
|
||||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
|
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
|
||||||
import com.seibel.lod.fabric.networking.NetworkHandler;
|
|
||||||
import com.seibel.lod.fabric.wrappers.modAccessor.ModChecker;
|
import com.seibel.lod.fabric.wrappers.modAccessor.ModChecker;
|
||||||
import com.seibel.lod.fabric.wrappers.modAccessor.OptifineAccessor;
|
import com.seibel.lod.fabric.wrappers.modAccessor.OptifineAccessor;
|
||||||
import com.seibel.lod.fabric.wrappers.modAccessor.SodiumAccessor;
|
import com.seibel.lod.fabric.wrappers.modAccessor.SodiumAccessor;
|
||||||
@@ -43,7 +42,7 @@ import net.fabricmc.api.ClientModInitializer;
|
|||||||
* If you are looking for the real start of the mod
|
* If you are looking for the real start of the mod
|
||||||
* check out the ClientProxy.
|
* check out the ClientProxy.
|
||||||
*
|
*
|
||||||
* @author coolGi2007
|
* @author coolGi
|
||||||
* @author Ran
|
* @author Ran
|
||||||
* @version 12-1-2021
|
* @version 12-1-2021
|
||||||
*/
|
*/
|
||||||
@@ -65,7 +64,7 @@ public class Main implements ClientModInitializer
|
|||||||
// This loads the mod after minecraft loads which doesn't causes a lot of issues
|
// This loads the mod after minecraft loads which doesn't causes a lot of issues
|
||||||
public static void init() {
|
public static void init() {
|
||||||
LodCommonMain.initConfig();
|
LodCommonMain.initConfig();
|
||||||
LodCommonMain.startup(null, false, new NetworkHandler());
|
LodCommonMain.startup(null, false);
|
||||||
FabricDependencySetup.createInitialBindings();
|
FabricDependencySetup.createInitialBindings();
|
||||||
FabricDependencySetup.finishBinding();
|
FabricDependencySetup.finishBinding();
|
||||||
ApiShared.LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
|
ApiShared.LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
|
||||||
@@ -88,7 +87,7 @@ public class Main implements ClientModInitializer
|
|||||||
|
|
||||||
public static void initServer() {
|
public static void initServer() {
|
||||||
LodCommonMain.initConfig();
|
LodCommonMain.initConfig();
|
||||||
LodCommonMain.startup(null, true, new NetworkHandler());
|
LodCommonMain.startup(null, true);
|
||||||
FabricDependencySetup.createInitialBindings();
|
FabricDependencySetup.createInitialBindings();
|
||||||
FabricDependencySetup.finishBinding();
|
FabricDependencySetup.finishBinding();
|
||||||
ApiShared.LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
|
ApiShared.LOGGER.info(ModInfo.READABLE_NAME + ", Version: " + ModInfo.VERSION);
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.seibel.lod.fabric.mixins;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
|
|
||||||
|
#if PRE_MC_1_18_1
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.server.level.WorldGenRegion;
|
||||||
|
import net.minecraft.world.level.StructureFeatureManager;
|
||||||
|
import net.minecraft.world.level.biome.Biome;
|
||||||
|
import net.minecraft.world.level.levelgen.WorldgenRandom;
|
||||||
|
|
||||||
|
@Mixin(ChunkGenerator.class)
|
||||||
|
public class MixinChunkGenerator {
|
||||||
|
@Redirect(method = "applyBiomeDecoration", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/level/biome/Biome;generate(Lnet/minecraft/world/level/StructureFeatureManager;"
|
||||||
|
+ "Lnet/minecraft/world/level/chunk/ChunkGenerator;Lnet/minecraft/server/level/WorldGenRegion;J"
|
||||||
|
+ "Lnet/minecraft/world/level/levelgen/WorldgenRandom;Lnet/minecraft/core/BlockPos;)V"
|
||||||
|
|
||||||
|
))
|
||||||
|
private void wrapBiomeGenerateCall(Biome biome, StructureFeatureManager structFeatManager, ChunkGenerator generator,
|
||||||
|
WorldGenRegion genRegion, long l, WorldgenRandom random, BlockPos pos) {
|
||||||
|
synchronized(ChunkGenerator.class) {
|
||||||
|
biome.generate(structFeatManager, (ChunkGenerator)(Object)this, genRegion, l, random, pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
@Mixin(ChunkGenerator.class)
|
||||||
|
public class MixinChunkGenerator {}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.seibel.lod.fabric.mixins;
|
||||||
|
|
||||||
|
import com.seibel.lod.core.render.F3Screen;
|
||||||
|
import net.minecraft.client.gui.components.DebugScreenOverlay;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mixin(DebugScreenOverlay.class)
|
||||||
|
public class MixinDebugScreenOverlay {
|
||||||
|
|
||||||
|
@Inject(method = "getSystemInformation", at = @At("RETURN"))
|
||||||
|
private void addCustomF3(CallbackInfoReturnable<List<String>> cir) {
|
||||||
|
List<String> messages = cir.getReturnValue();
|
||||||
|
|
||||||
|
for (String i: F3Screen.f3List) {
|
||||||
|
messages.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.mixins;
|
package com.seibel.lod.fabric.mixins;
|
||||||
|
|
||||||
import com.seibel.lod.fabric.Main;
|
import com.seibel.lod.fabric.Main;
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.mixins;
|
package com.seibel.lod.fabric.mixins;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -15,7 +34,11 @@ import net.minecraft.client.renderer.FogRenderer.FogMode;
|
|||||||
import net.minecraft.world.effect.MobEffects;
|
import net.minecraft.world.effect.MobEffects;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
import net.minecraft.world.level.material.FluidState;
|
||||||
|
#else
|
||||||
import net.minecraft.world.level.material.FogType;
|
import net.minecraft.world.level.material.FogType;
|
||||||
|
#endif
|
||||||
|
|
||||||
@Mixin(FogRenderer.class)
|
@Mixin(FogRenderer.class)
|
||||||
public class MixinFogRenderer {
|
public class MixinFogRenderer {
|
||||||
@@ -25,16 +48,33 @@ public class MixinFogRenderer {
|
|||||||
private static final float A_REALLY_REALLY_BIG_VALUE = 420694206942069.F;
|
private static final float A_REALLY_REALLY_BIG_VALUE = 420694206942069.F;
|
||||||
private static final float A_EVEN_LARGER_VALUE = 42069420694206942069.F;
|
private static final float A_EVEN_LARGER_VALUE = 42069420694206942069.F;
|
||||||
|
|
||||||
@Inject(at = @At("RETURN"), method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZ)V")
|
@Inject(at = @At("RETURN"), method = "setupFog")
|
||||||
|
#if PRE_MC_1_19_1
|
||||||
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, CallbackInfo callback) {
|
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, CallbackInfo callback) {
|
||||||
|
#else
|
||||||
|
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float g, CallbackInfo callback) {
|
||||||
|
#endif
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
FluidState fluidState = camera.getFluidInCamera();
|
||||||
|
boolean cameraNotInFluid = fluidState.isEmpty();
|
||||||
|
#else
|
||||||
FogType fogTypes = camera.getFluidInCamera();
|
FogType fogTypes = camera.getFluidInCamera();
|
||||||
|
boolean cameraNotInFluid = fogTypes == FogType.NONE;
|
||||||
|
#endif
|
||||||
|
|
||||||
Entity entity = camera.getEntity();
|
Entity entity = camera.getEntity();
|
||||||
boolean isUnderWater = (entity instanceof LivingEntity) && ((LivingEntity)entity).hasEffect(MobEffects.BLINDNESS);
|
boolean isSpecialFog = (entity instanceof LivingEntity) && ((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS);
|
||||||
if (!isUnderWater) {
|
if (!isSpecialFog && cameraNotInFluid && fogMode == FogMode.FOG_TERRAIN
|
||||||
if (fogMode == FogMode.FOG_TERRAIN && fogTypes == FogType.NONE && CONFIG.client().graphics().fogQuality().getDisableVanillaFog()) {
|
&& CONFIG.client().graphics().fogQuality().getDisableVanillaFog())
|
||||||
|
{
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
|
||||||
|
RenderSystem.fogEnd(A_EVEN_LARGER_VALUE);
|
||||||
|
#else
|
||||||
RenderSystem.setShaderFogStart(A_REALLY_REALLY_BIG_VALUE);
|
RenderSystem.setShaderFogStart(A_REALLY_REALLY_BIG_VALUE);
|
||||||
RenderSystem.setShaderFogEnd(A_EVEN_LARGER_VALUE);
|
RenderSystem.setShaderFogEnd(A_EVEN_LARGER_VALUE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.mixins;
|
package com.seibel.lod.fabric.mixins;
|
||||||
|
|
||||||
import com.seibel.lod.fabric.Main;
|
import com.seibel.lod.fabric.Main;
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.mixins;
|
package com.seibel.lod.fabric.mixins;
|
||||||
|
|
||||||
import com.seibel.lod.common.wrappers.config.ConfigGui;
|
import com.seibel.lod.common.wrappers.config.ConfigGui;
|
||||||
@@ -8,7 +27,9 @@ import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
|||||||
import net.minecraft.client.gui.screens.OptionsScreen;
|
import net.minecraft.client.gui.screens.OptionsScreen;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
#if PRE_MC_1_19
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
|
#endif
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -20,7 +41,7 @@ import java.util.Objects;
|
|||||||
/**
|
/**
|
||||||
* Adds a button to the menu to goto the config
|
* Adds a button to the menu to goto the config
|
||||||
*
|
*
|
||||||
* @author coolGi2007
|
* @author coolGi
|
||||||
* @version 12-02-2021
|
* @version 12-02-2021
|
||||||
*/
|
*/
|
||||||
@Mixin(OptionsScreen.class)
|
@Mixin(OptionsScreen.class)
|
||||||
@@ -34,7 +55,8 @@ public class MixinOptionsScreen extends Screen {
|
|||||||
@Inject(at = @At("HEAD"),method = "init")
|
@Inject(at = @At("HEAD"),method = "init")
|
||||||
private void lodconfig$init(CallbackInfo ci) {
|
private void lodconfig$init(CallbackInfo ci) {
|
||||||
if (SingletonHandler.get(ILodConfigWrapperSingleton.class).client().getOptionsButton())
|
if (SingletonHandler.get(ILodConfigWrapperSingleton.class).client().getOptionsButton())
|
||||||
this.addRenderableWidget(new TexturedButtonWidget(
|
this. #if PRE_MC_1_17_1 addButton #else addRenderableWidget #endif
|
||||||
|
(new TexturedButtonWidget(
|
||||||
// Where the button is on the screen
|
// Where the button is on the screen
|
||||||
this.width / 2 - 180, this.height / 6 - 12,
|
this.width / 2 - 180, this.height / 6 - 12,
|
||||||
// Width and height of the button
|
// Width and height of the button
|
||||||
@@ -47,6 +69,10 @@ public class MixinOptionsScreen extends Screen {
|
|||||||
// For now it goes to the client option by default
|
// For now it goes to the client option by default
|
||||||
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, "client")),
|
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, "client")),
|
||||||
// Add a title to the screen
|
// Add a title to the screen
|
||||||
|
#if PRE_MC_1_19
|
||||||
new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title")));
|
new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title")));
|
||||||
|
#else
|
||||||
|
Component.translatable("text.autoconfig." + ModInfo.ID + ".title")));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.mixins;
|
package com.seibel.lod.fabric.mixins;
|
||||||
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
@@ -16,7 +35,17 @@ import net.minecraft.Util;
|
|||||||
@Mixin(Util.class)
|
@Mixin(Util.class)
|
||||||
public class MixinUtilBackgroudThread
|
public class MixinUtilBackgroudThread
|
||||||
{
|
{
|
||||||
|
@Inject(method = "backgroundExecutor", at = @At("HEAD"), cancellable = true)
|
||||||
|
private static void overrideUtil$backgroundExecutor(CallbackInfoReturnable<ExecutorService> ci)
|
||||||
|
{
|
||||||
|
if (ClientProxy.isGenerationThreadChecker != null && ClientProxy.isGenerationThreadChecker.get())
|
||||||
|
{
|
||||||
|
//ApiShared.LOGGER.info("util backgroundExecutor triggered");
|
||||||
|
ci.setReturnValue(new DummyRunExecutorService());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if POST_MC_1_17_1
|
||||||
@Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;",
|
@Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;",
|
||||||
at = @At("HEAD"), cancellable = true)
|
at = @At("HEAD"), cancellable = true)
|
||||||
private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable<Runnable> ci)
|
private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable<Runnable> ci)
|
||||||
@@ -27,6 +56,8 @@ public class MixinUtilBackgroudThread
|
|||||||
ci.setReturnValue(r);
|
ci.setReturnValue(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if POST_MC_1_18_1
|
||||||
@Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;",
|
@Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;",
|
||||||
at = @At("HEAD"), cancellable = true)
|
at = @At("HEAD"), cancellable = true)
|
||||||
private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier<?> r, CallbackInfoReturnable<Supplier<?>> ci)
|
private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier<?> r, CallbackInfoReturnable<Supplier<?>> ci)
|
||||||
@@ -37,14 +68,6 @@ public class MixinUtilBackgroudThread
|
|||||||
ci.setReturnValue(r);
|
ci.setReturnValue(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
@Inject(method = "backgroundExecutor", at = @At("HEAD"), cancellable = true)
|
|
||||||
private static void overrideUtil$backgroundExecutor(CallbackInfoReturnable<ExecutorService> ci)
|
|
||||||
{
|
|
||||||
if (ClientProxy.isGenerationThreadChecker != null && ClientProxy.isGenerationThreadChecker.get())
|
|
||||||
{
|
|
||||||
//ApiShared.LOGGER.info("util backgroundExecutor triggered");
|
|
||||||
ci.setReturnValue(new DummyRunExecutorService());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 James Seibel
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,13 +20,19 @@
|
|||||||
package com.seibel.lod.fabric.mixins;
|
package com.seibel.lod.fabric.mixins;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
#if PRE_MC_1_19_3
|
||||||
import com.mojang.math.Matrix4f;
|
import com.mojang.math.Matrix4f;
|
||||||
|
#else
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
#endif
|
||||||
|
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;
|
||||||
import net.minecraft.client.Camera;
|
import net.minecraft.client.Camera;
|
||||||
import net.minecraft.client.renderer.LevelRenderer;
|
import net.minecraft.client.renderer.LevelRenderer;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
import org.lwjgl.opengl.GL15;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
@@ -41,7 +47,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
*
|
*
|
||||||
* This is also the mixin for rendering the clouds
|
* This is also the mixin for rendering the clouds
|
||||||
*
|
*
|
||||||
* @author coolGi2007
|
* @author coolGi
|
||||||
* @author James Seibel
|
* @author James Seibel
|
||||||
* @version 12-31-2021
|
* @version 12-31-2021
|
||||||
*/
|
*/
|
||||||
@@ -54,6 +60,40 @@ public class MixinWorldRenderer
|
|||||||
throw new NullPointerException("Null cannot be cast to non-null type.");
|
throw new NullPointerException("Null cannot be cast to non-null type.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Inject rendering at first call to renderChunkLayer
|
||||||
|
// HEAD or RETURN
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
@Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;F)V")
|
||||||
|
private void renderSky(PoseStack matrixStackIn, float partialTicks, CallbackInfo callback)
|
||||||
|
{
|
||||||
|
// get the partial ticks since renderBlockLayer doesn't
|
||||||
|
// have access to them
|
||||||
|
previousPartialTicks = partialTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(at = @At("HEAD"),
|
||||||
|
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDD)V",
|
||||||
|
cancellable = true)
|
||||||
|
private void renderChunkLayer(RenderType renderType, PoseStack matrixStackIn, double xIn, double yIn, double zIn, CallbackInfo callback)
|
||||||
|
{
|
||||||
|
// only render before solid blocks
|
||||||
|
if (renderType.equals(RenderType.solid()))
|
||||||
|
{
|
||||||
|
// get MC's current projection matrix
|
||||||
|
float[] mcProjMatrixRaw = new float[16];
|
||||||
|
GL15.glGetFloatv(GL15.GL_PROJECTION_MATRIX, mcProjMatrixRaw);
|
||||||
|
Mat4f mcProjectionMatrix = new Mat4f(mcProjMatrixRaw);
|
||||||
|
mcProjectionMatrix.transpose();
|
||||||
|
Mat4f mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose());
|
||||||
|
|
||||||
|
ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks);
|
||||||
|
}
|
||||||
|
if (Config.Client.Advanced.lodOnlyMode) {
|
||||||
|
callback.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#elif PRE_MC_1_19_3
|
||||||
@Inject(method = "renderClouds", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "renderClouds", at = @At("HEAD"), cancellable = true)
|
||||||
public void renderClouds(PoseStack poseStack, Matrix4f projectionMatrix, float tickDelta, double cameraX, double cameraY, double cameraZ, CallbackInfo ci) {
|
public void renderClouds(PoseStack poseStack, Matrix4f projectionMatrix, float tickDelta, double cameraX, double cameraY, double cameraZ, CallbackInfo ci) {
|
||||||
// get the partial ticks since renderChunkLayer doesn't
|
// get the partial ticks since renderChunkLayer doesn't
|
||||||
@@ -61,23 +101,6 @@ public class MixinWorldRenderer
|
|||||||
previousPartialTicks = tickDelta;
|
previousPartialTicks = tickDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HEAD or RETURN
|
|
||||||
@Inject(at = @At("RETURN"),
|
|
||||||
method = "renderSky",
|
|
||||||
cancellable = true)
|
|
||||||
private void renderLod(PoseStack modelViewMatrixStack, Matrix4f projectionMatrix, float f,
|
|
||||||
#if MC_VERSION_1_18_2 Camera camera, boolean bl,#endif Runnable r, CallbackInfo callback) {
|
|
||||||
|
|
||||||
Mat4f mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose());
|
|
||||||
Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix);
|
|
||||||
|
|
||||||
ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
// 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",
|
||||||
cancellable = true)
|
cancellable = true)
|
||||||
@@ -91,6 +114,34 @@ public class MixinWorldRenderer
|
|||||||
|
|
||||||
ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks);
|
ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks);
|
||||||
}
|
}
|
||||||
//callback.cancel();
|
if (Config.Client.Advanced.lodOnlyMode) {
|
||||||
}*/
|
callback.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
@Inject(method = "renderClouds", at = @At("HEAD"), cancellable = true)
|
||||||
|
public void renderClouds(PoseStack poseStack, Matrix4f projectionMatrix, float tickDelta, double cameraX, double cameraY, double cameraZ, CallbackInfo ci) {
|
||||||
|
// get the partial ticks since renderChunkLayer doesn't
|
||||||
|
// have access to them
|
||||||
|
previousPartialTicks = tickDelta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(at = @At("HEAD"),
|
||||||
|
method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLorg/joml/Matrix4f;)V",
|
||||||
|
cancellable = true)
|
||||||
|
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||||
|
{
|
||||||
|
// only render before solid blocks
|
||||||
|
if (renderType.equals(RenderType.solid()))
|
||||||
|
{
|
||||||
|
Mat4f mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose());
|
||||||
|
Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix);
|
||||||
|
|
||||||
|
ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks);
|
||||||
|
}
|
||||||
|
if (Config.Client.Advanced.lodOnlyMode) {
|
||||||
|
callback.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.mixins.events;
|
package com.seibel.lod.fabric.mixins.events;
|
||||||
|
|
||||||
import com.seibel.lod.fabric.Main;
|
import com.seibel.lod.fabric.Main;
|
||||||
|
|||||||
@@ -1,13 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.mixins.events;
|
package com.seibel.lod.fabric.mixins.events;
|
||||||
|
|
||||||
import com.seibel.lod.fabric.Main;
|
import com.seibel.lod.fabric.Main;
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||||
import net.minecraft.client.renderer.LevelRenderer;
|
import net.minecraft.client.renderer.LevelRenderer;
|
||||||
#if MC_VERSION_1_18_2
|
#if POST_MC_1_18_2
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
#endif
|
#endif
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.util.profiling.ProfilerFiller;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
import net.minecraft.world.level.chunk.LevelChunk;
|
||||||
import net.minecraft.world.level.dimension.DimensionType;
|
import net.minecraft.world.level.dimension.DimensionType;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -20,27 +41,26 @@ import java.util.function.Supplier;
|
|||||||
/**
|
/**
|
||||||
* This class is used for world loading events
|
* This class is used for world loading events
|
||||||
* @author Ran
|
* @author Ran
|
||||||
|
*
|
||||||
|
* FIXME: Why does forge not have the 1.18+ onChunkLightReady mixin?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Mixin(ClientLevel.class)
|
@Mixin(ClientLevel.class)
|
||||||
public class MixinClientLevel {
|
public class MixinClientLevel {
|
||||||
#if MC_VERSION_1_18_2
|
|
||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
private void loadWorldEvent(ClientPacketListener clientPacketListener, ClientLevel.ClientLevelData clientLevelData, ResourceKey resourceKey, Holder holder, int i, int j, Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) {
|
private void loadWorldEvent(ClientPacketListener clientPacketListener, ClientLevel.ClientLevelData clientLevelData, ResourceKey resourceKey,
|
||||||
|
#if POST_MC_1_18_2 Holder holder, #else DimensionType dimensionType, #endif int i,
|
||||||
|
#if POST_MC_1_18_1 int j, #endif Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) {
|
||||||
Main.client_proxy.worldLoadEvent((ClientLevel) (Object) this);
|
Main.client_proxy.worldLoadEvent((ClientLevel) (Object) this);
|
||||||
}
|
}
|
||||||
#elif MC_VERSION_1_18_1
|
|
||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
|
||||||
private void loadWorldEvent(ClientPacketListener clientPacketListener, ClientLevel.ClientLevelData clientLevelData, ResourceKey resourceKey, DimensionType dimensionType, int i, int j, Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) {
|
|
||||||
Main.client_proxy.worldLoadEvent((ClientLevel) (Object) this);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#if POST_MC_1_18_1
|
||||||
@Inject(method = "setLightReady", at = @At("HEAD"))
|
@Inject(method = "setLightReady", at = @At("HEAD"))
|
||||||
private void onChunkLightReady(int x, int z, CallbackInfo ci) {
|
private void onChunkLightReady(int x, int z, CallbackInfo ci) {
|
||||||
ClientLevel l = (ClientLevel) (Object) this;
|
ClientLevel l = (ClientLevel) (Object) this;
|
||||||
LevelChunk chunk = l.getChunkSource().getChunk(x, z, false);
|
LevelChunk chunk = l.getChunkSource().getChunk(x, z, false);
|
||||||
if (chunk!=null && !chunk.isClientLightReady())
|
if (chunk!=null&& !chunk.isClientLightReady())
|
||||||
Main.client_proxy.chunkLoadEvent(l, chunk);
|
Main.client_proxy.chunkLoadEvent(l, chunk);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.seibel.lod.fabric.mixins.events;
|
||||||
|
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.NativeImage;
|
||||||
|
import com.seibel.lod.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||||
|
import com.seibel.lod.core.api.ApiShared;
|
||||||
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(LightTexture.class)
|
||||||
|
public class MixinLightmap {
|
||||||
|
@Shadow
|
||||||
|
@Final
|
||||||
|
public NativeImage lightPixels;
|
||||||
|
|
||||||
|
@Inject(method="updateLightTexture", at=@At(
|
||||||
|
value="INVOKE",
|
||||||
|
target="Lnet/minecraft/client/renderer/texture/DynamicTexture;upload()V"))
|
||||||
|
public void updateLightTexture(float f, CallbackInfo ci) {
|
||||||
|
//ApiShared.LOGGER.info("Lightmap update");
|
||||||
|
MinecraftRenderWrapper.INSTANCE.updateLightmap(lightPixels);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.mixins.events;
|
package com.seibel.lod.fabric.mixins.events;
|
||||||
|
|
||||||
import com.seibel.lod.fabric.Main;
|
import com.seibel.lod.fabric.Main;
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.mixins.events;
|
package com.seibel.lod.fabric.mixins.events;
|
||||||
|
|
||||||
import com.seibel.lod.fabric.Main;
|
import com.seibel.lod.fabric.Main;
|
||||||
@@ -14,13 +33,19 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
*/
|
*/
|
||||||
@Mixin(ServerLevel.class)
|
@Mixin(ServerLevel.class)
|
||||||
public class MixinServerLevel {
|
public class MixinServerLevel {
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
@Inject(method = "save", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerChunkCache;save(Z)V", shift = At.Shift.AFTER))
|
||||||
|
private void saveWorldEvent(ProgressListener progressListener, boolean bl, boolean bl2, CallbackInfo ci) {
|
||||||
|
Main.client_proxy.worldSaveEvent();
|
||||||
|
}
|
||||||
|
#else
|
||||||
@Inject(method = "save", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/entity/PersistentEntitySectionManager;saveAll()V", shift = At.Shift.AFTER))
|
@Inject(method = "save", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/entity/PersistentEntitySectionManager;saveAll()V", shift = At.Shift.AFTER))
|
||||||
private void saveWorldEvent_sA(ProgressListener progressListener, boolean bl, boolean bl2, CallbackInfo ci) {
|
private void saveWorldEvent_sA(ProgressListener progressListener, boolean bl, boolean bl2, CallbackInfo ci) {
|
||||||
Main.client_proxy.worldSaveEvent();
|
Main.client_proxy.worldSaveEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "save", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/entity/PersistentEntitySectionManager;autoSave()V", shift = At.Shift.AFTER))
|
@Inject(method = "save", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/entity/PersistentEntitySectionManager;autoSave()V", shift = At.Shift.AFTER))
|
||||||
private void saveWorldEvent_aS(ProgressListener progressListener, boolean bl, boolean bl2, CallbackInfo ci) {
|
private void saveWorldEvent_aS(ProgressListener progressListener, boolean bl, boolean bl2, CallbackInfo ci) {
|
||||||
Main.client_proxy.worldSaveEvent();
|
Main.client_proxy.worldSaveEvent();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-1
@@ -1,7 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.mixins.unsafe;
|
package com.seibel.lod.fabric.mixins.unsafe;
|
||||||
|
|
||||||
import net.minecraft.util.ThreadingDetector;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
|
||||||
|
#if POST_MC_1_18_1
|
||||||
|
|
||||||
|
import net.minecraft.util.ThreadingDetector;
|
||||||
import org.spongepowered.asm.mixin.Mutable;
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -24,3 +47,7 @@ public class MixinThreadingDectector {
|
|||||||
this.lock = new Semaphore(2);
|
this.lock = new Semaphore(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
@Mixin(ServerLevel.class)
|
||||||
|
public class MixinThreadingDectector {} //FIXME: Is there some way to make this file just not be added?
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.seibel.lod.fabric.networking;
|
|
||||||
|
|
||||||
import com.seibel.lod.common.networking.NetworkInterface;
|
|
||||||
import com.seibel.lod.common.networking.Networking;
|
|
||||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
|
||||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Ran
|
|
||||||
*/
|
|
||||||
public class NetworkHandler implements NetworkInterface {
|
|
||||||
@Override
|
|
||||||
public void register_Client() {
|
|
||||||
ClientPlayNetworking.registerGlobalReceiver(Networking.resourceLocation_meow, (client, handler, buf, responseSender) -> {
|
|
||||||
com.seibel.lod.common.networking.NetworkHandler.receivePacketClient(client, handler, buf);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void register_Server() {
|
|
||||||
ServerPlayNetworking.registerGlobalReceiver(Networking.resourceLocation_meow, (server, player, handler, buf, responseSender) -> {
|
|
||||||
com.seibel.lod.common.networking.NetworkHandler.receivePacketServer(server, player, handler, buf);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.wrappers;
|
package com.seibel.lod.fabric.wrappers;
|
||||||
|
|
||||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
|
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.wrappers.config;
|
package com.seibel.lod.fabric.wrappers.config;
|
||||||
|
|
||||||
import com.seibel.lod.common.wrappers.config.ConfigGui;
|
import com.seibel.lod.common.wrappers.config.ConfigGui;
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.wrappers.modAccessor;
|
package com.seibel.lod.fabric.wrappers.modAccessor;
|
||||||
|
|
||||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
|
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.wrappers.modAccessor;
|
package com.seibel.lod.fabric.wrappers.modAccessor;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|||||||
+83
-8
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.wrappers.modAccessor;
|
package com.seibel.lod.fabric.wrappers.modAccessor;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -6,37 +25,93 @@ import java.util.stream.Collectors;
|
|||||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
|
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
|
||||||
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
|
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
|
||||||
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
|
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
|
||||||
|
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
|
import com.seibel.lod.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
|
||||||
|
|
||||||
|
|
||||||
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
|
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.network.protocol.Packet;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
|
import net.minecraft.world.phys.AABB;
|
||||||
|
#else
|
||||||
import net.minecraft.world.level.LevelHeightAccessor;
|
import net.minecraft.world.level.LevelHeightAccessor;
|
||||||
|
#endif
|
||||||
|
|
||||||
public class SodiumAccessor implements ISodiumAccessor {
|
public class SodiumAccessor implements ISodiumAccessor {
|
||||||
IWrapperFactory factory = SingletonHandler.get(IWrapperFactory.class);
|
private final IWrapperFactory factory = SingletonHandler.get(IWrapperFactory.class);
|
||||||
|
private final IMinecraftRenderWrapper MC_RENDER = SingletonHandler.get(IMinecraftRenderWrapper.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModName() {
|
public String getModName() {
|
||||||
return "Sodium-Fabric-1.18.X";
|
return "Sodium-Fabric";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if POST_MC_1_17_1
|
||||||
@Override
|
@Override
|
||||||
public HashSet<AbstractChunkPosWrapper> getNormalRenderedChunks() {
|
public HashSet<AbstractChunkPosWrapper> getNormalRenderedChunks() {
|
||||||
SodiumWorldRenderer renderer = SodiumWorldRenderer.instance();
|
SodiumWorldRenderer renderer = SodiumWorldRenderer.instance();
|
||||||
LevelHeightAccessor height = Minecraft.getInstance().level;
|
LevelHeightAccessor height = Minecraft.getInstance().level;
|
||||||
|
|
||||||
|
#if POST_MC_1_18_1
|
||||||
// 0b11 = Lighted chunk & loaded chunk
|
// 0b11 = Lighted chunk & loaded chunk
|
||||||
return renderer.getChunkTracker().getChunks(0b00).filter(
|
return renderer.getChunkTracker().getChunks(0b00).filter(
|
||||||
(long l) -> {
|
(long l) -> {
|
||||||
return true;
|
return true;
|
||||||
//for (int i = height.getMinSection(); i<height.getMaxSection(); i++) {
|
|
||||||
// SectionPos p = SectionPos.of(new ChunkPos(l), i);
|
|
||||||
// if (renderer.isBoxVisible(p.minBlockX()+1, p.minBlockY()+1, p.minBlockZ()+1,
|
|
||||||
// p.maxBlockX()-1, p.maxBlockY()-1, p.maxBlockZ()-1)) return true;
|
|
||||||
//}
|
|
||||||
//return false;
|
|
||||||
}).mapToObj((long l) -> {
|
}).mapToObj((long l) -> {
|
||||||
return (AbstractChunkPosWrapper)factory.createChunkPos(l);
|
return (AbstractChunkPosWrapper)factory.createChunkPos(l);
|
||||||
}).collect(Collectors.toCollection(HashSet::new));
|
}).collect(Collectors.toCollection(HashSet::new));
|
||||||
|
#else
|
||||||
|
// TODO: Maybe use a mixin to make this more efficient, and maybe ignore changes behind the camera
|
||||||
|
return MC_RENDER.getMaximumRenderedChunks().stream().filter((AbstractChunkPosWrapper chunk) -> {
|
||||||
|
return (renderer.isBoxVisible(
|
||||||
|
chunk.getMinBlockX()+1, height.getMinBuildHeight()+1, chunk.getMinBlockZ()+1,
|
||||||
|
chunk.getMinBlockX()+15, height.getMaxBuildHeight()-1, chunk.getMinBlockZ()+15));
|
||||||
|
}).collect(Collectors.toCollection(HashSet::new));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
@Override
|
||||||
|
public HashSet<AbstractChunkPosWrapper> getNormalRenderedChunks() {
|
||||||
|
SodiumWorldRenderer renderer = SodiumWorldRenderer.getInstance();
|
||||||
|
LevelAccessor height = Minecraft.getInstance().level;
|
||||||
|
// TODO: Maybe use a mixin to make this more efficient
|
||||||
|
return MC_RENDER.getMaximumRenderedChunks().stream().filter((AbstractChunkPosWrapper chunk) -> {
|
||||||
|
FakeChunkEntity AABB = new FakeChunkEntity(chunk.getX(), chunk.getZ(), height.getMaxBuildHeight());
|
||||||
|
return (renderer.isEntityVisible(AABB));
|
||||||
|
}).collect(Collectors.toCollection(HashSet::new));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class FakeChunkEntity extends Entity {
|
||||||
|
public int cx;
|
||||||
|
public int cz;
|
||||||
|
public int my;
|
||||||
|
public FakeChunkEntity(int chunkX, int chunkZ, int maxHeight) {
|
||||||
|
super(EntityType.AREA_EFFECT_CLOUD, null);
|
||||||
|
cx = chunkX;
|
||||||
|
cz = chunkZ;
|
||||||
|
my = maxHeight;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public AABB getBoundingBoxForCulling() {
|
||||||
|
return new AABB(cx*16+1, 1, cz*16+1,
|
||||||
|
cx*16+15, my-1, cz*16+15);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void defineSynchedData() {}
|
||||||
|
@Override
|
||||||
|
protected void readAdditionalSaveData(CompoundTag paramCompoundTag) {}
|
||||||
|
@Override
|
||||||
|
protected void addAdditionalSaveData(CompoundTag paramCompoundTag) {}
|
||||||
|
@Override
|
||||||
|
public Packet<?> getAddEntityPacket() {
|
||||||
|
throw new UnsupportedOperationException("This is a FAKE CHUNK ENTITY... For tricking the Sodium to check a AABB.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+19
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
|
* licensed under the GNU GPL 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 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.fabric.wrappers.modAccessor;
|
package com.seibel.lod.fabric.wrappers.modAccessor;
|
||||||
|
|
||||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
|
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "com.seibel.lod.fabric.mixins",
|
"package": "com.seibel.lod.fabric.mixins",
|
||||||
"compatibilityLevel": "JAVA_17",
|
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"unsafe.MixinThreadingDectector",
|
"unsafe.MixinThreadingDectector",
|
||||||
"MixinUtilBackgroudThread",
|
"MixinUtilBackgroudThread",
|
||||||
@@ -13,9 +12,12 @@
|
|||||||
"MixinOptionsScreen",
|
"MixinOptionsScreen",
|
||||||
"MixinWorldRenderer",
|
"MixinWorldRenderer",
|
||||||
"MixinFogRenderer",
|
"MixinFogRenderer",
|
||||||
|
"MixinChunkGenerator",
|
||||||
|
"MixinDebugScreenOverlay",
|
||||||
"events.MixinClientLevel",
|
"events.MixinClientLevel",
|
||||||
"events.MixinMinecraft",
|
"events.MixinMinecraft",
|
||||||
"events.MixinBlockUpdate"
|
"events.MixinBlockUpdate",
|
||||||
|
"events.MixinLightmap"
|
||||||
],
|
],
|
||||||
"server": [
|
"server": [
|
||||||
"MixinDedicatedServer"
|
"MixinDedicatedServer"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
"name": "${mod_name}",
|
"name": "${mod_name}",
|
||||||
"description": "${description}",
|
"description": "${description}",
|
||||||
"authors": ["${authors}"],
|
"authors": $authors,
|
||||||
|
|
||||||
"contact": {
|
"contact": {
|
||||||
"homepage": "${homepage}",
|
"homepage": "${homepage}",
|
||||||
@@ -33,13 +33,12 @@
|
|||||||
"accessWidener" : "lod.accesswidener",
|
"accessWidener" : "lod.accesswidener",
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": "*",
|
"fabricloader": "*",
|
||||||
"fabric": "*",
|
"fabric-lifecycle-events-v1": "*",
|
||||||
"minecraft": "${minecraft_version}",
|
"fabric-key-binding-api-v1": "*",
|
||||||
|
"fabric-networking-api-v1": "*",
|
||||||
|
"minecraft": $compatible_minecraft_versions,
|
||||||
"java": ">=${java_version}"
|
"java": ">=${java_version}"
|
||||||
},
|
},
|
||||||
"suggests": {
|
|
||||||
"another-mod": "*"
|
|
||||||
},
|
|
||||||
|
|
||||||
"custom": {
|
"custom": {
|
||||||
"modmenu": {
|
"modmenu": {
|
||||||
|
|||||||
+180
-2
@@ -1,12 +1,23 @@
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "com.github.johnrengelman.shadow" version "7.1.0"
|
id "com.github.johnrengelman.shadow" version "7.1.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply plugin: "java"
|
||||||
|
apply plugin: "architectury-plugin"
|
||||||
|
apply plugin: "maven-publish"
|
||||||
|
apply plugin: "dev.architectury.loom"
|
||||||
|
|
||||||
|
archivesBaseName = rootProject.archives_base_name
|
||||||
|
version = rootProject.mod_version //FIXME: HERE repeated def
|
||||||
|
group = rootProject.maven_group
|
||||||
|
|
||||||
version = rootProject.mod_version+"-"+rootProject.minecraft_version+"-"+new Date().format("yyyy_MM_dd_HH_mm")
|
version = rootProject.mod_version+"-"+rootProject.minecraft_version+"-"+new Date().format("yyyy_MM_dd_HH_mm")
|
||||||
|
|
||||||
loom {
|
|
||||||
accessWidenerPath.set(project(":common").file("src/main/resources/lod.accesswidener"))
|
|
||||||
|
|
||||||
|
loom {
|
||||||
|
silentMojangMappingsLicense()
|
||||||
|
accessWidenerPath.set(project(":common").file("src/main/resources/${acsessWidenerVersion}.lod.accesswidener"))
|
||||||
forge {
|
forge {
|
||||||
convertAccessWideners.set(true)
|
convertAccessWideners.set(true)
|
||||||
extraAccessWideners.add("lod.accesswidener")
|
extraAccessWideners.add("lod.accesswidener")
|
||||||
@@ -20,11 +31,21 @@ architectury {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
|
common
|
||||||
|
shadowMe
|
||||||
|
implementation.extendsFrom shadowMe
|
||||||
|
|
||||||
compileClasspath.extendsFrom common
|
compileClasspath.extendsFrom common
|
||||||
runtimeClasspath.extendsFrom common
|
runtimeClasspath.extendsFrom common
|
||||||
developmentForge.extendsFrom common
|
developmentForge.extendsFrom common
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
jar.dependsOn(project(":core").remapJar)
|
||||||
|
remapSourcesJar.dependsOn(project(":core").remapJar)
|
||||||
|
|
||||||
def addMod(path, enabled) {
|
def addMod(path, enabled) {
|
||||||
if (enabled == "2")
|
if (enabled == "2")
|
||||||
dependencies { modImplementation(path) }
|
dependencies { modImplementation(path) }
|
||||||
@@ -33,6 +54,35 @@ def addMod(path, enabled) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
|
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
||||||
|
// The following line declares the mojmap mappings & parchment mappings
|
||||||
|
mappings loom.layered() {
|
||||||
|
// Mojmap mappings
|
||||||
|
officialMojangMappings()
|
||||||
|
// Parchment mappings (it adds parameter mappings & javadoc)
|
||||||
|
if (
|
||||||
|
rootProject.minecraft_version != "1.19"
|
||||||
|
&& rootProject.minecraft_version != "1.19.1"
|
||||||
|
&& rootProject.minecraft_version != "1.19.2"
|
||||||
|
&& rootProject.minecraft_version != "1.19.3"
|
||||||
|
&& rootProject.minecraft_version != "1.19.4"
|
||||||
|
) // We are not gonna use this build script anymore so dont bother fixing this
|
||||||
|
parchment("org.parchmentmc.data:parchment-${rootProject.minecraft_version}:${rootProject.parchment_version}@zip")
|
||||||
|
else
|
||||||
|
parchment("org.parchmentmc.data:parchment-1.18.2:${rootProject.parchment_version}@zip") // As 1.19.x or higher doesnt have parchment mappings yet, we use 1.18.2 mapping
|
||||||
|
// Note: parchment may have later mappings at the time you are reading this, but at the time this was written, it didnt
|
||||||
|
// Check the main branch for the new build system, with the working mappings
|
||||||
|
}
|
||||||
|
|
||||||
|
//Manifold
|
||||||
|
annotationProcessor "systems.manifold:manifold-preprocessor:${rootProject.manifold_version}"
|
||||||
|
|
||||||
|
// Toml
|
||||||
|
implementation("com.electronwill.night-config:toml:${rootProject.toml_version}")
|
||||||
|
|
||||||
|
common(project(":core")) { transitive false }
|
||||||
|
|
||||||
// Forge loader
|
// Forge loader
|
||||||
forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}"
|
forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}"
|
||||||
|
|
||||||
@@ -40,8 +90,11 @@ dependencies {
|
|||||||
addMod("curse.maven:starlight-forge-526854:${rootProject.starlight_version_forge}", rootProject.enable_starlight_forge)
|
addMod("curse.maven:starlight-forge-526854:${rootProject.starlight_version_forge}", rootProject.enable_starlight_forge)
|
||||||
annotationProcessor "org.spongepowered:mixin:0.8.4:processor"
|
annotationProcessor "org.spongepowered:mixin:0.8.4:processor"
|
||||||
|
|
||||||
|
addMod("curse.maven:TerraForged-363820:${rootProject.terraforged_version}", rootProject.enable_terraforged)
|
||||||
|
|
||||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||||
shadowMe(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
|
shadowMe(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
|
||||||
|
shadowMe files(project(":core").file("build/libs/DistantHorizons-${rootProject.mod_version}.jar"))
|
||||||
|
|
||||||
// forgeDependencies(project(":core")) { transitive false }
|
// forgeDependencies(project(":core")) { transitive false }
|
||||||
|
|
||||||
@@ -56,6 +109,13 @@ dependencies {
|
|||||||
shadowMe 'org.apache.commons:commons-compress:1.21'
|
shadowMe 'org.apache.commons:commons-compress:1.21'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copies the correct accesswidener and renames it
|
||||||
|
task copyAccessWidener(type: Copy) {
|
||||||
|
from project(":common").file("src/main/resources/${rootProject.acsessWidenerVersion}.lod.accesswidener")
|
||||||
|
into(file("build/resources/main"))
|
||||||
|
rename "${rootProject.acsessWidenerVersion}.lod.accesswidener", "lod.accesswidener"
|
||||||
|
}
|
||||||
|
|
||||||
task copyCoreResources(type: Copy) {
|
task copyCoreResources(type: Copy) {
|
||||||
from fileTree(project(":core").file("src/main/resources"))
|
from fileTree(project(":core").file("src/main/resources"))
|
||||||
into file("build/resources/main")
|
into file("build/resources/main")
|
||||||
@@ -66,9 +126,46 @@ task copyCommonResources(type: Copy) {
|
|||||||
into file("build/resources/main")
|
into file("build/resources/main")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Put stuff from gradle.properties into the mod info
|
||||||
processResources {
|
processResources {
|
||||||
|
dependsOn(copyAccessWidener)
|
||||||
dependsOn(copyCoreResources)
|
dependsOn(copyCoreResources)
|
||||||
dependsOn(copyCommonResources)
|
dependsOn(copyCommonResources)
|
||||||
|
|
||||||
|
def resourceTargets = ["fabric.mod.json", "META-INF/mods.toml"] // Location of where to put
|
||||||
|
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
||||||
|
def replaceProperties = [
|
||||||
|
version : mod_version,
|
||||||
|
mod_name : mod_name,
|
||||||
|
authors : mod_authors,
|
||||||
|
description : mod_description,
|
||||||
|
homepage : mod_homepage,
|
||||||
|
source : mod_source,
|
||||||
|
issues : mod_issues,
|
||||||
|
minecraft_version : minecraft_version,
|
||||||
|
compatible_minecraft_versions: compatible_minecraft_versions,
|
||||||
|
java_version : java_version
|
||||||
|
]
|
||||||
|
// The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties
|
||||||
|
//TODO: Make Forge loader version also be relaced with non hardcoded value instead of "[36,42)"
|
||||||
|
|
||||||
|
inputs.properties replaceProperties
|
||||||
|
replaceProperties.put 'project', project
|
||||||
|
filesMatching(resourceTargets) {
|
||||||
|
expand replaceProperties
|
||||||
|
}
|
||||||
|
|
||||||
|
intoTargets.each { target ->
|
||||||
|
if (file(target).exists()) {
|
||||||
|
copy {
|
||||||
|
from(sourceSets.main.resources) {
|
||||||
|
include resourceTargets
|
||||||
|
expand replaceProperties
|
||||||
|
}
|
||||||
|
into target
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
@@ -93,6 +190,11 @@ remapJar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
manifest {
|
||||||
|
attributes 'Implementation-Title': rootProject.archives_base_name,
|
||||||
|
'Implementation-Version': rootProject.mod_version,
|
||||||
|
'Main-Class': 'com.seibel.lod.core.JarMain' // When changing the main of the jar change this line
|
||||||
|
}
|
||||||
classifier "dev"
|
classifier "dev"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,3 +223,79 @@ publishing {
|
|||||||
// Add repositories to publish to here.
|
// Add repositories to publish to here.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task printConfigurations {
|
||||||
|
doLast {task ->
|
||||||
|
println "Project Name: $name configurations:"
|
||||||
|
configurations.each {
|
||||||
|
println " $it.name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
|
||||||
|
// For parchment mappings
|
||||||
|
maven { url "https://maven.parchmentmc.org" }
|
||||||
|
|
||||||
|
// used to download and compile dependencies from git repos
|
||||||
|
maven { url 'https://jitpack.io' }
|
||||||
|
|
||||||
|
// For Manifold Preprocessor
|
||||||
|
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
|
||||||
|
|
||||||
|
// Required for importing Modrinth mods
|
||||||
|
maven {
|
||||||
|
name = "Modrinth"
|
||||||
|
url = "https://api.modrinth.com/maven"
|
||||||
|
content {
|
||||||
|
includeGroup "maven.modrinth"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required for importing CursedForge mods
|
||||||
|
maven {
|
||||||
|
url "https://www.cursemaven.com"
|
||||||
|
content {
|
||||||
|
includeGroup "curse.maven"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// These 2 are for importing mods that arnt on CursedForge, Modrinth, GitHub, GitLab or anywhere opensource
|
||||||
|
flatDir {
|
||||||
|
dirs "${rootDir}/mods/fabric"
|
||||||
|
content {
|
||||||
|
includeGroup "fabric-mod"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
flatDir {
|
||||||
|
dirs "${rootDir}/mods/forge"
|
||||||
|
content {
|
||||||
|
includeGroup "forge-mod"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
// Add Manifold Preprocessor
|
||||||
|
// def excapedMCVersion = rootProject.minecraft_version.replace(".", "_")
|
||||||
|
// options.compilerArgs += ['-Xplugin:Manifold', "-AMC_VERSION_${excapedMCVersion}"]
|
||||||
|
//
|
||||||
|
//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
|
||||||
|
|
||||||
|
// Set the java version
|
||||||
|
options.compilerArgs += ['-Xplugin:Manifold']
|
||||||
|
options.release = rootProject.java_version as Integer //FIXME: This warning??
|
||||||
|
|
||||||
|
// TODO: make everything use java 8
|
||||||
|
// options.release = 8 // Use Java 8 for everything so back porting is easier?
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 James Seibel
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,6 +23,9 @@ 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.gui.screens.TitleScreen;
|
||||||
|
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;
|
||||||
@@ -32,9 +35,15 @@ import com.seibel.lod.common.wrappers.world.WorldWrapper;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraftforge.client.event.InputEvent;
|
import net.minecraftforge.client.event.InputEvent;
|
||||||
import net.minecraftforge.event.TickEvent;
|
import net.minecraftforge.event.TickEvent;
|
||||||
|
#if PRE_MC_1_19
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
import net.minecraftforge.event.world.ChunkEvent;
|
import net.minecraftforge.event.world.ChunkEvent;
|
||||||
import net.minecraftforge.event.world.WorldEvent;
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
|
#else
|
||||||
|
import net.minecraftforge.event.level.BlockEvent;
|
||||||
|
import net.minecraftforge.event.level.ChunkEvent;
|
||||||
|
import net.minecraftforge.event.level.LevelEvent;
|
||||||
|
#endif
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,29 +70,56 @@ public class ForgeClientProxy
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void chunkLoadEvent(ChunkEvent.Load event)
|
public void chunkLoadEvent(ChunkEvent.Load event)
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_19
|
||||||
clientApi.clientChunkLoadEvent(new ChunkWrapper(event.getChunk(), event.getWorld()), WorldWrapper.getWorldWrapper(event.getWorld()));
|
clientApi.clientChunkLoadEvent(new ChunkWrapper(event.getChunk(), event.getWorld()), WorldWrapper.getWorldWrapper(event.getWorld()));
|
||||||
|
#else
|
||||||
|
clientApi.clientChunkLoadEvent(new ChunkWrapper(event.getChunk(), event.getLevel()), WorldWrapper.getWorldWrapper(event.getLevel()));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
#if PRE_MC_1_19
|
||||||
public void worldSaveEvent(WorldEvent.Save event)
|
public void worldSaveEvent(WorldEvent.Save event)
|
||||||
|
#else
|
||||||
|
public void worldSaveEvent(LevelEvent.Save event)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
eventApi.worldSaveEvent();
|
eventApi.worldSaveEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This is also called when a new dimension loads */
|
/** This is also called when a new dimension loads */
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
#if PRE_MC_1_19
|
||||||
public void worldLoadEvent(WorldEvent.Load event)
|
public void worldLoadEvent(WorldEvent.Load event)
|
||||||
|
#else
|
||||||
|
public void worldLoadEvent(LevelEvent.Load event)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
if (Minecraft.getInstance().screen instanceof TitleScreen) return;
|
||||||
|
if (Minecraft.getInstance().getConnection() == null) return; // In 1.19.3, the multiplayer world load is called twice. The first time is before it actually connects to the multiplayer server (so stuff like ip and name arent sent out yet)
|
||||||
|
#if PRE_MC_1_19
|
||||||
if (event.getWorld() != null) {
|
if (event.getWorld() != null) {
|
||||||
eventApi.worldLoadEvent(WorldWrapper.getWorldWrapper(event.getWorld()));
|
eventApi.worldLoadEvent(WorldWrapper.getWorldWrapper(event.getWorld()));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (event.getLevel() != null) {
|
||||||
|
eventApi.worldLoadEvent(WorldWrapper.getWorldWrapper(event.getLevel()));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
#if PRE_MC_1_19
|
||||||
public void worldUnloadEvent(WorldEvent.Unload event)
|
public void worldUnloadEvent(WorldEvent.Unload event)
|
||||||
{
|
{
|
||||||
eventApi.worldUnloadEvent(WorldWrapper.getWorldWrapper(event.getWorld()));
|
eventApi.worldUnloadEvent(WorldWrapper.getWorldWrapper(event.getWorld()));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
public void worldUnloadEvent(LevelEvent.Unload event)
|
||||||
|
{
|
||||||
|
eventApi.worldUnloadEvent(WorldWrapper.getWorldWrapper(event.getLevel()));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void blockChangeEvent(BlockEvent event)
|
public void blockChangeEvent(BlockEvent event)
|
||||||
@@ -95,8 +131,13 @@ public class ForgeClientProxy
|
|||||||
event.getClass() == BlockEvent.FluidPlaceBlockEvent.class ||
|
event.getClass() == BlockEvent.FluidPlaceBlockEvent.class ||
|
||||||
event.getClass() == BlockEvent.PortalSpawnEvent.class)
|
event.getClass() == BlockEvent.PortalSpawnEvent.class)
|
||||||
{
|
{
|
||||||
|
#if PRE_MC_1_19
|
||||||
IChunkWrapper chunk = new ChunkWrapper(event.getWorld().getChunk(event.getPos()), event.getWorld());
|
IChunkWrapper chunk = new ChunkWrapper(event.getWorld().getChunk(event.getPos()), event.getWorld());
|
||||||
DimensionTypeWrapper dimType = DimensionTypeWrapper.getDimensionTypeWrapper(event.getWorld().dimensionType());
|
DimensionTypeWrapper dimType = DimensionTypeWrapper.getDimensionTypeWrapper(event.getWorld().dimensionType());
|
||||||
|
#else
|
||||||
|
IChunkWrapper chunk = new ChunkWrapper(event.getLevel().getChunk(event.getPos()), event.getLevel());
|
||||||
|
DimensionTypeWrapper dimType = DimensionTypeWrapper.getDimensionTypeWrapper(event.getLevel().dimensionType());
|
||||||
|
#endif
|
||||||
|
|
||||||
// recreate the LOD where the blocks were changed
|
// recreate the LOD where the blocks were changed
|
||||||
eventApi.blockChangeEvent(chunk, dimType);
|
eventApi.blockChangeEvent(chunk, dimType);
|
||||||
@@ -104,7 +145,7 @@ public class ForgeClientProxy
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onKeyInput(InputEvent.KeyInputEvent event)
|
public void onKeyInput(#if PRE_MC_1_19 InputEvent.KeyInputEvent event #else InputEvent.Key event #endif)
|
||||||
{
|
{
|
||||||
if (Minecraft.getInstance().player == null) return;
|
if (Minecraft.getInstance().player == null) return;
|
||||||
if (event.getAction() != GLFW.GLFW_PRESS) return;
|
if (event.getAction() != GLFW.GLFW_PRESS) return;
|
||||||
@@ -112,5 +153,4 @@ public class ForgeClientProxy
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of the Distant Horizon mod (formerly the LOD Mod),
|
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||||
* licensed under the GNU GPL v3 License.
|
* licensed under the GNU GPL v3 License.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2020 James Seibel
|
* Copyright (C) 2020-2022 James Seibel
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -27,21 +27,17 @@ 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.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;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.world.level.ColorResolver;
|
||||||
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
|
||||||
import net.minecraftforge.client.ConfigGuiHandler;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.ModLoadingContext;
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
@@ -49,9 +45,28 @@ import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
|||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import net.minecraftforge.fml.loading.FMLLoader;
|
import net.minecraftforge.fml.loading.FMLLoader;
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
import net.minecraftforge.fml.ExtensionPoint;
|
||||||
|
#elif MC_1_17_1
|
||||||
|
import net.minecraftforge.fmlclient.ConfigGuiHandler;
|
||||||
|
#elif POST_MC_1_19
|
||||||
|
import net.minecraftforge.client.ConfigScreenHandler;
|
||||||
|
#else // 1.18+ untill 1.19
|
||||||
|
import net.minecraftforge.client.ConfigGuiHandler;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// these imports change due to forge refactoring classes in 1.19
|
||||||
|
#if POST_MC_1_19
|
||||||
|
import net.minecraft.util.RandomSource;
|
||||||
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
import net.minecraftforge.client.model.data.ModelData;
|
||||||
|
#else
|
||||||
|
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||||
|
import java.util.Random;
|
||||||
|
#endif
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize and setup the Mod. <br>
|
* Initialize and setup the Mod. <br>
|
||||||
@@ -70,7 +85,7 @@ public class ForgeMain implements LodForgeMethodCaller
|
|||||||
{
|
{
|
||||||
// make sure the dependencies are set up before the mod needs them
|
// make sure the dependencies are set up before the mod needs them
|
||||||
LodCommonMain.initConfig();
|
LodCommonMain.initConfig();
|
||||||
LodCommonMain.startup(this, !FMLLoader.getDist().isClient(), new NetworkHandler());
|
LodCommonMain.startup(this, !FMLLoader.getDist().isClient());
|
||||||
ForgeDependencySetup.createInitialBindings();
|
ForgeDependencySetup.createInitialBindings();
|
||||||
ForgeDependencySetup.finishBinding();
|
ForgeDependencySetup.finishBinding();
|
||||||
ApiShared.LOGGER.info("Distant Horizons initializing...");
|
ApiShared.LOGGER.info("Distant Horizons initializing...");
|
||||||
@@ -91,15 +106,45 @@ public class ForgeMain implements LodForgeMethodCaller
|
|||||||
|
|
||||||
ModAccessorHandler.finishBinding();
|
ModAccessorHandler.finishBinding();
|
||||||
|
|
||||||
|
#if PRE_MC_1_17_1
|
||||||
|
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY,
|
||||||
|
() -> (client, parent) -> ConfigGui.getScreen(parent, ""));
|
||||||
|
#elif POST_MC_1_19
|
||||||
|
ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class,
|
||||||
|
() -> new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> ConfigGui.getScreen(parent, "")));
|
||||||
|
#else
|
||||||
ModLoadingContext.get().registerExtensionPoint(ConfigGuiHandler.ConfigGuiFactory.class,
|
ModLoadingContext.get().registerExtensionPoint(ConfigGuiHandler.ConfigGuiFactory.class,
|
||||||
() -> new ConfigGuiHandler.ConfigGuiFactory((client, parent) -> ConfigGui.getScreen(parent, "")));
|
() -> new ConfigGuiHandler.ConfigGuiFactory((client, parent) -> ConfigGui.getScreen(parent, "")));
|
||||||
|
#endif
|
||||||
forgeClientProxy = new ForgeClientProxy();
|
forgeClientProxy = new ForgeClientProxy();
|
||||||
MinecraftForge.EVENT_BUS.register(forgeClientProxy);
|
MinecraftForge.EVENT_BUS.register(forgeClientProxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ModelDataMap dataMap = new ModelDataMap.Builder().build();
|
#if PRE_MC_1_19_
|
||||||
|
private final ModelDataMap modelData = new ModelDataMap.Builder().build();
|
||||||
|
#else
|
||||||
|
private final ModelData modelData = ModelData.EMPTY;
|
||||||
|
#endif
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
#if PRE_MC_1_19
|
||||||
public List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random) {
|
public List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, Random random) {
|
||||||
return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, dataMap);
|
return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
public List<BakedQuad> getQuads(MinecraftClientWrapper mc, Block block, BlockState blockState, Direction direction, RandomSource random)
|
||||||
|
{
|
||||||
|
return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, modelData #if POST_MC_1_19, RenderType.solid() #endif);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int colorResolverGetColor(ColorResolver resolver, Biome biome, double x, double z) {
|
||||||
|
#if MC_1_17_1_I_THINK_ITS_FIXED?
|
||||||
|
return resolver.m_130045_(biome, x, z);
|
||||||
|
#else
|
||||||
|
return resolver.getColor(biome, x, z);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-72
@@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.seibel.lod.forge.fabric.api.client.networking.v1;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.seibel.lod.forge.fabric.api.event.Event;
|
|
||||||
import com.seibel.lod.forge.fabric.api.event.EventFactory;
|
|
||||||
import com.seibel.lod.forge.fabric.api.networking.v1.PacketSender;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Offers access to events related to the indication of a connected server's ability to receive packets in certain channels.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public final class C2SPlayChannelEvents {
|
|
||||||
/**
|
|
||||||
* An event for the client play network handler receiving an update indicating the connected server's ability to receive packets in certain channels.
|
|
||||||
* This event may be invoked at any time after login and up to disconnection.
|
|
||||||
*/
|
|
||||||
public static final Event<Register> REGISTER = EventFactory.createArrayBacked(Register.class, callbacks -> (handler, sender, client, channels) -> {
|
|
||||||
for (Register callback : callbacks) {
|
|
||||||
callback.onChannelRegister(handler, sender, client, channels);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An event for the client play network handler receiving an update indicating the connected server's lack of ability to receive packets in certain channels.
|
|
||||||
* This event may be invoked at any time after login and up to disconnection.
|
|
||||||
*/
|
|
||||||
public static final Event<Unregister> UNREGISTER = EventFactory.createArrayBacked(Unregister.class, callbacks -> (handler, sender, client, channels) -> {
|
|
||||||
for (Unregister callback : callbacks) {
|
|
||||||
callback.onChannelUnregister(handler, sender, client, channels);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
private C2SPlayChannelEvents() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see C2SPlayChannelEvents#REGISTER
|
|
||||||
*/
|
|
||||||
|
|
||||||
@FunctionalInterface
|
|
||||||
public interface Register {
|
|
||||||
void onChannelRegister(ClientPacketListener handler, PacketSender sender, Minecraft client, List<ResourceLocation> channels);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see C2SPlayChannelEvents#UNREGISTER
|
|
||||||
*/
|
|
||||||
|
|
||||||
@FunctionalInterface
|
|
||||||
public interface Unregister {
|
|
||||||
void onChannelUnregister(ClientPacketListener handler, PacketSender sender, Minecraft client, List<ResourceLocation> channels);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-103
@@ -1,103 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.seibel.lod.forge.fabric.api.client.networking.v1;
|
|
||||||
|
|
||||||
import com.seibel.lod.forge.fabric.api.event.Event;
|
|
||||||
import com.seibel.lod.forge.fabric.api.event.EventFactory;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.multiplayer.ClientHandshakePacketListenerImpl;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Offers access to events related to the connection to a server on the client while the server is processing the client's login request.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public final class ClientLoginConnectionEvents {
|
|
||||||
/**
|
|
||||||
* Event indicating a connection entered the LOGIN state, ready for registering query request handlers.
|
|
||||||
* This event may be used by mods to prepare their client side state.
|
|
||||||
* This event does not guarantee that a login attempt will be successful.
|
|
||||||
*
|
|
||||||
* @see ClientLoginNetworking#registerReceiver(ResourceLocation, ClientLoginNetworking.LoginQueryRequestHandler)
|
|
||||||
*/
|
|
||||||
public static final Event<Init> INIT = EventFactory.createArrayBacked(Init.class, callbacks -> (handler, client) -> {
|
|
||||||
for (Init callback : callbacks) {
|
|
||||||
callback.onLoginStart(handler, client);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An event for when the client has started receiving login queries.
|
|
||||||
* A client can only start receiving login queries when a server has sent the first login query.
|
|
||||||
* Vanilla servers will typically never make the client enter this login phase, but it is not a guarantee that the
|
|
||||||
* connected server is a vanilla server since a modded server or proxy may have no login queries to send to the client
|
|
||||||
* and therefore bypass the login query phase.
|
|
||||||
* If this event is fired then it is a sign that a server is not a vanilla server or the server is behind a proxy which
|
|
||||||
* is capable of handling login queries.
|
|
||||||
*
|
|
||||||
* <p>This event may be used to {@link ClientLoginNetworking.LoginQueryRequestHandler register login query handlers}
|
|
||||||
* which may be used to send a response to a server.
|
|
||||||
*
|
|
||||||
* <p>No packets should be sent when this event is invoked.
|
|
||||||
*/
|
|
||||||
public static final Event<QueryStart> QUERY_START = EventFactory.createArrayBacked(QueryStart.class, callbacks -> (handler, client) -> {
|
|
||||||
for (QueryStart callback : callbacks) {
|
|
||||||
callback.onLoginQueryStart(handler, client);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An event for when the client's login process has ended due to disconnection.
|
|
||||||
*
|
|
||||||
* <p>No packets should be sent when this event is invoked.
|
|
||||||
*/
|
|
||||||
public static final Event<Disconnect> DISCONNECT = EventFactory.createArrayBacked(Disconnect.class, callbacks -> (handler, client) -> {
|
|
||||||
for (Disconnect callback : callbacks) {
|
|
||||||
callback.onLoginDisconnect(handler, client);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
private ClientLoginConnectionEvents() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ClientLoginConnectionEvents#INIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
@FunctionalInterface
|
|
||||||
public interface Init {
|
|
||||||
void onLoginStart(ClientHandshakePacketListenerImpl handler, Minecraft client);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ClientLoginConnectionEvents#QUERY_START
|
|
||||||
*/
|
|
||||||
|
|
||||||
@FunctionalInterface
|
|
||||||
public interface QueryStart {
|
|
||||||
void onLoginQueryStart(ClientHandshakePacketListenerImpl handler, Minecraft client);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ClientLoginConnectionEvents#DISCONNECT
|
|
||||||
*/
|
|
||||||
|
|
||||||
@FunctionalInterface
|
|
||||||
public interface Disconnect {
|
|
||||||
void onLoginDisconnect(ClientHandshakePacketListenerImpl handler, Minecraft client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user