Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 64d8f7ee2d | |||
| d8b3aee9dc | |||
| fce94fa4bf | |||
| 254d671629 | |||
| e66e7e627a | |||
| 1f1024251b | |||
| fc516a20d5 | |||
| 791c2c3426 | |||
| b00079897a | |||
| 37b73e1d5c | |||
| 4bd1136713 | |||
| ef98dbd5fd | |||
| 5df0a60b06 | |||
| 9feb20eff8 | |||
| c9267d61a8 | |||
| a29e225a80 | |||
| ae0f3c2b3b | |||
| 852ea75449 | |||
| ab6a5dad2b | |||
| 1a1eaca280 | |||
| 0272f8c57f | |||
| cf09358710 | |||
| b5d833fa3d | |||
| 329dbe9585 | |||
| c7ae7f155e | |||
| 5f7dbb8662 | |||
| ee21548151 | |||
| ca00125960 | |||
| 4067264e72 | |||
| 9c2d243ad4 | |||
| de9d8b0d2e | |||
| 67f4615b34 | |||
| cd7a130ee4 | |||
| 4d17f7aecf | |||
| a59e7500ab | |||
| 40040294e7 | |||
| 783e61ec3d | |||
| e09db5d7df | |||
| 91f9ef3f4b | |||
| d52a3abb14 | |||
| 16370b0b6e | |||
| bfa60b48cf | |||
| 50518bfe21 | |||
| 80e4467829 | |||
| 396315bd05 | |||
| 7a0fec2c2f | |||
| 4afaaa7b12 | |||
| b057041467 | |||
| 33e6ce6376 | |||
| 118ef39c30 | |||
| 1013e1c824 | |||
| b0e924c7fe | |||
| 1777acd1d4 | |||
| 8276a862f8 | |||
| 4329acf91d | |||
| 72f83b40f7 | |||
| a33eb30a53 | |||
| d3e96f50a8 | |||
| 3aefeb98b4 | |||
| 3553ff8e60 | |||
| 945a2c0c5a | |||
| 8c7974e216 | |||
| 37756cd759 | |||
| c60cc4f013 | |||
| 87cce2e33c | |||
| 40ada9c186 | |||
| 55fb458266 | |||
| 79d2466fa2 | |||
| d750e489df | |||
| a206e49b2b | |||
| 0b691ebcd5 | |||
| 3c35c52803 | |||
| 0ed4964ee5 | |||
| b7cf7b61c8 | |||
| 54b0ccfce6 | |||
| 050d00b628 | |||
| 2733201ac3 | |||
| 26bf03205c | |||
| 628d57d216 | |||
| 58ed8259f2 | |||
| e5536de44f |
@@ -1,19 +0,0 @@
|
|||||||
**/.git
|
|
||||||
**/.gitlab
|
|
||||||
**/.cache
|
|
||||||
|
|
||||||
buildAllJars
|
|
||||||
|
|
||||||
**/_Misc Files
|
|
||||||
*.bat
|
|
||||||
*.md
|
|
||||||
*.sh
|
|
||||||
*.txt
|
|
||||||
|
|
||||||
coreSubProjects/*.md
|
|
||||||
coreSubProjects/*.txt
|
|
||||||
|
|
||||||
**/.gitignore
|
|
||||||
**/.gitattributes
|
|
||||||
**/.gitlab-cy.yml
|
|
||||||
**/.gitmodules
|
|
||||||
@@ -25,6 +25,8 @@ hs_err_pid*
|
|||||||
Merged/
|
Merged/
|
||||||
# Folder created by the buildAll scripts
|
# Folder created by the buildAll scripts
|
||||||
buildAllJars/
|
buildAllJars/
|
||||||
|
_buildAllJars/
|
||||||
|
_buildWorkers/
|
||||||
|
|
||||||
relocate_natives/.venv/
|
relocate_natives/.venv/
|
||||||
relocate_natives/__pycache__/
|
relocate_natives/__pycache__/
|
||||||
|
|||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
FROM eclipse-temurin:25-jdk
|
|
||||||
|
|
||||||
WORKDIR /home/build/
|
|
||||||
COPY ./gradlew .
|
|
||||||
RUN chmod +x ./gradlew
|
|
||||||
CMD echo "\r========== [CLEAN: $MC_VER] ==========" && \
|
|
||||||
./gradlew clean -PmcVer="$MC_VER" --gradle-user-home .gradle-cache/ && \
|
|
||||||
echo "\r========== [BUILD: $MC_VER] ==========" && \
|
|
||||||
./gradlew build -PmcVer="$MC_VER" --gradle-user-home .gradle-cache/ && \
|
|
||||||
echo "\r========== [MERGE: $MC_VER] ==========" && \
|
|
||||||
./gradlew mergeJars -PmcVer="$MC_VER" --gradle-user-home .gradle-cache/ && \
|
|
||||||
echo "\r========== [DONE: $MC_VER] =========="
|
|
||||||
@@ -14,89 +14,11 @@ Below is a video demonstrating the system:
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
## Minecraft and Library Versions
|
|
||||||
|
|
||||||
### This branch supports the following versions of Minecraft:
|
|
||||||
|
|
||||||
#### 1.20.4, 1.20.3 (Default)
|
|
||||||
Fabric: 0.15.1\
|
|
||||||
Fabric API: 0.91.2+1.20.4\
|
|
||||||
Forge: 49.0.30\
|
|
||||||
NeoForge: 118-beta\
|
|
||||||
Parchment: 1.20.2:2023.12.10\
|
|
||||||
Modmenu: 9.0.0-pre.1
|
|
||||||
|
|
||||||
#### 1.20.2
|
|
||||||
Fabric: 0.14.24\
|
|
||||||
Fabric API: 0.90.4+1.20.2\
|
|
||||||
Forge: 48.0.13\
|
|
||||||
Parchment: 1.20.1:2023.09.03\
|
|
||||||
Modmenu: 8.0.0
|
|
||||||
|
|
||||||
#### 1.20.1, 1.20
|
|
||||||
Fabric: 0.14.24\
|
|
||||||
Fabric API: 0.90.4+1.20.1\
|
|
||||||
Forge: 47.2.1\
|
|
||||||
Parchment: 1.20.1:2023.09.03\
|
|
||||||
Modmenu: 7.2.2
|
|
||||||
|
|
||||||
#### 1.19.4
|
|
||||||
Fabric: 0.14.24\
|
|
||||||
Fabric API: 0.87.1+1.19.4\
|
|
||||||
Forge: 45.2.4\
|
|
||||||
Parchment: 1.19.4:2023.06.26\
|
|
||||||
Modmenu: 6.3.1
|
|
||||||
|
|
||||||
#### 1.19.2
|
|
||||||
Fabric: 0.14.24\
|
|
||||||
Fabric API: 0.76.1+1.19.2\
|
|
||||||
Forge: 43.3.2\
|
|
||||||
Parchment: 1.19.2:2022.11.27\
|
|
||||||
Modmenu: 4.2.0-beta.2
|
|
||||||
|
|
||||||
#### 1.18.2
|
|
||||||
Fabric: 0.14.24\
|
|
||||||
Fabric API: 0.76.0+1.18.2\
|
|
||||||
Forge: 40.2.10\
|
|
||||||
Parchment: 1.18.2:2022.11.06\
|
|
||||||
Modmenu: 3.2.5
|
|
||||||
|
|
||||||
#### 1.17.1, 1.17
|
|
||||||
Fabric: 0.14.24\
|
|
||||||
Fabric API: 0.46.1+1.17\
|
|
||||||
Forge: 37.1.1\
|
|
||||||
Parchment: 1.17.1:2021.12.12\
|
|
||||||
Modmenu: 2.0.14
|
|
||||||
|
|
||||||
#### 1.16.5, 1.16.4
|
|
||||||
Fabric: 0.14.24\
|
|
||||||
Fabric API: 0.42.0+1.16\
|
|
||||||
Forge: 36.2.39\
|
|
||||||
Parchment: 1.16.5:2022.03.06\
|
|
||||||
Modmenu: 1.16.22
|
|
||||||
|
|
||||||
### Versions no longer supported
|
|
||||||
- 1.18.1, 1.18
|
|
||||||
- 1.19.1, 1.19
|
|
||||||
- 1.19.3
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
### Plugin and Library versions
|
|
||||||
|
|
||||||
Gradle: 8.5\
|
|
||||||
Fabric loom: 1.4-SNAPSHOT\
|
|
||||||
Architectury loom (Forge gradle replacement): 1.4-SNAPSHOT\
|
|
||||||
Sponge vanilla gradle: 0.2.1-SNAPSHOT\
|
|
||||||
Java Preprocessor plugin: Manifold Preprocessor
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Source Code Installation
|
## Source Code Installation
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
* A Java Development Kit (JDK) for Java 17 (recommended) or newer. <br>
|
* A Java Development Kit (JDK) for Java 25 (recommended) or newer. <br>
|
||||||
Visit https://www.oracle.com/java/technologies/downloads/ for installers.
|
Visit https://www.oracle.com/java/technologies/downloads/ for installers.
|
||||||
* Git or someway to clone git projects. <br>
|
* Git or someway to clone git projects. <br>
|
||||||
Visit https://git-scm.com/ for installers.
|
Visit https://git-scm.com/ for installers.
|
||||||
@@ -104,15 +26,10 @@ Java Preprocessor plugin: Manifold Preprocessor
|
|||||||
|
|
||||||
**If using IntelliJ:**
|
**If using IntelliJ:**
|
||||||
1. Install the Manifold plugin
|
1. Install the Manifold plugin
|
||||||
|
- https://plugins.jetbrains.com/plugin/10057-manifold-ij
|
||||||
2. Open IDEA and import the build.gradle
|
2. Open IDEA and import the build.gradle
|
||||||
3. Refresh the Gradle project in IDEA if required
|
3. Refresh the Gradle project in IDEA if required
|
||||||
|
|
||||||
**If using Eclipse: (Note that Eclipse doesn't support Manifold's preprocessor!)**
|
|
||||||
1. Run the command: `./gradlew geneclipseruns`
|
|
||||||
2. Run the command: `./gradlew eclipse`
|
|
||||||
3. Make sure eclipse has the JDK 17 installed. (This is needed so that eclipse can run minecraft)
|
|
||||||
4. Import the project into eclipse
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
## Switching Versions
|
## Switching Versions
|
||||||
@@ -127,72 +44,42 @@ In IntelliJ, you will also need to do a gradle sync if it didn't happen automati
|
|||||||
## Compiling
|
## Compiling
|
||||||
|
|
||||||
Prerequisites:
|
Prerequisites:
|
||||||
- JDK 17 or newer
|
- JDK 25 or newer
|
||||||
|
|
||||||
From the File Explorer:
|
|
||||||
1. Download and extract the project zip
|
|
||||||
2. Download the core from https://gitlab.com/distant-horizons-team/distant-horizons-core and extract into a folder called `coreSubProjects`
|
|
||||||
3. Open a terminal emulator in the project folder (On Windows you can type `cmd` in the title bar)
|
|
||||||
4. Run the commands: `./gradlew assemble` (You may need to use a `.\` on Windows)
|
|
||||||
5. Merge the jars with `./gradlew mergeJars`
|
|
||||||
6. The compiled jar file will be in the folder `Merged`
|
|
||||||
|
|
||||||
From the command line:
|
From the command line:
|
||||||
1. `git clone --recurse-submodules https://gitlab.com/distant-horizons-team/distant-horizons.git`
|
1. `git clone --recurse-submodules https://gitlab.com/distant-horizons-team/distant-horizons.git`
|
||||||
2. `cd distant-horizons`
|
2. `cd distant-horizons`
|
||||||
3. `./gradlew assemble`
|
3. `./gradlew assemble`
|
||||||
4. `./gradlew mergeJars`
|
5. The compiled jar file will be in the folder `\build\libs`
|
||||||
5. The compiled jar file will be in the folder `Merged`
|
|
||||||
|
|
||||||
Run tests with: `./gradlew test`
|
From the File Explorer:
|
||||||
|
1. Download and extract the project zip
|
||||||
|
2. Download the core from https://gitlab.com/distant-horizons-team/distant-horizons-core and extract into a folder called `coreSubProjects`
|
||||||
|
3. Open command prompt/terminal in the project folder
|
||||||
|
4. Run the commands: `./gradlew assemble`
|
||||||
|
6. The compiled jar file will be in the folder `\build\libs`
|
||||||
|
|
||||||
>Note: You can add the argument `-PmcVer=?` to tell gradle to build a selected MC version instead of having to modify the `gradle.properties` file.\
|
>Note: You can add the argument `-PmcVer=?` to tell gradle to build a selected MC version instead of having to modify the `gradle.properties` file.\
|
||||||
> For example: `./gradlew assemble -PmcVer=1.18.2`
|
> For example: `./gradlew assemble -PmcVer=1.18.2`
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
## Compiling with Docker
|
|
||||||
|
|
||||||
`./compile <version>`
|
|
||||||
|
|
||||||
You can also locally compile the DH jars without a Java environment by using Docker. Where `<version>` is the version of Minecraft to compile for (ie `1.20.1`), or the keyword `all`. See [Versions](#minecraft-and-library-versions) for a list of all supported values.
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Other commands
|
## Other commands
|
||||||
|
|
||||||
`./gradlew --refresh-dependencies` to refresh local dependencies.
|
|
||||||
|
|
||||||
`./gradlew clean` to delete any compiled code.
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Note to self
|
|
||||||
|
|
||||||
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 & [Parchment](https://parchmentmc.org/) mappings.
|
|
||||||
|
|
||||||
To generate the source code run `./gradlew genSources` <br>
|
|
||||||
If your IDE fails to auto-detect the source jars when browsing Minecraft classes; manually select the JAR file ending with -sources.jar when prompted by your IDE. <br>
|
|
||||||
(In IntelliJ it's at the top where it says "choose sources" when browsing a Minecraft class)
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
## Other Useful commands
|
|
||||||
|
|
||||||
Run the standalone jar: `./gradlew run` <br>
|
Run the standalone jar: `./gradlew run` <br>
|
||||||
Build the standalone jar: `./gradlew core:build` <br>
|
Build the standalone jar: `./gradlew core:build` <br>
|
||||||
Only build Fabric: `./gradlew fabric:assemble` or `./gradlew fabric:build` <br>
|
Only build Fabric: `./gradlew fabric:assemble` or `./gradlew fabric:build` <br>
|
||||||
Only build Forge: `./gradlew forge:assemble` or `./gradlew forge:build` <br>
|
Only build Forge: `./gradlew forge:assemble` or `./gradlew forge:build` <br>
|
||||||
Run the Fabric client (for debugging): `./gradlew fabric:runClient` <br>
|
Run the Fabric client (for debugging): `./gradlew fabric:runClient` <br>
|
||||||
Run the Forge client (for debugging): `./gradlew forge:runClient` <br>
|
Run the Forge client (for debugging): `./gradlew forge:runClient` <br>
|
||||||
|
Delete all compiled code: `./gradlew clean` <br>
|
||||||
|
Refresh local dependencies: `./gradlew --refresh-dependencies`
|
||||||
|
|
||||||
To build all versions: `./buildAll` (all builds will end up in the `Merged` folder)
|
To build all versions: `./buildAll`
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
## Open Source Acknowledgements
|
## Open Source Libraries
|
||||||
|
|
||||||
Forgix (To merge multiple mod versions into one jar) [_Formerly_ [_DHJarMerger_](https://github.com/Ran-helo/DHJarMerger)]\
|
Forgix (To merge multiple mod versions into one jar) [_Formerly_ [_DHJarMerger_](https://github.com/Ran-helo/DHJarMerger)]\
|
||||||
https://github.com/PacifistMC/Forgix
|
https://github.com/PacifistMC/Forgix
|
||||||
@@ -208,3 +95,18 @@ https://github.com/blackears/svgSalamander
|
|||||||
|
|
||||||
sqlite-jdbc\
|
sqlite-jdbc\
|
||||||
https://github.com/xerial/sqlite-jdbc
|
https://github.com/xerial/sqlite-jdbc
|
||||||
|
|
||||||
|
|
||||||
|
## Acknowledgements
|
||||||
|
|
||||||
|
Distant Horizons has been graciously provided an open source license for <a href="https://www.yourkit.com/java/profiler/">YourKit Java Profiler</a>.
|
||||||
|
|
||||||
|
> <img src="https://www.yourkit.com/images/yklogo.png">
|
||||||
|
>
|
||||||
|
> YourKit supports open source projects with innovative and intelligent tools
|
||||||
|
for monitoring and profiling Java and .NET applications.
|
||||||
|
YourKit is the creator of <a href="https://www.yourkit.com/java/profiler/">YourKit Java Profiler</a>,
|
||||||
|
<a href="https://www.yourkit.com/dotnet-profiler/">YourKit .NET Profiler</a>,
|
||||||
|
and <a href="https://www.yourkit.com/youmonitor/">YourKit YouMonitor</a>.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,27 @@ plugins {
|
|||||||
id 'io.github.pacifistmc.forgix' version '2.+'
|
id 'io.github.pacifistmc.forgix' version '2.+'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (false) // TODO vulkan don't run if there is only one mod loader
|
||||||
forgix {
|
forgix {
|
||||||
autoRun = true
|
autoRun = true
|
||||||
|
|
||||||
|
// add the mod loaders to the end of the jar
|
||||||
|
// put together in the format: "a", "a-b", "a-b-c"
|
||||||
|
String modLoaders = "";
|
||||||
|
((String) gradle.builds_for)
|
||||||
|
.split(",")
|
||||||
|
.each
|
||||||
|
{ loader ->
|
||||||
|
def loaderName = loader.trim()
|
||||||
|
if (modLoaders != "")
|
||||||
|
{
|
||||||
|
modLoaders += "-";
|
||||||
|
}
|
||||||
|
|
||||||
|
modLoaders += loaderName;
|
||||||
|
}
|
||||||
|
// merged jars are named in the format:
|
||||||
|
// "DistantHorizons-3.0.1-b-dev-26.1-fabric-neoforge.jar"
|
||||||
|
archiveClassifier = modLoaders
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ for d in versionProperties/*; do
|
|||||||
sh gradlew build -PmcVer=$version
|
sh gradlew build -PmcVer=$version
|
||||||
if [ $? != 0 ]; then continue; fi
|
if [ $? != 0 ]; then continue; fi
|
||||||
|
|
||||||
echo "==================== Merging $version ===================="
|
|
||||||
sh gradlew mergeJars -PmcVer=$version
|
|
||||||
if [ $? != 0 ]; then continue; fi
|
|
||||||
|
|
||||||
echo "==================== Moving jar ===================="
|
echo "==================== Moving jar ===================="
|
||||||
mv build/forgix/*.jar buildAllJars/
|
mv build/forgix/*.jar buildAllJars/
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ for %%f in (versionProperties\*) do (
|
|||||||
echo ==================== Building !version! ====================
|
echo ==================== Building !version! ====================
|
||||||
call .\gradlew.bat build -PmcVer="!version!"
|
call .\gradlew.bat build -PmcVer="!version!"
|
||||||
|
|
||||||
echo ==================== Merging !version! ====================
|
|
||||||
call .\gradlew.bat mergeJars -PmcVer="!version!"
|
|
||||||
|
|
||||||
echo ==================== Moving jar ====================
|
echo ==================== Moving jar ====================
|
||||||
move build\forgix\*.jar buildAllJars\
|
move build\forgix\*.jar buildAllJars\
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
@echo off & setlocal enabledelayedexpansion
|
||||||
|
|
||||||
|
|
||||||
|
echo ==================== Getting versions to build... ====================
|
||||||
|
mkdir _buildAllJars 2>nul
|
||||||
|
del _buildAllJars\* /Q 2>nul
|
||||||
|
|
||||||
|
set "ROOT=%~dp0"
|
||||||
|
set "WORK_DIR=%ROOT%_buildWorkers"
|
||||||
|
mkdir "%WORK_DIR%" 2>nul
|
||||||
|
|
||||||
|
|
||||||
|
REM get the number of versions to compile
|
||||||
|
set count=0
|
||||||
|
for %%f in (versionProperties\*) do set /a count+=1
|
||||||
|
echo ==================== Found %count% versions to build in parallel ====================
|
||||||
|
|
||||||
|
REM Launch a parallel job for each version
|
||||||
|
for %%f in (%ROOT%versionProperties\*) do (
|
||||||
|
set version=%%~nf
|
||||||
|
|
||||||
|
echo starting [!version!]...
|
||||||
|
start "Build !version!" cmd /c ""%ROOT%build_worker.bat" "!version!" "%ROOT%" "%WORK_DIR%" ""..\..\_buildAllJars"""
|
||||||
|
|
||||||
|
REM Minor timeout between launches so we can stop the build early if we only want
|
||||||
|
REM to test part of the script and to reduce startup load
|
||||||
|
timeout /t 3 /nobreak
|
||||||
|
|
||||||
|
REM 2>nul to supress a harmless warning that the for loop
|
||||||
|
REM "cannot find the drive specified"
|
||||||
|
) 2>nul
|
||||||
|
|
||||||
|
|
||||||
|
echo ==================== All builds started... Completed Jars will be in _buildAllJars ====================
|
||||||
|
endlocal
|
||||||
@@ -54,7 +54,12 @@ repositories {
|
|||||||
url "https://www.cursemaven.com"
|
url "https://www.cursemaven.com"
|
||||||
content { includeGroup "curse.maven" }
|
content { includeGroup "curse.maven" }
|
||||||
}
|
}
|
||||||
maven { url "https://repo.spongepowered.org/maven/" }
|
maven {
|
||||||
|
url "https://repo.spongepowered.org/maven/"
|
||||||
|
// exclusion is needed since sponge has a deprecated version of fabric
|
||||||
|
// that gradle would prefer to get over the up-to-date version modrinth provides
|
||||||
|
content { excludeGroupByRegex "net\\.fabricmc(\\..*)?" }
|
||||||
|
}
|
||||||
maven { url "https://maven.terraformersmc.com/" }
|
maven { url "https://maven.terraformersmc.com/" }
|
||||||
maven { url "https://maven.neoforged.net/releases/" }
|
maven { url "https://maven.neoforged.net/releases/" }
|
||||||
flatDir {
|
flatDir {
|
||||||
@@ -362,6 +367,23 @@ if (isNotCommonProject) {
|
|||||||
}
|
}
|
||||||
runTask.jvmArgs = filteredArgs
|
runTask.jvmArgs = filteredArgs
|
||||||
|
|
||||||
|
// fix (Neo)forge debug running
|
||||||
|
doFirst {
|
||||||
|
def modsDir = rootProject.file("run/${isClient ? 'client' : 'server'}/mods")
|
||||||
|
modsDir.mkdirs()
|
||||||
|
|
||||||
|
// Remove any stale DH jars before copying the fresh one
|
||||||
|
modsDir.listFiles()?.each { file ->
|
||||||
|
if (file.name.startsWith(rootProject.mod_name)) file.delete()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy shadow jar into mods folder so (Neo)Forge discovers it properly
|
||||||
|
copy {
|
||||||
|
from shadowJar.archiveFile
|
||||||
|
into modsDir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// JVM args
|
// JVM args
|
||||||
runTask.jvmArgs(
|
runTask.jvmArgs(
|
||||||
"-Dio.netty.leakDetection.level=advanced",
|
"-Dio.netty.leakDetection.level=advanced",
|
||||||
@@ -371,7 +393,8 @@ if (isNotCommonProject) {
|
|||||||
//"-XX:+ZGenerational",
|
//"-XX:+ZGenerational",
|
||||||
rootProject.minecraftMemoryJavaArg,
|
rootProject.minecraftMemoryJavaArg,
|
||||||
)
|
)
|
||||||
if (isClient) {
|
if (isClient)
|
||||||
|
{
|
||||||
runTask.jvmArgs(
|
runTask.jvmArgs(
|
||||||
"-Dminecraft.api.auth.host=https://nope.invalid",
|
"-Dminecraft.api.auth.host=https://nope.invalid",
|
||||||
"-Dminecraft.api.account.host=https://nope.invalid",
|
"-Dminecraft.api.account.host=https://nope.invalid",
|
||||||
@@ -382,9 +405,17 @@ if (isNotCommonProject) {
|
|||||||
// use a consistent username for easier debugging in a given world (vs randomly teleporting to a new user each time the game boots)
|
// use a consistent username for easier debugging in a given world (vs randomly teleporting to a new user each time the game boots)
|
||||||
"--username", "Dev",
|
"--username", "Dev",
|
||||||
// "--renderDebugLabels" is a Mojang command to show render names in RenderDoc
|
// "--renderDebugLabels" is a Mojang command to show render names in RenderDoc
|
||||||
"--renderDebugLabels",
|
"--renderDebugLabels"
|
||||||
|
)
|
||||||
|
|
||||||
|
// enabling tracy causes constant memory growth so it isn't always desired
|
||||||
|
if (rootProject.minecraftEnableTracy == "true")
|
||||||
|
{
|
||||||
// "--tracy" is a Mojang command to allow individual frames to be debugged using Tracy https://github.com/wolfpld/tracy/releases/tag/v0.13.1
|
// "--tracy" is a Mojang command to allow individual frames to be debugged using Tracy https://github.com/wolfpld/tracy/releases/tag/v0.13.1
|
||||||
"--tracy")
|
runTask.args("--tracy")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
@echo off & setlocal enabledelayedexpansion
|
||||||
|
|
||||||
|
set "VERSION=%~1"
|
||||||
|
set "ROOT=%~2"
|
||||||
|
set "WORK_DIR=%~3"
|
||||||
|
set "WORKER=%WORK_DIR%\%VERSION%"
|
||||||
|
set "JAR_OUTPUT_DIR=%~4"
|
||||||
|
|
||||||
|
REM remove the ending "\" from the root folder, otherwise the final quote
|
||||||
|
REM in the robocopy command will be escaped and it won't run
|
||||||
|
if "%ROOT:~-1%"=="\" set "ROOT=%ROOT:~0,-1%"
|
||||||
|
set "WORKER=%~3\%~1"
|
||||||
|
|
||||||
|
set "BUILT_JAR_DIR=%WORKER%\build\forgix"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo ==================== [%VERSION%] Copying workspace ====================
|
||||||
|
mkdir "%WORKER%"
|
||||||
|
robocopy "%ROOT%" "%WORKER%" /E /XD "%WORKER%" "_buildWorkers" "buildAllJars" ".gradle" "build" ".git" ".idea" ".gitlab" "run" "testScripts" /NFL /NDL
|
||||||
|
|
||||||
|
echo ==================== [%VERSION%] Cleaning ====================
|
||||||
|
cd /d "%WORKER%"
|
||||||
|
call .\gradlew.bat clean
|
||||||
|
REM optional arg that can be added if we want to log the result to a file
|
||||||
|
REM >"%WORK_DIR%\build_%VERSION%.log" 2>&1
|
||||||
|
|
||||||
|
echo ==================== [%VERSION%] Assembling ====================
|
||||||
|
call .\gradlew.bat assemble -PmcVer="%VERSION%"
|
||||||
|
REM optional arg that can be added if we want to log the result to a file
|
||||||
|
REM >>"%WORK_DIR%\build_%VERSION%.log" 2>&1
|
||||||
|
|
||||||
|
echo ==================== [%VERSION%] Exporting ====================
|
||||||
|
mkdir "%JAR_OUTPUT_DIR%"
|
||||||
|
robocopy "%BUILT_JAR_DIR%" "%JAR_OUTPUT_DIR%" /NFL /NDL
|
||||||
|
|
||||||
|
echo ==================== [%VERSION%] Done ====================
|
||||||
|
endlocal
|
||||||
|
|
||||||
|
REM can be uncommented for debugging
|
||||||
|
REM pause
|
||||||
@@ -8,8 +8,8 @@ import com.seibel.distanthorizons.common.commands.CommandInitializer;
|
|||||||
import com.seibel.distanthorizons.common.wrappers.DependencySetup;
|
import com.seibel.distanthorizons.common.wrappers.DependencySetup;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.DhDebugScreenEntry;
|
import com.seibel.distanthorizons.common.wrappers.gui.DhDebugScreenEntry;
|
||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftServerWrapper;
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftServerWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.Initializer;
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
import com.seibel.distanthorizons.core.api.internal.SharedApi;
|
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
import com.seibel.distanthorizons.core.config.ConfigHandler;
|
import com.seibel.distanthorizons.core.config.ConfigHandler;
|
||||||
import com.seibel.distanthorizons.core.config.eventHandlers.presets.ThreadPresetConfigEventHandler;
|
import com.seibel.distanthorizons.core.config.eventHandlers.presets.ThreadPresetConfigEventHandler;
|
||||||
@@ -95,7 +95,8 @@ public abstract class AbstractModInitializer
|
|||||||
|
|
||||||
// Client uses config for auto-updater, so it's initialized here instead of post-init stage
|
// Client uses config for auto-updater, so it's initialized here instead of post-init stage
|
||||||
this.initConfig();
|
this.initConfig();
|
||||||
logModIncompatibilityWarnings(); // needs to be called after config loading
|
logIncompatibilityWarnings(); // needs to be called after config loading
|
||||||
|
Initializer.postConfigInit();
|
||||||
|
|
||||||
LOGGER.info(ModInfo.READABLE_NAME + " client Initialized.");
|
LOGGER.info(ModInfo.READABLE_NAME + " client Initialized.");
|
||||||
|
|
||||||
@@ -137,6 +138,7 @@ public abstract class AbstractModInitializer
|
|||||||
MinecraftServerWrapper.INSTANCE.dedicatedServer = (DedicatedServer)server;
|
MinecraftServerWrapper.INSTANCE.dedicatedServer = (DedicatedServer)server;
|
||||||
|
|
||||||
this.initConfig();
|
this.initConfig();
|
||||||
|
Initializer.postConfigInit();
|
||||||
this.postInit();
|
this.postInit();
|
||||||
this.postServerInit();
|
this.postServerInit();
|
||||||
this.commandInitializer.onServerReady();
|
this.commandInitializer.onServerReady();
|
||||||
@@ -159,7 +161,7 @@ public abstract class AbstractModInitializer
|
|||||||
private void startup()
|
private void startup()
|
||||||
{
|
{
|
||||||
DependencySetup.createSharedBindings();
|
DependencySetup.createSharedBindings();
|
||||||
SharedApi.init();
|
Initializer.preConfigInit();
|
||||||
this.createInitialSharedBindings();
|
this.createInitialSharedBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,9 +263,9 @@ public abstract class AbstractModInitializer
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==================================//
|
//======================//
|
||||||
// mod partial compatibility checks //
|
// compatibility checks //
|
||||||
//==================================//
|
//======================//
|
||||||
//region
|
//region
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -272,7 +274,7 @@ public abstract class AbstractModInitializer
|
|||||||
* This method will log (and display to chat if enabled)
|
* This method will log (and display to chat if enabled)
|
||||||
* these warnings and potential fixes.
|
* these warnings and potential fixes.
|
||||||
*/
|
*/
|
||||||
private static void logModIncompatibilityWarnings()
|
private static void logIncompatibilityWarnings()
|
||||||
{
|
{
|
||||||
boolean showChatWarnings = Config.Common.Logging.Warning.showModCompatibilityWarningsOnStartup.get();
|
boolean showChatWarnings = Config.Common.Logging.Warning.showModCompatibilityWarningsOnStartup.get();
|
||||||
IModChecker modChecker = SingletonInjector.INSTANCE.get(IModChecker.class);
|
IModChecker modChecker = SingletonInjector.INSTANCE.get(IModChecker.class);
|
||||||
|
|||||||
+8
-2
@@ -70,10 +70,16 @@ public class DhUpdateScreenBase
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MC.setScreen(new UpdateModScreen(
|
UpdateModScreen updateScreen = new UpdateModScreen(
|
||||||
new TitleScreen(false),
|
new TitleScreen(false),
|
||||||
versionId
|
versionId
|
||||||
));
|
);
|
||||||
|
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
|
MC.setScreen(updateScreen);
|
||||||
|
#else
|
||||||
|
MC.setScreenAndShow(updateScreen);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
+113
@@ -0,0 +1,113 @@
|
|||||||
|
package com.seibel.distanthorizons.common.commonMixins;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
|
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||||
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.Camera;
|
||||||
|
import net.minecraft.world.effect.MobEffects;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.client.Camera;
|
||||||
|
import net.minecraft.world.effect.MobEffects;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_17_1
|
||||||
|
import net.minecraft.world.level.material.FluidState;
|
||||||
|
import net.minecraft.client.renderer.FogRenderer;
|
||||||
|
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
#elif MC_VER < MC_1_21_3
|
||||||
|
import net.minecraft.world.level.material.FogType;
|
||||||
|
import net.minecraft.client.renderer.FogRenderer;
|
||||||
|
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
#elif MC_VER < MC_1_21_6
|
||||||
|
import net.minecraft.world.level.material.FogType;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
import com.mojang.blaze3d.shaders.FogShape;
|
||||||
|
import net.minecraft.client.renderer.FogRenderer;
|
||||||
|
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
||||||
|
import net.minecraft.client.renderer.FogParameters;
|
||||||
|
import org.joml.Vector4f;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
#else
|
||||||
|
import net.minecraft.world.level.material.FogType;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
public class MixinVanillaFogCommon
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_21_6
|
||||||
|
public static boolean cancelFog(Camera camera, FogRenderer.FogMode fogMode)
|
||||||
|
#else
|
||||||
|
public static boolean cancelFog()
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
#if MC_VER < MC_1_21_6
|
||||||
|
Entity entity = camera.getEntity();
|
||||||
|
#elif MC_VER <= MC_1_21_10
|
||||||
|
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
|
||||||
|
Entity entity = camera.getEntity();
|
||||||
|
#elif MC_VER <= MC_26_1_2
|
||||||
|
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
|
||||||
|
Entity entity = camera.entity();
|
||||||
|
#else
|
||||||
|
Camera camera = Minecraft.getInstance().gameRenderer.mainCamera();
|
||||||
|
Entity entity = camera.entity();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
boolean cameraNotInFluid = cameraNotInFluid(camera);
|
||||||
|
boolean isSpecialFog = (entity instanceof LivingEntity) && ((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS);
|
||||||
|
|
||||||
|
boolean cancelFog = !isSpecialFog;
|
||||||
|
cancelFog = cancelFog && cameraNotInFluid;
|
||||||
|
#if MC_VER < MC_1_21_6
|
||||||
|
cancelFog = cancelFog && (fogMode == FogRenderer.FogMode.FOG_TERRAIN);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cancelFog = cancelFog && !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial();
|
||||||
|
cancelFog = cancelFog && !Config.Client.Advanced.Graphics.Fog.enableVanillaFog.get();
|
||||||
|
|
||||||
|
|
||||||
|
return cancelFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean cameraNotInFluid(Camera camera)
|
||||||
|
{
|
||||||
|
#if MC_VER < MC_1_17_1
|
||||||
|
FluidState fluidState = camera.getFluidInCamera();
|
||||||
|
boolean cameraNotInFluid = fluidState.isEmpty();
|
||||||
|
#else
|
||||||
|
FogType fogTypes = camera.getFluidInCamera();
|
||||||
|
boolean cameraNotInFluid = fogTypes == FogType.NONE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return cameraNotInFluid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+21
-21
@@ -299,27 +299,27 @@ public class BlazeDebugWireframeRenderer extends AbstractDebugWireframeRenderer
|
|||||||
|
|
||||||
// render //
|
// render //
|
||||||
|
|
||||||
//try (RenderPass renderPass = commandEncoder.createRenderPass(
|
try (RenderPass renderPass = commandEncoder.createRenderPass(
|
||||||
// this::getRenderPassName,
|
this::getRenderPassName,
|
||||||
// BlazeDhMetaRenderer.INSTANCE.dhColorTextureWrapper.textureView,
|
BlazeDhMetaRenderer.INSTANCE.dhColorTextureWrapper.textureView,
|
||||||
// /*optionalClearColorAsInt*/ OptionalInt.empty(),
|
/*optionalClearColorAsInt*/ OptionalInt.empty(),
|
||||||
// BlazeDhMetaRenderer.INSTANCE.dhDepthTextureWrapper.textureView,
|
BlazeDhMetaRenderer.INSTANCE.dhDepthTextureWrapper.textureView,
|
||||||
// /*optionalDepthValueAsDouble*/ OptionalDouble.empty()))
|
/*optionalDepthValueAsDouble*/ OptionalDouble.empty()))
|
||||||
//{
|
{
|
||||||
// // Bind instance data //
|
// Bind instance data //
|
||||||
// renderPass.setUniform("uniformBlock", this.uniformBuffer);
|
renderPass.setUniform("uniformBlock", this.uniformBuffer);
|
||||||
//
|
|
||||||
// renderPass.setPipeline(this.pipeline);
|
renderPass.setPipeline(this.pipeline);
|
||||||
// renderPass.setIndexBuffer(this.boxIndexBuffer, VertexFormat.IndexType.INT);
|
renderPass.setIndexBuffer(this.boxIndexBuffer, VertexFormat.IndexType.INT);
|
||||||
//
|
|
||||||
// renderPass.setVertexBuffer(0, this.boxVertexBuffer);
|
renderPass.setVertexBuffer(0, this.boxVertexBuffer);
|
||||||
//
|
|
||||||
// renderPass.drawIndexed(
|
renderPass.drawIndexed(
|
||||||
// /*indexStart*/ 0,
|
/*indexStart*/ 0,
|
||||||
// /*firstIndex*/0,
|
/*firstIndex*/0,
|
||||||
// /*indexCount*/BOX_OUTLINE_INDICES.length,
|
/*indexCount*/BOX_OUTLINE_INDICES.length,
|
||||||
// /*instanceCount*/1);
|
/*instanceCount*/1);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
private String getRenderPassName() { return "distantHorizons:McDebugRenderer"; }
|
private String getRenderPassName() { return "distantHorizons:McDebugRenderer"; }
|
||||||
|
|
||||||
|
|||||||
+23
@@ -57,6 +57,7 @@ import com.seibel.distanthorizons.core.logging.DhLogger;
|
|||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
|
import com.seibel.distanthorizons.core.render.RenderThreadTaskHandler;
|
||||||
import com.seibel.distanthorizons.core.render.renderer.GenericRenderObjectFactory;
|
import com.seibel.distanthorizons.core.render.renderer.GenericRenderObjectFactory;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.objects.IDhGenericObjectVertexBufferContainer;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.objects.IDhGenericObjectVertexBufferContainer;
|
||||||
import com.seibel.distanthorizons.core.render.renderer.RenderableBoxGroup;
|
import com.seibel.distanthorizons.core.render.renderer.RenderableBoxGroup;
|
||||||
@@ -615,5 +616,27 @@ public class BlazeDhGenericObjectRenderer implements IDhGenericRenderer
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//================//
|
||||||
|
// base overrides //
|
||||||
|
//================//
|
||||||
|
//region
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close()
|
||||||
|
{
|
||||||
|
// close is called outside the render thread and buffer closing must be done on the render thread
|
||||||
|
RenderThreadTaskHandler.INSTANCE.queueRunningOnRenderThread("Generic Obj Cleanup", () ->
|
||||||
|
{
|
||||||
|
if (this.vertUniformBuffer != null)
|
||||||
|
{
|
||||||
|
this.vertUniformBuffer.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
+2
-1
@@ -10,6 +10,7 @@ import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterCo
|
|||||||
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiTextureCreatedParam;
|
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiTextureCreatedParam;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.apply.BlazeDhApplyRenderer;
|
import com.seibel.distanthorizons.common.render.blaze.apply.BlazeDhApplyRenderer;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureWrapper;
|
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureWrapper;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
import com.seibel.distanthorizons.coreapi.util.ColorUtil;
|
import com.seibel.distanthorizons.coreapi.util.ColorUtil;
|
||||||
@@ -86,7 +87,7 @@ public class BlazeDhMetaRenderer implements IDhMetaRenderer
|
|||||||
@Override
|
@Override
|
||||||
public void applyToMcTexture(RenderParams renderParams)
|
public void applyToMcTexture(RenderParams renderParams)
|
||||||
{
|
{
|
||||||
GpuTexture mcColorTexture = Minecraft.getInstance().getMainRenderTarget().getColorTexture();
|
GpuTexture mcColorTexture = MinecraftRenderWrapper.INSTANCE.getRenderTarget().getColorTexture();
|
||||||
this.applyRenderer.render(this.dhColorTextureWrapper.texture, this.dhDepthTextureWrapper.texture, mcColorTexture);
|
this.applyRenderer.render(this.dhColorTextureWrapper.texture, this.dhDepthTextureWrapper.texture, mcColorTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
@@ -19,6 +19,7 @@ import com.mojang.blaze3d.systems.RenderPass;
|
|||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeBufferRenderEvent;
|
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeBufferRenderEvent;
|
||||||
|
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeRenderPassEvent;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.util.BlazeDhVertexFormatUtil;
|
import com.seibel.distanthorizons.common.render.blaze.util.BlazeDhVertexFormatUtil;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.util.BlazeUniformUtil;
|
import com.seibel.distanthorizons.common.render.blaze.util.BlazeUniformUtil;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.wrappers.RenderPipelineBuilderWrapper;
|
import com.seibel.distanthorizons.common.render.blaze.wrappers.RenderPipelineBuilderWrapper;
|
||||||
@@ -267,6 +268,8 @@ public class BlazeDhTerrainRenderer implements IDhTerrainRenderer
|
|||||||
{
|
{
|
||||||
profiler.popPush("rendering");
|
profiler.popPush("rendering");
|
||||||
|
|
||||||
|
ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeRenderPassEvent.class, renderEventParam);
|
||||||
|
|
||||||
// create a render pass
|
// create a render pass
|
||||||
try (RenderPass renderPass = COMMAND_ENCODER.createRenderPass(
|
try (RenderPass renderPass = COMMAND_ENCODER.createRenderPass(
|
||||||
this::getRenderPassName,
|
this::getRenderPassName,
|
||||||
|
|||||||
+2
-1
@@ -40,6 +40,7 @@ import com.seibel.distanthorizons.common.render.blaze.util.BlazeUniformUtil;
|
|||||||
import com.seibel.distanthorizons.common.render.blaze.wrappers.RenderPipelineBuilderWrapper;
|
import com.seibel.distanthorizons.common.render.blaze.wrappers.RenderPipelineBuilderWrapper;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureViewWrapper;
|
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureViewWrapper;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureWrapper;
|
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureWrapper;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
@@ -151,7 +152,7 @@ public class BlazeDhFarFadeRenderer implements IDhFarFadeRenderer
|
|||||||
|
|
||||||
// textures
|
// textures
|
||||||
this.dhFadeColorTextureWrapper.tryCreateOrResize();
|
this.dhFadeColorTextureWrapper.tryCreateOrResize();
|
||||||
this.mcColorTextureViewWrapper.tryWrap(Minecraft.getInstance().getMainRenderTarget().getColorTexture());
|
this.mcColorTextureViewWrapper.tryWrap(MinecraftRenderWrapper.INSTANCE.getRenderTarget().getColorTexture());
|
||||||
|
|
||||||
this.dhFadeDepthTextureWrapper.tryCreateOrResize();
|
this.dhFadeDepthTextureWrapper.tryCreateOrResize();
|
||||||
|
|
||||||
|
|||||||
+25
-14
@@ -24,18 +24,6 @@ public class BlazeDhFogRenderer {}
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
import com.mojang.blaze3d.buffers.GpuBuffer;
|
|
||||||
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
|
||||||
import com.mojang.blaze3d.buffers.Std140Builder;
|
|
||||||
import com.mojang.blaze3d.buffers.Std140SizeCalculator;
|
|
||||||
import com.mojang.blaze3d.pipeline.BlendFunction;
|
|
||||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
|
||||||
import com.mojang.blaze3d.platform.DestFactor;
|
|
||||||
import com.mojang.blaze3d.platform.SourceFactor;
|
|
||||||
import com.mojang.blaze3d.systems.CommandEncoder;
|
|
||||||
import com.mojang.blaze3d.systems.GpuDevice;
|
|
||||||
import com.mojang.blaze3d.systems.RenderPass;
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogColorMode;
|
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogColorMode;
|
||||||
import com.seibel.distanthorizons.api.enums.rendering.EDhApiHeightFogDirection;
|
import com.seibel.distanthorizons.api.enums.rendering.EDhApiHeightFogDirection;
|
||||||
import com.seibel.distanthorizons.api.enums.rendering.EDhApiHeightFogMixMode;
|
import com.seibel.distanthorizons.api.enums.rendering.EDhApiHeightFogMixMode;
|
||||||
@@ -62,6 +50,24 @@ import java.nio.ByteOrder;
|
|||||||
import java.util.OptionalDouble;
|
import java.util.OptionalDouble;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.buffers.GpuBuffer;
|
||||||
|
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
||||||
|
import com.mojang.blaze3d.buffers.Std140Builder;
|
||||||
|
import com.mojang.blaze3d.buffers.Std140SizeCalculator;
|
||||||
|
import com.mojang.blaze3d.pipeline.BlendFunction;
|
||||||
|
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||||
|
import com.mojang.blaze3d.systems.CommandEncoder;
|
||||||
|
import com.mojang.blaze3d.systems.GpuDevice;
|
||||||
|
import com.mojang.blaze3d.systems.RenderPass;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
|
import com.mojang.blaze3d.platform.DestFactor;
|
||||||
|
import com.mojang.blaze3d.platform.SourceFactor;
|
||||||
|
#else
|
||||||
|
import com.mojang.blaze3d.platform.BlendFactor;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders fog onto the LODs.
|
* Renders fog onto the LODs.
|
||||||
*/
|
*/
|
||||||
@@ -109,11 +115,16 @@ public class BlazeDhFogRenderer implements IDhFogRenderer
|
|||||||
this.init = true;
|
this.init = true;
|
||||||
|
|
||||||
|
|
||||||
|
BlendFunction blendFunc;
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
|
blendFunc = new BlendFunction(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
|
#else
|
||||||
|
blendFunc = new BlendFunction(BlendFactor.SRC_ALPHA, BlendFactor.ONE_MINUS_SRC_ALPHA, BlendFactor.ONE, BlendFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
|
#endif
|
||||||
|
|
||||||
this.applyRenderer = new BlazeDhApplyRenderer(
|
this.applyRenderer = new BlazeDhApplyRenderer(
|
||||||
"fog_apply_to_dh",
|
"fog_apply_to_dh",
|
||||||
new BlendFunction(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ONE, DestFactor.ONE_MINUS_SRC_ALPHA),
|
blendFunc,
|
||||||
"apply/blaze/vert", "apply/blaze/frag"
|
"apply/blaze/vert", "apply/blaze/frag"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
+28
-13
@@ -24,18 +24,6 @@ public class BlazeDhSsaoRenderer {}
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
import com.mojang.blaze3d.buffers.GpuBuffer;
|
|
||||||
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
|
||||||
import com.mojang.blaze3d.buffers.Std140Builder;
|
|
||||||
import com.mojang.blaze3d.buffers.Std140SizeCalculator;
|
|
||||||
import com.mojang.blaze3d.pipeline.BlendFunction;
|
|
||||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
|
||||||
import com.mojang.blaze3d.platform.DestFactor;
|
|
||||||
import com.mojang.blaze3d.platform.SourceFactor;
|
|
||||||
import com.mojang.blaze3d.systems.CommandEncoder;
|
|
||||||
import com.mojang.blaze3d.systems.GpuDevice;
|
|
||||||
import com.mojang.blaze3d.systems.RenderPass;
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import com.seibel.distanthorizons.common.render.blaze.BlazeDhMetaRenderer;
|
import com.seibel.distanthorizons.common.render.blaze.BlazeDhMetaRenderer;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.apply.BlazeDhApplyRenderer;
|
import com.seibel.distanthorizons.common.render.blaze.apply.BlazeDhApplyRenderer;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.wrappers.RenderPipelineBuilderWrapper;
|
import com.seibel.distanthorizons.common.render.blaze.wrappers.RenderPipelineBuilderWrapper;
|
||||||
@@ -56,6 +44,25 @@ import java.nio.ByteOrder;
|
|||||||
import java.util.OptionalDouble;
|
import java.util.OptionalDouble;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.buffers.GpuBuffer;
|
||||||
|
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
||||||
|
import com.mojang.blaze3d.buffers.Std140Builder;
|
||||||
|
import com.mojang.blaze3d.buffers.Std140SizeCalculator;
|
||||||
|
import com.mojang.blaze3d.pipeline.BlendFunction;
|
||||||
|
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||||
|
import com.mojang.blaze3d.platform.BlendFactor;
|
||||||
|
import com.mojang.blaze3d.systems.CommandEncoder;
|
||||||
|
import com.mojang.blaze3d.systems.GpuDevice;
|
||||||
|
import com.mojang.blaze3d.systems.RenderPass;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
|
import com.mojang.blaze3d.platform.DestFactor;
|
||||||
|
import com.mojang.blaze3d.platform.SourceFactor;
|
||||||
|
#else
|
||||||
|
import com.mojang.blaze3d.platform.BlendFactor;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Renders SSAO to the DH LODs. */
|
/** Renders SSAO to the DH LODs. */
|
||||||
public class BlazeDhSsaoRenderer implements IDhSsaoRenderer
|
public class BlazeDhSsaoRenderer implements IDhSsaoRenderer
|
||||||
{
|
{
|
||||||
@@ -101,9 +108,17 @@ public class BlazeDhSsaoRenderer implements IDhSsaoRenderer
|
|||||||
this.init = true;
|
this.init = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BlendFunction blendFunc;
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
|
blendFunc = new BlendFunction(SourceFactor.ZERO, DestFactor.SRC_ALPHA, SourceFactor.ZERO, DestFactor.ONE);
|
||||||
|
#else
|
||||||
|
blendFunc = new BlendFunction(BlendFactor.ZERO, BlendFactor.SRC_ALPHA, BlendFactor.ZERO, BlendFactor.ONE);
|
||||||
|
#endif
|
||||||
|
|
||||||
this.applyRenderer = new BlazeDhApplyRenderer(
|
this.applyRenderer = new BlazeDhApplyRenderer(
|
||||||
"ssao_apply_to_dh",
|
"ssao_apply_to_dh",
|
||||||
new BlendFunction(SourceFactor.ZERO, DestFactor.SRC_ALPHA, SourceFactor.ZERO, DestFactor.ONE),
|
blendFunc,
|
||||||
"apply/blaze/vert", "ssao/blaze/apply",
|
"apply/blaze/vert", "ssao/blaze/apply",
|
||||||
/*uniforms*/ new String[] { "applyFragUniformBlock" }
|
/*uniforms*/ new String[] { "applyFragUniformBlock" }
|
||||||
);
|
);
|
||||||
|
|||||||
+5
-7
@@ -43,6 +43,7 @@ import com.seibel.distanthorizons.common.render.blaze.util.BlazeUniformUtil;
|
|||||||
import com.seibel.distanthorizons.common.render.blaze.wrappers.RenderPipelineBuilderWrapper;
|
import com.seibel.distanthorizons.common.render.blaze.wrappers.RenderPipelineBuilderWrapper;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureViewWrapper;
|
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureViewWrapper;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureWrapper;
|
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureWrapper;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
@@ -164,8 +165,8 @@ public class BlazeVanillaFadeRenderer implements IDhVanillaFadeRenderer
|
|||||||
this.fadeColorTextureWrapper.tryCreateOrResize();
|
this.fadeColorTextureWrapper.tryCreateOrResize();
|
||||||
this.fadeDepthTextureWrapper.tryCreateOrResize();
|
this.fadeDepthTextureWrapper.tryCreateOrResize();
|
||||||
|
|
||||||
this.mcDepthTextureWrapper.tryWrap(Minecraft.getInstance().getMainRenderTarget().getDepthTexture());
|
this.mcDepthTextureWrapper.tryWrap(MinecraftRenderWrapper.INSTANCE.getRenderTarget().getDepthTexture());
|
||||||
this.mcColorTextureWrapper.tryWrap(Minecraft.getInstance().getMainRenderTarget().getColorTexture());
|
this.mcColorTextureWrapper.tryWrap(MinecraftRenderWrapper.INSTANCE.getRenderTarget().getColorTexture());
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -198,11 +199,8 @@ public class BlazeVanillaFadeRenderer implements IDhVanillaFadeRenderer
|
|||||||
Mat4f inverseMcMvmProjMatrix = inverseMcModelViewProjectionMatrix;
|
Mat4f inverseMcMvmProjMatrix = inverseMcModelViewProjectionMatrix;
|
||||||
|
|
||||||
|
|
||||||
Mat4f dhProjectionMatrix = RenderUtil.createLodProjectionMatrix(renderParams.mcProjectionMatrix);
|
Mat4f inverseDhModelViewProjectionMatrix = new Mat4f(renderParams.dhProjectionMatrix);
|
||||||
Mat4f dhModelViewMatrix = RenderUtil.createLodModelViewMatrix(renderParams.mcModelViewMatrix);
|
inverseDhModelViewProjectionMatrix.multiply(renderParams.dhModelViewMatrix);
|
||||||
|
|
||||||
Mat4f inverseDhModelViewProjectionMatrix = new Mat4f(dhProjectionMatrix);
|
|
||||||
inverseDhModelViewProjectionMatrix.multiply(dhModelViewMatrix);
|
|
||||||
inverseDhModelViewProjectionMatrix.invert();
|
inverseDhModelViewProjectionMatrix.invert();
|
||||||
Mat4f inverseDhMvmProjMatrix = inverseDhModelViewProjectionMatrix;
|
Mat4f inverseDhMvmProjMatrix = inverseDhModelViewProjectionMatrix;
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -37,6 +37,7 @@ import com.mojang.blaze3d.vertex.VertexFormat;
|
|||||||
import com.seibel.distanthorizons.common.render.blaze.util.BlazeDhVertexFormatUtil;
|
import com.seibel.distanthorizons.common.render.blaze.util.BlazeDhVertexFormatUtil;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.wrappers.RenderPipelineBuilderWrapper;
|
import com.seibel.distanthorizons.common.render.blaze.wrappers.RenderPipelineBuilderWrapper;
|
||||||
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureViewWrapper;
|
import com.seibel.distanthorizons.common.render.blaze.wrappers.texture.BlazeTextureViewWrapper;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
@@ -164,8 +165,8 @@ public class BlazeDhTestTriangleRenderer implements IDhTestTriangleRenderer
|
|||||||
{
|
{
|
||||||
this.tryInit();
|
this.tryInit();
|
||||||
|
|
||||||
this.mcColorTextureViewWrapper.tryWrap(Minecraft.getInstance().getMainRenderTarget().getColorTexture());
|
this.mcColorTextureViewWrapper.tryWrap(MinecraftRenderWrapper.INSTANCE.getRenderTarget().getColorTexture());
|
||||||
this.mcDepthTextureViewWrapper.tryWrap(Minecraft.getInstance().getMainRenderTarget().getDepthTexture());
|
this.mcDepthTextureViewWrapper.tryWrap(MinecraftRenderWrapper.INSTANCE.getRenderTarget().getDepthTexture());
|
||||||
|
|
||||||
try (RenderPass renderPass = COMMAND_ENCODER.createRenderPass(
|
try (RenderPass renderPass = COMMAND_ENCODER.createRenderPass(
|
||||||
this::getRenderPassName,
|
this::getRenderPassName,
|
||||||
|
|||||||
+16
-1
@@ -5,6 +5,7 @@ public class BlazeDhVertexFormatUtil {}
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.GpuFormat;
|
||||||
import com.mojang.blaze3d.vertex.VertexFormatElement;
|
import com.mojang.blaze3d.vertex.VertexFormatElement;
|
||||||
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderApi;
|
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderApi;
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
@@ -70,7 +71,7 @@ public class BlazeDhVertexFormatUtil
|
|||||||
IRIS_NORMAL = VertexFormatElement.register(/*id*/29, /*index*/0, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, /*count*/ 1);
|
IRIS_NORMAL = VertexFormatElement.register(/*id*/29, /*index*/0, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, /*count*/ 1);
|
||||||
|
|
||||||
FLOAT_XYZ_POS = VertexFormatElement.register(/*id*/30, /*index*/0, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.POSITION, /*count*/ 3);
|
FLOAT_XYZ_POS = VertexFormatElement.register(/*id*/30, /*index*/0, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.POSITION, /*count*/ 3);
|
||||||
#else
|
#elif MC_VER <= MC_26_1_2
|
||||||
SCREEN_POS = VertexFormatElement.register(/*id*/22, /*index*/0, VertexFormatElement.Type.FLOAT, false, /*count*/ 2);
|
SCREEN_POS = VertexFormatElement.register(/*id*/22, /*index*/0, VertexFormatElement.Type.FLOAT, false, /*count*/ 2);
|
||||||
RGBA_FLOAT_COLOR = VertexFormatElement.register(/*id*/23, /*index*/0, VertexFormatElement.Type.FLOAT, false, /*count*/ 4);
|
RGBA_FLOAT_COLOR = VertexFormatElement.register(/*id*/23, /*index*/0, VertexFormatElement.Type.FLOAT, false, /*count*/ 4);
|
||||||
|
|
||||||
@@ -83,6 +84,20 @@ public class BlazeDhVertexFormatUtil
|
|||||||
IRIS_NORMAL = VertexFormatElement.register(/*id*/29, /*index*/0, VertexFormatElement.Type.BYTE, false, /*count*/ 1);
|
IRIS_NORMAL = VertexFormatElement.register(/*id*/29, /*index*/0, VertexFormatElement.Type.BYTE, false, /*count*/ 1);
|
||||||
|
|
||||||
FLOAT_XYZ_POS = VertexFormatElement.register(/*id*/30, /*index*/0, VertexFormatElement.Type.FLOAT, false, /*count*/ 3);
|
FLOAT_XYZ_POS = VertexFormatElement.register(/*id*/30, /*index*/0, VertexFormatElement.Type.FLOAT, false, /*count*/ 3);
|
||||||
|
#else
|
||||||
|
|
||||||
|
SCREEN_POS = VertexFormatElement.register(/*id*/22, /*index*/0, GpuFormat.RG32_FLOAT); // 2 floats
|
||||||
|
RGBA_FLOAT_COLOR = VertexFormatElement.register(/*id*/23, /*index*/0, GpuFormat.RGBA32_FLOAT); // 4 floats
|
||||||
|
|
||||||
|
SHORT_XYZ_POS = VertexFormatElement.register(/*id*/24, /*index*/0, GpuFormat.RGB16_UINT); // 3 ushorts
|
||||||
|
BYTE_PAD = VertexFormatElement.register(/*id*/25, /*index*/0, GpuFormat.R8_UINT); // 1 byte
|
||||||
|
|
||||||
|
META = VertexFormatElement.register(/*id*/26, /*index*/0, GpuFormat.R16_UINT); // 1 ushort
|
||||||
|
RGBA_UBYTE_COLOR = VertexFormatElement.register(/*id*/27, /*index*/0, GpuFormat.RGBA8_UNORM); // 4 ubytes
|
||||||
|
IRIS_MATERIAL = VertexFormatElement.register(/*id*/28, /*index*/0, GpuFormat.R8_UINT); // 1 byte
|
||||||
|
IRIS_NORMAL = VertexFormatElement.register(/*id*/29, /*index*/0, GpuFormat.R8_UINT); // 1 byte
|
||||||
|
|
||||||
|
FLOAT_XYZ_POS = VertexFormatElement.register(/*id*/30, /*index*/0, GpuFormat.RGB32_FLOAT); // 3 floats
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
+40
-4
@@ -6,8 +6,8 @@ public class RenderPipelineBuilderWrapper {}
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
import com.mojang.blaze3d.pipeline.BlendFunction;
|
import com.mojang.blaze3d.GpuFormat;
|
||||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
import com.mojang.blaze3d.pipeline.*;
|
||||||
import com.mojang.blaze3d.platform.PolygonMode;
|
import com.mojang.blaze3d.platform.PolygonMode;
|
||||||
import com.mojang.blaze3d.shaders.UniformType;
|
import com.mojang.blaze3d.shaders.UniformType;
|
||||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||||
@@ -16,13 +16,12 @@ import net.minecraft.resources.Identifier;
|
|||||||
#if MC_VER <= MC_1_21_11
|
#if MC_VER <= MC_1_21_11
|
||||||
import com.mojang.blaze3d.platform.DepthTestFunction;
|
import com.mojang.blaze3d.platform.DepthTestFunction;
|
||||||
#else
|
#else
|
||||||
import com.mojang.blaze3d.pipeline.ColorTargetState;
|
|
||||||
import com.mojang.blaze3d.pipeline.DepthStencilState;
|
|
||||||
import com.mojang.blaze3d.platform.CompareOp;
|
import com.mojang.blaze3d.platform.CompareOp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class RenderPipelineBuilderWrapper
|
public class RenderPipelineBuilderWrapper
|
||||||
@@ -130,15 +129,27 @@ public class RenderPipelineBuilderWrapper
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final ArrayList<String> samplerNames = new ArrayList<>();
|
||||||
public RenderPipelineBuilderWrapper withSampler(String name) throws IllegalArgumentException
|
public RenderPipelineBuilderWrapper withSampler(String name) throws IllegalArgumentException
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
this.blazePipelineBuilder.withSampler(name);
|
this.blazePipelineBuilder.withSampler(name);
|
||||||
|
#else
|
||||||
|
samplerNames.add(name);
|
||||||
|
#endif
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final ArrayList<String> uniformBufferNames = new ArrayList<>();
|
||||||
public RenderPipelineBuilderWrapper withUniformBuffer(String name) throws IllegalArgumentException
|
public RenderPipelineBuilderWrapper withUniformBuffer(String name) throws IllegalArgumentException
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
this.blazePipelineBuilder.withUniform(name, UniformType.UNIFORM_BUFFER);
|
this.blazePipelineBuilder.withUniform(name, UniformType.UNIFORM_BUFFER);
|
||||||
|
#else
|
||||||
|
uniformBufferNames.add(name);
|
||||||
|
#endif
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,6 +293,31 @@ public class RenderPipelineBuilderWrapper
|
|||||||
this.blazePipelineBuilder.withVertexFormat(vertexFormat, blazeVertexMode);
|
this.blazePipelineBuilder.withVertexFormat(vertexFormat, blazeVertexMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// uniform buffers
|
||||||
|
{
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
|
// handled before this point
|
||||||
|
#else
|
||||||
|
|
||||||
|
BindGroupLayout.Builder bindGroupBuilder = BindGroupLayout.builder();
|
||||||
|
|
||||||
|
for (String name : this.samplerNames)
|
||||||
|
{
|
||||||
|
bindGroupBuilder.withSampler(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String name : this.uniformBufferNames)
|
||||||
|
{
|
||||||
|
bindGroupBuilder.withUniform(name, UniformType.UNIFORM_BUFFER);
|
||||||
|
}
|
||||||
|
|
||||||
|
BindGroupLayout bindGroup = bindGroupBuilder.build();
|
||||||
|
this.blazePipelineBuilder.withBindGroupLayout(bindGroup);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return this.blazePipelineBuilder.build();
|
return this.blazePipelineBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+38
-9
@@ -5,11 +5,6 @@ public class BlazeTextureWrapper {}
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
import com.mojang.blaze3d.buffers.GpuBuffer;
|
|
||||||
import com.mojang.blaze3d.systems.CommandEncoder;
|
|
||||||
import com.mojang.blaze3d.systems.GpuDevice;
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import com.mojang.blaze3d.textures.*;
|
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
@@ -18,6 +13,17 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRen
|
|||||||
|
|
||||||
import java.util.OptionalDouble;
|
import java.util.OptionalDouble;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.systems.CommandEncoder;
|
||||||
|
import com.mojang.blaze3d.systems.GpuDevice;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import com.mojang.blaze3d.textures.*;
|
||||||
|
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
|
|
||||||
|
#else
|
||||||
|
import com.mojang.blaze3d.GpuFormat;
|
||||||
|
#endif
|
||||||
|
|
||||||
public class BlazeTextureWrapper
|
public class BlazeTextureWrapper
|
||||||
{
|
{
|
||||||
public static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
public static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||||
@@ -29,7 +35,11 @@ public class BlazeTextureWrapper
|
|||||||
|
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
public final TextureFormat textureFormat;
|
public final TextureFormat textureFormat;
|
||||||
|
#else
|
||||||
|
public final GpuFormat textureFormat;
|
||||||
|
#endif
|
||||||
|
|
||||||
public GpuTexture texture = null;
|
public GpuTexture texture = null;
|
||||||
public GpuTextureView textureView = null;
|
public GpuTextureView textureView = null;
|
||||||
@@ -45,10 +55,27 @@ public class BlazeTextureWrapper
|
|||||||
//==============//
|
//==============//
|
||||||
//region
|
//region
|
||||||
|
|
||||||
public static BlazeTextureWrapper createDepth(String name) { return new BlazeTextureWrapper(name, TextureFormat.DEPTH32); }
|
public static BlazeTextureWrapper createDepth(String name)
|
||||||
public static BlazeTextureWrapper createColor(String name) { return new BlazeTextureWrapper(name, TextureFormat.RGBA8); }
|
{
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
|
return new BlazeTextureWrapper(name, TextureFormat.DEPTH32);
|
||||||
|
#else
|
||||||
|
return new BlazeTextureWrapper(name, GpuFormat.D32_FLOAT);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
public static BlazeTextureWrapper createColor(String name)
|
||||||
|
{
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
|
return new BlazeTextureWrapper(name, TextureFormat.RGBA8);
|
||||||
|
#else
|
||||||
|
return new BlazeTextureWrapper(name, GpuFormat.RGBA8_UNORM);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
private BlazeTextureWrapper(String name, TextureFormat textureFormat)
|
private BlazeTextureWrapper(
|
||||||
|
String name,
|
||||||
|
#if MC_VER <= MC_26_1_2 TextureFormat #else GpuFormat #endif textureFormat
|
||||||
|
)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.textureFormat = textureFormat;
|
this.textureFormat = textureFormat;
|
||||||
@@ -116,7 +143,9 @@ public class BlazeTextureWrapper
|
|||||||
| GpuTexture.USAGE_TEXTURE_BINDING
|
| GpuTexture.USAGE_TEXTURE_BINDING
|
||||||
| GpuTexture.USAGE_COPY_SRC
|
| GpuTexture.USAGE_COPY_SRC
|
||||||
| GpuTexture.USAGE_RENDER_ATTACHMENT;
|
| GpuTexture.USAGE_RENDER_ATTACHMENT;
|
||||||
this.texture = GPU_DEVICE.createTexture(this.name,
|
|
||||||
|
this.texture = GPU_DEVICE.createTexture(
|
||||||
|
this.name,
|
||||||
usage,
|
usage,
|
||||||
this.textureFormat,
|
this.textureFormat,
|
||||||
viewWidth, viewHeight,
|
viewWidth, viewHeight,
|
||||||
|
|||||||
-2
@@ -10,7 +10,6 @@ import com.seibel.distanthorizons.common.render.openGl.glObject.GLProxy;
|
|||||||
import com.seibel.distanthorizons.common.render.openGl.glObject.GlDhFramebuffer;
|
import com.seibel.distanthorizons.common.render.openGl.glObject.GlDhFramebuffer;
|
||||||
import com.seibel.distanthorizons.common.render.openGl.glObject.texture.*;
|
import com.seibel.distanthorizons.common.render.openGl.glObject.texture.*;
|
||||||
import com.seibel.distanthorizons.common.render.openGl.postProcessing.apply.GlDhApplyShader;
|
import com.seibel.distanthorizons.common.render.openGl.postProcessing.apply.GlDhApplyShader;
|
||||||
import com.seibel.distanthorizons.common.render.openGl.terrain.GlDhTerrainShaderProgram;
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftGLWrapper;
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftGLWrapper;
|
||||||
import com.seibel.distanthorizons.common.wrappers.misc.LightMapWrapper;
|
import com.seibel.distanthorizons.common.wrappers.misc.LightMapWrapper;
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
@@ -22,7 +21,6 @@ import com.seibel.distanthorizons.core.render.DhApiRenderProxy;
|
|||||||
import com.seibel.distanthorizons.core.render.RenderParams;
|
import com.seibel.distanthorizons.core.render.RenderParams;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.ILightMapWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.AbstractOptifineAccessor;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhMetaRenderer;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.IDhMetaRenderer;
|
||||||
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
|
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
|
||||||
|
|||||||
+23
@@ -748,4 +748,27 @@ public class GlGenericObjectRenderer implements IDhGenericRenderer
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//================//
|
||||||
|
// base overrides //
|
||||||
|
//================//
|
||||||
|
//region
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close()
|
||||||
|
{
|
||||||
|
if (this.boxVertexBuffer != null)
|
||||||
|
{
|
||||||
|
this.boxVertexBuffer.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.boxIndexBuffer != null)
|
||||||
|
{
|
||||||
|
this.boxIndexBuffer.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -126,6 +126,8 @@ public class GLProxy
|
|||||||
|
|
||||||
private GLProxy() throws IllegalStateException
|
private GLProxy() throws IllegalStateException
|
||||||
{
|
{
|
||||||
|
// TODO vulkan complain if created when MC is running on vulkan
|
||||||
|
|
||||||
// this must be created on minecraft's render context to work correctly
|
// this must be created on minecraft's render context to work correctly
|
||||||
if (GLFW.glfwGetCurrentContext() == 0L)
|
if (GLFW.glfwGetCurrentContext() == 0L)
|
||||||
{
|
{
|
||||||
|
|||||||
+278
-37
@@ -21,14 +21,19 @@ package com.seibel.distanthorizons.common.render.openGl.glObject.buffer;
|
|||||||
|
|
||||||
import com.seibel.distanthorizons.api.enums.config.EDhApiGpuUploadMethod;
|
import com.seibel.distanthorizons.api.enums.config.EDhApiGpuUploadMethod;
|
||||||
import com.seibel.distanthorizons.common.render.openGl.glObject.GLProxy;
|
import com.seibel.distanthorizons.common.render.openGl.glObject.GLProxy;
|
||||||
import com.seibel.distanthorizons.common.render.openGl.glObject.GLState;
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftGLWrapper;
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftGLWrapper;
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
import com.seibel.distanthorizons.core.config.Config;
|
||||||
|
import com.seibel.distanthorizons.core.jar.EPlatform;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
|
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
||||||
import com.seibel.distanthorizons.core.render.RenderThreadTaskHandler;
|
import com.seibel.distanthorizons.core.render.RenderThreadTaskHandler;
|
||||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||||
import com.seibel.distanthorizons.core.util.ThreadUtil;
|
import com.seibel.distanthorizons.core.util.ThreadUtil;
|
||||||
|
import com.seibel.distanthorizons.core.util.objects.Pair;
|
||||||
|
import com.seibel.distanthorizons.core.util.objects.pooling.PhantomLoggingHelper;
|
||||||
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
|
import com.seibel.distanthorizons.coreapi.util.StringUtil;
|
||||||
import org.lwjgl.opengl.GL32;
|
import org.lwjgl.opengl.GL32;
|
||||||
import org.lwjgl.opengl.GL44;
|
import org.lwjgl.opengl.GL44;
|
||||||
|
|
||||||
@@ -36,9 +41,12 @@ import java.lang.ref.PhantomReference;
|
|||||||
import java.lang.ref.Reference;
|
import java.lang.ref.Reference;
|
||||||
import java.lang.ref.ReferenceQueue;
|
import java.lang.ref.ReferenceQueue;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.concurrent.locks.StampedLock;
|
||||||
|
|
||||||
public class GLBuffer implements AutoCloseable
|
public class GLBuffer implements AutoCloseable
|
||||||
{
|
{
|
||||||
@@ -50,26 +58,57 @@ public class GLBuffer implements AutoCloseable
|
|||||||
private static final MinecraftGLWrapper GLMC = MinecraftGLWrapper.INSTANCE;
|
private static final MinecraftGLWrapper GLMC = MinecraftGLWrapper.INSTANCE;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO move to a shared location that can be handled by both GL and Blaze3D buffers
|
||||||
|
/** if enabled the number of GC'ed buffers will be logged */
|
||||||
|
private static final boolean LOG_PHANTOM_RECOVERY = ModInfo.IS_DEV_BUILD;
|
||||||
|
/** If enabled buffers allocation/upload stacks will be logged when GC'ed. */
|
||||||
|
private static final boolean LOG_PHANTOM_ALLOCATION_STACKS = false; // disabled by default due to the increased GC load
|
||||||
|
|
||||||
public static final double BUFFER_EXPANSION_MULTIPLIER = 1.3;
|
public static final double BUFFER_EXPANSION_MULTIPLIER = 1.3;
|
||||||
public static final double BUFFER_SHRINK_TRIGGER = BUFFER_EXPANSION_MULTIPLIER * BUFFER_EXPANSION_MULTIPLIER;
|
public static final double BUFFER_SHRINK_TRIGGER = BUFFER_EXPANSION_MULTIPLIER * BUFFER_EXPANSION_MULTIPLIER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On macOS the legacy OpenGL -> Metal bridge crashes with SIGBUS in
|
||||||
|
* {@code _platform_memmove} when {@code glBufferData} or {@code glBufferSubData}
|
||||||
|
* are called with a large ByteBuffer in one shot. To work around it, we split
|
||||||
|
* the upload into smaller sub-data calls that each fit comfortably inside the
|
||||||
|
* driver's internal staging path. <br>
|
||||||
|
* 256 KiB tuned empirically against macOS 26.5 — a 1 MiB chunk still
|
||||||
|
* tripped the same {@code _platform_memmove} crash inside
|
||||||
|
* {@code glBufferSubData_Exec}, but 256 KiB consistently survives.
|
||||||
|
*/
|
||||||
|
public static final int MAC_UPLOAD_CHUNK_BYTES = 256 * 1024;
|
||||||
|
/** Threshold above which the chunked path kicks in on macOS. */
|
||||||
|
public static final int MAC_UPLOAD_CHUNK_THRESHOLD = MAC_UPLOAD_CHUNK_BYTES;
|
||||||
/** the number of active buffers, can be used for debugging */
|
/** the number of active buffers, can be used for debugging */
|
||||||
public static AtomicInteger bufferCount = new AtomicInteger(0);
|
public static AtomicInteger bufferCount = new AtomicInteger(0);
|
||||||
|
|
||||||
private static final int PHANTOM_REF_CHECK_TIME_IN_MS = 5 * 1000;
|
private static final int PHANTOM_REF_CHECK_TIME_IN_MS = 5 * 1000;
|
||||||
private static final ConcurrentHashMap<PhantomReference<? extends GLBuffer>, Integer> PHANTOM_TO_BUFFER_ID = new ConcurrentHashMap<>();
|
private static final ConcurrentHashMap<PhantomReference<? extends GLBuffer>, Integer> PHANTOM_TO_BUFFER_ID = new ConcurrentHashMap<>();
|
||||||
private static final ConcurrentHashMap<Integer, PhantomReference<? extends GLBuffer>> BUFFER_ID_TO_PHANTOM = new ConcurrentHashMap<>();
|
private static final ConcurrentHashMap<Integer, PhantomReference<? extends GLBuffer>> BUFFER_ID_TO_PHANTOM = new ConcurrentHashMap<>();
|
||||||
|
private static final ConcurrentHashMap<Integer, String> BUFFER_ID_TO_ALLOCATION_STRING = new ConcurrentHashMap<>();
|
||||||
private static final ReferenceQueue<GLBuffer> PHANTOM_REFERENCE_QUEUE = new ReferenceQueue<>();
|
private static final ReferenceQueue<GLBuffer> PHANTOM_REFERENCE_QUEUE = new ReferenceQueue<>();
|
||||||
private static final ThreadPoolExecutor CLEANUP_THREAD = ThreadUtil.makeSingleDaemonThreadPool("GLBuffer Cleanup");
|
private static final ThreadPoolExecutor CLEANUP_THREAD = ThreadUtil.makeSingleDaemonThreadPool("GLBuffer Cleanup");
|
||||||
|
|
||||||
|
|
||||||
protected int id;
|
protected volatile int id = 0;
|
||||||
public final int getId() { return this.id; }
|
public final int getId() { return this.id; }
|
||||||
protected int size = 0;
|
protected int size = 0;
|
||||||
public int getSize() { return this.size; }
|
public int getSize() { return this.size; }
|
||||||
protected boolean bufferStorage;
|
protected boolean bufferStorage;
|
||||||
public final boolean isBufferStorage() { return this.bufferStorage; }
|
|
||||||
protected boolean isMapped = false;
|
protected boolean isMapped = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Locking on the render thread isn't great, but is needed due to an inconsistent
|
||||||
|
* race condition where VBOs can be marked as deleted outside the render thread. <br><br>
|
||||||
|
*
|
||||||
|
* But, due to being a read-write lock the chance of freezing
|
||||||
|
* the render thread is very low
|
||||||
|
* and since this is a stamped lock, the optimistic read time is basically zero.
|
||||||
|
* (The optimistic lock time doesn't even appear in the profiler).
|
||||||
|
*/
|
||||||
|
public final StampedLock renderStampLock = new StampedLock();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==============//
|
//==============//
|
||||||
@@ -112,13 +151,28 @@ public class GLBuffer implements AutoCloseable
|
|||||||
LodUtil.assertNotReach("Thread ["+Thread.currentThread()+"] tried to create a GLBuffer outside the MC render thread.");
|
LodUtil.assertNotReach("Thread ["+Thread.currentThread()+"] tried to create a GLBuffer outside the MC render thread.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// destroy the old buffer if one is present
|
|
||||||
if (this.id != 0)
|
// lock to prevent the render thread from accessing the buffer's ID
|
||||||
|
// while we are removing it
|
||||||
|
long writeStamp = renderStampLock.writeLock();
|
||||||
|
try
|
||||||
{
|
{
|
||||||
destroyBufferIdNow(this.id);
|
final int oldId = this.id;
|
||||||
|
this.id = GLMC.glGenBuffers();
|
||||||
|
//LOGGER.info("created [" + newId + "].");
|
||||||
|
|
||||||
|
// destroy the old buffer
|
||||||
|
// after the new one has been created
|
||||||
|
// to hopefully prevent a rare race conditions where the old ID
|
||||||
|
// is still used somewhere
|
||||||
|
if (oldId != 0)
|
||||||
|
{
|
||||||
|
// this ID doesn't need to be tracked anymore
|
||||||
|
tryRemoveBufferIdFromPhantom(oldId);
|
||||||
|
destroyBufferIdNow(oldId, "destroyOldAndCreate");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.id = GLMC.glGenBuffers();
|
|
||||||
this.bufferStorage = asBufferStorage;
|
this.bufferStorage = asBufferStorage;
|
||||||
bufferCount.getAndIncrement();
|
bufferCount.getAndIncrement();
|
||||||
|
|
||||||
@@ -126,9 +180,20 @@ public class GLBuffer implements AutoCloseable
|
|||||||
PHANTOM_TO_BUFFER_ID.put(phantom, this.id);
|
PHANTOM_TO_BUFFER_ID.put(phantom, this.id);
|
||||||
BUFFER_ID_TO_PHANTOM.put(this.id, phantom);
|
BUFFER_ID_TO_PHANTOM.put(this.id, phantom);
|
||||||
|
|
||||||
|
this.updateAllocationStackTrace();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
renderStampLock.unlock(writeStamp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void destroyAsync()
|
protected void destroyAsync()
|
||||||
|
{
|
||||||
|
// lock to prevent the render thread from accessing the buffer's ID
|
||||||
|
// while we are removing it
|
||||||
|
long writeStamp = renderStampLock.writeLock();
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (this.id == 0)
|
if (this.id == 0)
|
||||||
{
|
{
|
||||||
@@ -137,47 +202,68 @@ public class GLBuffer implements AutoCloseable
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int idToDelete = this.id; // saving the ID to a separate variable is necessary so it can be captured by the lambda
|
final int idToDelete = this.id; // saving the ID to a separate variable is necessary so it can be captured by the lambda
|
||||||
RenderThreadTaskHandler.INSTANCE.queueRunningOnRenderThread("GLBuffer destroyAsync", () -> { destroyBufferIdNow(idToDelete); });
|
|
||||||
|
|
||||||
|
// remove the phantom tracking now so the phantom doesn't have the chance to
|
||||||
|
// get garbage collected before the render thread task runs
|
||||||
|
// (this can happen if MC is running at extremely low framerates like 1 fps via mods)
|
||||||
|
tryRemoveBufferIdFromPhantom(idToDelete);
|
||||||
|
|
||||||
|
// mark the old data is invalid before deleting to prevent a rare race condition
|
||||||
|
// where the queued on render thread task runs before the ID is cleared
|
||||||
this.id = 0;
|
this.id = 0;
|
||||||
this.size = 0;
|
this.size = 0;
|
||||||
|
|
||||||
|
//LOGGER.info("async destroy [" + idToDelete + "].");
|
||||||
|
RenderThreadTaskHandler.INSTANCE.queueRunningOnRenderThread("GLBuffer destroyAsync", () -> { destroyBufferIdNow(idToDelete, "destroyAsync"); });
|
||||||
}
|
}
|
||||||
private static void destroyBufferIdNow(int id)
|
finally
|
||||||
|
{
|
||||||
|
renderStampLock.unlock(writeStamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void destroyBufferIdNow(int id, String cause)
|
||||||
{
|
{
|
||||||
// only delete valid buffers
|
// only delete valid buffers
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
{
|
{
|
||||||
LOGGER.warn("Attempted to destroy a buffer with ID 0, VRAM memory leaks may occur.");
|
LOGGER.warn("Attempted to destroy a buffer with ID 0, VRAM memory leaks may occur, cause: ["+cause+"].");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove and clear the phantom reference if present
|
bufferCount.decrementAndGet();
|
||||||
if (BUFFER_ID_TO_PHANTOM.containsKey(id))
|
GLMC.glDeleteBuffers(id);
|
||||||
{
|
|
||||||
Reference<? extends GLBuffer> phantom = BUFFER_ID_TO_PHANTOM.get(id);
|
|
||||||
|
|
||||||
|
if (Config.Client.Advanced.Debugging.logBufferGarbageCollection.get())
|
||||||
|
{
|
||||||
|
LOGGER.info("destroyed buffer [" + id + "], remaining: [" + BUFFER_ID_TO_PHANTOM.size() + "], cause: ["+cause+"].");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** should be called before {@link GLBuffer#destroyBufferIdNow} */
|
||||||
|
private static void tryRemoveBufferIdFromPhantom(int id)
|
||||||
|
{
|
||||||
|
// will contain nothing if stack tracking isn't enabled
|
||||||
|
BUFFER_ID_TO_ALLOCATION_STRING.remove(id);
|
||||||
|
|
||||||
|
PhantomReference<? extends GLBuffer> phantom = BUFFER_ID_TO_PHANTOM.remove(id);
|
||||||
|
if (phantom != null)
|
||||||
|
{
|
||||||
// if we are manually closing this buffer, we don't want the phantom reference to accidentally close it again
|
// if we are manually closing this buffer, we don't want the phantom reference to accidentally close it again
|
||||||
// this can cause a race condition were we accidentally delete an in-use buffer and cause NVIDIA
|
// this can cause a race condition were we accidentally delete an in-use buffer and cause NVIDIA
|
||||||
// to throw an EXCEPTION_ACCESS_VIOLATION when we attempt to render it
|
// to throw an EXCEPTION_ACCESS_VIOLATION when we attempt to render it
|
||||||
phantom.clear();
|
phantom.clear();
|
||||||
|
|
||||||
PHANTOM_TO_BUFFER_ID.remove(phantom);
|
Integer phantomId = PHANTOM_TO_BUFFER_ID.remove(phantom);
|
||||||
BUFFER_ID_TO_PHANTOM.remove(id);
|
if (phantomId == null)
|
||||||
}
|
|
||||||
|
|
||||||
bufferCount.decrementAndGet();
|
|
||||||
|
|
||||||
// destroy the buffer if it exists,
|
|
||||||
// the buffer may not exist if the destroy method is called twice
|
|
||||||
if (GL32.glIsBuffer(id))
|
|
||||||
{
|
{
|
||||||
GLMC.glDeleteBuffers(id);
|
LOGGER.warn("No Phantom->ID binding stored for ID ["+id+"]");
|
||||||
|
|
||||||
if (Config.Client.Advanced.Debugging.logBufferGarbageCollection.get())
|
|
||||||
{
|
|
||||||
LOGGER.info("destroyed buffer [" + id + "], remaining: [" + BUFFER_ID_TO_PHANTOM.size() + "]");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.warn("Unable to remove phantom GLBuffer with ID ["+id+"], buffer may have already been deleted.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
@@ -263,8 +349,25 @@ public class GLBuffer implements AutoCloseable
|
|||||||
LodUtil.assertTrue(!this.bufferStorage, "Buffer is bufferStorage but its trying to use bufferData upload method!");
|
LodUtil.assertTrue(!this.bufferStorage, "Buffer is bufferStorage but its trying to use bufferData upload method!");
|
||||||
|
|
||||||
int bbSize = bb.limit() - bb.position();
|
int bbSize = bb.limit() - bb.position();
|
||||||
GL32.glBufferData(this.getBufferBindingTarget(), bb, bufferDataHint);
|
int target = this.getBufferBindingTarget();
|
||||||
|
|
||||||
|
if (shouldUploadToGpuInChunks(bbSize))
|
||||||
|
{
|
||||||
|
// Two-step path used on macOS to dodge the Apple OpenGL -> Metal
|
||||||
|
// memmove SIGBUS triggered by uploading a large ByteBuffer in one
|
||||||
|
// glBufferData call:
|
||||||
|
// 1) allocate-only with the size overload (no memcpy)
|
||||||
|
// 2) fill the buffer through chunked glBufferSubData calls
|
||||||
|
GL32.glBufferData(target, (long) bbSize, bufferDataHint);
|
||||||
|
subDataUploadInChunks(target, 0, bb, MAC_UPLOAD_CHUNK_BYTES);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GL32.glBufferData(target, bb, bufferDataHint);
|
||||||
|
}
|
||||||
this.size = bbSize;
|
this.size = bbSize;
|
||||||
|
|
||||||
|
this.updateAllocationStackTrace();
|
||||||
}
|
}
|
||||||
/** Requires the buffer to be bound */
|
/** Requires the buffer to be bound */
|
||||||
protected void uploadSubData(ByteBuffer bb, int maxExpansionSize, int bufferDataHint)
|
protected void uploadSubData(ByteBuffer bb, int maxExpansionSize, int bufferDataHint)
|
||||||
@@ -272,14 +375,30 @@ public class GLBuffer implements AutoCloseable
|
|||||||
LodUtil.assertTrue(!this.bufferStorage, "Buffer is bufferStorage but its trying to use subData upload method!");
|
LodUtil.assertTrue(!this.bufferStorage, "Buffer is bufferStorage but its trying to use subData upload method!");
|
||||||
|
|
||||||
int bbSize = bb.limit() - bb.position();
|
int bbSize = bb.limit() - bb.position();
|
||||||
|
int target = this.getBufferBindingTarget();
|
||||||
if (this.size < bbSize || this.size > bbSize * BUFFER_SHRINK_TRIGGER)
|
if (this.size < bbSize || this.size > bbSize * BUFFER_SHRINK_TRIGGER)
|
||||||
{
|
{
|
||||||
int newSize = (int) (bbSize * BUFFER_EXPANSION_MULTIPLIER);
|
int newSize = (int) (bbSize * BUFFER_EXPANSION_MULTIPLIER);
|
||||||
if (newSize > maxExpansionSize) newSize = maxExpansionSize;
|
if (newSize > maxExpansionSize)
|
||||||
GL32.glBufferData(this.getBufferBindingTarget(), newSize, bufferDataHint);
|
{
|
||||||
|
newSize = maxExpansionSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
// allocate-only — no memcpy, safe on macOS regardless of size
|
||||||
|
GL32.glBufferData(target, (long) newSize, bufferDataHint);
|
||||||
this.size = newSize;
|
this.size = newSize;
|
||||||
}
|
}
|
||||||
GL32.glBufferSubData(this.getBufferBindingTarget(), 0, bb);
|
|
||||||
|
if (shouldUploadToGpuInChunks(bbSize))
|
||||||
|
{
|
||||||
|
subDataUploadInChunks(target, 0, bb, MAC_UPLOAD_CHUNK_BYTES);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GL32.glBufferSubData(target, 0, bb);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateAllocationStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
@@ -321,7 +440,6 @@ public class GLBuffer implements AutoCloseable
|
|||||||
{
|
{
|
||||||
// recreate if the buffer storage type changed
|
// recreate if the buffer storage type changed
|
||||||
this.bind();
|
this.bind();
|
||||||
destroyBufferIdNow(this.id);
|
|
||||||
this.destroyOldAndCreate(uploadMethod.useBufferStorage);
|
this.destroyOldAndCreate(uploadMethod.useBufferStorage);
|
||||||
this.bind();
|
this.bind();
|
||||||
}
|
}
|
||||||
@@ -338,6 +456,91 @@ public class GLBuffer implements AutoCloseable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* macOS-only mitigation for the SIGBUS in
|
||||||
|
* {@code libsystem_platform.dylib _platform_memmove} that happens when the
|
||||||
|
* Apple OpenGL -> Metal translation layer copies a single large ByteBuffer
|
||||||
|
* out of LWJGL into driver memory. Splitting the copy into
|
||||||
|
* {@link #MAC_UPLOAD_CHUNK_BYTES} slices keeps every memmove inside a size
|
||||||
|
* the bridge handles reliably.
|
||||||
|
*/
|
||||||
|
private static boolean shouldUploadToGpuInChunks(int byteCount)
|
||||||
|
{
|
||||||
|
return EPlatform.get() == EPlatform.MACOS
|
||||||
|
&& byteCount > MAC_UPLOAD_CHUNK_THRESHOLD;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uploads {@code bb} into the currently bound buffer at {@code baseOffset}
|
||||||
|
* using a sequence of {@link GL32#glBufferSubData(int, long, ByteBuffer)}
|
||||||
|
* calls of at most {@code chunkBytes} each. The buffer's position/limit are
|
||||||
|
* restored before returning.
|
||||||
|
*/
|
||||||
|
private static void subDataUploadInChunks(int target, int baseOffset, ByteBuffer bb, int chunkBytes)
|
||||||
|
{
|
||||||
|
final int origPos = bb.position();
|
||||||
|
final int origLimit = bb.limit();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final int total = origLimit - origPos;
|
||||||
|
int uploaded = 0;
|
||||||
|
while (uploaded < total)
|
||||||
|
{
|
||||||
|
int chunk = Math.min(chunkBytes, total - uploaded);
|
||||||
|
bb.position(origPos + uploaded);
|
||||||
|
bb.limit(origPos + uploaded + chunk);
|
||||||
|
GL32.glBufferSubData(target, (long) (baseOffset + uploaded), bb);
|
||||||
|
uploaded += chunk;
|
||||||
|
// Force the driver to drain its command queue between chunks
|
||||||
|
// so the OpenGL -> Metal bridge processes (and frees) each
|
||||||
|
// staging copy before the next sub-data call piles another
|
||||||
|
// memmove on top of it.
|
||||||
|
if (uploaded < total)
|
||||||
|
{
|
||||||
|
GL32.glFlush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
bb.limit(origLimit);
|
||||||
|
bb.position(origPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* used to help track down leaks where the buffer isn't properly closed
|
||||||
|
* Note: this probably needs extending to accept a stack trace from outside where it's being called
|
||||||
|
* since it's often called on the render thread in an un-helpful location.
|
||||||
|
*/
|
||||||
|
public void updateAllocationStackTrace()
|
||||||
|
{
|
||||||
|
if (LOG_PHANTOM_ALLOCATION_STACKS)
|
||||||
|
{
|
||||||
|
String stack;
|
||||||
|
|
||||||
|
RenderThreadTaskHandler.QueuedRunnable parentQueuedRunnable;
|
||||||
|
// if this is running on the render thread, try getting the render task's stack trace instead
|
||||||
|
// since it's a lot more helpful than wherever the render thread tasks themselves are being run from
|
||||||
|
if (RenderThreadTaskHandler.INSTANCE.isCurrentThread()
|
||||||
|
&& (parentQueuedRunnable = RenderThreadTaskHandler.INSTANCE.getCurrentlyRunningTask()) != null
|
||||||
|
&& parentQueuedRunnable.stackTrace != null)
|
||||||
|
{
|
||||||
|
// trim off the getStacktrace() and queueRunningOnRenderThread() methods
|
||||||
|
StackTraceElement[] trimmedElements = Arrays.copyOfRange(parentQueuedRunnable.stackTrace, 2, parentQueuedRunnable.stackTrace.length);
|
||||||
|
stack = StringUtil.join("\n", trimmedElements).intern();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// not running on the render thread, use the normal stack trace
|
||||||
|
StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
|
||||||
|
stack = StringUtil.join("\n", stackTraceElements).intern();
|
||||||
|
}
|
||||||
|
|
||||||
|
BUFFER_ID_TO_ALLOCATION_STRING.put(this.id, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
@@ -349,8 +552,13 @@ public class GLBuffer implements AutoCloseable
|
|||||||
|
|
||||||
private static void runPhantomReferenceCleanupLoop()
|
private static void runPhantomReferenceCleanupLoop()
|
||||||
{
|
{
|
||||||
|
// these arrays are stored here so they don't have to be re-allocated each loop
|
||||||
|
ArrayList<Pair<String, AtomicInteger>> allocationStackTraceCountPairList = new ArrayList<>();
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
allocationStackTraceCountPairList.clear();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -359,20 +567,53 @@ public class GLBuffer implements AutoCloseable
|
|||||||
}
|
}
|
||||||
catch (InterruptedException ignore) { }
|
catch (InterruptedException ignore) { }
|
||||||
|
|
||||||
|
int collectedCount = 0;
|
||||||
|
|
||||||
Reference<? extends GLBuffer> phantomRef = PHANTOM_REFERENCE_QUEUE.poll();
|
Reference<? extends GLBuffer> phantomRef = PHANTOM_REFERENCE_QUEUE.poll();
|
||||||
while (phantomRef != null)
|
while (phantomRef != null)
|
||||||
{
|
{
|
||||||
// destroy the buffer if it hasn't been cleared yet
|
// destroy the buffer if it hasn't been cleared yet
|
||||||
if (PHANTOM_TO_BUFFER_ID.containsKey(phantomRef))
|
Integer idRef = PHANTOM_TO_BUFFER_ID.remove((PhantomReference<? extends GLBuffer>)phantomRef); // cast to make IntelliJ happy
|
||||||
|
if (idRef != null)
|
||||||
{
|
{
|
||||||
int id = PHANTOM_TO_BUFFER_ID.get(phantomRef);
|
BUFFER_ID_TO_PHANTOM.remove(idRef);
|
||||||
RenderThreadTaskHandler.INSTANCE.queueRunningOnRenderThread("GLBuffer phantom destroy", () -> { destroyBufferIdNow(id); });
|
final int id = idRef;
|
||||||
//LOGGER.warn("Buffer Phantom collected, ID: ["+id+"]");
|
RenderThreadTaskHandler.INSTANCE.queueRunningOnRenderThread("GLBuffer phantom destroy", () -> { destroyBufferIdNow(id, "runPhantomReferenceCleanupLoop"); });
|
||||||
|
//LOGGER.info("Buffer Phantom collected, ID: ["+id+"]");
|
||||||
|
|
||||||
|
if (LOG_PHANTOM_ALLOCATION_STACKS) // stack trace shouldn't be null, but just in case
|
||||||
|
{
|
||||||
|
String stack = BUFFER_ID_TO_ALLOCATION_STRING.get(idRef);
|
||||||
|
PhantomLoggingHelper.putAndIncrementTrackingString(stack, allocationStackTraceCountPairList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.warn("Failed to find Buffer ID for phantom reference: ["+phantomRef+"]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
collectedCount++;
|
||||||
phantomRef = PHANTOM_REFERENCE_QUEUE.poll();
|
phantomRef = PHANTOM_REFERENCE_QUEUE.poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (LOG_PHANTOM_RECOVERY)
|
||||||
|
{
|
||||||
|
// we only want to log when something has been returned
|
||||||
|
if (collectedCount != 0)
|
||||||
|
{
|
||||||
|
LOGGER.warn("GLBuffer phantom recovered: ["+ F3Screen.NUMBER_FORMAT.format(collectedCount)+"].");
|
||||||
|
|
||||||
|
// log stack traces if present
|
||||||
|
if (LOG_PHANTOM_ALLOCATION_STACKS)
|
||||||
|
{
|
||||||
|
PhantomLoggingHelper.LogAllocationStackTracePairCounts(LOGGER, allocationStackTraceCountPairList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-4
@@ -37,10 +37,11 @@ public class GLIndexBuffer extends GLBuffer
|
|||||||
protected int glType = GL32.GL_UNSIGNED_INT;
|
protected int glType = GL32.GL_UNSIGNED_INT;
|
||||||
public int getGlType() { return this.glType; }
|
public int getGlType() { return this.glType; }
|
||||||
|
|
||||||
public GLIndexBuffer(boolean isBufferStorage)
|
|
||||||
{
|
|
||||||
super(isBufferStorage);
|
public GLIndexBuffer(boolean isBufferStorage) { super(isBufferStorage); }
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroyAsync()
|
public void destroyAsync()
|
||||||
|
|||||||
+30
-1
@@ -289,6 +289,9 @@ public class GlDhTerrainShaderProgram extends GlShaderProgram implements IDhApiS
|
|||||||
GLMC.disableBlend();
|
GLMC.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// needs to be triggered after DH attempts to set the GL state so that Iris
|
||||||
|
// can override it as needed
|
||||||
|
ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeRenderPassEvent.class, renderEventParam);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -311,6 +314,12 @@ public class GlDhTerrainShaderProgram extends GlShaderProgram implements IDhApiS
|
|||||||
for (int lodIndex = 0; lodIndex < bufferContainers.size(); lodIndex++)
|
for (int lodIndex = 0; lodIndex < bufferContainers.size(); lodIndex++)
|
||||||
{
|
{
|
||||||
LodBufferContainer bufferContainer = bufferContainers.get(lodIndex);
|
LodBufferContainer bufferContainer = bufferContainers.get(lodIndex);
|
||||||
|
if (!bufferContainer.buffersUploaded)
|
||||||
|
{
|
||||||
|
// make sure we don't accidentally try
|
||||||
|
// rendering a buffer that is (or is going to be) freed
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// set uniforms and fire events
|
// set uniforms and fire events
|
||||||
{
|
{
|
||||||
@@ -335,13 +344,27 @@ public class GlDhTerrainShaderProgram extends GlShaderProgram implements IDhApiS
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// for lock information please view the lock's javadocs
|
||||||
|
long vboReadStamp = vbo.renderStampLock.readLock();
|
||||||
|
long iboReadStamp = vbo.getQuadIBO().renderStampLock.readLock();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// don't render empty sections
|
||||||
if (vbo.getVertexCount() == 0)
|
if (vbo.getVertexCount() == 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// don't render deleted VBOs (this will crash the driver/game)
|
||||||
|
if (vbo.getId() == 0
|
||||||
|
|| vbo.getQuadIBO().getId() == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 4 vertices per face, but 6 indices (IE 2 triangles) per face, aka need to multiply by 1.5
|
// 4 vertices per face, but 6 indices (IE 2 triangles) per face, aka need to multiply by 1.5
|
||||||
int indexCount = (int)(vbo.getVertexCount() * 1.5);
|
int indexCount = (int) (vbo.getVertexCount() * 1.5);
|
||||||
|
|
||||||
vbo.bind();
|
vbo.bind();
|
||||||
vbo.getQuadIBO().bind();
|
vbo.getQuadIBO().bind();
|
||||||
@@ -355,6 +378,12 @@ public class GlDhTerrainShaderProgram extends GlShaderProgram implements IDhApiS
|
|||||||
vbo.unbind();
|
vbo.unbind();
|
||||||
vbo.getQuadIBO().unbind();
|
vbo.getQuadIBO().unbind();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
vbo.renderStampLock.unlock(vboReadStamp);
|
||||||
|
vbo.getQuadIBO().renderStampLock.unlock(iboReadStamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-1
@@ -80,9 +80,20 @@ public class DependencySetup
|
|||||||
SingletonInjector.INSTANCE.bind(IConfigGui.class, ClassicConfigGUI.CONFIG_CORE_INTERFACE);
|
SingletonInjector.INSTANCE.bind(IConfigGui.class, ClassicConfigGUI.CONFIG_CORE_INTERFACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean renderingApiBindingsSet = false;
|
||||||
/** will be called from a DH thread, not the render thread */
|
/** will be called from a DH thread, not the render thread */
|
||||||
public static void setRenderingApiBindings()
|
public synchronized static void setRenderingApiBindings()
|
||||||
{
|
{
|
||||||
|
// shouldn't happen, but there was a single report that this method was triggered twice
|
||||||
|
if (renderingApiBindingsSet)
|
||||||
|
{
|
||||||
|
LOGGER.warn("Rendering bindings already set, skipping. How did this happen?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
renderingApiBindingsSet = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EDhApiRenderApi renderingApiEnum = Config.Client.Advanced.Graphics.Experimental.renderingApi.get();
|
EDhApiRenderApi renderingApiEnum = Config.Client.Advanced.Graphics.Experimental.renderingApi.get();
|
||||||
if (renderingApiEnum == EDhApiRenderApi.AUTO)
|
if (renderingApiEnum == EDhApiRenderApi.AUTO)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ public class VersionConstants implements IVersionConstants
|
|||||||
return "1.21.11";
|
return "1.21.11";
|
||||||
#elif MC_VER == MC_26_1_2
|
#elif MC_VER == MC_26_1_2
|
||||||
return "26.1.2";
|
return "26.1.2";
|
||||||
|
#elif MC_VER == MC_26_2_0
|
||||||
|
return "26.2.0";
|
||||||
#else
|
#else
|
||||||
ERROR MC version constant missing
|
ERROR MC version constant missing
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+302
-264
@@ -140,26 +140,6 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
//==============//
|
//==============//
|
||||||
//region
|
//region
|
||||||
|
|
||||||
public static BlockStateWrapper fromBlockState(BlockState blockState, ILevelWrapper levelWrapper)
|
|
||||||
{
|
|
||||||
if (blockState == null || blockState.isAir())
|
|
||||||
{
|
|
||||||
return AIR;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (WRAPPER_BY_BLOCK_STATE.containsKey(blockState))
|
|
||||||
{
|
|
||||||
return WRAPPER_BY_BLOCK_STATE.get(blockState);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BlockStateWrapper newWrapper = createNewWrapper(blockState, levelWrapper);
|
|
||||||
WRAPPER_BY_BLOCK_STATE.put(blockState, newWrapper);
|
|
||||||
return newWrapper;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be faster than {@link BlockStateWrapper#fromBlockState(BlockState, ILevelWrapper)}
|
* Can be faster than {@link BlockStateWrapper#fromBlockState(BlockState, ILevelWrapper)}
|
||||||
* in cases where the same block state is expected to be referenced multiple times.
|
* in cases where the same block state is expected to be referenced multiple times.
|
||||||
@@ -179,9 +159,35 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
return fromBlockState(blockState, levelWrapper);
|
return fromBlockState(blockState, levelWrapper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static BlockStateWrapper fromBlockState(@Nullable BlockState blockState, ILevelWrapper levelWrapper)
|
||||||
private static BlockStateWrapper createNewWrapper(@Nullable BlockState blockState, ILevelWrapper levelWrapper)
|
|
||||||
{
|
{
|
||||||
|
// air is a special case
|
||||||
|
if (isAir(blockState))
|
||||||
|
{
|
||||||
|
return AIR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// pooling wrappers significantly improves chunk->LOD processing speed
|
||||||
|
// and also reduces GC pressure
|
||||||
|
BlockStateWrapper existingWrapper = WRAPPER_BY_BLOCK_STATE.get(blockState);
|
||||||
|
if (existingWrapper != null)
|
||||||
|
{
|
||||||
|
return existingWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// synchronized so the API event only fires once per block
|
||||||
|
synchronized (WRAPPER_BY_BLOCK_STATE)
|
||||||
|
{
|
||||||
|
// if another thread already finished this block, use that wrapper
|
||||||
|
existingWrapper = WRAPPER_BY_BLOCK_STATE.get(blockState);
|
||||||
|
if (existingWrapper != null)
|
||||||
|
{
|
||||||
|
return existingWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// create a wrapper specifically for the API event to use
|
// create a wrapper specifically for the API event to use
|
||||||
BlockStateWrapper apiWrapper = new BlockStateWrapper(blockState, levelWrapper, null);
|
BlockStateWrapper apiWrapper = new BlockStateWrapper(blockState, levelWrapper, null);
|
||||||
DhApiBlockStateWrapperCreatedEvent.EventParam eventParam = new DhApiBlockStateWrapperCreatedEvent.EventParam(apiWrapper);
|
DhApiBlockStateWrapperCreatedEvent.EventParam eventParam = new DhApiBlockStateWrapperCreatedEvent.EventParam(apiWrapper);
|
||||||
@@ -189,21 +195,50 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
if (!eventParam.getOverridesSet())
|
if (!eventParam.getOverridesSet())
|
||||||
{
|
{
|
||||||
// no changes needed, use the existing object
|
// no API changes needed, use the existing object
|
||||||
|
WRAPPER_BY_BLOCK_STATE.putIfAbsent(blockState, apiWrapper);
|
||||||
return apiWrapper;
|
return apiWrapper;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// create a new wrapper using whatever overrides the API user set
|
// create a new wrapper using whatever overrides the API user set
|
||||||
BlockStateWrapper returnWrapper = new BlockStateWrapper(blockState, levelWrapper, eventParam);
|
BlockStateWrapper returnWrapper = new BlockStateWrapper(blockState, levelWrapper, eventParam);
|
||||||
|
WRAPPER_BY_BLOCK_STATE.putIfAbsent(blockState, returnWrapper);
|
||||||
return returnWrapper;
|
return returnWrapper;
|
||||||
}
|
}
|
||||||
private BlockStateWrapper(@Nullable BlockState blockState, ILevelWrapper levelWrapper, @Nullable DhApiBlockStateWrapperCreatedEvent.EventParam overrideEventParam)
|
}
|
||||||
|
}
|
||||||
|
private BlockStateWrapper(
|
||||||
|
@Nullable BlockState blockState, ILevelWrapper levelWrapper,
|
||||||
|
@Nullable DhApiBlockStateWrapperCreatedEvent.EventParam overrideEventParam)
|
||||||
{
|
{
|
||||||
this.blockState = blockState;
|
this.blockState = blockState;
|
||||||
this.serialString = this.serialize(levelWrapper);
|
this.serialString = serialize(blockState, levelWrapper);
|
||||||
this.hashCode = Objects.hash(this.serialString);
|
this.hashCode = Objects.hash(this.serialString);
|
||||||
|
String lowerCaseSerial = this.serialString.toLowerCase();
|
||||||
|
|
||||||
// allow overriding if present
|
|
||||||
|
|
||||||
|
// is liquid //
|
||||||
|
{
|
||||||
|
if (this.isAir()
|
||||||
|
|| this.blockState == null) // == null isn't necessary since its handled in isAir() but is here to prevent intellij from complaining
|
||||||
|
{
|
||||||
|
this.isLiquid = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if MC_VER < MC_1_20_1
|
||||||
|
this.isLiquid = this.blockState.getMaterial().isLiquid() || !this.blockState.getFluidState().isEmpty();
|
||||||
|
#else
|
||||||
|
this.isLiquid = !this.blockState.getFluidState().isEmpty();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// API overriding //
|
||||||
|
{
|
||||||
if (overrideEventParam != null
|
if (overrideEventParam != null
|
||||||
&& overrideEventParam.getBlockMaterial() != null)
|
&& overrideEventParam.getBlockMaterial() != null)
|
||||||
{
|
{
|
||||||
@@ -212,7 +247,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no API override, use the base logic
|
// no API override, use the base logic
|
||||||
this.blockMaterialId = this.calculateEDhApiBlockMaterialId().index;
|
this.blockMaterialId = calculateEDhApiBlockMaterialId(this.blockState, lowerCaseSerial, this.isLiquid).index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow overriding if present
|
// allow overriding if present
|
||||||
@@ -223,7 +258,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.opacity = this.calculateOpacity();
|
this.opacity = calculateOpacity(this.blockState, isAir(this.blockState), this.isLiquid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow overriding if present
|
// allow overriding if present
|
||||||
@@ -236,10 +271,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
{
|
{
|
||||||
this.allowApiColorOverride = false;
|
this.allowApiColorOverride = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
String lowerCaseSerial = this.serialString.toLowerCase();
|
|
||||||
|
|
||||||
|
|
||||||
|
// beacon handling //
|
||||||
|
{
|
||||||
|
|
||||||
// beacon base blocks
|
// beacon base blocks
|
||||||
#if MC_VER <= MC_1_18_2
|
#if MC_VER <= MC_1_18_2
|
||||||
@@ -316,8 +352,8 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
if (this.blockState != null)
|
if (this.blockState != null)
|
||||||
{
|
{
|
||||||
// get block properties (defaults to the values used by air)
|
// get block properties (defaults to the values used by air)
|
||||||
boolean canOcclude = this.getCanOcclude();
|
boolean canOcclude = getCanOcclude(this.blockState);
|
||||||
boolean propagatesSkyLightDown = this.getPropagatesSkyLightDown();
|
boolean propagatesSkyLightDown = getPropagatesSkyLightDown(this.blockState);
|
||||||
|
|
||||||
if (lowerCaseSerial.contains("minecraft:bedrock"))
|
if (lowerCaseSerial.contains("minecraft:bedrock"))
|
||||||
{
|
{
|
||||||
@@ -348,9 +384,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
allowsBeaconBeamPassage = true;
|
allowsBeaconBeamPassage = true;
|
||||||
}
|
}
|
||||||
this.allowsBeaconBeamPassage = allowsBeaconBeamPassage;
|
this.allowsBeaconBeamPassage = allowsBeaconBeamPassage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// map color
|
// map color //
|
||||||
|
{
|
||||||
if (this.blockState != null)
|
if (this.blockState != null)
|
||||||
{
|
{
|
||||||
int mcColor = 0;
|
int mcColor = 0;
|
||||||
@@ -365,13 +403,15 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.mapColor = new Color(0,0,0,0);
|
this.mapColor = new Color(0, 0, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// is solid
|
// is solid //
|
||||||
|
{
|
||||||
if (this.isAir()
|
if (this.isAir()
|
||||||
|| this.blockState == null) // "== null" isn't necessary since its handled in isAir() but is here to prevent intellij from complaining
|
|| this.blockState == null) // "== null" isn't necessary since its handled in isAir() but is here to prevent IntelliJ from complaining
|
||||||
{
|
{
|
||||||
this.isSolid = false;
|
this.isSolid = false;
|
||||||
}
|
}
|
||||||
@@ -383,27 +423,194 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
this.isSolid = !this.blockState.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO).isEmpty();
|
this.isSolid = !this.blockState.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO).isEmpty();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// is liquid
|
|
||||||
if (this.isAir()
|
}
|
||||||
|| this.blockState == null) // == null isn't necessary since its handled in isAir() but is here to prevent intellij from complaining
|
|
||||||
|
// static constructor helpers //
|
||||||
|
//region
|
||||||
|
|
||||||
|
private static EDhApiBlockMaterial calculateEDhApiBlockMaterialId(
|
||||||
|
@Nullable BlockState blockState,
|
||||||
|
String lowercaseSerialString,
|
||||||
|
boolean isLiquid
|
||||||
|
)
|
||||||
{
|
{
|
||||||
this.isLiquid = false;
|
if (blockState == null)
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.AIR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (blockState.is(BlockTags.LEAVES)
|
||||||
|
|| lowercaseSerialString.contains("bamboo")
|
||||||
|
|| lowercaseSerialString.contains("cactus")
|
||||||
|
|| lowercaseSerialString.contains("chorus_flower")
|
||||||
|
|| lowercaseSerialString.contains("mushroom")
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.LEAVES;
|
||||||
|
}
|
||||||
|
else if (blockState.is(Blocks.LAVA))
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.LAVA;
|
||||||
|
}
|
||||||
|
else if (isLiquid
|
||||||
|
|| blockState.is(Blocks.WATER))
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.WATER;
|
||||||
|
}
|
||||||
|
else if (blockState.getSoundType() == SoundType.WOOD
|
||||||
|
|| lowercaseSerialString.contains("root")
|
||||||
|
#if MC_VER >= MC_1_19_4
|
||||||
|
|| blockState.getSoundType() == SoundType.CHERRY_WOOD
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.WOOD;
|
||||||
|
}
|
||||||
|
else if (blockState.getSoundType() == SoundType.METAL
|
||||||
|
#if MC_VER >= MC_1_19_2
|
||||||
|
|| blockState.getSoundType() == SoundType.COPPER
|
||||||
|
#endif
|
||||||
|
#if MC_VER >= MC_1_20_4
|
||||||
|
|| blockState.getSoundType() == SoundType.COPPER_BULB
|
||||||
|
|| blockState.getSoundType() == SoundType.COPPER_GRATE
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.METAL;
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
lowercaseSerialString.contains("grass_block")
|
||||||
|
|| lowercaseSerialString.contains("grass_slab")
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.GRASS;
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
lowercaseSerialString.contains("dirt")
|
||||||
|
|| lowercaseSerialString.contains("gravel")
|
||||||
|
|| lowercaseSerialString.contains("mud")
|
||||||
|
|| lowercaseSerialString.contains("podzol")
|
||||||
|
|| lowercaseSerialString.contains("mycelium")
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.DIRT;
|
||||||
|
}
|
||||||
|
#if MC_VER >= MC_1_17_1
|
||||||
|
else if (blockState.getSoundType() == SoundType.DEEPSLATE
|
||||||
|
|| blockState.getSoundType() == SoundType.DEEPSLATE_BRICKS
|
||||||
|
|| blockState.getSoundType() == SoundType.DEEPSLATE_TILES
|
||||||
|
|| blockState.getSoundType() == SoundType.POLISHED_DEEPSLATE
|
||||||
|
|| lowercaseSerialString.contains("deepslate") )
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.DEEPSLATE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else if (lowercaseSerialString.contains("snow"))
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.SNOW;
|
||||||
|
}
|
||||||
|
else if (lowercaseSerialString.contains("sand"))
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.SAND;
|
||||||
|
}
|
||||||
|
else if (lowercaseSerialString.contains("terracotta"))
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.TERRACOTTA;
|
||||||
|
}
|
||||||
|
else if (blockState.is(BlockTags.BASE_STONE_NETHER))
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.NETHER_STONE;
|
||||||
|
}
|
||||||
|
else if (lowercaseSerialString.contains("stone")
|
||||||
|
|| lowercaseSerialString.contains("ore"))
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.STONE;
|
||||||
|
}
|
||||||
|
else if (blockState.getLightEmission() > 0)
|
||||||
|
{
|
||||||
|
return EDhApiBlockMaterial.ILLUMINATED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_20_1
|
return EDhApiBlockMaterial.UNKNOWN;
|
||||||
this.isLiquid = this.blockState.getMaterial().isLiquid() || !this.blockState.getFluidState().isEmpty();
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int calculateOpacity(
|
||||||
|
@Nullable BlockState blockState,
|
||||||
|
boolean isAir, boolean isLiquid
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// get block properties (defaults to the values used by air)
|
||||||
|
boolean canOcclude = getCanOcclude(blockState);
|
||||||
|
boolean propagatesSkyLightDown = getPropagatesSkyLightDown(blockState);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// this method isn't perfect, but works well enough for our use case
|
||||||
|
int opacity;
|
||||||
|
if (isAir)
|
||||||
|
{
|
||||||
|
opacity = LodUtil.BLOCK_FULLY_TRANSPARENT;
|
||||||
|
}
|
||||||
|
else if (isLiquid && !canOcclude)
|
||||||
|
{
|
||||||
|
// probably not a waterlogged block (which should block light entirely)
|
||||||
|
|
||||||
|
// +1 to indicate that the block is translucent (in between transparent and opaque)
|
||||||
|
opacity = LodUtil.BLOCK_FULLY_TRANSPARENT + 1;
|
||||||
|
}
|
||||||
|
else if (propagatesSkyLightDown && !canOcclude)
|
||||||
|
{
|
||||||
|
// probably glass or some other fully transparent block
|
||||||
|
|
||||||
|
// !canOcclude is required to ignore stairs and slabs since
|
||||||
|
// propagateSkyLightDown is true for them, but they're solid and don't actually let light through
|
||||||
|
|
||||||
|
opacity = LodUtil.BLOCK_FULLY_TRANSPARENT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// default for all other blocks
|
||||||
|
opacity = LodUtil.BLOCK_FULLY_OPAQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return opacity;
|
||||||
|
}
|
||||||
|
private static boolean getCanOcclude(@Nullable BlockState blockState)
|
||||||
|
{
|
||||||
|
// defaults to the value used by air
|
||||||
|
boolean canOcclude = false;
|
||||||
|
if (blockState != null)
|
||||||
|
{
|
||||||
|
canOcclude = blockState.canOcclude();
|
||||||
|
}
|
||||||
|
|
||||||
|
return canOcclude;
|
||||||
|
}
|
||||||
|
private static boolean getPropagatesSkyLightDown(@Nullable BlockState blockState)
|
||||||
|
{
|
||||||
|
// defaults to the value used by air
|
||||||
|
boolean propagatesSkyLightDown = true;
|
||||||
|
if (blockState != null)
|
||||||
|
{
|
||||||
|
#if MC_VER < MC_1_21_3
|
||||||
|
propagatesSkyLightDown = blockState.propagatesSkylightDown(EmptyBlockGetter.INSTANCE, BlockPos.ZERO);
|
||||||
#else
|
#else
|
||||||
this.isLiquid = !this.blockState.getFluidState().isEmpty();
|
propagatesSkyLightDown = blockState.propagatesSkylightDown();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return propagatesSkyLightDown;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -480,15 +687,6 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
return waterBlock;
|
return waterBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clearCachedIgnoreBlocks()
|
|
||||||
{
|
|
||||||
rendererIgnoredBlocks = null;
|
|
||||||
rendererIgnoredCaveBlocks = null;
|
|
||||||
waterSurfaceReplacementBlocks = null;
|
|
||||||
waterSubsurfaceReplacementBlocks = null;
|
|
||||||
waterBlock = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
@@ -545,7 +743,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
List<BlockState> blockStatesToIgnore = defaultBlockStateToIgnore.blockState.getBlock().getStateDefinition().getPossibleStates();
|
List<BlockState> blockStatesToIgnore = defaultBlockStateToIgnore.blockState.getBlock().getStateDefinition().getPossibleStates();
|
||||||
for (BlockState blockState : blockStatesToIgnore)
|
for (BlockState blockState : blockStatesToIgnore)
|
||||||
{
|
{
|
||||||
BlockStateWrapper newBlockToIgnore = BlockStateWrapper.fromBlockState(blockState, levelWrapper);
|
BlockStateWrapper newBlockToIgnore = fromBlockState(blockState, levelWrapper);
|
||||||
blockStateWrappers.add(newBlockToIgnore);
|
blockStateWrappers.add(newBlockToIgnore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -568,6 +766,15 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
return blockStateWrappers;
|
return blockStateWrappers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void clearCachedIgnoreBlocks()
|
||||||
|
{
|
||||||
|
rendererIgnoredBlocks = null;
|
||||||
|
rendererIgnoredCaveBlocks = null;
|
||||||
|
waterSurfaceReplacementBlocks = null;
|
||||||
|
waterSubsurfaceReplacementBlocks = null;
|
||||||
|
waterBlock = null;
|
||||||
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
@@ -579,73 +786,6 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getOpacity() { return this.opacity; }
|
public int getOpacity() { return this.opacity; }
|
||||||
private int calculateOpacity()
|
|
||||||
{
|
|
||||||
// get block properties (defaults to the values used by air)
|
|
||||||
boolean canOcclude = this.getCanOcclude();
|
|
||||||
boolean propagatesSkyLightDown = this.getPropagatesSkyLightDown();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// this method isn't perfect, but works well enough for our use case
|
|
||||||
int opacity;
|
|
||||||
if (this.isAir())
|
|
||||||
{
|
|
||||||
opacity = LodUtil.BLOCK_FULLY_TRANSPARENT;
|
|
||||||
}
|
|
||||||
else if (this.isLiquid() && !canOcclude)
|
|
||||||
{
|
|
||||||
// probably not a waterlogged block (which should block light entirely)
|
|
||||||
|
|
||||||
// +1 to indicate that the block is translucent (in between transparent and opaque)
|
|
||||||
opacity = LodUtil.BLOCK_FULLY_TRANSPARENT + 1;
|
|
||||||
}
|
|
||||||
else if (propagatesSkyLightDown && !canOcclude)
|
|
||||||
{
|
|
||||||
// probably glass or some other fully transparent block
|
|
||||||
|
|
||||||
// !canOcclude is required to ignore stairs and slabs since
|
|
||||||
// propagateSkyLightDown is true for them, but they're solid and don't actually let light through
|
|
||||||
|
|
||||||
opacity = LodUtil.BLOCK_FULLY_TRANSPARENT;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// default for all other blocks
|
|
||||||
opacity = LodUtil.BLOCK_FULLY_OPAQUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return opacity;
|
|
||||||
}
|
|
||||||
private boolean getCanOcclude()
|
|
||||||
{
|
|
||||||
// defaults to the value used by air
|
|
||||||
boolean canOcclude = false;
|
|
||||||
if (this.blockState != null)
|
|
||||||
{
|
|
||||||
canOcclude = this.blockState.canOcclude();
|
|
||||||
}
|
|
||||||
|
|
||||||
return canOcclude;
|
|
||||||
}
|
|
||||||
private boolean getPropagatesSkyLightDown()
|
|
||||||
{
|
|
||||||
// defaults to the value used by air
|
|
||||||
boolean propagatesSkyLightDown = true;
|
|
||||||
if (this.blockState != null)
|
|
||||||
{
|
|
||||||
#if MC_VER < MC_1_21_3
|
|
||||||
propagatesSkyLightDown = this.blockState.propagatesSkylightDown(EmptyBlockGetter.INSTANCE, BlockPos.ZERO);
|
|
||||||
#else
|
|
||||||
propagatesSkyLightDown = this.blockState.propagatesSkylightDown();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return propagatesSkyLightDown;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightEmission() { return (this.blockState != null) ? this.blockState.getLightEmission() : 0; }
|
public int getLightEmission() { return (this.blockState != null) ? this.blockState.getLightEmission() : 0; }
|
||||||
@@ -653,34 +793,12 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
@Override
|
@Override
|
||||||
public String getSerialString() { return this.serialString; }
|
public String getSerialString() { return this.serialString; }
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (this == obj)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj == null || this.getClass() != obj.getClass())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockStateWrapper that = (BlockStateWrapper) obj;
|
|
||||||
// the serialized value is used so we can test the contents instead of the references
|
|
||||||
return Objects.equals(this.getSerialString(), that.getSerialString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() { return this.hashCode; }
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getWrappedMcObject() { return this.blockState; }
|
public Object getWrappedMcObject() { return this.blockState; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAir() { return this.isAir(this.blockState); }
|
public boolean isAir() { return isAir(this.blockState); }
|
||||||
public boolean isAir(BlockState blockState) { return blockState == null || blockState.isAir(); }
|
public static boolean isAir(BlockState blockState) { return blockState == null || blockState.isAir(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSolid() { return this.isSolid; }
|
public boolean isSolid() { return this.isSolid; }
|
||||||
@@ -705,9 +823,6 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
@Override
|
@Override
|
||||||
public byte getMaterialId() { return this.blockMaterialId; }
|
public byte getMaterialId() { return this.blockMaterialId; }
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() { return this.getSerialString(); }
|
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
@@ -717,9 +832,9 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
//=======================//
|
//=======================//
|
||||||
//region
|
//region
|
||||||
|
|
||||||
private String serialize(ILevelWrapper levelWrapper)
|
private static String serialize(BlockState blockState, ILevelWrapper levelWrapper)
|
||||||
{
|
{
|
||||||
if (this.blockState == null)
|
if (blockState == null)
|
||||||
{
|
{
|
||||||
return AIR_STRING;
|
return AIR_STRING;
|
||||||
}
|
}
|
||||||
@@ -740,27 +855,26 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER <= MC_1_17_1
|
#if MC_VER <= MC_1_17_1
|
||||||
resourceLocation = Registry.BLOCK.getKey(this.blockState.getBlock());
|
resourceLocation = Registry.BLOCK.getKey(blockState.getBlock());
|
||||||
#elif MC_VER <= MC_1_19_2
|
#elif MC_VER <= MC_1_19_2
|
||||||
resourceLocation = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).getKey(this.blockState.getBlock());
|
resourceLocation = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).getKey(blockState.getBlock());
|
||||||
#elif MC_VER <= MC_1_21_1
|
#elif MC_VER <= MC_1_21_1
|
||||||
resourceLocation = registryAccess.registryOrThrow(Registries.BLOCK).getKey(this.blockState.getBlock());
|
resourceLocation = registryAccess.registryOrThrow(Registries.BLOCK).getKey(blockState.getBlock());
|
||||||
#else
|
#else
|
||||||
resourceLocation = registryAccess.lookupOrThrow(Registries.BLOCK).getKey(this.blockState.getBlock());
|
resourceLocation = registryAccess.lookupOrThrow(Registries.BLOCK).getKey(blockState.getBlock());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (resourceLocation == null)
|
if (resourceLocation == null)
|
||||||
{
|
{
|
||||||
LOGGER.warn("No ResourceLocation found, unable to serialize: " + this.blockState);
|
LOGGER.warn("No ResourceLocation found, unable to serialize: " + blockState);
|
||||||
return AIR_STRING;
|
return AIR_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.serialString = resourceLocation.getNamespace() + RESOURCE_LOCATION_SEPARATOR + resourceLocation.getPath()
|
String serialString = resourceLocation.getNamespace() + RESOURCE_LOCATION_SEPARATOR + resourceLocation.getPath()
|
||||||
+ STATE_STRING_SEPARATOR + serializeBlockStateProperties(this.blockState);
|
+ STATE_STRING_SEPARATOR + serializeBlockStateProperties(blockState);
|
||||||
|
return serialString;
|
||||||
return this.serialString;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -899,7 +1013,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
foundState = block.defaultBlockState();
|
foundState = block.defaultBlockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
foundWrapper = createNewWrapper(foundState, levelWrapper);
|
foundWrapper = fromBlockState(foundState, levelWrapper);
|
||||||
return foundWrapper;
|
return foundWrapper;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -912,6 +1026,11 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
// put if absent in case two threads deserialize at the same time
|
// put if absent in case two threads deserialize at the same time
|
||||||
// unfortunately we can't put everything in a computeIfAbsent() since we also throw exceptions
|
// unfortunately we can't put everything in a computeIfAbsent() since we also throw exceptions
|
||||||
WRAPPER_BY_RESOURCE_LOCATION.putIfAbsent(finalResourceStateString, foundWrapper);
|
WRAPPER_BY_RESOURCE_LOCATION.putIfAbsent(finalResourceStateString, foundWrapper);
|
||||||
|
|
||||||
|
if (foundWrapper != AIR)
|
||||||
|
{
|
||||||
|
WRAPPER_BY_BLOCK_STATE.putIfAbsent(foundWrapper.blockState, foundWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -949,118 +1068,37 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==============//
|
//================//
|
||||||
// Iris methods //
|
// base overrides //
|
||||||
//==============//
|
//================//
|
||||||
//region
|
//region
|
||||||
|
|
||||||
private EDhApiBlockMaterial calculateEDhApiBlockMaterialId()
|
@Override
|
||||||
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (this.blockState == null)
|
if (this == obj)
|
||||||
{
|
{
|
||||||
return EDhApiBlockMaterial.AIR;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (obj == null || this.getClass() != obj.getClass())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
String serialString = this.getSerialString().toLowerCase();
|
BlockStateWrapper that = (BlockStateWrapper) obj;
|
||||||
|
// the serialized value is used so we can test the contents instead of the references
|
||||||
|
return Objects.equals(this.getSerialString(), that.getSerialString());
|
||||||
|
}
|
||||||
|
|
||||||
if (this.blockState.is(BlockTags.LEAVES)
|
@Override
|
||||||
|| serialString.contains("bamboo")
|
public int hashCode() { return this.hashCode; }
|
||||||
|| serialString.contains("cactus")
|
|
||||||
|| serialString.contains("chorus_flower")
|
@Override
|
||||||
|| serialString.contains("mushroom")
|
public String toString() { return this.getSerialString(); }
|
||||||
)
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.LEAVES;
|
|
||||||
}
|
|
||||||
else if (this.blockState.is(Blocks.LAVA))
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.LAVA;
|
|
||||||
}
|
|
||||||
else if (this.isLiquid() || this.blockState.is(Blocks.WATER))
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.WATER;
|
|
||||||
}
|
|
||||||
else if (this.blockState.getSoundType() == SoundType.WOOD
|
|
||||||
|| serialString.contains("root")
|
|
||||||
#if MC_VER >= MC_1_19_4
|
|
||||||
|| this.blockState.getSoundType() == SoundType.CHERRY_WOOD
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.WOOD;
|
|
||||||
}
|
|
||||||
else if (this.blockState.getSoundType() == SoundType.METAL
|
|
||||||
#if MC_VER >= MC_1_19_2
|
|
||||||
|| this.blockState.getSoundType() == SoundType.COPPER
|
|
||||||
#endif
|
|
||||||
#if MC_VER >= MC_1_20_4
|
|
||||||
|| this.blockState.getSoundType() == SoundType.COPPER_BULB
|
|
||||||
|| this.blockState.getSoundType() == SoundType.COPPER_GRATE
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.METAL;
|
|
||||||
}
|
|
||||||
else if (
|
|
||||||
serialString.contains("grass_block")
|
|
||||||
|| serialString.contains("grass_slab")
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.GRASS;
|
|
||||||
}
|
|
||||||
else if (
|
|
||||||
serialString.contains("dirt")
|
|
||||||
|| serialString.contains("gravel")
|
|
||||||
|| serialString.contains("mud")
|
|
||||||
|| serialString.contains("podzol")
|
|
||||||
|| serialString.contains("mycelium")
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.DIRT;
|
|
||||||
}
|
|
||||||
#if MC_VER >= MC_1_17_1
|
|
||||||
else if (this.blockState.getSoundType() == SoundType.DEEPSLATE
|
|
||||||
|| this.blockState.getSoundType() == SoundType.DEEPSLATE_BRICKS
|
|
||||||
|| this.blockState.getSoundType() == SoundType.DEEPSLATE_TILES
|
|
||||||
|| this.blockState.getSoundType() == SoundType.POLISHED_DEEPSLATE
|
|
||||||
|| serialString.contains("deepslate") )
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.DEEPSLATE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (this.serialString.contains("snow"))
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.SNOW;
|
|
||||||
}
|
|
||||||
else if (serialString.contains("sand"))
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.SAND;
|
|
||||||
}
|
|
||||||
else if (serialString.contains("terracotta"))
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.TERRACOTTA;
|
|
||||||
}
|
|
||||||
else if (this.blockState.is(BlockTags.BASE_STONE_NETHER))
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.NETHER_STONE;
|
|
||||||
}
|
|
||||||
else if (serialString.contains("stone")
|
|
||||||
|| serialString.contains("ore"))
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.STONE;
|
|
||||||
}
|
|
||||||
else if (this.blockState.getLightEmission() > 0)
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.ILLUMINATED;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return EDhApiBlockMaterial.UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-10
@@ -259,6 +259,8 @@ public class ClientBlockStateColorCache
|
|||||||
if (quads != null
|
if (quads != null
|
||||||
&& !quads.isEmpty()
|
&& !quads.isEmpty()
|
||||||
&& quads.get(0) != null)
|
&& quads.get(0) != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
BakedQuad firstQuad = quads.get(0);
|
BakedQuad firstQuad = quads.get(0);
|
||||||
|
|
||||||
@@ -294,6 +296,20 @@ public class ClientBlockStateColorCache
|
|||||||
EColorMode.getColorMode(this.blockState.getBlock()));
|
EColorMode.getColorMode(this.blockState.getBlock()));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
// Shouldn't normally happen, but there was at least
|
||||||
|
// one report of MC's texture being un-loaded
|
||||||
|
// which prevented us from getting the texture.
|
||||||
|
// So we should have some basic backup logic.
|
||||||
|
|
||||||
|
LOGGER.warn("Failed to get texture color for block ["+this.blockStateWrapper.getSerialString()+"] due to: ["+e.getMessage()+"], falling back to particle color.");
|
||||||
|
|
||||||
|
this.needPostTinting = false;
|
||||||
|
this.tintIndex = 0;
|
||||||
|
this.baseColor = this.getParticleIconColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Backup method.
|
// Backup method.
|
||||||
@@ -399,22 +415,14 @@ public class ClientBlockStateColorCache
|
|||||||
int scale = 1;
|
int scale = 1;
|
||||||
if (colorMode == EColorMode.Leaves)
|
if (colorMode == EColorMode.Leaves)
|
||||||
{
|
{
|
||||||
//switch (//FIXME add config option)
|
if (a == 0)
|
||||||
// case BLACK:
|
{
|
||||||
// a = 255; //simulate black background of fast leaves
|
|
||||||
// break;
|
|
||||||
// case IGNORE:
|
|
||||||
if (a == 0) {
|
|
||||||
continue; //same long grass
|
continue; //same long grass
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
a = 255; //just in case there are semi transparent pixels
|
a = 255; //just in case there are semi transparent pixels
|
||||||
}
|
}
|
||||||
// break;
|
|
||||||
// case TRANSPARENT:
|
|
||||||
// break; //do nothing, let it count towards transparency
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (a == 0 && colorMode != EColorMode.Glass)
|
else if (a == 0 && colorMode != EColorMode.Glass)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.seibel.distanthorizons.common.wrappers.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class DhScreenUtil
|
||||||
|
{
|
||||||
|
//================//
|
||||||
|
// helper methods //
|
||||||
|
//================//
|
||||||
|
//region
|
||||||
|
|
||||||
|
public static void showScreen(Screen screen)
|
||||||
|
{
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
|
Objects.requireNonNull(Minecraft.getInstance()).setScreen(screen);
|
||||||
|
#else
|
||||||
|
Objects.requireNonNull(Minecraft.getInstance()).setScreenAndShow(screen);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+17
-4
@@ -24,10 +24,19 @@ import java.util.*;
|
|||||||
|
|
||||||
public class MinecraftScreen
|
public class MinecraftScreen
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// helper methods
|
||||||
|
//
|
||||||
|
|
||||||
public static Screen getScreen(Screen parent, AbstractScreen screen, String translationName)
|
public static Screen getScreen(Screen parent, AbstractScreen screen, String translationName)
|
||||||
{
|
{ return new ConfigScreenRenderer(parent, screen, translationName); }
|
||||||
return new ConfigScreenRenderer(parent, screen, translationName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//=========//
|
||||||
|
// screens //
|
||||||
|
//=========//
|
||||||
|
//region
|
||||||
|
|
||||||
private static class ConfigScreenRenderer extends DhScreen
|
private static class ConfigScreenRenderer extends DhScreen
|
||||||
{
|
{
|
||||||
@@ -152,7 +161,7 @@ public class MinecraftScreen
|
|||||||
public void onClose()
|
public void onClose()
|
||||||
{
|
{
|
||||||
this.screen.onClose(); // Close our screen
|
this.screen.onClose(); // Close our screen
|
||||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent); // Goto the parent screen
|
DhScreenUtil.showScreen(this.parent); // Goto the parent screen
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -180,4 +189,8 @@ public class MinecraftScreen
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-16
@@ -3,16 +3,15 @@ package com.seibel.distanthorizons.common.wrappers.gui.classicConfig;
|
|||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.api.enums.config.DisallowSelectingViaConfigGui;
|
import com.seibel.distanthorizons.api.enums.config.DisallowSelectingViaConfigGui;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.DhScreen;
|
import com.seibel.distanthorizons.common.wrappers.gui.DhScreen;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.gui.DhScreenUtil;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget;
|
import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.config.ConfigGuiInfo;
|
import com.seibel.distanthorizons.common.wrappers.gui.config.ConfigGuiInfo;
|
||||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper;
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper;
|
||||||
@@ -21,27 +20,20 @@ import com.seibel.distanthorizons.core.config.ConfigHandler;
|
|||||||
import com.seibel.distanthorizons.core.config.types.*;
|
import com.seibel.distanthorizons.core.config.types.*;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.updater.ChangelogScreen;
|
import com.seibel.distanthorizons.common.wrappers.gui.updater.ChangelogScreen;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.core.config.types.enums.EConfigCommentTextPosition;
|
|
||||||
import com.seibel.distanthorizons.core.config.types.enums.EConfigValidity;
|
import com.seibel.distanthorizons.core.config.types.enums.EConfigValidity;
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.jar.updater.SelfUpdater;
|
import com.seibel.distanthorizons.core.jar.updater.SelfUpdater;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.util.AnnotationUtil;
|
import com.seibel.distanthorizons.core.util.AnnotationUtil;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.config.IConfigGui;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.config.ILangWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.config.ILangWrapper;
|
||||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.Font;
|
|
||||||
import net.minecraft.client.gui.components.AbstractWidget;
|
import net.minecraft.client.gui.components.AbstractWidget;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
|
||||||
import net.minecraft.client.gui.components.EditBox;
|
import net.minecraft.client.gui.components.EditBox;
|
||||||
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.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +47,6 @@ import net.minecraft.client.gui.GuiGraphicsExtractor;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER >= MC_1_17_1
|
#if MC_VER >= MC_1_17_1
|
||||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER <= MC_1_21_10
|
#if MC_VER <= MC_1_21_10
|
||||||
@@ -92,6 +83,7 @@ class DhConfigScreen extends DhScreen
|
|||||||
//=============//
|
//=============//
|
||||||
// constructor //
|
// constructor //
|
||||||
//=============//
|
//=============//
|
||||||
|
//region
|
||||||
|
|
||||||
protected DhConfigScreen(Screen parent, String category)
|
protected DhConfigScreen(Screen parent, String category)
|
||||||
{
|
{
|
||||||
@@ -104,15 +96,25 @@ class DhConfigScreen extends DhScreen
|
|||||||
this.category = category;
|
this.category = category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
//=============//
|
||||||
|
// tick update //
|
||||||
|
//=============//
|
||||||
|
//region
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() { super.tick(); }
|
public void tick() { super.tick(); }
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==================//
|
//==================//
|
||||||
// menu UI creation //
|
// menu UI creation //
|
||||||
//==================//
|
//==================//
|
||||||
|
//region
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init()
|
protected void init()
|
||||||
@@ -150,7 +152,7 @@ class DhConfigScreen extends DhScreen
|
|||||||
ChangelogScreen changelogScreen = new ChangelogScreen(this);
|
ChangelogScreen changelogScreen = new ChangelogScreen(this);
|
||||||
if (changelogScreen.usable)
|
if (changelogScreen.usable)
|
||||||
{
|
{
|
||||||
Objects.requireNonNull(this.minecraft).setScreen(changelogScreen);
|
DhScreenUtil.showScreen(changelogScreen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -170,7 +172,7 @@ class DhConfigScreen extends DhScreen
|
|||||||
(button) ->
|
(button) ->
|
||||||
{
|
{
|
||||||
ConfigHandler.INSTANCE.configFileHandler.loadFromFile();
|
ConfigHandler.INSTANCE.configFileHandler.loadFromFile();
|
||||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent);
|
DhScreenUtil.showScreen(this.parent);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// done/close button
|
// done/close button
|
||||||
@@ -181,7 +183,7 @@ class DhConfigScreen extends DhScreen
|
|||||||
(button) ->
|
(button) ->
|
||||||
{
|
{
|
||||||
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
||||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent);
|
DhScreenUtil.showScreen(this.parent);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.configListWidget = new ClassicConfigGUI.ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, 32, 25);
|
this.configListWidget = new ClassicConfigGUI.ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, 32, 25);
|
||||||
@@ -464,7 +466,7 @@ class DhConfigScreen extends DhScreen
|
|||||||
{
|
{
|
||||||
configEntry.uiSetWithoutSaving(configEntry.getDefaultValue());
|
configEntry.uiSetWithoutSaving(configEntry.getDefaultValue());
|
||||||
this.reload = true;
|
this.reload = true;
|
||||||
Objects.requireNonNull(this.minecraft).setScreen(this);
|
DhScreenUtil.showScreen(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
int resetButtonPosX = this.width
|
int resetButtonPosX = this.width
|
||||||
@@ -574,7 +576,7 @@ class DhConfigScreen extends DhScreen
|
|||||||
((button) ->
|
((button) ->
|
||||||
{
|
{
|
||||||
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
||||||
Objects.requireNonNull(this.minecraft).setScreen(ClassicConfigGUI.getScreen(this, configCategory.getDestination()));
|
DhScreenUtil.showScreen(ClassicConfigGUI.getScreen(this, configCategory.getDestination()));
|
||||||
}));
|
}));
|
||||||
this.configListWidget.addButton(this, configType, widget, null, null, null);
|
this.configListWidget.addButton(this, configType, widget, null, null, null);
|
||||||
|
|
||||||
@@ -655,11 +657,14 @@ class DhConfigScreen extends DhScreen
|
|||||||
private Component GetTranslatableTextComponentForConfig(AbstractConfigBase<?> configType)
|
private Component GetTranslatableTextComponentForConfig(AbstractConfigBase<?> configType)
|
||||||
{ return Translatable(TRANSLATION_PREFIX + configType.getNameAndCategory()); }
|
{ return Translatable(TRANSLATION_PREFIX + configType.getNameAndCategory()); }
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===========//
|
//===========//
|
||||||
// rendering //
|
// rendering //
|
||||||
//===========//
|
//===========//
|
||||||
|
//region
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
#if MC_VER < MC_1_20_1
|
#if MC_VER < MC_1_20_1
|
||||||
@@ -779,21 +784,27 @@ class DhConfigScreen extends DhScreen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==========//
|
//==========//
|
||||||
// shutdown //
|
// shutdown //
|
||||||
//==========//
|
//==========//
|
||||||
|
//region
|
||||||
|
|
||||||
/** When you close it, it goes to the previous screen and saves */
|
/** When you close it, it goes to the previous screen and saves */
|
||||||
@Override
|
@Override
|
||||||
public void onClose()
|
public void onClose()
|
||||||
{
|
{
|
||||||
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
||||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent);
|
DhScreenUtil.showScreen(this.parent);
|
||||||
|
|
||||||
ClassicConfigGUI.CONFIG_CORE_INTERFACE.onScreenChangeListenerList.forEach((listener) -> listener.run());
|
ClassicConfigGUI.CONFIG_CORE_INTERFACE.onScreenChangeListenerList.forEach((listener) -> listener.run());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-4
@@ -1,6 +1,7 @@
|
|||||||
package com.seibel.distanthorizons.common.wrappers.gui.updater;
|
package com.seibel.distanthorizons.common.wrappers.gui.updater;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.DhScreen;
|
import com.seibel.distanthorizons.common.wrappers.gui.DhScreen;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.gui.DhScreenUtil;
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.IVersionConstants;
|
||||||
@@ -222,10 +223,7 @@ public class ChangelogScreen extends DhScreen
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClose()
|
public void onClose() { DhScreenUtil.showScreen(this.parent); }
|
||||||
{
|
|
||||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent); // Goto the parent screen
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class TextArea extends ContainerObjectSelectionList<ButtonEntry>
|
public static class TextArea extends ContainerObjectSelectionList<ButtonEntry>
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-2
@@ -2,6 +2,7 @@ package com.seibel.distanthorizons.common.wrappers.gui.updater;
|
|||||||
|
|
||||||
import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch;
|
import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.DhScreen;
|
import com.seibel.distanthorizons.common.wrappers.gui.DhScreen;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.gui.DhScreenUtil;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget;
|
import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget;
|
||||||
import com.seibel.distanthorizons.core.jar.ModJarInfo;
|
import com.seibel.distanthorizons.core.jar.ModJarInfo;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
@@ -137,7 +138,7 @@ public class UpdateModScreen extends DhScreen
|
|||||||
#endif
|
#endif
|
||||||
20, 20,
|
20, 20,
|
||||||
// Create the button and tell it where to go
|
// Create the button and tell it where to go
|
||||||
(buttonWidget) -> Objects.requireNonNull(this.minecraft).setScreen(new ChangelogScreen(this, this.newVersionID)),
|
(buttonWidget) -> DhScreenUtil.showScreen(new ChangelogScreen(this, this.newVersionID)),
|
||||||
// Add a title to the button
|
// Add a title to the button
|
||||||
Translatable(ModInfo.ID + ".updater.title")
|
Translatable(ModInfo.ID + ".updater.title")
|
||||||
));
|
));
|
||||||
@@ -218,7 +219,7 @@ public class UpdateModScreen extends DhScreen
|
|||||||
@Override
|
@Override
|
||||||
public void onClose()
|
public void onClose()
|
||||||
{
|
{
|
||||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent); // Go to the parent screen
|
DhScreenUtil.showScreen(this.parent); // Go to the parent screen
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+34
-6
@@ -136,9 +136,12 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
#if MC_VER <= MC_1_21_10
|
#if MC_VER <= MC_1_21_10
|
||||||
Camera camera = MC.gameRenderer.getMainCamera();
|
Camera camera = MC.gameRenderer.getMainCamera();
|
||||||
return new Vec3f(camera.getLookVector().x(), camera.getLookVector().y(), camera.getLookVector().z());
|
return new Vec3f(camera.getLookVector().x(), camera.getLookVector().y(), camera.getLookVector().z());
|
||||||
#else
|
#elif MC_VER <= MC_26_1_2
|
||||||
Camera camera = MC.gameRenderer.getMainCamera();
|
Camera camera = MC.gameRenderer.getMainCamera();
|
||||||
return new Vec3f(camera.forwardVector().x(), camera.forwardVector().y(), camera.forwardVector().z());
|
return new Vec3f(camera.forwardVector().x(), camera.forwardVector().y(), camera.forwardVector().z());
|
||||||
|
#else
|
||||||
|
Camera camera = MC.gameRenderer.mainCamera();
|
||||||
|
return new Vec3f(camera.forwardVector().x(), camera.forwardVector().y(), camera.forwardVector().z());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +173,12 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
@Override
|
@Override
|
||||||
public Vec3d getCameraExactPosition()
|
public Vec3d getCameraExactPosition()
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
Camera camera = MC.gameRenderer.getMainCamera();
|
Camera camera = MC.gameRenderer.getMainCamera();
|
||||||
|
#else
|
||||||
|
Camera camera = MC.gameRenderer.mainCamera();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if MC_VER <= MC_1_21_10
|
#if MC_VER <= MC_1_21_10
|
||||||
Vec3 projectedView = camera.getPosition();
|
Vec3 projectedView = camera.getPosition();
|
||||||
#else
|
#else
|
||||||
@@ -263,20 +271,29 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
float darkenAmount;
|
float darkenAmount;
|
||||||
#if MC_VER <= MC_1_21_11
|
#if MC_VER <= MC_1_21_11
|
||||||
darkenAmount = MC.gameRenderer.getDarkenWorldAmount(MC.deltaTracker.getGameTimeDeltaPartialTick(true));
|
darkenAmount = MC.gameRenderer.getDarkenWorldAmount(MC.deltaTracker.getGameTimeDeltaPartialTick(true));
|
||||||
#else
|
#elif MC_VER <= MC_26_1_2
|
||||||
darkenAmount = MC.gameRenderer.getBossOverlayWorldDarkening(MC.deltaTracker.getGameTimeDeltaPartialTick(true));
|
darkenAmount = MC.gameRenderer.getBossOverlayWorldDarkening(MC.deltaTracker.getGameTimeDeltaPartialTick(true));
|
||||||
|
#else
|
||||||
|
darkenAmount = MC.gameRenderer.bossOverlayWorldDarkening(MC.deltaTracker.getGameTimeDeltaPartialTick(true));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
|
Camera camera = MC.gameRenderer.getMainCamera();
|
||||||
|
#else
|
||||||
|
Camera camera = MC.gameRenderer.mainCamera();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER <= MC_1_21_11
|
#if MC_VER <= MC_1_21_11
|
||||||
Vector4f colorValues = mcFogRenderer.setupFog(
|
Vector4f colorValues = mcFogRenderer.setupFog(
|
||||||
MC.gameRenderer.getMainCamera(),
|
camera,
|
||||||
MC.options.getEffectiveRenderDistance(),
|
MC.options.getEffectiveRenderDistance(),
|
||||||
MC.deltaTracker,
|
MC.deltaTracker,
|
||||||
darkenAmount,
|
darkenAmount,
|
||||||
MC.level);
|
MC.level);
|
||||||
#else
|
#else
|
||||||
FogData fogData = mcFogRenderer.setupFog(
|
FogData fogData = mcFogRenderer.setupFog(
|
||||||
MC.gameRenderer.getMainCamera(),
|
camera,
|
||||||
MC.options.getEffectiveRenderDistance(),
|
MC.options.getEffectiveRenderDistance(),
|
||||||
MC.deltaTracker,
|
MC.deltaTracker,
|
||||||
darkenAmount,
|
darkenAmount,
|
||||||
@@ -342,7 +359,14 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RenderTarget getRenderTarget() { return MC.getMainRenderTarget(); }
|
public RenderTarget getRenderTarget()
|
||||||
|
{
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
|
return MC.getMainRenderTarget();
|
||||||
|
#else
|
||||||
|
return MC.gameRenderer.mainRenderTarget();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mcRendersToFrameBuffer()
|
public boolean mcRendersToFrameBuffer()
|
||||||
@@ -415,6 +439,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
// TODO vulkan deprecate(?) and add method to get color texture
|
||||||
@Override
|
@Override
|
||||||
public int getColorTextureId()
|
public int getColorTextureId()
|
||||||
{
|
{
|
||||||
@@ -479,9 +504,12 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
|||||||
isBlind |= fluidState.is(FluidTags.WATER);
|
isBlind |= fluidState.is(FluidTags.WATER);
|
||||||
isBlind |= fluidState.is(FluidTags.LAVA);
|
isBlind |= fluidState.is(FluidTags.LAVA);
|
||||||
return isBlind;
|
return isBlind;
|
||||||
#else
|
#elif MC_VER <= MC_26_1_2
|
||||||
boolean isBlind = this.playerHasBlindingEffect();
|
boolean isBlind = this.playerHasBlindingEffect();
|
||||||
return MC.gameRenderer.getMainCamera().getFluidInCamera() != FogType.NONE || isBlind;
|
return MC.gameRenderer.getMainCamera().getFluidInCamera() != FogType.NONE || isBlind;
|
||||||
|
#else
|
||||||
|
boolean isBlind = this.playerHasBlindingEffect();
|
||||||
|
return MC.gameRenderer.mainCamera().getFluidInCamera() != FogType.NONE || isBlind;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-17
@@ -154,22 +154,12 @@ public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironm
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
boolean isTerraFirmaCraftPresent = false;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Class.forName("net.dries007.tfc.world.TFCChunkGenerator");
|
|
||||||
isTerraFirmaCraftPresent = true;
|
|
||||||
LOGGER.info("TerraFirmaCraft detected.");
|
|
||||||
}
|
|
||||||
catch (ClassNotFoundException ignore) { }
|
|
||||||
|
|
||||||
|
|
||||||
ImmutableMap.Builder<EDhApiWorldGenerationStep, Integer> builder = ImmutableMap.builder();
|
ImmutableMap.Builder<EDhApiWorldGenerationStep, Integer> builder = ImmutableMap.builder();
|
||||||
builder.put(EDhApiWorldGenerationStep.EMPTY, 1);
|
builder.put(EDhApiWorldGenerationStep.EMPTY, 1);
|
||||||
builder.put(EDhApiWorldGenerationStep.STRUCTURE_START, 0);
|
builder.put(EDhApiWorldGenerationStep.STRUCTURE_START, 0);
|
||||||
builder.put(EDhApiWorldGenerationStep.STRUCTURE_REFERENCE, 0);
|
builder.put(EDhApiWorldGenerationStep.STRUCTURE_REFERENCE, 0);
|
||||||
builder.put(EDhApiWorldGenerationStep.BIOMES, isTerraFirmaCraftPresent ? 1 : 0);
|
builder.put(EDhApiWorldGenerationStep.BIOMES, 0);
|
||||||
builder.put(EDhApiWorldGenerationStep.NOISE, isTerraFirmaCraftPresent ? 1 : 0);
|
builder.put(EDhApiWorldGenerationStep.NOISE, 0);
|
||||||
builder.put(EDhApiWorldGenerationStep.SURFACE, 0);
|
builder.put(EDhApiWorldGenerationStep.SURFACE, 0);
|
||||||
builder.put(EDhApiWorldGenerationStep.CARVERS, 0);
|
builder.put(EDhApiWorldGenerationStep.CARVERS, 0);
|
||||||
builder.put(EDhApiWorldGenerationStep.LIQUID_CARVERS, 0);
|
builder.put(EDhApiWorldGenerationStep.LIQUID_CARVERS, 0);
|
||||||
@@ -205,11 +195,6 @@ public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironm
|
|||||||
LOGGER.info("TerraForge Chunk Generator detected: [" + generator.getClass() + "], Distant Generation will try its best to support it.");
|
LOGGER.info("TerraForge Chunk Generator detected: [" + generator.getClass() + "], Distant Generation will try its best to support it.");
|
||||||
LOGGER.info("If it does crash, turn Distant Generation off or set it to to [" + EDhApiDistantGeneratorMode.PRE_EXISTING_ONLY + "].");
|
LOGGER.info("If it does crash, turn Distant Generation off or set it to to [" + EDhApiDistantGeneratorMode.PRE_EXISTING_ONLY + "].");
|
||||||
}
|
}
|
||||||
else if (generator.getClass().toString().equals("class net.dries007.tfc.world.TFCChunkGenerator"))
|
|
||||||
{
|
|
||||||
LOGGER.info("TerraFirmaCraft Chunk Generator detected: [" + generator.getClass() + "], Distant Generation will try its best to support it.");
|
|
||||||
LOGGER.info("If it does crash, turn Distant Generation off or set it to to [" + EDhApiDistantGeneratorMode.PRE_EXISTING_ONLY + "].");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGGER.warn("Unknown Chunk Generator detected: [" + generator.getClass() + "], Distant Generation May Fail!");
|
LOGGER.warn("Unknown Chunk Generator detected: [" + generator.getClass() + "], Distant Generation May Fail!");
|
||||||
|
|||||||
+21
-5
@@ -12,11 +12,9 @@ import com.seibel.distanthorizons.core.config.Config;
|
|||||||
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||||
import com.seibel.distanthorizons.core.enums.MinecraftTextFormat;
|
import com.seibel.distanthorizons.core.enums.MinecraftTextFormat;
|
||||||
import com.seibel.distanthorizons.core.generation.DhLightingEngine;
|
import com.seibel.distanthorizons.core.generation.DhLightingEngine;
|
||||||
import com.seibel.distanthorizons.core.level.DhServerLevel;
|
|
||||||
import com.seibel.distanthorizons.core.level.IDhServerLevel;
|
import com.seibel.distanthorizons.core.level.IDhServerLevel;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
|
||||||
import com.seibel.distanthorizons.core.util.ExceptionUtil;
|
import com.seibel.distanthorizons.core.util.ExceptionUtil;
|
||||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||||
import com.seibel.distanthorizons.core.util.TimerUtil;
|
import com.seibel.distanthorizons.core.util.TimerUtil;
|
||||||
@@ -195,12 +193,22 @@ public class InternalServerGenerator
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
ArrayList<CompletableFuture<Void>> releaseFutures = new ArrayList<>();
|
||||||
|
|
||||||
// release all chunks from the server to prevent out of memory issues
|
// release all chunks from the server to prevent out of memory issues
|
||||||
Iterator<ChunkPos> chunkPosIterator = ChunkPosGenStream.getIterator(genEvent.minPos.getX(), genEvent.minPos.getZ(), genEvent.widthInChunks, 0);
|
Iterator<ChunkPos> chunkPosIterator = ChunkPosGenStream.getIterator(genEvent.minPos.getX(), genEvent.minPos.getZ(), genEvent.widthInChunks, 0);
|
||||||
while (chunkPosIterator.hasNext())
|
while (chunkPosIterator.hasNext())
|
||||||
{
|
{
|
||||||
ChunkPos chunkPos = chunkPosIterator.next();
|
ChunkPos chunkPos = chunkPosIterator.next();
|
||||||
this.releaseChunkFromServer(this.params.mcServerLevel, this.params.dhServerLevel, chunkPos);
|
releaseFutures.add(this.releaseChunkFromServerAsync(this.params.mcServerLevel, chunkPos));
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait for all release futures to finish to prevent an issue where DH queues
|
||||||
|
// tickets faster than MC can clear them out
|
||||||
|
for (int i = 0; i < releaseFutures.size(); i++)
|
||||||
|
{
|
||||||
|
CompletableFuture<Void> releaseFuture = releaseFutures.get(i);
|
||||||
|
releaseFuture.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,8 +294,10 @@ public class InternalServerGenerator
|
|||||||
* mitigates out of memory issues in the vanilla chunk system. <br>
|
* mitigates out of memory issues in the vanilla chunk system. <br>
|
||||||
* See: https://github.com/pop4959/Chunky/pull/383
|
* See: https://github.com/pop4959/Chunky/pull/383
|
||||||
*/
|
*/
|
||||||
private void releaseChunkFromServer(ServerLevel level, IDhServerLevel dhLevel, ChunkPos chunkPos)
|
private CompletableFuture<Void> releaseChunkFromServerAsync(ServerLevel level, ChunkPos chunkPos)
|
||||||
{
|
{
|
||||||
|
CompletableFuture<Void> removeTicketFuture = new CompletableFuture<>();
|
||||||
|
|
||||||
level.getChunkSource().chunkMap.mainThreadExecutor.execute(() ->
|
level.getChunkSource().chunkMap.mainThreadExecutor.execute(() ->
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -323,9 +333,15 @@ public class InternalServerGenerator
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.warn("Failed to release chunk back to internal server. Error: ["+e.getMessage()+"]", e);
|
LOGGER.warn("Failed to release chunk ["+chunkPos+"] back to internal server. Error: ["+e.getMessage()+"]", e);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
removeTicketFuture.complete(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return removeTicketFuture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
-3
@@ -40,8 +40,6 @@ public final class ThreadWorldGenParams
|
|||||||
public StructureCheck structCheck;
|
public StructureCheck structCheck;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boolean isValid = true;
|
|
||||||
|
|
||||||
// used for some older MC versions
|
// used for some older MC versions
|
||||||
private static GlobalWorldGenParams previousGlobalWorldGenParams = null;
|
private static GlobalWorldGenParams previousGlobalWorldGenParams = null;
|
||||||
|
|
||||||
@@ -55,7 +53,6 @@ public final class ThreadWorldGenParams
|
|||||||
{
|
{
|
||||||
ThreadWorldGenParams threadParam = LOCAL_PARAM_REF.get();
|
ThreadWorldGenParams threadParam = LOCAL_PARAM_REF.get();
|
||||||
if (threadParam != null
|
if (threadParam != null
|
||||||
&& threadParam.isValid
|
|
||||||
&& threadParam.level == globalParams.mcServerLevel)
|
&& threadParam.level == globalParams.mcServerLevel)
|
||||||
{
|
{
|
||||||
return threadParam;
|
return threadParam;
|
||||||
|
|||||||
-31
@@ -1,31 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
publish_version()
|
|
||||||
{
|
|
||||||
if [[ "$2" == "all" || "$1" == "$2" ]]
|
|
||||||
then
|
|
||||||
docker run --name=dh-build-$1 --rm -v /${PWD}:/home/build -e MC_VER=$1 dh-eclipse-temurin
|
|
||||||
cp ./fabric/build/libs/*$1.jar ./buildAllJars/fabric/
|
|
||||||
cp ./forge/build/libs/*$1.jar ./buildAllJars/forge/
|
|
||||||
cp ./Merged/*.jar ./buildAllJars/merged/
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if [ -z "$1" ]
|
|
||||||
then
|
|
||||||
echo "Build target is undefined! [all] [1.20.1] [1.19.4] [1.19.2] [1.18.2] [1.17.1] [1.16.5]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
docker build --tag=dh-eclipse-temurin -q .
|
|
||||||
|
|
||||||
mkdir -p buildAllJars/fabric
|
|
||||||
mkdir -p buildAllJars/forge
|
|
||||||
mkdir -p buildAllJars/merged
|
|
||||||
publish_version 1.20.1 $1
|
|
||||||
publish_version 1.19.4 $1
|
|
||||||
publish_version 1.19.2 $1
|
|
||||||
publish_version 1.18.2 $1
|
|
||||||
publish_version 1.17.1 $1
|
|
||||||
publish_version 1.16.5 $1
|
|
||||||
+1
-1
Submodule coreSubProjects updated: 53fcce9d7c...269f2c30fd
@@ -327,10 +327,11 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
|
|||||||
// FIXME: Use better hooks so it doesn't trigger key press events in text boxes
|
// FIXME: Use better hooks so it doesn't trigger key press events in text boxes
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(client ->
|
ClientTickEvents.END_CLIENT_TICK.register(client ->
|
||||||
{
|
{
|
||||||
if (client.player != null && !(Minecraft.getInstance().screen instanceof TitleScreen))
|
// TODO
|
||||||
{
|
//if (client.player != null && !(Minecraft.getInstance().screen instanceof TitleScreen))
|
||||||
this.onKeyInput();
|
//{
|
||||||
}
|
// this.onKeyInput();
|
||||||
|
//}
|
||||||
});
|
});
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.seibel.distanthorizons.fabric;
|
package com.seibel.distanthorizons.fabric;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.api.DhApi;
|
import com.seibel.distanthorizons.api.DhApi;
|
||||||
|
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBlockColorOverrideEvent;
|
||||||
|
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBlockStateWrapperCreatedEvent;
|
||||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiChunkProcessingEvent;
|
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiChunkProcessingEvent;
|
||||||
import com.seibel.distanthorizons.api.methods.events.DhApiEventRegister;
|
import com.seibel.distanthorizons.api.methods.events.DhApiEventRegister;
|
||||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiLevelLoadEvent;
|
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiLevelLoadEvent;
|
||||||
@@ -16,7 +18,9 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
|||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IPluginPacketSender;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IPluginPacketSender;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||||
|
import com.seibel.distanthorizons.fabric.testing.TestBlockWrapperCreatedEvent;
|
||||||
import com.seibel.distanthorizons.fabric.testing.TestChunkInputReplacerEvent;
|
import com.seibel.distanthorizons.fabric.testing.TestChunkInputReplacerEvent;
|
||||||
|
import com.seibel.distanthorizons.fabric.testing.TestCustomColorEvent;
|
||||||
import com.seibel.distanthorizons.fabric.testing.TestWorldGenBindingEvent;
|
import com.seibel.distanthorizons.fabric.testing.TestWorldGenBindingEvent;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents;
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents;
|
||||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||||
@@ -88,12 +92,22 @@ public class FabricServerProxy implements AbstractModInitializer.IEventProxy
|
|||||||
/* Register the mod needed event callbacks */
|
/* Register the mod needed event callbacks */
|
||||||
|
|
||||||
// can be enabled to test overrides/events without having to build a separate API project
|
// can be enabled to test overrides/events without having to build a separate API project
|
||||||
|
{
|
||||||
|
// test custom world gen
|
||||||
if (false)
|
if (false)
|
||||||
{
|
{
|
||||||
DhApiEventRegister.on(DhApiLevelLoadEvent.class, new TestWorldGenBindingEvent());
|
DhApiEventRegister.on(DhApiLevelLoadEvent.class, new TestWorldGenBindingEvent());
|
||||||
DhApi.events.bind(DhApiChunkProcessingEvent.class, new TestChunkInputReplacerEvent());
|
DhApi.events.bind(DhApiChunkProcessingEvent.class, new TestChunkInputReplacerEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// test custom colors
|
||||||
|
if (false)
|
||||||
|
{
|
||||||
|
DhApi.events.bind(DhApiBlockColorOverrideEvent.class, new TestCustomColorEvent());
|
||||||
|
DhApi.events.bind(DhApiBlockStateWrapperCreatedEvent.class, new TestBlockWrapperCreatedEvent());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ServerWorldLoadEvent
|
// ServerWorldLoadEvent
|
||||||
ServerLifecycleEvents.SERVER_STARTING.register((server) ->
|
ServerLifecycleEvents.SERVER_STARTING.register((server) ->
|
||||||
|
|||||||
+3
@@ -93,7 +93,10 @@ public class MixinChunkSectionsToRender
|
|||||||
@Inject(at = @At("HEAD"), method = "renderGroup", order = 800)
|
@Inject(at = @At("HEAD"), method = "renderGroup", order = 800)
|
||||||
private void renderDeferredLayerHead(ChunkSectionLayerGroup chunkSectionLayerGroup, GpuSampler gpuSampler, CallbackInfo ci)
|
private void renderDeferredLayerHead(ChunkSectionLayerGroup chunkSectionLayerGroup, GpuSampler gpuSampler, CallbackInfo ci)
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
ClientApi.RENDER_STATE.clientLevelWrapper = ClientLevelWrapper.getWrapperIfDifferent(ClientApi.RENDER_STATE.clientLevelWrapper, Minecraft.getInstance().levelRenderer.level);
|
ClientApi.RENDER_STATE.clientLevelWrapper = ClientLevelWrapper.getWrapperIfDifferent(ClientApi.RENDER_STATE.clientLevelWrapper, Minecraft.getInstance().levelRenderer.level);
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
ClientApi.RENDER_STATE.canRenderOrThrow();
|
ClientApi.RENDER_STATE.canRenderOrThrow();
|
||||||
|
|||||||
+5
-59
@@ -19,19 +19,13 @@
|
|||||||
|
|
||||||
package com.seibel.distanthorizons.fabric.mixins.client;
|
package com.seibel.distanthorizons.fabric.mixins.client;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.commonMixins.MixinVanillaFogCommon;
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
import net.minecraft.client.Camera;
|
import net.minecraft.client.Camera;
|
||||||
import net.minecraft.world.effect.MobEffects;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
|
|
||||||
#if MC_VER < MC_1_17_1
|
#if MC_VER < MC_1_17_1
|
||||||
import net.minecraft.world.level.material.FluidState;
|
import net.minecraft.world.level.material.FluidState;
|
||||||
@@ -42,7 +36,6 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
#elif MC_VER < MC_1_21_3
|
#elif MC_VER < MC_1_21_3
|
||||||
import net.minecraft.world.level.material.FogType;
|
|
||||||
import net.minecraft.client.renderer.FogRenderer;
|
import net.minecraft.client.renderer.FogRenderer;
|
||||||
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
@@ -96,11 +89,11 @@ public class MixinFogRenderer
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_21_6
|
#if MC_VER < MC_1_21_6
|
||||||
boolean cancelFog = cancelFog(camera, fogMode);
|
boolean cancelFog = MixinVanillaFogCommon.cancelFog(camera, fogMode);
|
||||||
#elif MC_VER < MC_1_21_6
|
#elif MC_VER < MC_1_21_6
|
||||||
boolean cancelFog = cancelFog(camera);
|
boolean cancelFog = MixinVanillaFogCommon.cancelFog(camera);
|
||||||
#else
|
#else
|
||||||
boolean cancelFog = cancelFog();
|
boolean cancelFog = MixinVanillaFogCommon.cancelFog();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (cancelFog)
|
if (cancelFog)
|
||||||
@@ -142,7 +135,7 @@ public class MixinFogRenderer
|
|||||||
)
|
)
|
||||||
private void onSetRenderDistanceEnd(FogData instance, float value, Operation<Void> original)
|
private void onSetRenderDistanceEnd(FogData instance, float value, Operation<Void> original)
|
||||||
{
|
{
|
||||||
if (cancelFog())
|
if (MixinVanillaFogCommon.cancelFog())
|
||||||
{
|
{
|
||||||
instance.environmentalStart = A_REALLY_REALLY_BIG_VALUE;
|
instance.environmentalStart = A_REALLY_REALLY_BIG_VALUE;
|
||||||
instance.environmentalEnd = A_EVEN_LARGER_VALUE;
|
instance.environmentalEnd = A_EVEN_LARGER_VALUE;
|
||||||
@@ -164,52 +157,5 @@ public class MixinFogRenderer
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@Unique
|
|
||||||
#if MC_VER < MC_1_21_6
|
|
||||||
private static boolean cancelFog(Camera camera, FogMode fogMode)
|
|
||||||
#else
|
|
||||||
private static boolean cancelFog()
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
#if MC_VER < MC_1_21_6
|
|
||||||
Entity entity = camera.getEntity();
|
|
||||||
#elif MC_VER <= MC_1_21_10
|
|
||||||
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
|
|
||||||
Entity entity = camera.getEntity();
|
|
||||||
#else
|
|
||||||
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
|
|
||||||
Entity entity = camera.entity();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
boolean cameraNotInFluid = cameraNotInFluid(camera);
|
|
||||||
boolean isSpecialFog = (entity instanceof LivingEntity) && ((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS);
|
|
||||||
|
|
||||||
boolean cancelFog = !isSpecialFog;
|
|
||||||
cancelFog = cancelFog && cameraNotInFluid;
|
|
||||||
#if MC_VER < MC_1_21_6
|
|
||||||
cancelFog = cancelFog && (fogMode == FogMode.FOG_TERRAIN);
|
|
||||||
#endif
|
|
||||||
cancelFog = cancelFog && !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial();
|
|
||||||
cancelFog = cancelFog && !Config.Client.Advanced.Graphics.Fog.enableVanillaFog.get();
|
|
||||||
|
|
||||||
return cancelFog;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Unique
|
|
||||||
private static boolean cameraNotInFluid(Camera camera)
|
|
||||||
{
|
|
||||||
#if MC_VER < MC_1_17_1
|
|
||||||
FluidState fluidState = camera.getFluidInCamera();
|
|
||||||
boolean cameraNotInFluid = fluidState.isEmpty();
|
|
||||||
#else
|
|
||||||
FogType fogTypes = camera.getFluidInCamera();
|
|
||||||
boolean cameraNotInFluid = fogTypes == FogType.NONE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return cameraNotInFluid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+13
@@ -29,8 +29,11 @@ public class MixinGameRenderer {}
|
|||||||
#else
|
#else
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftRenderWrapper;
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
import net.minecraft.client.DeltaTracker;
|
import net.minecraft.client.DeltaTracker;
|
||||||
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.client.player.LocalPlayer;
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
import net.minecraft.client.renderer.GameRenderer;
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
import net.minecraft.client.renderer.state.OptionsRenderState;
|
import net.minecraft.client.renderer.state.OptionsRenderState;
|
||||||
@@ -71,6 +74,16 @@ public class MixinGameRenderer
|
|||||||
final Matrix4f projectionMatrix,
|
final Matrix4f projectionMatrix,
|
||||||
final PoseStack poseStack)
|
final PoseStack poseStack)
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
|
#else
|
||||||
|
ClientApi.RENDER_STATE.clientLevelWrapper = ClientLevelWrapper.getWrapperIfDifferent(ClientApi.RENDER_STATE.clientLevelWrapper, (ClientLevel)player.level());
|
||||||
|
|
||||||
|
ClientApi.RENDER_STATE.mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrix);
|
||||||
|
|
||||||
|
ClientApi.RENDER_STATE.partialTickTime = MinecraftRenderWrapper.INSTANCE.getPartialTickTime();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
ClientApi.RENDER_STATE.mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix);
|
ClientApi.RENDER_STATE.mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
@@ -94,8 +94,11 @@ import com.seibel.distanthorizons.core.logging.DhLogger;
|
|||||||
@Mixin(LevelRenderer.class)
|
@Mixin(LevelRenderer.class)
|
||||||
public class MixinLevelRenderer
|
public class MixinLevelRenderer
|
||||||
{
|
{
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
@Shadow
|
@Shadow
|
||||||
private ClientLevel level;
|
private ClientLevel level;
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
|
||||||
@Unique
|
@Unique
|
||||||
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||||
@@ -220,12 +223,14 @@ public class MixinLevelRenderer
|
|||||||
#if MC_VER <= MC_1_21_11
|
#if MC_VER <= MC_1_21_11
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#if MC_VER <= MC_26_1_2
|
||||||
@Inject(at = @At("HEAD"), method = "prepareChunkRenders")
|
@Inject(at = @At("HEAD"), method = "prepareChunkRenders")
|
||||||
private void prepareChunkRenders(final Matrix4fc modelViewMatrix, CallbackInfoReturnable<ChunkSectionsToRender> callback)
|
private void prepareChunkRenders(final Matrix4fc modelViewMatrix, CallbackInfoReturnable<ChunkSectionsToRender> callback)
|
||||||
{
|
{
|
||||||
ClientApi.RENDER_STATE.clientLevelWrapper = ClientLevelWrapper.getWrapperIfDifferent(ClientApi.RENDER_STATE.clientLevelWrapper, this.level);
|
ClientApi.RENDER_STATE.clientLevelWrapper = ClientLevelWrapper.getWrapperIfDifferent(ClientApi.RENDER_STATE.clientLevelWrapper, this.level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "renderLevel")
|
@Inject(at = @At("HEAD"), method = "renderLevel")
|
||||||
public void renderLevel(
|
public void renderLevel(
|
||||||
final GraphicsResourceAllocator resourceAllocator, final DeltaTracker deltaTracker,
|
final GraphicsResourceAllocator resourceAllocator, final DeltaTracker deltaTracker,
|
||||||
@@ -241,6 +246,9 @@ public class MixinLevelRenderer
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -112,9 +112,10 @@ public class MixinLightTexture
|
|||||||
GlTexture glTexture = (GlTexture) this.texture;
|
GlTexture glTexture = (GlTexture) this.texture;
|
||||||
this.renderWrapper.setLightmapId(glTexture.glId(), clientLevel);
|
this.renderWrapper.setLightmapId(glTexture.glId(), clientLevel);
|
||||||
#else
|
#else
|
||||||
// both options are available since the renderer can be changed to either Blaze3D or OpenGL
|
// TODO vulkan
|
||||||
GlTexture glTexture = (GlTexture) this.texture;
|
//// both options are available since the renderer can be changed to either Blaze3D or OpenGL
|
||||||
this.renderWrapper.setLightmapId(glTexture.glId(), clientLevel);
|
//GlTexture glTexture = (GlTexture) this.texture;
|
||||||
|
//this.renderWrapper.setLightmapId(glTexture.glId(), clientLevel);
|
||||||
|
|
||||||
this.renderWrapper.setLightmapGpuTexture(this.texture, clientLevel);
|
this.renderWrapper.setLightmapGpuTexture(this.texture, clientLevel);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+12
-11
@@ -87,17 +87,18 @@ public abstract class MixinMinecraft
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MC_VER >= MC_1_20_2
|
// TODO vulkan
|
||||||
@Redirect(
|
//#if MC_VER >= MC_1_20_2
|
||||||
method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V",
|
//@Redirect(
|
||||||
at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V")
|
// method = "Lnet/minecraft/client/Minecraft;onGameLoadFinished(Lnet/minecraft/client/Minecraft$GameLoadCookie;)V",
|
||||||
)
|
// at = @At(value = "INVOKE", target = "Ljava/lang/Runnable;run()V")
|
||||||
private void buildInitialScreens(Runnable runnable)
|
//)
|
||||||
{
|
//private void buildInitialScreens(Runnable runnable)
|
||||||
DhUpdateScreenBase.tryShowUpdateScreenAndRunAutoUpdateStartup(runnable);
|
//{
|
||||||
runnable.run();
|
// DhUpdateScreenBase.tryShowUpdateScreenAndRunAutoUpdateStartup(runnable);
|
||||||
}
|
// runnable.run();
|
||||||
#endif
|
//}
|
||||||
|
//#endif
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "updateLevelInEngines")
|
@Inject(at = @At("HEAD"), method = "updateLevelInEngines")
|
||||||
public void updateLevelInEngines(ClientLevel level, CallbackInfo ci)
|
public void updateLevelInEngines(ClientLevel level, CallbackInfo ci)
|
||||||
|
|||||||
+2
-1
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.seibel.distanthorizons.fabric.mixins.client;
|
package com.seibel.distanthorizons.fabric.mixins.client;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.wrappers.gui.DhScreenUtil;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
|
import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget;
|
import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget;
|
||||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||||
@@ -147,7 +148,7 @@ public class MixinOptionsScreen extends Screen
|
|||||||
20, ICON_TEXTURE, 20, 40,
|
20, ICON_TEXTURE, 20, 40,
|
||||||
// Create the button and tell it where to go
|
// Create the button and tell it where to go
|
||||||
// For now it goes to the client option by default
|
// For now it goes to the client option by default
|
||||||
(buttonWidget) -> Objects.requireNonNull(this.minecraft).setScreen(GetConfigScreen.getScreen(this)),
|
(buttonWidget) -> DhScreenUtil.showScreen(GetConfigScreen.getScreen(this)),
|
||||||
// Add a title to the button
|
// Add a title to the button
|
||||||
#if MC_VER < MC_1_19_2
|
#if MC_VER < MC_1_19_2
|
||||||
new TranslatableComponent(ModInfo.ID + ".title"));
|
new TranslatableComponent(ModInfo.ID + ".title"));
|
||||||
|
|||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
package com.seibel.distanthorizons.fabric.testing;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBlockStateWrapperCreatedEvent;
|
||||||
|
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiEventParam;
|
||||||
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
|
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TestCustomColorEvent
|
||||||
|
*/
|
||||||
|
public class TestBlockWrapperCreatedEvent extends DhApiBlockStateWrapperCreatedEvent
|
||||||
|
{
|
||||||
|
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void blockStateWrapperCreated(DhApiEventParam<EventParam> event)
|
||||||
|
{
|
||||||
|
EventParam eventParam = event.value;
|
||||||
|
|
||||||
|
// can be enabled to flip the opacity of transparent/opaque blocks
|
||||||
|
if (false)
|
||||||
|
{
|
||||||
|
if (eventParam.getBlockStateWrapper().getOpacity() == LodUtil.BLOCK_FULLY_OPAQUE)
|
||||||
|
{
|
||||||
|
eventParam.setOpacity(LodUtil.BLOCK_FULLY_TRANSPARENT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
eventParam.setOpacity(LodUtil.BLOCK_FULLY_OPAQUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// needed for TestCustomColorEvent
|
||||||
|
eventParam.setAllowApiColorOverride(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+86
@@ -0,0 +1,86 @@
|
|||||||
|
package com.seibel.distanthorizons.fabric.testing;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBlockColorOverrideEvent;
|
||||||
|
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiEventParam;
|
||||||
|
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||||
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
|
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||||
|
import com.seibel.distanthorizons.coreapi.util.ColorUtil;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see TestBlockWrapperCreatedEvent
|
||||||
|
*/
|
||||||
|
public class TestCustomColorEvent extends DhApiBlockColorOverrideEvent
|
||||||
|
{
|
||||||
|
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void blockStateWrapperCreated(DhApiEventParam<EventParam> event)
|
||||||
|
{
|
||||||
|
EventParam eventParam = event.value;
|
||||||
|
|
||||||
|
//randomDatapointColors(eventParam);
|
||||||
|
//randomPerBlockColors(eventParam);
|
||||||
|
//blackWhitePositionStripe(eventParam);
|
||||||
|
positionRainbow(eventParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** each datapoint has a random color */
|
||||||
|
private void randomDatapointColors(EventParam eventParam)
|
||||||
|
{
|
||||||
|
// random colors for each datapoint
|
||||||
|
int a = eventParam.getAlpha();
|
||||||
|
int r = eventParam.getRed();
|
||||||
|
int g = eventParam.getGreen();
|
||||||
|
int b = eventParam.getBlue();
|
||||||
|
|
||||||
|
if (eventParam.getBlockStateWrapper().getOpacity() == LodUtil.BLOCK_FULLY_OPAQUE)
|
||||||
|
{
|
||||||
|
eventParam.setColor(255,r,g,b);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
eventParam.setColor(60,r,g,b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** each block has a different color */
|
||||||
|
private void randomPerBlockColors(EventParam eventParam)
|
||||||
|
{
|
||||||
|
// random colors per block
|
||||||
|
int r = Math.abs(eventParam.getBlockStateWrapper().hashCode() % 255);
|
||||||
|
int g = Math.abs((eventParam.getBlockStateWrapper().hashCode() << 4) % 255);
|
||||||
|
int b = Math.abs((eventParam.getBlockStateWrapper().hashCode() << 8) % 255);
|
||||||
|
eventParam.setColor(r,g,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void blackWhitePositionStripe(EventParam eventParam)
|
||||||
|
{
|
||||||
|
// black-white stripes
|
||||||
|
int r = Math.abs(eventParam.getBlockPosX() % 255);
|
||||||
|
int g = r;
|
||||||
|
int b = r;
|
||||||
|
eventParam.setColor(r,g,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** rainbow along the X axis repeating every 255 blocks */
|
||||||
|
private void positionRainbow(EventParam eventParam)
|
||||||
|
{
|
||||||
|
float[] ahsv = ColorUtil.argbToAhsv(ColorUtil.RED);
|
||||||
|
float a = ahsv[0];
|
||||||
|
|
||||||
|
int xModPos = Math.abs(eventParam.getBlockPosX() % 510);
|
||||||
|
float h = xModPos < 255 ? xModPos : 510 - xModPos;
|
||||||
|
float s = ahsv[2];
|
||||||
|
float v = ahsv[3];
|
||||||
|
int colorInt = ColorUtil.ahsvToArgb(a,h,s,v);
|
||||||
|
eventParam.setColor(ColorUtil.getRed(colorInt),ColorUtil.getGreen(colorInt),ColorUtil.getBlue(colorInt));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+8
-8
@@ -20,17 +20,17 @@
|
|||||||
package com.seibel.distanthorizons.fabric.wrappers.config;
|
package com.seibel.distanthorizons.fabric.wrappers.config;
|
||||||
|
|
||||||
import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
|
import com.seibel.distanthorizons.common.wrappers.gui.GetConfigScreen;
|
||||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
//import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
//import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||||
|
|
||||||
/** For making the config show up in modmenu */
|
/** For making the config show up in modmenu */
|
||||||
public class ModMenuIntegration implements ModMenuApi
|
public class ModMenuIntegration //implements ModMenuApi
|
||||||
{
|
{
|
||||||
// For the custom config code
|
// For the custom config code
|
||||||
@Override
|
//@Override
|
||||||
public ConfigScreenFactory<?> getModConfigScreenFactory()
|
//public ConfigScreenFactory<?> getModConfigScreenFactory()
|
||||||
{
|
//{
|
||||||
return parent -> GetConfigScreen.getScreen(parent);
|
// return parent -> GetConfigScreen.getScreen(parent);
|
||||||
}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -27,20 +27,20 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccess
|
|||||||
import net.coderbot.iris.Iris;
|
import net.coderbot.iris.Iris;
|
||||||
import net.irisshaders.iris.api.v0.IrisApi;
|
import net.irisshaders.iris.api.v0.IrisApi;
|
||||||
#else
|
#else
|
||||||
import net.irisshaders.iris.Iris;
|
//import net.irisshaders.iris.Iris;
|
||||||
import net.irisshaders.iris.api.v0.IrisApi;
|
//import net.irisshaders.iris.api.v0.IrisApi;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public class IrisAccessor implements IIrisAccessor
|
public class IrisAccessor implements IIrisAccessor
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public String getModName() { return Iris.MODID; }
|
public String getModName() { return /*Iris.MODID;*/ ""; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isShaderPackInUse() { return IrisApi.getInstance().isShaderPackInUse(); }
|
public boolean isShaderPackInUse() { return false;/*IrisApi.getInstance().isShaderPackInUse();*/ }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRenderingShadowPass() { return IrisApi.getInstance().isRenderingShadowPass(); }
|
public boolean isRenderingShadowPass() { return false;/*IrisApi.getInstance().isRenderingShadowPass();*/ }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ dependencies {
|
|||||||
// TerraFirmaCraft
|
// TerraFirmaCraft
|
||||||
addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft)
|
addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft)
|
||||||
|
|
||||||
|
// Oculus (Iris port)
|
||||||
|
addMod("maven.modrinth:oculus:${rootProject.oculus_version}", rootProject.enable_oculus)
|
||||||
|
|
||||||
// TODO: Check if this is still needed and if so ensure this code works for MC 26.1+
|
// TODO: Check if this is still needed and if so ensure this code works for MC 26.1+
|
||||||
// (potential) hack fix for MC 1.20.6 and later, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+
|
// (potential) hack fix for MC 1.20.6 and later, force jopt-simple to be exactly 5.0.4 because Mojang ships that version, but some transitive dependencies request 6.0+
|
||||||
def mcParts = rootProject.minecraft_version.split("\\.")
|
def mcParts = rootProject.minecraft_version.split("\\.")
|
||||||
|
|||||||
+12
-25
@@ -19,10 +19,8 @@
|
|||||||
|
|
||||||
package com.seibel.distanthorizons.forge.mixins.client;
|
package com.seibel.distanthorizons.forge.mixins.client;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.commonMixins.MixinVanillaFogCommon;
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
|
||||||
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;
|
||||||
@@ -33,14 +31,6 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
|||||||
import net.minecraft.client.Camera;
|
import net.minecraft.client.Camera;
|
||||||
import net.minecraft.client.renderer.FogRenderer;
|
import net.minecraft.client.renderer.FogRenderer;
|
||||||
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
||||||
import net.minecraft.world.effect.MobEffects;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
#if MC_VER < MC_1_17_1
|
|
||||||
import net.minecraft.world.level.material.FluidState;
|
|
||||||
#else
|
|
||||||
import net.minecraft.world.level.material.FogType;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@Mixin(FogRenderer.class)
|
@Mixin(FogRenderer.class)
|
||||||
public class MixinFogRenderer
|
public class MixinFogRenderer
|
||||||
@@ -55,29 +45,25 @@ public class MixinFogRenderer
|
|||||||
remap = #if MC_VER == MC_1_17_1 || MC_VER == MC_1_18_2 false #else true #endif ) // Remap messiness due to this being weird in forge
|
remap = #if MC_VER == MC_1_17_1 || MC_VER == MC_1_18_2 false #else true #endif ) // Remap messiness due to this being weird in forge
|
||||||
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback)
|
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback)
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_17_1
|
#if MC_VER < MC_1_21_6
|
||||||
FluidState fluidState = camera.getFluidInCamera();
|
boolean cancelFog = MixinVanillaFogCommon.cancelFog(camera, fogMode);
|
||||||
boolean cameraNotInFluid = fluidState.isEmpty();
|
#elif MC_VER < MC_1_21_6
|
||||||
|
boolean cancelFog = MixinVanillaFogCommon.cancelFog(camera);
|
||||||
#else
|
#else
|
||||||
FogType fogTypes = camera.getFluidInCamera();
|
boolean cancelFog = MixinVanillaFogCommon.cancelFog();
|
||||||
boolean cameraNotInFluid = fogTypes == FogType.NONE;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (cancelFog)
|
||||||
Entity entity = camera.getEntity();
|
|
||||||
boolean isSpecialFog = (entity instanceof LivingEntity) && ((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS);
|
|
||||||
if (!isSpecialFog
|
|
||||||
&& cameraNotInFluid
|
|
||||||
&& fogMode == FogMode.FOG_TERRAIN
|
|
||||||
&& !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial()
|
|
||||||
&& !Config.Client.Advanced.Graphics.Fog.enableVanillaFog.get())
|
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_17_1
|
#if MC_VER < MC_1_17_1
|
||||||
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
|
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
|
||||||
RenderSystem.fogEnd(A_EVEN_LARGER_VALUE);
|
RenderSystem.fogEnd(A_EVEN_LARGER_VALUE);
|
||||||
#else
|
#elif MC_VER < MC_1_21_3
|
||||||
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);
|
||||||
|
#elif MC_VER < MC_1_21_6
|
||||||
|
callback.setReturnValue(FogParameters.NO_FOG);
|
||||||
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ClientApi.RENDER_STATE.vanillaFogEnabled = false;
|
ClientApi.RENDER_STATE.vanillaFogEnabled = false;
|
||||||
@@ -86,6 +72,7 @@ public class MixinFogRenderer
|
|||||||
{
|
{
|
||||||
ClientApi.RENDER_STATE.vanillaFogEnabled = true;
|
ClientApi.RENDER_STATE.vanillaFogEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-7
@@ -23,35 +23,50 @@ import com.seibel.distanthorizons.core.logging.DhLogger;
|
|||||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor;
|
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccessor;
|
||||||
|
|
||||||
|
#if MC_VER == MC_1_20_1
|
||||||
|
import net.irisshaders.iris.Iris;
|
||||||
|
import net.irisshaders.iris.api.v0.IrisApi;
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
|
||||||
public class OculusAccessor implements IIrisAccessor
|
public class OculusAccessor implements IIrisAccessor
|
||||||
{
|
{
|
||||||
protected static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
protected static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||||
|
|
||||||
|
|
||||||
public OculusAccessor()
|
public OculusAccessor()
|
||||||
{
|
{ LOGGER.warn("Partial Oculus support enabled. Some DH features may be disabled or behave strangely, use Iris instead if possible."); }
|
||||||
LOGGER.warn("Partial Oculus support enabled. Some DH features may be disabled or behave strangely, use Iris instead if possible.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModName()
|
public String getModName()
|
||||||
{
|
{
|
||||||
return "oculus";
|
#if MC_VER == MC_1_20_1
|
||||||
|
return Iris.MODID;
|
||||||
|
#else
|
||||||
|
return "iris"; // Oculus doesn't support this MC version
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isShaderPackInUse()
|
public boolean isShaderPackInUse()
|
||||||
{
|
{
|
||||||
// assume shaders are always active
|
#if MC_VER == MC_1_20_1
|
||||||
return true;
|
return IrisApi.getInstance().isShaderPackInUse();
|
||||||
|
#else
|
||||||
|
return true; // Oculus doesn't support this MC version
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRenderingShadowPass()
|
public boolean isRenderingShadowPass()
|
||||||
{
|
{
|
||||||
return false;
|
#if MC_VER == MC_1_20_1
|
||||||
|
return IrisApi.getInstance().isRenderingShadowPass();
|
||||||
|
#else
|
||||||
|
return false; // Oculus doesn't support this MC version
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-3
@@ -5,8 +5,9 @@ org.gradle.caching=true
|
|||||||
|
|
||||||
# Mod Info
|
# Mod Info
|
||||||
mod_name=DistantHorizons
|
mod_name=DistantHorizons
|
||||||
mod_version=3.0.0-b
|
api_name=DistantHorizonsApi
|
||||||
api_version=6.0.0
|
mod_version=3.0.4-b-dev
|
||||||
|
api_version=6.1.1
|
||||||
maven_group=com.seibel.distanthorizons
|
maven_group=com.seibel.distanthorizons
|
||||||
mod_readable_name=Distant Horizons
|
mod_readable_name=Distant Horizons
|
||||||
mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow.
|
mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow.
|
||||||
@@ -46,7 +47,10 @@ versionStr=
|
|||||||
|
|
||||||
# This defines what MC version Intellij will use for the preprocessor
|
# This defines what MC version Intellij will use for the preprocessor
|
||||||
# and what version is used automatically by build and run commands
|
# and what version is used automatically by build and run commands
|
||||||
mcVer=26.1.2
|
mcVer=26.2.0
|
||||||
|
|
||||||
# Defines the maximum amount of memory Minecraft is allowed when run in a development environment
|
# Defines the maximum amount of memory Minecraft is allowed when run in a development environment
|
||||||
minecraftMemoryJavaArg=-Xmx6G
|
minecraftMemoryJavaArg=-Xmx6G
|
||||||
|
# can be enabled for use with the Tracy profiler, disabled by default since it causes constant memory growth when running
|
||||||
|
minecraftEnableTracy=false
|
||||||
|
|
||||||
|
|||||||
+5
-55
@@ -19,11 +19,8 @@
|
|||||||
|
|
||||||
package com.seibel.distanthorizons.neoforge.mixins.client;
|
package com.seibel.distanthorizons.neoforge.mixins.client;
|
||||||
|
|
||||||
|
import com.seibel.distanthorizons.common.commonMixins.MixinVanillaFogCommon;
|
||||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||||
import com.seibel.distanthorizons.core.config.Config;
|
|
||||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
|
||||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -96,11 +93,11 @@ public class MixinFogRenderer
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if MC_VER < MC_1_21_6
|
#if MC_VER < MC_1_21_6
|
||||||
boolean cancelFog = cancelFog(camera, fogMode);
|
boolean cancelFog = MixinVanillaFogCommon.cancelFog(camera, fogMode);
|
||||||
#elif MC_VER < MC_1_21_6
|
#elif MC_VER < MC_1_21_6
|
||||||
boolean cancelFog = cancelFog(camera);
|
boolean cancelFog = MixinVanillaFogCommon.cancelFog(camera);
|
||||||
#else
|
#else
|
||||||
boolean cancelFog = cancelFog();
|
boolean cancelFog = MixinVanillaFogCommon.cancelFog();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (cancelFog)
|
if (cancelFog)
|
||||||
@@ -142,7 +139,7 @@ public class MixinFogRenderer
|
|||||||
)
|
)
|
||||||
private void onSetRenderDistanceEnd(FogData instance, float value, Operation<Void> original)
|
private void onSetRenderDistanceEnd(FogData instance, float value, Operation<Void> original)
|
||||||
{
|
{
|
||||||
if (cancelFog())
|
if (MixinVanillaFogCommon.cancelFog())
|
||||||
{
|
{
|
||||||
instance.environmentalStart = A_REALLY_REALLY_BIG_VALUE;
|
instance.environmentalStart = A_REALLY_REALLY_BIG_VALUE;
|
||||||
instance.environmentalEnd = A_EVEN_LARGER_VALUE;
|
instance.environmentalEnd = A_EVEN_LARGER_VALUE;
|
||||||
@@ -164,52 +161,5 @@ public class MixinFogRenderer
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@Unique
|
|
||||||
#if MC_VER < MC_1_21_6
|
|
||||||
private static boolean cancelFog(Camera camera, FogMode fogMode)
|
|
||||||
#else
|
|
||||||
private static boolean cancelFog()
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
#if MC_VER < MC_1_21_6
|
|
||||||
Entity entity = camera.getEntity();
|
|
||||||
#elif MC_VER <= MC_1_21_10
|
|
||||||
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
|
|
||||||
Entity entity = camera.getEntity();
|
|
||||||
#else
|
|
||||||
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
|
|
||||||
Entity entity = camera.entity();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
boolean cameraNotInFluid = cameraNotInFluid(camera);
|
|
||||||
boolean isSpecialFog = (entity instanceof LivingEntity) && ((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS);
|
|
||||||
|
|
||||||
boolean cancelFog = !isSpecialFog;
|
|
||||||
cancelFog = cancelFog && cameraNotInFluid;
|
|
||||||
#if MC_VER < MC_1_21_6
|
|
||||||
cancelFog = cancelFog && (fogMode == FogMode.FOG_TERRAIN);
|
|
||||||
#endif
|
|
||||||
cancelFog = cancelFog && !SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class).isFogStateSpecial();
|
|
||||||
cancelFog = cancelFog && !Config.Client.Advanced.Graphics.Fog.enableVanillaFog.get();
|
|
||||||
|
|
||||||
return cancelFog;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Unique
|
|
||||||
private static boolean cameraNotInFluid(Camera camera)
|
|
||||||
{
|
|
||||||
#if MC_VER < MC_1_17_1
|
|
||||||
FluidState fluidState = camera.getFluidInCamera();
|
|
||||||
boolean cameraNotInFluid = fluidState.isEmpty();
|
|
||||||
#else
|
|
||||||
FogType fogTypes = camera.getFluidInCamera();
|
|
||||||
boolean cameraNotInFluid = fogTypes == FogType.NONE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return cameraNotInFluid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ forge_version=36.2.39
|
|||||||
|
|
||||||
# Forge mod versions
|
# Forge mod versions
|
||||||
terraforged_version=4044290
|
terraforged_version=4044290
|
||||||
|
oculus_version=
|
||||||
|
|
||||||
# Forge mod run
|
# Forge mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
@@ -62,3 +63,4 @@ forge_version=36.2.39
|
|||||||
enable_starlight_forge=0
|
enable_starlight_forge=0
|
||||||
enable_terraforged=1
|
enable_terraforged=1
|
||||||
enable_terrafirmacraft=0
|
enable_terrafirmacraft=0
|
||||||
|
enable_oculus=0
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ forge_version=37.1.1
|
|||||||
|
|
||||||
# Forge mod versions
|
# Forge mod versions
|
||||||
terraforged_version=
|
terraforged_version=
|
||||||
|
oculus_version=
|
||||||
|
|
||||||
# Forge mod run
|
# Forge mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
@@ -61,3 +62,4 @@ forge_version=37.1.1
|
|||||||
enable_starlight_forge=0
|
enable_starlight_forge=0
|
||||||
enable_terraforged=0
|
enable_terraforged=0
|
||||||
enable_terrafirmacraft=0
|
enable_terrafirmacraft=0
|
||||||
|
enable_oculus=0
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ forge_version=40.2.10
|
|||||||
|
|
||||||
# Forge mod versions
|
# Forge mod versions
|
||||||
terraforged_version=
|
terraforged_version=
|
||||||
|
oculus_version=
|
||||||
|
|
||||||
# Forge mod run
|
# Forge mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
@@ -70,3 +71,4 @@ forge_version=40.2.10
|
|||||||
enable_starlight_forge=0
|
enable_starlight_forge=0
|
||||||
enable_terraforged=0
|
enable_terraforged=0
|
||||||
enable_terrafirmacraft=0
|
enable_terrafirmacraft=0
|
||||||
|
enable_oculus=0
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ forge_version=43.3.2
|
|||||||
|
|
||||||
# Forge mod versions
|
# Forge mod versions
|
||||||
terraforged_version=
|
terraforged_version=
|
||||||
|
oculus_version=
|
||||||
|
|
||||||
# Forge mod run
|
# Forge mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
@@ -60,3 +61,4 @@ forge_version=43.3.2
|
|||||||
enable_starlight_forge=0
|
enable_starlight_forge=0
|
||||||
enable_terraforged=0
|
enable_terraforged=0
|
||||||
enable_terrafirmacraft=0
|
enable_terrafirmacraft=0
|
||||||
|
enable_oculus=0
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ forge_version=45.2.4
|
|||||||
|
|
||||||
# Forge mod versions
|
# Forge mod versions
|
||||||
terraforged_version=
|
terraforged_version=
|
||||||
|
oculus_version=
|
||||||
|
|
||||||
# Forge mod run
|
# Forge mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
@@ -59,3 +60,4 @@ forge_version=45.2.4
|
|||||||
enable_starlight_forge=0
|
enable_starlight_forge=0
|
||||||
enable_terraforged=0
|
enable_terraforged=0
|
||||||
enable_terrafirmacraft=0
|
enable_terrafirmacraft=0
|
||||||
|
enable_oculus=0
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ forge_version=47.2.1
|
|||||||
|
|
||||||
# Forge mod versions
|
# Forge mod versions
|
||||||
terraforged_version=
|
terraforged_version=
|
||||||
|
oculus_version=1.20.1-1.8.0
|
||||||
|
|
||||||
# Forge mod run
|
# Forge mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
@@ -59,3 +60,4 @@ forge_version=47.2.1
|
|||||||
enable_starlight_forge=0
|
enable_starlight_forge=0
|
||||||
enable_terraforged=0
|
enable_terraforged=0
|
||||||
enable_terrafirmacraft=0
|
enable_terrafirmacraft=0
|
||||||
|
enable_oculus=1
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ forge_version=48.0.13
|
|||||||
|
|
||||||
# Forge mod versions
|
# Forge mod versions
|
||||||
terraforged_version=
|
terraforged_version=
|
||||||
|
oculus_version=
|
||||||
|
|
||||||
# Forge mod run
|
# Forge mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
@@ -59,3 +60,4 @@ forge_version=48.0.13
|
|||||||
enable_starlight_forge=0
|
enable_starlight_forge=0
|
||||||
enable_terraforged=0
|
enable_terraforged=0
|
||||||
enable_terrafirmacraft=0
|
enable_terrafirmacraft=0
|
||||||
|
enable_oculus=0
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ neoforge_version=
|
|||||||
|
|
||||||
# Forge mod versions
|
# Forge mod versions
|
||||||
terraforged_version=
|
terraforged_version=
|
||||||
|
oculus_version=
|
||||||
|
|
||||||
# Forge mod run
|
# Forge mod run
|
||||||
# 0 = Don't enable and don't run
|
# 0 = Don't enable and don't run
|
||||||
@@ -60,3 +61,4 @@ neoforge_version=
|
|||||||
enable_starlight_forge=0
|
enable_starlight_forge=0
|
||||||
enable_terraforged=0
|
enable_terraforged=0
|
||||||
enable_terrafirmacraft=0
|
enable_terrafirmacraft=0
|
||||||
|
enable_oculus=0
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ lwjgl_version=3.3.3
|
|||||||
|
|
||||||
# Fabric loader
|
# Fabric loader
|
||||||
fabric_loader_version=0.16.9
|
fabric_loader_version=0.16.9
|
||||||
fabric_api_version=0.115.0+1.21.1
|
fabric_api_version=0.116.11+1.21.1
|
||||||
# Fabric mod versions
|
# Fabric mod versions
|
||||||
modmenu_version=11.0.0-beta.1
|
modmenu_version=11.0.0-beta.1
|
||||||
starlight_version_fabric=
|
starlight_version_fabric=
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ minecraft_version=1.21.3
|
|||||||
parchment_version=1.21:2024.07.28
|
parchment_version=1.21:2024.07.28
|
||||||
compatible_minecraft_versions=["1.21.3"]
|
compatible_minecraft_versions=["1.21.3"]
|
||||||
accessWidenerVersion=1_21_3
|
accessWidenerVersion=1_21_3
|
||||||
builds_for=neoforge,fabric
|
builds_for=fabric,neoforge
|
||||||
# forge is broken due to gradle/build script issues
|
# forge is broken due to gradle/build script issues
|
||||||
|
|
||||||
# Netty
|
# Netty
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ minecraft_version=1.21.4
|
|||||||
parchment_version=1.21:2024.07.28
|
parchment_version=1.21:2024.07.28
|
||||||
compatible_minecraft_versions=["1.21.4"]
|
compatible_minecraft_versions=["1.21.4"]
|
||||||
accessWidenerVersion=1_21_4
|
accessWidenerVersion=1_21_4
|
||||||
builds_for=neoforge,fabric
|
builds_for=fabric,neoforge
|
||||||
# forge is broken due to gradle/build script issues
|
# forge is broken due to gradle/build script issues
|
||||||
|
|
||||||
# Netty
|
# Netty
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# 26.1.2 version
|
# 26.1.2 version
|
||||||
java_version=25
|
java_version=25
|
||||||
minecraft_version=26.1
|
minecraft_version=26.1.2
|
||||||
parchment_version=1.21:2024.07.28
|
parchment_version=1.21:2024.07.28
|
||||||
# version range should be used instead of individual versions due to how NeoForge handles version loading
|
# version range should be used instead of individual versions due to how NeoForge handles version loading
|
||||||
compatible_minecraft_versions=["26.1.0", "26.1.2"]
|
compatible_minecraft_versions=["26.1.0", "26.1.2"]
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
# 26.2.0 version
|
||||||
|
java_version=25
|
||||||
|
minecraft_version=26.2-snapshot-5
|
||||||
|
parchment_version=1.21:2024.07.28
|
||||||
|
# version range should be used instead of individual versions due to how NeoForge handles version loading
|
||||||
|
compatible_minecraft_versions=["26.2.0","26.2-alpha.5"]
|
||||||
|
accessWidenerVersion=26_1
|
||||||
|
builds_for=fabric
|
||||||
|
#,neoforge
|
||||||
|
# forge is broken due to gradle/build script issues
|
||||||
|
|
||||||
|
# Netty
|
||||||
|
netty_version=4.1.97.Final
|
||||||
|
|
||||||
|
# LWJGL
|
||||||
|
lwjgl_version=3.4.1
|
||||||
|
|
||||||
|
# Fabric loader
|
||||||
|
fabric_loader_version=0.18.5
|
||||||
|
fabric_api_version=0.147.1+26.2
|
||||||
|
modmenu_version=
|
||||||
|
starlight_version_fabric=
|
||||||
|
phosphor_version_fabric=
|
||||||
|
lithium_version=
|
||||||
|
sodium_version=
|
||||||
|
iris_version=
|
||||||
|
bclib_version=
|
||||||
|
immersive_portals_version=
|
||||||
|
canvas_version=
|
||||||
|
|
||||||
|
fabric_incompatibility_list={ }
|
||||||
|
fabric_recommend_list={}
|
||||||
|
|
||||||
|
# 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_mod_menu=0
|
||||||
|
enable_starlight=0
|
||||||
|
enable_phosphor=0
|
||||||
|
enable_sodium=0
|
||||||
|
enable_lithium=0
|
||||||
|
enable_iris=0
|
||||||
|
enable_bclib=0
|
||||||
|
enable_immersive_portals=0
|
||||||
|
enable_canvas=0
|
||||||
|
|
||||||
|
# NeoForge loader
|
||||||
|
forge_version=
|
||||||
|
neoforge_version=15-beta
|
||||||
|
neoforge_version_range=[*,)
|
||||||
|
|
||||||
|
# NeoForge mod versions
|
||||||
|
neo_iris_version=
|
||||||
|
|
||||||
|
# (Neo)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
|
||||||
|
neo_enable_iris=0
|
||||||
Reference in New Issue
Block a user