Compare commits
73 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| da0f4ae326 | |||
| b37e568372 | |||
| b1c6a5c1d4 | |||
| 8222126e8f | |||
| b5b888c69f | |||
| 85f6b8320b | |||
| 6c4740e8aa | |||
| ffda83c25d | |||
| 18859d22a8 | |||
| befa3b375e | |||
| a96c08cad4 | |||
| d7f789c402 | |||
| ed28bcd0ba | |||
| 982ae0c0a0 | |||
| d17897f276 | |||
| c0ccef7e82 | |||
| 55e5c64c68 | |||
| da72f783ed | |||
| 8a9bfa3d33 | |||
| 82937d840a | |||
| c1bd358502 | |||
| a8a22fd9fe | |||
| adb70857fe | |||
| a680596b3e | |||
| b2986ec782 | |||
| f40f7afab3 | |||
| 59555d1ca8 | |||
| 6e2eb7d1ac | |||
| 69483067b4 | |||
| c815591565 | |||
| f82b7ec608 | |||
| 23a107682c | |||
| 26da69c875 | |||
| 8f2df2396d | |||
| dbc9cbb418 | |||
| 09c788e495 | |||
| 9af71ac0ea | |||
| 2db20f8f24 | |||
| 2c9827c227 | |||
| 825b1ab4db | |||
| c61faac06c | |||
| 6b442f03c1 | |||
| 10ab638643 | |||
| d349d0c453 | |||
| e5c948ce9c | |||
| c51255f379 | |||
| 5bbeceee56 | |||
| ee78920a88 | |||
| 138972cf18 | |||
| 1bda767cd7 | |||
| cf1402edb9 | |||
| 778144a553 | |||
| fcca51a8d9 | |||
| 3cc663ee95 | |||
| 52f15a86fd | |||
| 734bb4afb8 | |||
| 9cd48fb5d7 | |||
| cd5c3d9f13 | |||
| 73ba1c8b56 | |||
| 8199b4408a | |||
| c00e3d7393 | |||
| 5d60251da0 | |||
| 855d707b3e | |||
| 592a1c3601 | |||
| da280db0f8 | |||
| 0ee6673e68 | |||
| 8bedb3dbaa | |||
| ea0e24b430 | |||
| cd35461df6 | |||
| 40580e81c2 | |||
| 1a279b90be | |||
| e34203fe3d | |||
| 870c0f68d3 |
+4
-1
@@ -34,6 +34,9 @@ build.properties
|
||||
|
||||
# Sqlite databases
|
||||
*.sqlite
|
||||
*.sqlite-journal
|
||||
*.sqlite-shm
|
||||
*.sqlite-wal
|
||||
|
||||
# Don't add access transformers to git as it's dynamically generated
|
||||
# Don't add access transformers to git as they're dynamically generated
|
||||
accesstransformer.cfg
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
# <img src="https://gitlab.com/jeseibel/distant-horizons-core/-/raw/main/_Misc%20Files/logo%20files/LOD%20logo%20flat%20-%20with%20boarder.png" width="32"> Distant Horizons
|
||||
_See farther without turning your game into a slide show._
|
||||
|
||||
> A mod that adds a Level of Detail System to Minecraft
|
||||
|
||||
<br>
|
||||
|
||||
# What is Distant Horizons?
|
||||
|
||||
Distant Horizons is a Minecraft mod that adds a Level Of Detail (LOD) system to\
|
||||
render simplified chunks outside the normal render distance\
|
||||
allowing for an increased view distance without harming performance.
|
||||
Distant Horizons is a mod which implements a [Level of Detail](https://en.wikipedia.org/wiki/Level_of_detail_(computer_graphics)) system to Minecraft.\
|
||||
This allows for far greater render distances without harming performance by gradually lowering the quality of distant terrain.
|
||||
|
||||
In other words: this mod lets you see farther without turning your game into a slide show.\
|
||||
If you want to see a quick demo, check out a video covering the mod here:
|
||||
Below is a video demonstrating the system:
|
||||
|
||||
<a href="https://youtu.be/_04BZ8W2bDM" target="_blank"></a>
|
||||
<a href="https://youtu.be/SxQdbtjGEsc" target="_blank"></a>
|
||||
|
||||
<br>
|
||||
|
||||
@@ -81,7 +79,8 @@ Modmenu: 1.16.22
|
||||
- 1.18.1, 1.18
|
||||
- 1.19.1, 1.19
|
||||
- 1.19.3
|
||||
<br><br>
|
||||
|
||||
<br>
|
||||
|
||||
### Plugin and Library versions
|
||||
|
||||
@@ -101,7 +100,7 @@ Java Preprocessor plugin: Manifold Preprocessor
|
||||
Visit https://www.oracle.com/java/technologies/downloads/ for installers.
|
||||
* Git or someway to clone git projects. <br>
|
||||
Visit https://git-scm.com/ for installers.
|
||||
* (Not required) Any Java IDE with plugins that support Manifold, for example Intellij IDEA.
|
||||
* (Not required) Any Java IDE with plugins that support Manifold, for example IntelliJ IDEA.
|
||||
|
||||
**If using IntelliJ:**
|
||||
1. Install the Manifold plugin
|
||||
@@ -114,17 +113,14 @@ Java Preprocessor plugin: Manifold Preprocessor
|
||||
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>
|
||||
|
||||
## Switching Versions
|
||||
|
||||
To switch between different Minecraft versions, change `mcVer=1.?` in the `gradle.properties` file.
|
||||
|
||||
If running in an IDE, to ensure the IDE noticed the version change, run any gradle command to refresh gradle. (In IntellJ you will also need to do a gradle sync if it didn't happen automatically.)
|
||||
>Note: There may be a `java.nio.file.FileSystemException` thrown when running the command after switching versions. To fix it, either restart your IDE (as your IDE is probably locking a file) or use a tool like LockHunter to unlock the linked file(s). (Generally it is a lib file under `common\build\lib`, `forge\build\lib`, or `fabric\build\lib`). \
|
||||
> If anyone knows how to solve this issue please let us know here: \
|
||||
> https://gitlab.com/jeseibel/distant-horizons/-/issues/233
|
||||
|
||||
If running in an IDE, to ensure the IDE noticed the version change, run any gradle command to refresh gradle.\
|
||||
In IntelliJ, you will also need to do a gradle sync if it didn't happen automatically.
|
||||
|
||||
<br>
|
||||
|
||||
@@ -138,21 +134,20 @@ From the File Explorer:
|
||||
2. Download the core from https://gitlab.com/jeseibel/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 wih `./gradlew mergeJars`
|
||||
5. Merge the jars with `./gradlew mergeJars`
|
||||
6. The compiled jar file will be in the folder `Merged`
|
||||
|
||||
From the command line:
|
||||
1. `git clone --recurse-submodules https://gitlab.com/jeseibel/distant-horizons.git`
|
||||
2. `cd minecraft-lod-mod`
|
||||
2. `cd distant-horizons`
|
||||
3. `./gradlew assemble`
|
||||
4. `./gradlew mergeJars`
|
||||
5. The compiled jar file will be in the folder `Merged`
|
||||
|
||||
Run tests with: `./gradlew test`
|
||||
|
||||
>Note: You can add the arg: `-PmcVer=?` to tell gradle to build a selected MC version instead of having to modify the `gradle.properties` file. \
|
||||
> Example: `./gradlew assemble -PmcVer=1.18.2`
|
||||
|
||||
>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`
|
||||
|
||||
<br>
|
||||
|
||||
@@ -162,7 +157,6 @@ Run tests with: `./gradlew test`
|
||||
|
||||
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
|
||||
@@ -171,6 +165,7 @@ You can also locally compile the DH jars without a Java environment by using Doc
|
||||
|
||||
`./gradlew clean` to delete any compiled code.
|
||||
|
||||
<br>
|
||||
|
||||
## Note to self
|
||||
|
||||
@@ -178,7 +173,7 @@ The Minecraft source code is NOT added to your workspace in an editable way. Min
|
||||
|
||||
Source code uses Mojang mappings & [Parchment](https://parchmentmc.org/) mappings.
|
||||
|
||||
To generate the source code run `./gradlew genSources`\
|
||||
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)
|
||||
|
||||
@@ -186,12 +181,12 @@ If your IDE fails to auto-detect the source jars when browsing Minecraft classes
|
||||
|
||||
## Other Useful commands
|
||||
|
||||
Run the standalone jar: `./gradlew run`\
|
||||
Build the standalone jar: `./gradlew core:build`\
|
||||
Only build Fabric: `./gradlew fabric:assemble` or `./gradlew fabric:build`\
|
||||
Only build Forge: `./gradlew fabric:assemble` or `./gradlew forge:build`\
|
||||
Run the Fabric client (for debugging): `./gradlew fabric:runClient`\
|
||||
Run the Forge client (for debugging): `./gradlew forge:runClient`
|
||||
Run the standalone jar: `./gradlew run` <br>
|
||||
Build the standalone jar: `./gradlew core:build` <br>
|
||||
Only build Fabric: `./gradlew fabric:assemble` or `./gradlew fabric: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 Forge client (for debugging): `./gradlew forge:runClient` <br>
|
||||
|
||||
To build all versions: `./buildAll` (all builds will end up in the `Merged` folder)
|
||||
|
||||
@@ -205,7 +200,7 @@ https://github.com/PacifistMC/Forgix
|
||||
LZ4 for Java (data compression)\
|
||||
https://github.com/lz4/lz4-java
|
||||
|
||||
NightConfig for Json & Toml (config handling)\
|
||||
NightConfig for JSON & TOML (config handling)\
|
||||
https://github.com/TheElectronWill/night-config
|
||||
|
||||
SVG Salamander for SVG support (not being used atm)\
|
||||
|
||||
+122
-152
@@ -7,16 +7,11 @@ plugins {
|
||||
// Plugin to create merged jars
|
||||
id "io.github.pacifistmc.forgix" version "1.2.6"
|
||||
|
||||
// Unimined is our all in one solution to minecraft loaders
|
||||
// id "xyz.wagyourtail.unimined" version "1.2.0-SNAPSHOT" apply false // Unstable Release (TODO: Check back to see when the unstable branch fixes forge run without the jank)
|
||||
id "xyz.wagyourtail.unimined" version "1.1.2-SNAPSHOT" apply false // LTS Release
|
||||
}
|
||||
// Manifold preprocessor
|
||||
id "systems.manifold.manifold-gradle-plugin" version "0.0.2-alpha"
|
||||
|
||||
|
||||
// Transfers the values set in settings.gradle to the rest of the project
|
||||
project.gradle.ext.getProperties().each { prop ->
|
||||
rootProject.ext.set(prop.key, prop.value)
|
||||
// println "Added prop [key:" + prop.key + ", value:" + prop.value + "]"
|
||||
// Architectury is used here only as a replacement for forge's own loom
|
||||
id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +49,14 @@ def writeBuildGradlePredefine(List<String> mcVers, int mcIndex)
|
||||
|
||||
new File(projectDir, "build.properties").text = sb.toString()
|
||||
}
|
||||
|
||||
|
||||
// Transfers the values set in settings.gradle to the rest of the project
|
||||
project.gradle.ext.getProperties().each { prop ->
|
||||
rootProject.ext.set(prop.key, prop.value)
|
||||
// println "Added prop [key:" + prop.key + ", value:" + prop.value + "]"
|
||||
}
|
||||
// Sets up manifold stuff
|
||||
writeBuildGradlePredefine(rootProject.mcVers, rootProject.mcIndex)
|
||||
|
||||
|
||||
@@ -61,7 +64,6 @@ writeBuildGradlePredefine(rootProject.mcVers, rootProject.mcIndex)
|
||||
|
||||
// Sets up the version string (the name we use for our jar)
|
||||
rootProject.versionStr = rootProject.mod_version + "-" + rootProject.minecraft_version // + "-" + new Date().format("yyyy_MM_dd_HH_mm")
|
||||
|
||||
// Forgix settings (used for merging jars)
|
||||
forgix {
|
||||
group = "com.seibel.distanthorizons"
|
||||
@@ -92,7 +94,7 @@ forgix {
|
||||
}
|
||||
|
||||
subprojects { p ->
|
||||
// Does the same as "p == project(":common") || p == project(":fabric") || p == project(":forge") || p == project("WhateverLoaderWeAddLaterOn")"
|
||||
// Does the same as "p == project(":common") || p == project(":fabric") || p == project(":quilt") || p == project(":forge") || p == project("WhateverWeAddLaterOn")"
|
||||
// Useful later on so we dont have duplicated code
|
||||
def isMinecraftSubProject = p != project(":core") && p != project(":api")
|
||||
|
||||
@@ -100,79 +102,73 @@ subprojects { p ->
|
||||
// Apply plugins
|
||||
apply plugin: "java"
|
||||
apply plugin: "com.github.johnrengelman.shadow"
|
||||
if (p == project(":core"))
|
||||
apply plugin: "application"
|
||||
if (isMinecraftSubProject)
|
||||
apply plugin: "systems.manifold.manifold-gradle-plugin"
|
||||
|
||||
if (isMinecraftSubProject) {
|
||||
apply plugin: "xyz.wagyourtail.unimined"
|
||||
// Apply forge's loom
|
||||
if (
|
||||
(findProject(":forge") && p == project(":forge")) ||
|
||||
(findProject(":neoforge") && p == project(":neoforge"))
|
||||
)
|
||||
apply plugin: "dev.architectury.loom"
|
||||
|
||||
unimined.minecraft(sourceSets.main, true) {
|
||||
version = rootProject.minecraft_version
|
||||
|
||||
def parchmentVersionParts = rootProject.parchment_version.split(":")
|
||||
mappings {
|
||||
mojmap()
|
||||
parchment(parchmentVersionParts[0], parchmentVersionParts[1])
|
||||
devNamespace "mojmap"
|
||||
}
|
||||
|
||||
runs {
|
||||
config("client") {
|
||||
workingDir = rootProject.file("run")
|
||||
}
|
||||
config("server") {
|
||||
workingDir = rootProject.file("run") // TODO: When running the server, would it be a better idea to change this to a different dir?
|
||||
disabled = true // TODO: Once server-side support is added, remove this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p != project(":common")) {
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
source(project(":common").sourceSets.main.java)
|
||||
source(project(":api").sourceSets.main.java)
|
||||
source(project(":core").sourceSets.main.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(GenerateModuleMetadata) {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
// Disable testing for projects that aren't the core or api project.
|
||||
// If not done compiling will fail due to an issue with Manifold
|
||||
if (isMinecraftSubProject) {
|
||||
test {
|
||||
enabled = false
|
||||
}
|
||||
compileTestJava {
|
||||
enabled = false
|
||||
}
|
||||
// Set the manifold version (may not be required tough)
|
||||
manifold {
|
||||
manifoldVersion = rootProject.manifold_version
|
||||
}
|
||||
|
||||
|
||||
// set up custom configurations (configurations are a way to handle dependencies)
|
||||
configurations {
|
||||
// extends the shadowJar configuration
|
||||
shadowMc // Configuration that doesn't contain coreProjects
|
||||
|
||||
shadowMe
|
||||
// have implemented dependencies automatically embedded in the final jar
|
||||
implementation.extendsFrom(shadowMc)
|
||||
implementation.extendsFrom(shadowMe)
|
||||
|
||||
// Add shaded libraries very early in the classpath (excluding coreProjects as that's added in a different way)
|
||||
minecraftLibraries.extendsFrom(shadowMc)
|
||||
}
|
||||
// Configuration fpr core & api
|
||||
coreProjects
|
||||
shadowMe.extendsFrom(coreProjects)
|
||||
|
||||
|
||||
// Let the application plugin know where the main class is
|
||||
// (This will point to a non-existent class in all sub-projects except "Core")
|
||||
if (p == project(":core")) {
|
||||
application {
|
||||
mainClass.set("com.seibel.distanthorizons.core.jar.JarMain")
|
||||
// FIXME this additional configuration is necessary because forge
|
||||
// needs forgeRuntimeLibrary, although adding it to shadowMe
|
||||
// causes runtime issues where the libraries aren't properly added
|
||||
forgeShadowMe
|
||||
// this should match shadowMe pretty closely
|
||||
implementation.extendsFrom(forgeShadowMe)
|
||||
shadowMe.extendsFrom(forgeShadowMe)
|
||||
forgeRuntimeLibrary.extendsFrom(forgeShadowMe)
|
||||
|
||||
|
||||
if (isMinecraftSubProject && p != project(":common")) {
|
||||
// Shadow common
|
||||
common
|
||||
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
|
||||
compileClasspath.extendsFrom common
|
||||
runtimeClasspath.extendsFrom common
|
||||
if (findProject(":forge"))
|
||||
developmentForge.extendsFrom common
|
||||
if (findProject(":neoforge"))
|
||||
developmentNeoForge.extendsFrom common
|
||||
compileClasspath.extendsFrom coreProjects
|
||||
runtimeClasspath.extendsFrom coreProjects
|
||||
if (findProject(":forge"))
|
||||
developmentForge.extendsFrom coreProjects
|
||||
if (findProject(":neoforge"))
|
||||
developmentNeoForge.extendsFrom coreProjects
|
||||
|
||||
if (findProject(":fabricLike") && p != project(":fabricLike")) {
|
||||
// Shadow fabricLike
|
||||
fabricLike
|
||||
shadowFabricLike
|
||||
compileClasspath.extendsFrom fabricLike
|
||||
runtimeClasspath.extendsFrom fabricLike
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
//=====================//
|
||||
// shared dependencies //
|
||||
@@ -184,41 +180,36 @@ subprojects { p ->
|
||||
}
|
||||
|
||||
// Log4j
|
||||
// TODO: Change to shadowCore later to work in the standalone jar
|
||||
// TODO: Change to shadowMe later to work in the standalone jar
|
||||
// We cannot do this now as it would break Quilt
|
||||
implementation("org.apache.logging.log4j:log4j-api:${rootProject.log4j_version}")
|
||||
implementation("org.apache.logging.log4j:log4j-core:${rootProject.log4j_version}")
|
||||
|
||||
// JOML
|
||||
if (project.hasProperty("embed_joml") && embed_joml == "true")
|
||||
forgeShadowMe("org.joml:joml:${rootProject.joml_version}")
|
||||
else
|
||||
implementation("org.joml:joml:${rootProject.joml_version}")
|
||||
|
||||
// JUnit tests
|
||||
implementation("org.junit.jupiter:junit-jupiter:5.8.2")
|
||||
implementation("org.junit.jupiter:junit-jupiter-engine:5.8.2")
|
||||
implementation("junit:junit:4.13")
|
||||
|
||||
// JOML
|
||||
if (project.hasProperty("embed_joml") && embed_joml == "true")
|
||||
shadowMc("org.joml:joml:${rootProject.joml_version}")
|
||||
else
|
||||
implementation("org.joml:joml:${rootProject.joml_version}")
|
||||
|
||||
// Compression
|
||||
shadowMc("org.lz4:lz4-java:${rootProject.lz4_version}")
|
||||
|
||||
// Sqlite Database
|
||||
shadowMc("org.xerial:sqlite-jdbc:${rootProject.sqlite_jdbc_version}")
|
||||
|
||||
// NightConfig (includes Toml & Json)
|
||||
shadowMc("com.electronwill.night-config:toml:${rootProject.nightconfig_version}")
|
||||
shadowMc("com.electronwill.night-config:json:${rootProject.nightconfig_version}")
|
||||
// needs to be here and in core to prevent compiler errors
|
||||
forgeShadowMe("com.electronwill.night-config:toml:${rootProject.nightconfig_version}")
|
||||
forgeShadowMe("com.electronwill.night-config:json:${rootProject.nightconfig_version}")
|
||||
|
||||
// SVG (not needed atm)
|
||||
//shadowMc("com.formdev:svgSalamander:${rootProject.svgSalamander_version}")
|
||||
// Compression
|
||||
// needs to be here and in core to prevent compiler errors
|
||||
forgeShadowMe("org.lz4:lz4-java:${rootProject.lz4_version}") // LZ4
|
||||
|
||||
// Netty
|
||||
// Breaks 1.16.5
|
||||
//shadowMc("io.netty:netty-all:${rootProject.netty_version}")
|
||||
|
||||
// Remember, for lwjgl dependencies that arent included in Minecraft, you need to also need to add it to the ShadowJar thing
|
||||
shadowMc("org.lwjgl:lwjgl-jawt:${rootProject.lwjgl_version}") {
|
||||
forgeShadowMe("org.lwjgl:lwjgl-jawt:${rootProject.lwjgl_version}") {
|
||||
exclude group: "org.lwjgl", module: "lwjgl" // This module is imported by Minecraft so exclude it
|
||||
}
|
||||
|
||||
@@ -231,12 +222,11 @@ subprojects { p ->
|
||||
|
||||
// Add core
|
||||
if (isMinecraftSubProject) {
|
||||
compileOnly(project(":core")) {
|
||||
coreProjects(project(":core")) {
|
||||
// Remove Junit test libraries
|
||||
exclude group: "org.junit.jupiter", module: "junit-jupiter"
|
||||
exclude group: "org.junit.jupiter", module: "junit-jupiter-engine"
|
||||
exclude group: "junit", module: "junit"
|
||||
|
||||
// Removed dependencies
|
||||
transitive false
|
||||
}
|
||||
@@ -244,12 +234,11 @@ subprojects { p ->
|
||||
|
||||
// Add the api
|
||||
if (p != project(":api")) {
|
||||
implementation(project(":api")) {
|
||||
coreProjects(project(":api")) {
|
||||
// Remove Junit test libraries
|
||||
exclude group: "org.junit.jupiter", module: "junit-jupiter"
|
||||
exclude group: "org.junit.jupiter", module: "junit-jupiter-engine"
|
||||
exclude group: "junit", module: "junit"
|
||||
|
||||
// Removed dependencies
|
||||
transitive false
|
||||
}
|
||||
@@ -258,44 +247,38 @@ subprojects { p ->
|
||||
// Add common
|
||||
if (isMinecraftSubProject && p != project(":common")) {
|
||||
// Common
|
||||
compileOnly(project(":common")) { transitive false }
|
||||
common(project(":common")) { transitive false }
|
||||
shadowCommon(project(":common")) { transitive false }
|
||||
|
||||
// FabricLike
|
||||
if (findProject(":fabricLike") && p != project(":fabricLike")) {
|
||||
fabricLike(project(path: ":fabricLike")) { transitive false }
|
||||
shadowFabricLike(project(path: ":fabricLike")) { transitive false }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
shadowJar {
|
||||
configurations = [project.configurations.shadowMc]
|
||||
|
||||
configurations = [project.configurations.shadowMe]
|
||||
if (isMinecraftSubProject && p != project(":common")) {
|
||||
configurations.push(project.configurations.shadowCommon) // Shadow the common subproject
|
||||
relocate "com.seibel.distanthorizons.common", "loaderCommon.${p.name}.com.seibel.distanthorizons.common" // Move the loader files to a different location
|
||||
|
||||
if (findProject(":fabricLike") && p != project(":fabricLike")) {
|
||||
configurations.push(project.configurations.shadowFabricLike) // Shadow the fabricLike subproject
|
||||
relocate "com.seibel.distanthorizons.fabriclike", "loaderCommon.${p.name}.com.seibel.distanthorizons.fabriclike" // Move the loader files to a different location
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def librariesLocation = "distanthorizons.libraries"
|
||||
|
||||
// LWJGL
|
||||
// Only ever shadow the dependencies we use otherwise some stuff would break when running on an external client
|
||||
relocate "org.lwjgl.system.jawt", "${librariesLocation}.lwjgl.system.jawt"
|
||||
|
||||
// Compression (LZ4)
|
||||
relocate "net.jpountz", "${librariesLocation}.jpountz"
|
||||
|
||||
// Sqlite Database
|
||||
//At the moment, there is a bug in this library which doesnt allow it to be relocated
|
||||
// relocate "org.sqlite", "${librariesLocation}.sqlite"
|
||||
|
||||
// JOML
|
||||
if (project.hasProperty("embed_joml") && embed_joml == "true")
|
||||
relocate "org.joml", "${librariesLocation}.joml"
|
||||
|
||||
// NightConfig (includes Toml & Json)
|
||||
relocate "com.electronwill.nightconfig", "${librariesLocation}.electronwill.nightconfig"
|
||||
|
||||
// SVG (not needed atm)
|
||||
// relocate "com.kitfox.svg", "${librariesLocation}.kitfox.svg"
|
||||
|
||||
// Netty
|
||||
relocate "io.netty", "${librariesLocation}.netty"
|
||||
// Compression (LZ4)
|
||||
relocate "net.jpountz", "${librariesLocation}.jpountz"
|
||||
|
||||
relocate "com.electronwill.nightconfig", "${librariesLocation}.electronwill.nightconfig"
|
||||
|
||||
mergeServiceFiles()
|
||||
}
|
||||
@@ -305,33 +288,20 @@ subprojects { p ->
|
||||
|
||||
// Put stuff from gradle.properties into the mod info
|
||||
processResources {
|
||||
duplicatesStrategy = DuplicatesStrategy.WARN
|
||||
// Include all the resources
|
||||
from project(":common").sourceSets.main.resources
|
||||
from project(":core").sourceSets.main.resources
|
||||
from project(":api").sourceSets.main.resources
|
||||
def resourceTargets = [ // Location of where to inject the properties
|
||||
// Holds info like git commit
|
||||
// TODO: For some reason this script doesnt work with the core project
|
||||
"build_info.json",
|
||||
|
||||
// Copy accessWideners
|
||||
// FIXME: remove copyCommonLoaderResources and use this instead (and if you are removing that task, also remove copyCoreResources while your at it)
|
||||
// from project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener")
|
||||
// into(file(p.file("build/resources/main")))
|
||||
rename "${accessWidenerVersion}.distanthorizons.accesswidener", "distanthorizons.accesswidener"
|
||||
// Properties for each of the loaders
|
||||
"fabric.mod.json",
|
||||
"quilt.mod.json",
|
||||
"META-INF/mods.toml",
|
||||
|
||||
// Location of where to inject the properties
|
||||
def resourceTargets = [
|
||||
// Holds info like git commit
|
||||
// TODO: For some reason this script doesnt work with the core project
|
||||
"build_info.json",
|
||||
|
||||
// Properties for each of the loaders
|
||||
"fabric.mod.json",
|
||||
"quilt.mod.json",
|
||||
"META-INF/mods.toml",
|
||||
|
||||
// The mixins for each of the loaders
|
||||
"DistantHorizons."+ p.name +".fabricLike.mixins.json"
|
||||
// The mixins for each of the loaders
|
||||
"DistantHorizons."+ p.name +".fabricLike.mixins.json"
|
||||
]
|
||||
def buildResourceTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
||||
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
||||
|
||||
// Fix forge version numbering system as it is weird
|
||||
// For whatever reason forge uses [1.18, 1.18.1, 1.18.2) instead of the standard ["1.18", "1.18.1", "1.18.2"]
|
||||
@@ -339,7 +309,7 @@ subprojects { p ->
|
||||
// println compatible_forgemc_versions
|
||||
|
||||
// Quilt's custom contributors system
|
||||
// has to be in the format:
|
||||
// This has to be like
|
||||
// "Person": "Developer", "Another person": "Developer"
|
||||
def quilt_contributors = []
|
||||
def mod_author_list = mod_authors.replaceAll("\"", "").replace("[", "").replace("]", "").split(",")
|
||||
@@ -391,14 +361,12 @@ subprojects { p ->
|
||||
|
||||
// replace any properties in the sub-projects with the values defined here
|
||||
inputs.properties replaceProperties
|
||||
replaceProperties.put("project", project)
|
||||
replaceProperties.put "project", project
|
||||
filesMatching(resourceTargets) {
|
||||
expand replaceProperties
|
||||
}
|
||||
|
||||
|
||||
// copy all our resources into the loader specific resource directory
|
||||
buildResourceTargets.each { target ->
|
||||
intoTargets.each { target ->
|
||||
if (file(target).exists()) {
|
||||
copy {
|
||||
from(sourceSets.main.resources) {
|
||||
@@ -562,7 +530,6 @@ allprojects { p ->
|
||||
// Set the OS lwjgl is using to the current os
|
||||
project.ext.lwjglNatives = "natives-" + os.toFamilyName()
|
||||
|
||||
// TODO: Include Minecraft in core-projects but dont include MC code stuff
|
||||
dependencies { // All of these dependencies are in Vanilla Minecraft, but we need to depend on it as we arent importing Minecraft in the core
|
||||
// Imports most of lwjgl's libraries (well, only the ones that we need)
|
||||
implementation platform("org.lwjgl:lwjgl-bom:${rootProject.lwjgl_version}") // TODO: Use Minecraft's version for lwjgl_version (which changes in nearly every version) instead of a hard defined version for all versions
|
||||
@@ -590,27 +557,30 @@ allprojects { p ->
|
||||
implementation("com.google.code.findbugs:jsr305:3.0.2")
|
||||
implementation("com.google.common:google-collect:0.5")
|
||||
implementation("com.google.guava:guava:31.1-jre")
|
||||
implementation("it.unimi.dsi:fastutil:8.5.11")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: Remove this as no loader needs this
|
||||
// - Fabric can rename which aw they use
|
||||
// - (Neo)Forge converts the aw to their own at, which is stored at a different place
|
||||
task copyCommonLoaderResources(type: Copy) {
|
||||
from project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener")
|
||||
into(file(p.file("build/resources/main")))
|
||||
rename "${accessWidenerVersion}.distanthorizons.accesswidener", "distanthorizons.accesswidener"
|
||||
|
||||
|
||||
// Move the fabricLike mixin to its different places for each subproject
|
||||
if (findProject(":fabricLike")) {
|
||||
from project(":fabricLike").file("src/main/resources/DistantHorizons.fabricLike.mixins.json")
|
||||
into(file(p.file("build/resources/main")))
|
||||
rename "DistantHorizons.fabricLike.mixins.json", "DistantHorizons." + p.name + ".fabricLike.mixins.json"
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Remove this later as we no longer need this. We are now including the resources in the processResources section
|
||||
task copyCoreResources(type: Copy) {
|
||||
from fileTree(project(":core").file("src/main/resources"))
|
||||
into p.file("build/resources/main")
|
||||
}
|
||||
|
||||
compileJava {
|
||||
tasks.withType(JavaCompile) {
|
||||
if (isMinecraftSubProject) {
|
||||
options.release = rootProject.java_version as Integer
|
||||
options.compilerArgs += ["-Xplugin:Manifold"]
|
||||
|
||||
+24
-10
@@ -1,16 +1,30 @@
|
||||
// Use Unimined's implimentation for MC as we can use Parchment mappings in common now! :tada:
|
||||
// With Sponge's vanilla gradle, we cannot change the mappings to anything out of mojmaps
|
||||
unimined.minecraft {
|
||||
fabric { // TODO: Find a way to only include the mc stuff, not fabric's loader
|
||||
loader rootProject.fabric_loader_version
|
||||
accessWidener(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"))
|
||||
|
||||
skipInsertAw = true
|
||||
}
|
||||
plugins {
|
||||
id "org.spongepowered.gradle.vanilla" version "0.2.1-SNAPSHOT"
|
||||
}
|
||||
|
||||
defaultRemapJar = false
|
||||
minecraft {
|
||||
accessWideners(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"))
|
||||
version(rootProject.minecraft_version)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
// So mixins can be written in common
|
||||
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
|
||||
}
|
||||
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenCommon(MavenPublication) {
|
||||
artifactId = rootProject.mod_readable_name
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
|
||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||
repositories {
|
||||
// Add repositories to publish to here.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -166,10 +166,7 @@ public abstract class AbstractModInitializer
|
||||
LOGGER.info("Mod Post-Initialized");
|
||||
}
|
||||
|
||||
private void initCommands()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
private void initCommands() { /* currently unimplemented */ }
|
||||
|
||||
|
||||
|
||||
|
||||
-94
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2023 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.distanthorizons.common.rendering;
|
||||
|
||||
#if MC_VER < MC_1_19_4
|
||||
import com.mojang.math.Matrix4f;
|
||||
#else
|
||||
import org.joml.Matrix4f;
|
||||
#endif
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.util.RenderUtil;
|
||||
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
public class SeamlessOverdraw
|
||||
{
|
||||
/**
|
||||
* Proof-of-concept experimental option, not intended for normal use. <br>
|
||||
* (Poorly) replaces Minecraft's far clip plane so it lines up with DH's near clip plane.
|
||||
*/
|
||||
public static float[] overwriteMinecraftNearFarClipPlanes(Matrix4f minecraftProjectionMatrix, float previousPartialTicks)
|
||||
{
|
||||
float[] matrixFloatArray;
|
||||
|
||||
#if MC_VER < MC_1_19_4
|
||||
FloatBuffer matrixFloatBuffer = FloatBuffer.allocate(16);
|
||||
minecraftProjectionMatrix.store(matrixFloatBuffer);
|
||||
matrixFloatArray = matrixFloatBuffer.array();
|
||||
#else
|
||||
// Passing float buffers in caused native code crashes, so we are passing in a float array instead
|
||||
matrixFloatArray = new float[16];
|
||||
minecraftProjectionMatrix.get(matrixFloatArray);
|
||||
#endif
|
||||
|
||||
return overwriteMinecraftNearFarClipPlanes(matrixFloatArray, previousPartialTicks);
|
||||
}
|
||||
|
||||
public static float[] overwriteMinecraftNearFarClipPlanes(Mat4f minecraftProjectionMatrix, float previousPartialTicks)
|
||||
{
|
||||
return overwriteMinecraftNearFarClipPlanes(minecraftProjectionMatrix.getValuesAsArray(), previousPartialTicks);
|
||||
}
|
||||
|
||||
private static float[] overwriteMinecraftNearFarClipPlanes(float[] projectionMatrixFloatArray, float previousPartialTicks)
|
||||
{
|
||||
float dhFarClipPlane = RenderUtil.getNearClipPlaneDistanceInBlocks(previousPartialTicks);
|
||||
|
||||
// works for fabric, bad not for forge for some reason :/
|
||||
float farClip = dhFarClipPlane * 5.1f; // magic number found via trial and error, James has no idea what it represents, except that it makes the seam between DH and vanilla rendering pretty close
|
||||
float nearClip = 0.5f; // this causes issues with some vanilla rendering, specifically the wireframe around selected blocks is slightly off. Unfortunately the ratio between the near and far clip plane can't be easily modified without completely screwing up the rendering.
|
||||
|
||||
// these may be the wrong index locations in any version of MC other than 1.18.2
|
||||
projectionMatrixFloatArray[10] = -((farClip + nearClip) / (farClip - nearClip)); // near clip plane
|
||||
projectionMatrixFloatArray[11] = -((2 * farClip * nearClip) / (farClip - nearClip)); // far clip plane
|
||||
|
||||
|
||||
return projectionMatrixFloatArray;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//================//
|
||||
// helper methods //
|
||||
//================//
|
||||
|
||||
public static void applyLegacyProjectionMatrix(float[] projectionMatrixFloatArray)
|
||||
{
|
||||
int glMatrixMode = GL15.glGetInteger(GL15.GL_MATRIX_MODE);
|
||||
GL15.glMatrixMode(GL15.GL_PROJECTION);
|
||||
|
||||
GL15.glLoadMatrixf(projectionMatrixFloatArray);
|
||||
|
||||
GL15.glMatrixMode(glMatrixMode);
|
||||
}
|
||||
|
||||
}
|
||||
+12
-5
@@ -56,8 +56,10 @@ import net.minecraft.world.level.biome.Biomes;
|
||||
/** This class wraps the minecraft BlockPos.Mutable (and BlockPos) class */
|
||||
public class BiomeWrapper implements IBiomeWrapper
|
||||
{
|
||||
// must be defined before AIR, otherwise a null pointer will be thrown
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
|
||||
#if MC_VER < MC_1_18_2
|
||||
public static final ConcurrentMap<Biome, BiomeWrapper> WRAPPER_BY_BIOME = new ConcurrentHashMap<>();
|
||||
#else
|
||||
@@ -65,7 +67,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
#endif
|
||||
|
||||
public static final String EMPTY_STRING = "EMPTY";
|
||||
public static final BiomeWrapper EMPTY_WRAPPER = new BiomeWrapper();
|
||||
public static final BiomeWrapper EMPTY_WRAPPER = new BiomeWrapper(null, null);
|
||||
|
||||
/** keep track of broken biomes so we don't log every time */
|
||||
private static final HashSet<String> brokenResourceLocationStrings = new HashSet<>();
|
||||
@@ -88,7 +90,8 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
#endif
|
||||
|
||||
/** technically final, but since it requires a method call to generate it can't be marked as such */
|
||||
private String serialString = null;
|
||||
private String serialString;
|
||||
private final int hashCode;
|
||||
|
||||
|
||||
|
||||
@@ -119,7 +122,9 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
{
|
||||
this.biome = biome;
|
||||
this.serialString = this.serialize(levelWrapper);
|
||||
LOGGER.trace("Created BiomeWrapper ["+this.serialString+"] for ["+biome+"]");
|
||||
this.hashCode = Objects.hash(this.serialString);
|
||||
|
||||
//LOGGER.trace("Created BiomeWrapper ["+this.serialString+"] for ["+biome+"]");
|
||||
}
|
||||
|
||||
/** should only be used to create {@link BiomeWrapper#EMPTY_WRAPPER} */
|
||||
@@ -127,6 +132,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
{
|
||||
this.biome = null;
|
||||
this.serialString = EMPTY_STRING;
|
||||
this.hashCode = Objects.hash(this.serialString);
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +174,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() { return Objects.hash(this.getSerialString()); }
|
||||
public int hashCode() { return this.hashCode; }
|
||||
|
||||
@Override
|
||||
public String getSerialString() { return this.serialString; }
|
||||
@@ -209,7 +215,8 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
|
||||
// generate the serial string //
|
||||
|
||||
net.minecraft.core.RegistryAccess registryAccess = Minecraft.getInstance().level.registryAccess();
|
||||
Level level = (Level)levelWrapper.getWrappedMcObject();
|
||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||
|
||||
ResourceLocation resourceLocation;
|
||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
||||
|
||||
+11
-3
@@ -69,6 +69,8 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
public static final String AIR_STRING = "AIR";
|
||||
public static final BlockStateWrapper AIR = new BlockStateWrapper(null, null);
|
||||
|
||||
public static final String DIRT_RESOURCE_LOCATION_STRING = "minecraft:dirt";
|
||||
|
||||
// TODO: Make this changeable through the config
|
||||
public static final String[] RENDERER_IGNORED_BLOCKS_RESOURCE_LOCATIONS = { AIR_STRING, "minecraft:barrier", "minecraft:structure_void", "minecraft:light", "minecraft:tripwire" };
|
||||
public static HashSet<IBlockStateWrapper> rendererIgnoredBlocks = null;
|
||||
@@ -83,6 +85,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
public final BlockState blockState;
|
||||
/** technically final, but since it requires a method call to generate it can't be marked as such */
|
||||
private String serialString;
|
||||
private final int hashCode;
|
||||
/**
|
||||
* Cached opacity value, -1 if not populated. <br>
|
||||
* Should be between {@link IBlockStateWrapper#FULLY_OPAQUE} and {@link IBlockStateWrapper#FULLY_OPAQUE}
|
||||
@@ -121,8 +124,10 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
{
|
||||
this.blockState = blockState;
|
||||
this.serialString = this.serialize(levelWrapper);
|
||||
this.hashCode = Objects.hash(this.serialString);
|
||||
this.irisBlockMaterialId = this.calculateIrisBlockMaterialId();
|
||||
LOGGER.trace("Created BlockStateWrapper ["+this.serialString+"] for ["+blockState+"] with material ID ["+this.irisBlockMaterialId+"]");
|
||||
|
||||
//LOGGER.trace("Created BlockStateWrapper ["+this.serialString+"] for ["+blockState+"] with material ID ["+this.irisBlockMaterialId+"]");
|
||||
}
|
||||
|
||||
|
||||
@@ -245,7 +250,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() { return Objects.hash(this.getSerialString()); }
|
||||
public int hashCode() { return this.hashCode; }
|
||||
|
||||
|
||||
@Override
|
||||
@@ -518,9 +523,12 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
{
|
||||
return IrisBlockMaterial.METAL;
|
||||
}
|
||||
else if (serialString.contains("grass_block"))
|
||||
{
|
||||
return IrisBlockMaterial.GRASS;
|
||||
}
|
||||
else if (
|
||||
serialString.contains("dirt")
|
||||
|| serialString.contains("grass_block")
|
||||
|| serialString.contains("gravel")
|
||||
|| serialString.contains("mud")
|
||||
|| serialString.contains("podzol")
|
||||
|
||||
+124
-32
@@ -92,16 +92,94 @@ public class ClientBlockStateCache
|
||||
Default,
|
||||
Flower,
|
||||
Leaves,
|
||||
Chisel;
|
||||
Chisel,
|
||||
Glass;
|
||||
static ColorMode getColorMode(Block b)
|
||||
{
|
||||
if (b instanceof LeavesBlock) return Leaves;
|
||||
if (b instanceof FlowerBlock) return Flower;
|
||||
if (b.toString().contains("glass")) return Glass;
|
||||
if (b.toString().equals("Block{chiselsandbits:chiseled}")) return Chisel;
|
||||
return Default;
|
||||
}
|
||||
}
|
||||
|
||||
//Way to efficiently do this was suggested by IMS from sodium. This is where those numbers and support code was lifted from.
|
||||
private static final int MIN_BITS = 0x39000000; // 2^(-13)
|
||||
private static final int MAX_BITS = 0x3f7fffff; // 1.0 - f32::EPSILON
|
||||
private static final float MIN_BOUND = Float.intBitsToFloat(MIN_BITS);
|
||||
private static final float MAX_BOUND = Float.intBitsToFloat(MAX_BITS);
|
||||
|
||||
private static final int[] linearToSrgbTable = new int[] {
|
||||
0x0073000d, 0x007a000d, 0x0080000d, 0x0087000d, 0x008d000d, 0x0094000d, 0x009a000d, 0x00a1000d,
|
||||
0x00a7001a, 0x00b4001a, 0x00c1001a, 0x00ce001a, 0x00da001a, 0x00e7001a, 0x00f4001a, 0x0101001a,
|
||||
0x010e0033, 0x01280033, 0x01410033, 0x015b0033, 0x01750033, 0x018f0033, 0x01a80033, 0x01c20033,
|
||||
0x01dc0067, 0x020f0067, 0x02430067, 0x02760067, 0x02aa0067, 0x02dd0067, 0x03110067, 0x03440067,
|
||||
0x037800ce, 0x03df00ce, 0x044600ce, 0x04ad00ce, 0x051400ce, 0x057b00c5, 0x05dd00bc, 0x063b00b5,
|
||||
0x06970158, 0x07420142, 0x07e30130, 0x087b0120, 0x090b0112, 0x09940106, 0x0a1700fc, 0x0a9500f2,
|
||||
0x0b0f01cb, 0x0bf401ae, 0x0ccb0195, 0x0d950180, 0x0e56016e, 0x0f0d015e, 0x0fbc0150, 0x10630143,
|
||||
0x11070264, 0x1238023e, 0x1357021d, 0x14660201, 0x156601e9, 0x165a01d3, 0x174401c0, 0x182401af,
|
||||
0x18fe0331, 0x1a9602fe, 0x1c1502d2, 0x1d7e02ad, 0x1ed4028d, 0x201a0270, 0x21520256, 0x227d0240,
|
||||
0x239f0443, 0x25c003fe, 0x27bf03c4, 0x29a10392, 0x2b6a0367, 0x2d1d0341, 0x2ebe031f, 0x304d0300,
|
||||
0x31d105b0, 0x34a80555, 0x37520507, 0x39d504c5, 0x3c37048b, 0x3e7c0458, 0x40a8042a, 0x42bd0401,
|
||||
0x44c20798, 0x488e071e, 0x4c1c06b6, 0x4f76065d, 0x52a50610, 0x55ac05cc, 0x5892058f, 0x5b590559,
|
||||
0x5e0c0a23, 0x631c0980, 0x67db08f6, 0x6c55087f, 0x70940818, 0x74a007bd, 0x787d076c, 0x7c330723,
|
||||
};
|
||||
|
||||
private static final float[] srgbToLinearTable = new float[] {
|
||||
0.0f, 0.000303527f, 0.000607054f, 0.00091058103f, 0.001214108f, 0.001517635f, 0.0018211621f, 0.002124689f,
|
||||
0.002428216f, 0.002731743f, 0.00303527f, 0.0033465356f, 0.003676507f, 0.004024717f, 0.004391442f,
|
||||
0.0047769533f, 0.005181517f, 0.0056053917f, 0.0060488326f, 0.006512091f, 0.00699541f, 0.0074990317f,
|
||||
0.008023192f, 0.008568125f, 0.009134057f, 0.009721218f, 0.010329823f, 0.010960094f, 0.011612245f,
|
||||
0.012286487f, 0.012983031f, 0.013702081f, 0.014443844f, 0.015208514f, 0.015996292f, 0.016807375f,
|
||||
0.017641952f, 0.018500218f, 0.019382361f, 0.020288562f, 0.02121901f, 0.022173883f, 0.023153365f,
|
||||
0.02415763f, 0.025186857f, 0.026241222f, 0.027320892f, 0.028426038f, 0.029556843f, 0.03071345f, 0.03189604f,
|
||||
0.033104774f, 0.03433981f, 0.035601325f, 0.036889452f, 0.038204376f, 0.039546248f, 0.04091521f, 0.042311423f,
|
||||
0.043735042f, 0.045186214f, 0.046665095f, 0.048171833f, 0.049706575f, 0.051269468f, 0.052860655f, 0.05448028f,
|
||||
0.056128494f, 0.057805434f, 0.05951124f, 0.06124607f, 0.06301003f, 0.06480328f, 0.06662595f, 0.06847818f,
|
||||
0.07036011f, 0.07227186f, 0.07421358f, 0.07618539f, 0.07818743f, 0.08021983f, 0.082282715f, 0.084376216f,
|
||||
0.086500466f, 0.088655606f, 0.09084173f, 0.09305898f, 0.095307484f, 0.09758736f, 0.09989874f, 0.10224175f,
|
||||
0.10461649f, 0.10702311f, 0.10946172f, 0.111932434f, 0.11443538f, 0.116970696f, 0.11953845f, 0.12213881f,
|
||||
0.12477186f, 0.12743773f, 0.13013652f, 0.13286836f, 0.13563336f, 0.13843165f, 0.14126332f, 0.1441285f,
|
||||
0.1470273f, 0.14995982f, 0.15292618f, 0.1559265f, 0.15896086f, 0.16202943f, 0.16513224f, 0.16826946f,
|
||||
0.17144115f, 0.17464745f, 0.17788847f, 0.1811643f, 0.18447503f, 0.1878208f, 0.19120172f, 0.19461787f,
|
||||
0.19806935f, 0.2015563f, 0.20507877f, 0.2086369f, 0.21223079f, 0.21586053f, 0.21952623f, 0.22322798f,
|
||||
0.22696589f, 0.23074007f, 0.23455065f, 0.23839766f, 0.2422812f, 0.2462014f, 0.25015837f, 0.25415218f,
|
||||
0.2581829f, 0.26225072f, 0.26635566f, 0.27049786f, 0.27467737f, 0.27889434f, 0.2831488f, 0.2874409f,
|
||||
0.2917707f, 0.29613832f, 0.30054384f, 0.30498737f, 0.30946895f, 0.31398875f, 0.31854683f, 0.32314324f,
|
||||
0.32777813f, 0.33245158f, 0.33716366f, 0.34191445f, 0.3467041f, 0.3515327f, 0.35640025f, 0.36130688f,
|
||||
0.3662527f, 0.37123778f, 0.37626222f, 0.3813261f, 0.38642952f, 0.39157256f, 0.3967553f, 0.40197787f,
|
||||
0.4072403f, 0.4125427f, 0.41788515f, 0.42326775f, 0.42869055f, 0.4341537f, 0.43965724f, 0.44520125f,
|
||||
0.45078585f, 0.45641106f, 0.46207705f, 0.46778384f, 0.47353154f, 0.47932023f, 0.48514998f, 0.4910209f,
|
||||
0.49693304f, 0.5028866f, 0.50888145f, 0.5149178f, 0.5209957f, 0.52711535f, 0.5332766f, 0.5394797f,
|
||||
0.5457247f, 0.5520116f, 0.5583406f, 0.5647117f, 0.57112503f, 0.57758063f, 0.5840786f, 0.590619f, 0.597202f,
|
||||
0.60382754f, 0.61049575f, 0.61720675f, 0.62396055f, 0.63075733f, 0.637597f, 0.6444799f, 0.6514058f,
|
||||
0.65837497f, 0.66538745f, 0.67244333f, 0.6795426f, 0.68668544f, 0.69387203f, 0.70110214f, 0.70837605f,
|
||||
0.7156938f, 0.72305536f, 0.730461f, 0.7379107f, 0.7454045f, 0.75294244f, 0.76052475f, 0.7681514f, 0.77582246f,
|
||||
0.78353804f, 0.79129815f, 0.79910296f, 0.8069525f, 0.8148468f, 0.822786f, 0.8307701f, 0.83879924f, 0.84687346f,
|
||||
0.8549928f, 0.8631574f, 0.87136734f, 0.8796226f, 0.8879232f, 0.89626956f, 0.90466136f, 0.913099f, 0.92158204f,
|
||||
0.93011117f, 0.9386859f, 0.9473069f, 0.9559735f, 0.9646866f, 0.9734455f, 0.98225087f, 0.9911022f, 1.0f
|
||||
};
|
||||
|
||||
private static int linearToSrgb(float c) {
|
||||
if (!(c > MIN_BOUND)) {
|
||||
c = MIN_BOUND;
|
||||
}
|
||||
|
||||
if (c > MAX_BOUND) {
|
||||
c = MAX_BOUND;
|
||||
}
|
||||
int inputBits = Float.floatToRawIntBits(c);
|
||||
int entry = linearToSrgbTable[((inputBits - MIN_BITS) >> 20)];
|
||||
|
||||
int bias = (entry >>> 16) << 9;
|
||||
int scale = entry & 0xffff;
|
||||
int t = (inputBits >>> 12) & 0xff;
|
||||
|
||||
return (bias + (scale * t)) >>> 16;
|
||||
}
|
||||
//////////////
|
||||
|
||||
private static int getWidth(TextureAtlasSprite texture)
|
||||
{
|
||||
#if MC_VER < MC_1_19_4
|
||||
@@ -120,20 +198,23 @@ public class ClientBlockStateCache
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//TODO: Perhaps make this not just use the first frame?
|
||||
private static int calculateColorFromTexture(TextureAtlasSprite texture, ColorMode colorMode)
|
||||
{
|
||||
int count = 0;
|
||||
double alpha = 0;
|
||||
int alpha = 0;
|
||||
double red = 0;
|
||||
double green = 0;
|
||||
double blue = 0;
|
||||
int tempColor;
|
||||
//make Chiseled block not render. Since ColorMode is set per block, you only need to check it once
|
||||
if (colorMode != ColorMode.Chisel)
|
||||
{
|
||||
// textures normally use u and v instead of x and y
|
||||
for (int u = 0; u < getWidth(texture); u++)
|
||||
for (int v = 0; v < getHeight(texture); v++)
|
||||
{
|
||||
for (int v = 0; v < getHeight(texture); v++)
|
||||
for (int u = 0; u < getWidth(texture); u++)
|
||||
{
|
||||
//note: Minecraft color format is: 0xAA BB GG RR
|
||||
//________ DH mod color format is: 0xAA RR GG BB
|
||||
@@ -141,40 +222,45 @@ public class ClientBlockStateCache
|
||||
//_ OpenGL RGBA format Java Order: 0xAA BB GG RR
|
||||
tempColor = TextureAtlasSpriteWrapper.getPixelRGBA(texture, 0, u, v);
|
||||
|
||||
double r = ((tempColor & 0x000000FF)) / 255.;
|
||||
double g = ((tempColor & 0x0000FF00) >>> 8) / 255.;
|
||||
double b = ((tempColor & 0x00FF0000) >>> 16) / 255.;
|
||||
double a = ((tempColor & 0xFF000000) >>> 24) / 255.;
|
||||
int r = (tempColor & 0x000000FF);
|
||||
int g = (tempColor & 0x0000FF00) >>> 8;
|
||||
int b = (tempColor & 0x00FF0000) >>> 16;
|
||||
int a = (tempColor & 0xFF000000) >>> 24;
|
||||
int scale = 1;
|
||||
|
||||
if (colorMode == ColorMode.Leaves)
|
||||
{
|
||||
r *= a;
|
||||
g *= a;
|
||||
b *= a;
|
||||
a = 1.;
|
||||
//switch (//FIXME add config option)
|
||||
// case BLACK:
|
||||
// a = 255; //simulate black background of fast leaves
|
||||
// break;
|
||||
// case IGNORE:
|
||||
if (a == 0) {
|
||||
continue; //same long grass
|
||||
}
|
||||
else
|
||||
{
|
||||
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.)
|
||||
else if (a == 0 && colorMode != ColorMode.Glass)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (colorMode == ColorMode.Flower && (g + 0.1 < b || g + 0.1 < r))
|
||||
else if (colorMode == ColorMode.Flower && (g + 25 < b || g + 25 < r))
|
||||
{
|
||||
scale = FLOWER_COLOR_SCALE;
|
||||
}
|
||||
//make Chiseled block not render
|
||||
else if (colorMode == ColorMode.Chisel)
|
||||
{
|
||||
r = 0;
|
||||
g = 0;
|
||||
b = 0;
|
||||
a = 0;
|
||||
}
|
||||
count += scale;
|
||||
alpha += a * a * scale;
|
||||
red += r * r * scale;
|
||||
green += g * g * scale;
|
||||
blue += b * b * scale;
|
||||
//apparently alpha is linear
|
||||
alpha += a * scale;
|
||||
//gamma correction is complicated
|
||||
red += srgbToLinearTable[r] * a * scale;
|
||||
green += srgbToLinearTable[g] * a * scale;
|
||||
blue += srgbToLinearTable[b] * a * scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,10 +272,16 @@ public class ClientBlockStateCache
|
||||
{
|
||||
// determine the average color
|
||||
tempColor = ColorUtil.rgbToInt(
|
||||
(int) (Math.sqrt(alpha / count) * 255.),
|
||||
(int) (Math.sqrt(red / count) * 255.),
|
||||
(int) (Math.sqrt(green / count) * 255.),
|
||||
(int) (Math.sqrt(blue / count) * 255.));
|
||||
alpha / count,
|
||||
linearToSrgb((float) (red / (double) alpha)),
|
||||
linearToSrgb((float) (green / (double) alpha)),
|
||||
linearToSrgb((float) (blue / (double) alpha)));
|
||||
}
|
||||
//check if not missing texture
|
||||
if (tempColor == ColorUtil.rgbToInt(255, 182, 0, 182))
|
||||
{
|
||||
//make it not render at all
|
||||
tempColor = ColorUtil.rgbToInt(0, 255, 255, 255);
|
||||
}
|
||||
return tempColor;
|
||||
}
|
||||
@@ -204,7 +296,7 @@ public class ClientBlockStateCache
|
||||
for (Direction direction : DIRECTION_ORDER)
|
||||
{
|
||||
quads = Minecraft.getInstance().getModelManager().getBlockModelShaper().
|
||||
getBlockModel(blockState).getQuads(blockState, direction, random);
|
||||
getBlockModel(blockState).getQuads(blockState, direction, random); // TODO getQuads sometimes throws a "makeThreadingException", is there anything we can do about that? Note: this isn't a critical issue, it just prints an ugly error and the render data will need to be regenered.
|
||||
if (quads != null && !quads.isEmpty() &&
|
||||
!(blockState.getBlock() instanceof RotatedPillarBlock && direction == Direction.UP))
|
||||
break;
|
||||
|
||||
+27
-4
@@ -42,27 +42,50 @@ public class ChunkLightStorage
|
||||
/** the data stored in this storage, split up into 16x16x16 areas. */
|
||||
public LightSection[] lightSections;
|
||||
|
||||
/**
|
||||
* If the get method is called on a Y position above what's stored
|
||||
* this value will be returned. <br><br>
|
||||
*
|
||||
* This needs to be manually defined since sky and block lights behave differently
|
||||
* for values both above and below what's defined.
|
||||
*/
|
||||
public int aboveMaxYValue;
|
||||
/** @see ChunkLightStorage#aboveMaxYValue */
|
||||
public int belowMinYValue;
|
||||
|
||||
|
||||
public ChunkLightStorage(int minY, int maxY)
|
||||
|
||||
//=============//
|
||||
// constructor //
|
||||
//=============//
|
||||
|
||||
public ChunkLightStorage(int minY, int maxY, int aboveMaxYValue, int belowMinYValue)
|
||||
{
|
||||
this.minY = minY;
|
||||
this.maxY = maxY;
|
||||
|
||||
this.aboveMaxYValue = aboveMaxYValue;
|
||||
this.belowMinYValue = belowMinYValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=====================//
|
||||
// getters and setters //
|
||||
//=====================//
|
||||
|
||||
public int get(int x, int y, int z)
|
||||
{
|
||||
if (y < this.minY)
|
||||
{
|
||||
return 0;
|
||||
return this.belowMinYValue;
|
||||
}
|
||||
if (y >= this.maxY)
|
||||
else if (y >= this.maxY)
|
||||
{
|
||||
return 15;
|
||||
return this.aboveMaxYValue;
|
||||
}
|
||||
|
||||
|
||||
if (this.lightSections != null)
|
||||
{
|
||||
LightSection lightSection = this.lightSections[BitShiftUtil.divideByPowerOfTwo(y - this.minY, 4)];
|
||||
|
||||
+8
-2
@@ -358,7 +358,10 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
{
|
||||
if (this.blockLightStorage == null)
|
||||
{
|
||||
this.blockLightStorage = new ChunkLightStorage(this.getMinBuildHeight(), this.getMaxBuildHeight());
|
||||
this.blockLightStorage = new ChunkLightStorage(
|
||||
this.getMinBuildHeight(), this.getMaxBuildHeight(),
|
||||
// positions above and below the handled area should be unlit
|
||||
LodUtil.MIN_MC_LIGHT, LodUtil.MIN_MC_LIGHT);
|
||||
}
|
||||
return this.blockLightStorage;
|
||||
}
|
||||
@@ -381,7 +384,10 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
{
|
||||
if (this.skyLightStorage == null)
|
||||
{
|
||||
this.skyLightStorage = new ChunkLightStorage(this.getMinBuildHeight(), this.getMaxBuildHeight());
|
||||
this.skyLightStorage = new ChunkLightStorage(
|
||||
this.getMinBuildHeight(), this.getMaxBuildHeight(),
|
||||
// positions above should be lit but positions below should be unlit
|
||||
LodUtil.MAX_MC_LIGHT, LodUtil.MIN_MC_LIGHT);
|
||||
}
|
||||
return this.skyLightStorage;
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import java.util.regex.Pattern;
|
||||
// Logger (for debug stuff)
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.DisallowSelectingViaConfigGui;
|
||||
import com.seibel.distanthorizons.api.enums.config.EUpdateBranch;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.config.ConfigBase;
|
||||
import com.seibel.distanthorizons.core.config.types.*;
|
||||
@@ -244,7 +244,7 @@ public class ClassicConfigGUI
|
||||
}
|
||||
|
||||
// Changelog button
|
||||
if (Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() && Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE)
|
||||
if (Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get() && Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE)
|
||||
{
|
||||
this.addBtn(new TexturedButtonWidget(
|
||||
// Where the button is on the screen
|
||||
|
||||
+2
-6
@@ -1,23 +1,19 @@
|
||||
package com.seibel.distanthorizons.common.wrappers.gui.updater;
|
||||
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import com.seibel.distanthorizons.api.enums.config.EUpdateBranch;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.DhScreen;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget;
|
||||
import com.seibel.distanthorizons.core.jar.ModJarInfo;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.jar.JarUtils;
|
||||
import com.seibel.distanthorizons.core.jar.installer.ModrinthGetter;
|
||||
import com.seibel.distanthorizons.core.jar.updater.SelfUpdater;
|
||||
import net.minecraft.client.Minecraft;
|
||||
#if MC_VER >= MC_1_20_1
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
#else
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
#endif
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import static com.seibel.distanthorizons.common.wrappers.gui.GuiHelper.*;
|
||||
@@ -92,7 +88,7 @@ public class UpdateModScreen extends DhScreen
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE)
|
||||
if (Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE)
|
||||
{
|
||||
this.addBtn(new TexturedButtonWidget(
|
||||
// Where the button is on the screen
|
||||
|
||||
+5
-5
@@ -25,7 +25,7 @@ import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import com.seibel.distanthorizons.api.enums.config.ELodShading;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiLodShading;
|
||||
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.world.ServerLevelWrapper;
|
||||
@@ -113,11 +113,11 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
@Override
|
||||
public float getShade(EDhDirection lodDirection)
|
||||
{
|
||||
ELodShading lodShading = Config.Client.Advanced.Graphics.AdvancedGraphics.lodShading.get();
|
||||
EDhApiLodShading lodShading = Config.Client.Advanced.Graphics.AdvancedGraphics.lodShading.get();
|
||||
switch (lodShading)
|
||||
{
|
||||
default:
|
||||
case MINECRAFT:
|
||||
case AUTO:
|
||||
if (this.mc.level != null)
|
||||
{
|
||||
Direction mcDir = McObjectConverter.Convert(lodDirection);
|
||||
@@ -128,7 +128,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
case OLD_LIGHTING:
|
||||
case ENABLED:
|
||||
switch (lodDirection)
|
||||
{
|
||||
case DOWN:
|
||||
@@ -144,7 +144,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
return 0.6F;
|
||||
}
|
||||
|
||||
case NONE:
|
||||
case DISABLED:
|
||||
return 1.0F;
|
||||
}
|
||||
}
|
||||
|
||||
+23
@@ -30,6 +30,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ClientLevelWrapper implements IClientLevelWrapper
|
||||
@@ -41,6 +42,8 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
||||
private final ClientLevel level;
|
||||
private final ClientBlockDetailMap blockMap = new ClientBlockDetailMap(this);
|
||||
|
||||
private BlockStateWrapper dirtBlockWrapper;
|
||||
|
||||
|
||||
|
||||
//=============//
|
||||
@@ -116,6 +119,26 @@ public class ClientLevelWrapper implements IClientLevelWrapper
|
||||
return this.blockMap.getColor(((BlockStateWrapper) blockState).blockState, (BiomeWrapper) biome, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDirtBlockColor()
|
||||
{
|
||||
if (this.dirtBlockWrapper == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.dirtBlockWrapper = (BlockStateWrapper) BlockStateWrapper.deserialize(BlockStateWrapper.DIRT_RESOURCE_LOCATION_STRING, this);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// shouldn't happen, but just in case
|
||||
LOGGER.warn("Unable to get dirt color with resource location ["+BlockStateWrapper.DIRT_RESOURCE_LOCATION_STRING+"] with level ["+this+"].", e);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return this.blockMap.getColor(this.dirtBlockWrapper.blockState, BiomeWrapper.EMPTY_WRAPPER, DhBlockPos.ZERO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDimensionTypeWrapper getDimensionType() { return DimensionTypeWrapper.getDimensionTypeWrapper(this.level.dimensionType()); }
|
||||
|
||||
|
||||
+2
-4
@@ -26,13 +26,11 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiWorldGenerationStep;
|
||||
import com.seibel.distanthorizons.core.generation.WorldGenerationQueue;
|
||||
import com.seibel.distanthorizons.core.util.ThreadUtil;
|
||||
import com.seibel.distanthorizons.core.util.objects.UncheckedInterruptedException;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.util.objects.EventTimer;
|
||||
import com.seibel.distanthorizons.core.util.threading.ThreadPools;
|
||||
import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -123,7 +121,7 @@ public final class GenerationEvent
|
||||
public boolean terminate()
|
||||
{
|
||||
LOGGER.info("======================DUMPING ALL THREADS FOR WORLD GEN=======================");
|
||||
ThreadPools.WORLD_GEN_THREAD_FACTORY.dumpAllThreadStacks();
|
||||
ThreadPoolUtil.WORLD_GEN_THREAD_FACTORY.dumpAllThreadStacks();
|
||||
this.future.cancel(true);
|
||||
return this.future.isCancelled();
|
||||
}
|
||||
|
||||
+82
-58
@@ -25,9 +25,11 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import com.seibel.distanthorizons.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import net.minecraft.world.level.block.EntityBlock;
|
||||
import net.minecraft.world.level.block.SpawnerBlock;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
@@ -59,19 +61,23 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
{
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName());
|
||||
|
||||
private static ChunkStatus debugTriggeredForStatus = null;
|
||||
|
||||
|
||||
public final DummyLightEngine lightEngine;
|
||||
public final BatchGenerationEnvironment.EmptyChunkGenerator generator;
|
||||
public final int writeRadius;
|
||||
public final int size;
|
||||
|
||||
private final ChunkPos firstPos;
|
||||
private final List<ChunkAccess> cache;
|
||||
Long2ObjectOpenHashMap<ChunkAccess> chunkMap = new Long2ObjectOpenHashMap<ChunkAccess>();
|
||||
private final Long2ObjectOpenHashMap<ChunkAccess> chunkMap = new Long2ObjectOpenHashMap<ChunkAccess>();
|
||||
|
||||
/**
|
||||
* Present to reduce the chance that we accidentally break underlying MC code that isn't thread safe,
|
||||
* specifically: "it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap.getAndMoveToFirst()"
|
||||
*/
|
||||
ReentrantLock getChunkLock = new ReentrantLock();
|
||||
private final ReentrantLock getChunkLock = new ReentrantLock();
|
||||
|
||||
#if MC_VER < MC_1_18_2
|
||||
private ChunkPos overrideCenterPos = null;
|
||||
@@ -198,12 +204,9 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
#endif
|
||||
}
|
||||
|
||||
// Skip BlockEntity stuff. It aren't really needed
|
||||
/** Skip BlockEntity stuff. They aren't needed for our use case. */
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public boolean addFreshEntity(@NotNull Entity entity) { return true; }
|
||||
|
||||
// Allays have empty chunks even if it's outside the worldGenRegion
|
||||
// @Override
|
||||
@@ -214,13 +217,13 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
// Override to ensure no other mod mixins cause skipping the overrided
|
||||
// getChunk(...)
|
||||
@Override
|
||||
public ChunkAccess getChunk(int i, int j)
|
||||
public @NotNull ChunkAccess getChunk(int chunkX, int chunkZ)
|
||||
{
|
||||
try
|
||||
{
|
||||
// lock is to prevent issues with underlying MC code that doesn't support multithreading
|
||||
this.getChunkLock.lock();
|
||||
return this.getChunk(i, j, ChunkStatus.EMPTY);
|
||||
return this.getChunk(chunkX, chunkZ, ChunkStatus.EMPTY);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -231,13 +234,19 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
// Override to ensure no other mod mixins cause skipping the overrided
|
||||
// getChunk(...)
|
||||
@Override
|
||||
public ChunkAccess getChunk(int i, int j, ChunkStatus chunkStatus)
|
||||
public @NotNull ChunkAccess getChunk(int chunkX, int chunkZ, @NotNull ChunkStatus chunkStatus)
|
||||
{
|
||||
try
|
||||
{
|
||||
// lock is to prevent issues with underlying MC code that doesn't support multithreading
|
||||
this.getChunkLock.lock();
|
||||
return this.getChunk(i, j, chunkStatus, true);
|
||||
|
||||
ChunkAccess chunk = this.getChunk(chunkX, chunkZ, chunkStatus, true);
|
||||
if (chunk == null)
|
||||
{
|
||||
LodUtil.assertNotReach("getChunk shouldn't return null values");
|
||||
}
|
||||
return chunk;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -245,28 +254,12 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
}
|
||||
}
|
||||
|
||||
// Use this instead of super.getChunk() to bypass C2ME concurrency checks
|
||||
private ChunkAccess superGetChunk(int x, int z, ChunkStatus cs)
|
||||
{
|
||||
int k = x - firstPos.x;
|
||||
int l = z - firstPos.z;
|
||||
return cache.get(k + l * size);
|
||||
}
|
||||
|
||||
// Use this instead of super.hasChunk() to bypass C2ME concurrency checks
|
||||
public boolean superHasChunk(int x, int z)
|
||||
{
|
||||
int k = x - firstPos.x;
|
||||
int l = z - firstPos.z;
|
||||
return l >= 0 && l < size && k >= 0 && k < size;
|
||||
}
|
||||
|
||||
// Allow creating empty chunks even if it's outside the worldGenRegion
|
||||
/** Allows creating empty chunks even if they're outside the worldGenRegion */
|
||||
@Override
|
||||
@Nullable
|
||||
public ChunkAccess getChunk(int i, int j, ChunkStatus chunkStatus, boolean bl)
|
||||
public ChunkAccess getChunk(int chunkX, int chunkZ, @NotNull ChunkStatus chunkStatus, boolean returnNonNull)
|
||||
{
|
||||
ChunkAccess chunk = getChunkAccess(i, j, chunkStatus, bl);
|
||||
ChunkAccess chunk = this.getChunkAccess(chunkX, chunkZ, chunkStatus, returnNonNull);
|
||||
if (chunk instanceof LevelChunk)
|
||||
{
|
||||
chunk = new ImposterProtoChunk((LevelChunk) chunk #if MC_VER >= MC_1_18_2 , true #endif );
|
||||
@@ -274,67 +267,98 @@ public class DhLitWorldGenRegion extends WorldGenRegion
|
||||
return chunk;
|
||||
}
|
||||
|
||||
private static ChunkStatus debugTriggeredForStatus = null;
|
||||
|
||||
private ChunkAccess getChunkAccess(int i, int j, ChunkStatus chunkStatus, boolean bl)
|
||||
/**
|
||||
* @param returnNonNull if true this method will always return a non-null chunk,
|
||||
* if false it will return null if no chunk exists at the given position with the given status
|
||||
*/
|
||||
private ChunkAccess getChunkAccess(int chunkX, int chunkZ, ChunkStatus chunkStatus, boolean returnNonNull)
|
||||
{
|
||||
ChunkAccess chunk = superHasChunk(i, j) ? superGetChunk(i, j, ChunkStatus.EMPTY) : null;
|
||||
ChunkAccess chunk = this.superHasChunk(chunkX, chunkZ) ? this.superGetChunk(chunkX, chunkZ) : null;
|
||||
if (chunk != null && chunk.getStatus().isOrAfter(chunkStatus))
|
||||
{
|
||||
return chunk;
|
||||
}
|
||||
if (!bl)
|
||||
else if (!returnNonNull)
|
||||
{
|
||||
// no chunk found with the necessary status and null return values are allowed
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// we need a non-null chunk
|
||||
if (chunk == null)
|
||||
{
|
||||
chunk = chunkMap.get(ChunkPos.asLong(i, j));
|
||||
// check memory
|
||||
chunk = this.chunkMap.get(ChunkPos.asLong(chunkX, chunkZ));
|
||||
if (chunk == null)
|
||||
{
|
||||
chunk = generator.generate(i, j);
|
||||
// chunk isn't in memory, generate a new one
|
||||
chunk = this.generator.generate(chunkX, chunkZ);
|
||||
if (chunk == null)
|
||||
{
|
||||
throw new NullPointerException("The provided generator should not return null!");
|
||||
chunkMap.put(ChunkPos.asLong(i, j), chunk);
|
||||
}
|
||||
this.chunkMap.put(ChunkPos.asLong(chunkX, chunkZ), chunk);
|
||||
}
|
||||
}
|
||||
|
||||
if (chunkStatus != ChunkStatus.EMPTY && chunkStatus != debugTriggeredForStatus)
|
||||
{
|
||||
LOGGER.info("WorldGen requiring " + chunkStatus
|
||||
+ " outside expected range detected. Force passing EMPTY chunk and seeing if it works.");
|
||||
debugTriggeredForStatus = chunkStatus;
|
||||
}
|
||||
|
||||
return chunk;
|
||||
}
|
||||
|
||||
/** Overriding allows us to use our own lighting engine */
|
||||
@Override
|
||||
public LevelLightEngine getLightEngine() { return this.lightEngine; }
|
||||
|
||||
/** Overriding allows us to use our own lighting engine */
|
||||
@Override
|
||||
public int getBrightness(LightLayer lightLayer, BlockPos blockPos) { return 0; }
|
||||
|
||||
/** Overriding allows us to use our own lighting engine */
|
||||
@Override
|
||||
public int getRawBrightness(BlockPos blockPos, int i) { return 0; }
|
||||
|
||||
/** Overriding allows us to use our own lighting engine */
|
||||
@Override
|
||||
public boolean canSeeSky(BlockPos blockPos)
|
||||
/** Use this instead of super.hasChunk() to bypass C2ME concurrency checks */
|
||||
public boolean superHasChunk(int x, int z)
|
||||
{
|
||||
return (getBrightness(LightLayer.SKY, blockPos) >= getMaxLightLevel());
|
||||
int k = x - this.firstPos.x;
|
||||
int l = z - this.firstPos.z;
|
||||
return l >= 0 && l < this.size && k >= 0 && k < this.size;
|
||||
}
|
||||
|
||||
public int getBlockTint(BlockPos blockPos, ColorResolver colorResolver)
|
||||
/** Use this instead of super.getChunk() to bypass C2ME concurrency checks */
|
||||
private ChunkAccess superGetChunk(int x, int z)
|
||||
{
|
||||
return calculateBlockTint(blockPos, colorResolver);
|
||||
int k = x - this.firstPos.x;
|
||||
int l = z - this.firstPos.z;
|
||||
return this.cache.get(k + l * this.size);
|
||||
}
|
||||
|
||||
|
||||
/** Overriding allows us to use our own lighting engine */
|
||||
@Override
|
||||
public @NotNull LevelLightEngine getLightEngine() { return this.lightEngine; }
|
||||
|
||||
/** Overriding allows us to use our own lighting engine */
|
||||
@Override
|
||||
public int getBrightness(@NotNull LightLayer lightLayer, @NotNull BlockPos blockPos) { return 0; }
|
||||
|
||||
/** Overriding allows us to use our own lighting engine */
|
||||
@Override
|
||||
public int getRawBrightness(@NotNull BlockPos blockPos, int i) { return 0; }
|
||||
|
||||
/** Overriding allows us to use our own lighting engine */
|
||||
@Override
|
||||
public boolean canSeeSky(@NotNull BlockPos blockPos)
|
||||
{
|
||||
return (this.getBrightness(LightLayer.SKY, blockPos) >= this.getMaxLightLevel());
|
||||
}
|
||||
|
||||
public int getBlockTint(@NotNull BlockPos blockPos, @NotNull ColorResolver colorResolver)
|
||||
{
|
||||
return this.calculateBlockTint(blockPos, colorResolver);
|
||||
}
|
||||
|
||||
private Biome _getBiome(BlockPos pos)
|
||||
{
|
||||
#if MC_VER >= MC_1_18_2
|
||||
return getBiome(pos).value();
|
||||
return this.getBiome(pos).value();
|
||||
#else
|
||||
return getBiome(pos);
|
||||
return this.getBiome(pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+1
-1
Submodule coreSubProjects updated: 87e5647379...b41e54e6a6
+56
-51
@@ -1,49 +1,75 @@
|
||||
unimined.minecraft {
|
||||
fabric {
|
||||
loader rootProject.fabric_loader_version
|
||||
accessWidener(project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"))
|
||||
plugins {
|
||||
id "fabric-loom" version "1.6-SNAPSHOT"
|
||||
}
|
||||
|
||||
skipInsertAw = true
|
||||
loom {
|
||||
accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener")
|
||||
|
||||
// "runs" isn't required, but when we do need it then it can be useful
|
||||
runs {
|
||||
client {
|
||||
client()
|
||||
setConfigName("Fabric Client")
|
||||
ideConfigGenerated(true)
|
||||
runDir("../run")
|
||||
}
|
||||
server {
|
||||
server()
|
||||
setConfigName("Fabric Server")
|
||||
ideConfigGenerated(true)
|
||||
runDir("../run")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
remapJar {
|
||||
inputFile = shadowJar.archiveFile
|
||||
dependsOn shadowJar
|
||||
}
|
||||
|
||||
|
||||
configurations {
|
||||
// The addModJar basically embeds the mod to the built jar
|
||||
addModJar
|
||||
include.extendsFrom addModJar
|
||||
modImplementation.extendsFrom addModJar
|
||||
dummy
|
||||
}
|
||||
|
||||
|
||||
|
||||
def addMod(path, enabled) {
|
||||
if (enabled == "2")
|
||||
dependencies { modImplementation(path) }
|
||||
else if (enabled == "1")
|
||||
dependencies { compileOnly(path) }
|
||||
}
|
||||
|
||||
// TODO: There currently seems to be a bug which causes the regular addModJar to not work, swap back to the regular addModJar when fixed
|
||||
def addModJar_(path) {
|
||||
dependencies {
|
||||
modImplementation(path)
|
||||
include(path)
|
||||
}
|
||||
dependencies { modCompileOnly(path) }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
annotationProcessor "javax.annotation:javax.annotation-api:1.3.2"
|
||||
implementation("javax.annotation:javax.annotation-api:1.3.2")
|
||||
runtimeOnly "javax.annotation:javax.annotation-api:1.3.2"
|
||||
compileOnly "javax.annotation:javax.annotation-api:1.3.2"
|
||||
modImplementation "javax.annotation:javax.annotation-api:1.3.2"
|
||||
minecraft "com.mojang:minecraft:${minecraft_version}"
|
||||
mappings loom.layered() {
|
||||
// Mojmap mappings
|
||||
officialMojangMappings()
|
||||
// Parchment mappings (it adds parameter mappings & javadoc)
|
||||
parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip")
|
||||
}
|
||||
// Fabric loader
|
||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
|
||||
|
||||
// annotationProcessor "javax.annotation:javax.annotation-api:1.3.2"
|
||||
// implementation("javax.annotation:javax.annotation-api:1.3.2")
|
||||
// runtimeOnly "javax.annotation:javax.annotation-api:1.3.2"
|
||||
// compileOnly "javax.annotation:javax.annotation-api:1.3.2"
|
||||
// modImplementation "javax.annotation:javax.annotation-api:1.3.2"
|
||||
|
||||
// Fabric API
|
||||
addModJar_(fabricApi.fabricModule("fabric-api-base", rootProject.fabric_api_version))
|
||||
addModJar_(fabricApi.fabricModule("fabric-lifecycle-events-v1", rootProject.fabric_api_version))
|
||||
addModJar_(fabricApi.fabricModule("fabric-resource-loader-v0", rootProject.fabric_api_version))
|
||||
addModJar_(fabricApi.fabricModule("fabric-events-interaction-v0", rootProject.fabric_api_version))
|
||||
addModJar_(fabricApi.fabricModule("fabric-rendering-v1", rootProject.fabric_api_version)) // TODO: Remove this as it is only needed in 1 line (FabricClientProxy)
|
||||
addModJar_(fabricApi.fabricModule("fabric-networking-api-v1", rootProject.fabric_api_version))
|
||||
addModJar(fabricApi.module("fabric-api-base", rootProject.fabric_api_version))
|
||||
addModJar(fabricApi.module("fabric-lifecycle-events-v1", rootProject.fabric_api_version))
|
||||
addModJar(fabricApi.module("fabric-resource-loader-v0", rootProject.fabric_api_version))
|
||||
addModJar(fabricApi.module("fabric-events-interaction-v0", rootProject.fabric_api_version))
|
||||
addModJar(fabricApi.module("fabric-rendering-v1", rootProject.fabric_api_version)) // TODO: Remove this as it is only needed in 1 line (FabricClientProxy)
|
||||
addModJar(fabricApi.module("fabric-networking-api-v1", rootProject.fabric_api_version))
|
||||
|
||||
|
||||
// Mod Menu
|
||||
modImplementation("com.terraformersmc:modmenu:${rootProject.modmenu_version}")
|
||||
@@ -98,12 +124,6 @@ dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
remapJar {
|
||||
inputFile = shadowJar.archiveFile
|
||||
dependsOn shadowJar
|
||||
// classifier null
|
||||
}
|
||||
|
||||
|
||||
task deleteResources(type: Delete) {
|
||||
delete file("build/resources/main")
|
||||
@@ -114,31 +134,16 @@ processResources {
|
||||
dependsOn(copyCommonLoaderResources)
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
runClient {
|
||||
dependsOn(copyCoreResources)
|
||||
dependsOn(copyCommonLoaderResources)
|
||||
runClient {
|
||||
dependsOn(copyCoreResources)
|
||||
dependsOn(copyCommonLoaderResources)
|
||||
// jvmArgs([ "-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg ])
|
||||
finalizedBy(deleteResources)
|
||||
}
|
||||
finalizedBy(deleteResources)
|
||||
}
|
||||
|
||||
//jar {
|
||||
// classifier "dev"
|
||||
//}
|
||||
|
||||
sourcesJar {
|
||||
def commonSources = project(":common").sourcesJar
|
||||
dependsOn commonSources
|
||||
from commonSources.archiveFile.map { zipTree(it) }
|
||||
|
||||
// def fabricLikeSources = project(":fabricLike").sourcesJar
|
||||
// dependsOn fabricLikeSources
|
||||
// from fabricLikeSources.archiveFile.map { zipTree(it) }
|
||||
}
|
||||
|
||||
//components.java {
|
||||
// withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
||||
// skip()
|
||||
// }
|
||||
//}
|
||||
@@ -20,7 +20,6 @@
|
||||
package com.seibel.distanthorizons.fabric;
|
||||
|
||||
import com.seibel.distanthorizons.common.AbstractModInitializer;
|
||||
import com.seibel.distanthorizons.common.rendering.SeamlessOverdraw;
|
||||
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||
import com.seibel.distanthorizons.core.api.internal.ClientApi;
|
||||
@@ -131,7 +130,7 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
|
||||
ChunkAccess chunk = level.getChunk(blockPos);
|
||||
if (chunk != null)
|
||||
{
|
||||
LOGGER.trace("attack block at blockPos: " + blockPos);
|
||||
//LOGGER.trace("attack block at blockPos: " + blockPos);
|
||||
|
||||
IClientLevelWrapper wrappedLevel = ClientLevelWrapper.getWrapper((ClientLevel) level);
|
||||
SharedApi.INSTANCE.chunkBlockChangedEvent(
|
||||
@@ -161,7 +160,7 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
|
||||
ChunkAccess chunk = level.getChunk(hitResult.getBlockPos());
|
||||
if (chunk != null)
|
||||
{
|
||||
LOGGER.trace("use block at blockPos: " + hitResult.getBlockPos());
|
||||
//LOGGER.trace("use block at blockPos: " + hitResult.getBlockPos());
|
||||
|
||||
IClientLevelWrapper wrappedLevel = ClientLevelWrapper.getWrapper((ClientLevel) level);
|
||||
SharedApi.INSTANCE.chunkBlockChangedEvent(
|
||||
@@ -197,21 +196,6 @@ public class FabricClientProxy implements AbstractModInitializer.IEventProxy
|
||||
McObjectConverter.Convert(renderContext.matrixStack().last().pose()),
|
||||
McObjectConverter.Convert(renderContext.projectionMatrix()),
|
||||
renderContext.tickDelta());
|
||||
|
||||
|
||||
// experimental proof-of-concept option
|
||||
if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get())
|
||||
{
|
||||
float[] matrixFloatArray = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(renderContext.projectionMatrix(), renderContext.tickDelta());
|
||||
|
||||
#if MC_VER == MC_1_16_5
|
||||
SeamlessOverdraw.applyLegacyProjectionMatrix(matrixFloatArray);
|
||||
#elif MC_VER < MC_1_19_4
|
||||
renderContext.projectionMatrix().load(FloatBuffer.wrap(matrixFloatArray));
|
||||
#else
|
||||
renderContext.projectionMatrix().set(matrixFloatArray);
|
||||
#endif
|
||||
}
|
||||
});
|
||||
|
||||
// Debug keyboard event
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.config.ConfigBase;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.*;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
@@ -37,8 +38,10 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
@@ -50,6 +53,8 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti
|
||||
{
|
||||
private static final ResourceLocation INITIAL_PHASE = ResourceLocation.tryParse("distanthorizons:dedicated_server_initial");
|
||||
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@@ -72,10 +77,13 @@ public class FabricMain extends AbstractModInitializer implements ClientModIniti
|
||||
// If sodium is installed Indium is also necessary in order to use the Fabric rendering API
|
||||
if (!modChecker.isModLoaded("indium"))
|
||||
{
|
||||
// People don't read the crash logs!!!
|
||||
// So, just put a notification, so they hopefully realise what's the problem (and dont just open issues)
|
||||
System.setProperty("java.awt.headless", "false"); // Required to make it work
|
||||
JOptionPane.showMessageDialog(null, ModInfo.READABLE_NAME + " now relies on Indium to work with Sodium.\nPlease download Indium from https://modrinth.com/mod/indium", ModInfo.READABLE_NAME, JOptionPane.INFORMATION_MESSAGE);
|
||||
String indiumMissingMessage = ModInfo.READABLE_NAME + " now relies on Indium to work with Sodium.\nPlease download Indium from https://modrinth.com/mod/indium";
|
||||
LOGGER.fatal(indiumMissingMessage);
|
||||
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
JOptionPane.showMessageDialog(null, indiumMissingMessage, ModInfo.READABLE_NAME, JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
IMinecraftClientWrapper mc = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||
String errorMessage = "loading Distant Horizons. Distant Horizons requires Indium in order to run with Sodium.";
|
||||
|
||||
+19
-2
@@ -7,6 +7,7 @@ import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
@@ -23,13 +24,29 @@ public class MixinClientPacketListener
|
||||
@Shadow
|
||||
private ClientLevel level;
|
||||
|
||||
@Unique
|
||||
private ClientLevel previousLevel;
|
||||
|
||||
|
||||
@Inject(method = "handleLogin", at = @At("RETURN"))
|
||||
void onHandleLoginEnd(CallbackInfo ci) { ClientApi.INSTANCE.onClientOnlyConnected(); }
|
||||
|
||||
@Inject(method = "handleRespawn", at = @At("HEAD"))
|
||||
void onHandleRespawnStart(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelUnloadEvent(ClientLevelWrapper.getWrapper(this.level)); }
|
||||
void onHandleRespawnStart(CallbackInfo ci) { this.previousLevel = this.level; }
|
||||
@Inject(method = "handleRespawn", at = @At("RETURN"))
|
||||
void onHandleRespawnEnd(CallbackInfo ci) { ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(this.level)); }
|
||||
void onHandleRespawnEnd(CallbackInfo ci)
|
||||
{
|
||||
// If the player changes dimensions the "this.level" will be changed halfway through the respawn method.
|
||||
// By checking if the object references are the same, we can see if the previous level should be unloaded
|
||||
// or if the player just respawned in the same level.
|
||||
if (this.previousLevel != this.level)
|
||||
{
|
||||
ClientApi.INSTANCE.clientLevelUnloadEvent(ClientLevelWrapper.getWrapper(this.previousLevel));
|
||||
ClientApi.INSTANCE.clientLevelLoadEvent(ClientLevelWrapper.getWrapper(this.level));
|
||||
}
|
||||
|
||||
this.previousLevel = null;
|
||||
}
|
||||
|
||||
#if MC_VER < MC_1_19_4
|
||||
@Inject(method = "cleanup", at = @At("HEAD"))
|
||||
|
||||
+5
-3
@@ -1,6 +1,6 @@
|
||||
package com.seibel.distanthorizons.fabric.mixins.client;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.EUpdateBranch;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.updater.UpdateModScreen;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
@@ -51,7 +51,7 @@ public class MixinMinecraft
|
||||
{
|
||||
instance.setScreen(new UpdateModScreen(
|
||||
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
|
||||
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
||||
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
||||
));
|
||||
}
|
||||
else
|
||||
@@ -77,7 +77,9 @@ public class MixinMinecraft
|
||||
Minecraft.getInstance().setScreen(new UpdateModScreen(
|
||||
// TODO: Change to runnable, instead of tittle screen
|
||||
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
|
||||
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
||||
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE
|
||||
? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion())
|
||||
: GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
||||
));
|
||||
};
|
||||
}
|
||||
|
||||
+71
-86
@@ -1,44 +1,87 @@
|
||||
unimined.minecraft {
|
||||
minecraftForge {
|
||||
loader forge_version
|
||||
mixinConfig("DistantHorizons.forge.mixins.json")
|
||||
plugins {
|
||||
// Note: This is only needed for multi-loader projects
|
||||
// The main architectury loom version is set at the start of the root build.gradle
|
||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||
}
|
||||
|
||||
file("build/sourcesSets/main/META-INF/").mkdirs()
|
||||
accessTransformer(aw2at(
|
||||
project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"),
|
||||
file("build/sourcesSets/main/META-INF/accesstransformer.cfg") // We'd wanna output the access transformer to somewhere where it'll only appear in the final jar
|
||||
))
|
||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
forge()
|
||||
}
|
||||
|
||||
//loom {
|
||||
// forge {
|
||||
// convertAccessWideners.set(true)
|
||||
// extraAccessWideners.add("lod.accesswidener")
|
||||
// mixinConfigs("DistantHorizons.mixins.json")
|
||||
// }
|
||||
//}
|
||||
|
||||
loom {
|
||||
silentMojangMappingsLicense() // Shut the licencing warning
|
||||
accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener")
|
||||
|
||||
forge {
|
||||
convertAccessWideners = true
|
||||
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
|
||||
|
||||
mixinConfigs = [
|
||||
"DistantHorizons.forge.mixins.json"
|
||||
]
|
||||
}
|
||||
|
||||
// "runs" isn't required, but when we do need it then it can be useful
|
||||
runs {
|
||||
client {
|
||||
client()
|
||||
setConfigName("Forge Client")
|
||||
ideConfigGenerated(true)
|
||||
runDir("../run")
|
||||
// vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg)
|
||||
}
|
||||
server {
|
||||
server()
|
||||
setConfigName("Forge Server")
|
||||
ideConfigGenerated(true)
|
||||
runDir("../run")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
remapJar {
|
||||
inputFile = shadowJar.archiveFile
|
||||
dependsOn shadowJar
|
||||
}
|
||||
|
||||
def addMod(path, enabled) {
|
||||
if (enabled == "2")
|
||||
dependencies { modImplementation(path) }
|
||||
dependencies { implementation(path) }
|
||||
else if (enabled == "1")
|
||||
dependencies { compileOnly(path) }
|
||||
dependencies { modCompileOnly(path) }
|
||||
}
|
||||
dependencies {
|
||||
// Architectury API
|
||||
// if (minecraft_version == "1.16.5") {
|
||||
// implementation("me.shedaniel:architectury-forge:${rootProject.architectury_version}")
|
||||
// } else {
|
||||
// implementation("dev.architectury:architectury-forge:${rootProject.architectury_version}")
|
||||
// }
|
||||
|
||||
// Starlight
|
||||
addMod("curse.maven:starlight-forge-526854:${rootProject.starlight_version_forge}", rootProject.enable_starlight_forge)
|
||||
// annotationProcessor "org.spongepowered:mixin:0.8.4:processor"
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
||||
mappings loom.layered() {
|
||||
// Mojmap mappings
|
||||
officialMojangMappings()
|
||||
// Parchment mappings (it adds parameter mappings & javadoc)
|
||||
parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip")
|
||||
}
|
||||
|
||||
// Forge
|
||||
forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}"
|
||||
|
||||
addMod("curse.maven:TerraForged-363820:${rootProject.terraforged_version}", rootProject.enable_terraforged)
|
||||
|
||||
addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft)
|
||||
|
||||
// annotationProcessor "org.spongepowered:mixin:0.8.5:processor"
|
||||
}
|
||||
|
||||
// if (System.getProperty("idea.sync.active") != "true") {
|
||||
// annotationProcessor "org.spongepowered:mixin:0.8.4:processor"
|
||||
// }
|
||||
task deleteResources(type: Delete) {
|
||||
delete file("build/resources/main")
|
||||
}
|
||||
|
||||
tasks.register('copyAllResources') {
|
||||
@@ -46,70 +89,12 @@ tasks.register('copyAllResources') {
|
||||
dependsOn(copyCommonLoaderResources)
|
||||
}
|
||||
|
||||
|
||||
|
||||
processResources {
|
||||
dependsOn(tasks.named('copyAllResources'))
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
runClient {
|
||||
dependsOn(tasks.named('copyAllResources'))
|
||||
}
|
||||
|
||||
// TODO this isn't a great place for these, but `tasks.build.doLast` doesn't always work and I'm not sure of a better place right now
|
||||
tasks.runClient.doFirst {
|
||||
// TODO can we just ignore these folders instead?
|
||||
// deleting them may cause issues if the OS locks the files
|
||||
// and it feels hacky
|
||||
delete file("../common/build/libs")
|
||||
delete file("../coreSubProjects/core/build/libs")
|
||||
delete file("../coreSubProjects/api/build/libs")
|
||||
}
|
||||
}
|
||||
|
||||
remapJar {
|
||||
inputFile = shadowJar.archiveFile
|
||||
dependsOn shadowJar
|
||||
// classifier null
|
||||
}
|
||||
|
||||
|
||||
sourcesJar {
|
||||
def commonSources = project(":common").sourcesJar
|
||||
dependsOn commonSources
|
||||
from commonSources.archiveFile.map { zipTree(it) }
|
||||
}
|
||||
|
||||
//components.java {
|
||||
// withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
||||
// skip()
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
// TODO this was specifically added for MC 1.20.4 and should not be used on MC versions prior to it
|
||||
// source: https://github.com/MinecraftForge/MinecraftForge/blob/5d0047753dfac0caaf5d97cc3f5c9a8b0990cb44/mdk/build.gradle#L209-L217
|
||||
//
|
||||
// Merge the resources and classes into the same directory.
|
||||
// This is done because java expects modules to be in a single directory.
|
||||
// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem
|
||||
// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later.
|
||||
sourceSets.each {
|
||||
if ( // Only run on MC 1.20.4 or later
|
||||
// FIXME: Add an environment variable for the Major, Minor, and Patch version number of Minecraft
|
||||
minecraft_version.split("\\.")[1].toInteger() >= 20 &&
|
||||
(
|
||||
minecraft_version.split("\\.").length > 1 && // Incase there isn't a minor version
|
||||
minecraft_version.split("\\.")[2].toInteger() >= 4
|
||||
)
|
||||
) {
|
||||
// all of our code and resources should be in the sourceSets/main/ folder for Forge 1.20.4+
|
||||
def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
|
||||
println "source name: [" + it.name + "]"// as of 2024-2-4 "it.name" only returned "main" and "test"
|
||||
it.output.resourcesDir = dir
|
||||
it.java.destinationDirectory = dir
|
||||
}
|
||||
tasks.named('runClient') {
|
||||
dependsOn(tasks.named('copyAllResources'))
|
||||
finalizedBy(deleteResources)
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ public class ForgeClientProxy implements AbstractModInitializer.IEventProxy
|
||||
return;
|
||||
}
|
||||
|
||||
LOGGER.trace("interact or block place event at blockPos: " + event.getPos());
|
||||
//LOGGER.trace("interact or block place event at blockPos: " + event.getPos());
|
||||
|
||||
#if MC_VER < MC_1_19_2
|
||||
LevelAccessor level = event.getWorld();
|
||||
@@ -197,7 +197,7 @@ public class ForgeClientProxy implements AbstractModInitializer.IEventProxy
|
||||
return;
|
||||
}
|
||||
|
||||
LOGGER.trace("break or block attack at blockPos: " + event.getPos());
|
||||
//LOGGER.trace("break or block attack at blockPos: " + event.getPos());
|
||||
|
||||
#if MC_VER < MC_1_19_2
|
||||
LevelAccessor level = event.getWorld();
|
||||
|
||||
@@ -70,7 +70,7 @@ import java.util.function.Consumer;
|
||||
* If you are looking for the real start of the mod
|
||||
* check out the ClientProxy.
|
||||
*/
|
||||
@Mod("distanthorizons") // TODO: Change it back to ModInfo.ID when forge works
|
||||
@Mod(ModInfo.ID)
|
||||
public class ForgeMain extends AbstractModInitializer
|
||||
{
|
||||
public ForgeMain()
|
||||
|
||||
-15
@@ -29,7 +29,6 @@ import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import org.joml.Matrix4f;
|
||||
#endif
|
||||
import com.seibel.distanthorizons.common.rendering.SeamlessOverdraw;
|
||||
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||
@@ -141,20 +140,6 @@ public class MixinLevelRenderer
|
||||
if (renderType.equals(RenderType.solid()))
|
||||
{
|
||||
ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(this.level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime());
|
||||
|
||||
// experimental proof-of-concept option
|
||||
if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get())
|
||||
{
|
||||
float[] matrixFloatArray = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(mcProjectionMatrix, previousPartialTicks);
|
||||
|
||||
#if MC_VER == MC_1_16_5
|
||||
SeamlessOverdraw.applyLegacyProjectionMatrix(matrixFloatArray);
|
||||
#elif MC_VER < MC_1_19_4
|
||||
projectionMatrix.load(FloatBuffer.wrap(matrixFloatArray));
|
||||
#else
|
||||
projectionMatrix.set(matrixFloatArray);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (renderType.equals(RenderType.translucent()))
|
||||
{
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package com.seibel.distanthorizons.forge.mixins.client;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.EUpdateBranch;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.updater.UpdateModScreen;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
@@ -51,7 +51,7 @@ public class MixinMinecraft
|
||||
{
|
||||
instance.setScreen(new UpdateModScreen(
|
||||
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
|
||||
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
||||
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()): GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
||||
));
|
||||
}
|
||||
else
|
||||
@@ -77,7 +77,7 @@ public class MixinMinecraft
|
||||
Minecraft.getInstance().setScreen(new UpdateModScreen(
|
||||
// TODO: Change to runnable, instead of tittle screen
|
||||
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
|
||||
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
||||
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
||||
));
|
||||
};
|
||||
}
|
||||
|
||||
+5
-4
@@ -2,12 +2,10 @@
|
||||
org.gradle.jvmargs=-Xmx4096M
|
||||
org.gradle.parallel=true
|
||||
org.gradle.caching=true
|
||||
fabric.loom.multiProjectOptimisation=true
|
||||
|
||||
# Mod Info
|
||||
mod_name=DistantHorizons
|
||||
mod_id=distanthorizons
|
||||
mod_version=2.0.2-a-dev
|
||||
mod_version=2.0.3-a-dev
|
||||
api_version=1.1.0
|
||||
maven_group=com.seibel.distanthorizons
|
||||
mod_readable_name=Distant Horizons
|
||||
@@ -20,10 +18,13 @@ mod_issues=https://gitlab.com/jeseibel/distant-horizons/-/issues
|
||||
mod_discord=https://discord.gg/xAB8G4cENx
|
||||
|
||||
# Global Plugin Versions
|
||||
manifold_version=2024.1.0
|
||||
manifold_version=2024.1.9
|
||||
nightconfig_version=3.6.6
|
||||
lz4_version=1.8.0
|
||||
zstd_version=1.5.5-11
|
||||
xz_version=1.9
|
||||
sqlite_jdbc_version=3.43.0.0
|
||||
fastutil_version=8.5.13
|
||||
#svgSalamander_version=1.1.3
|
||||
|
||||
# Minecraft related libaries (included in MC's jar)
|
||||
|
||||
+86
-41
@@ -1,44 +1,98 @@
|
||||
unimined.minecraft {
|
||||
neoForged {
|
||||
loader neoforge_version
|
||||
mixinConfig("DistantHorizons.neoforge.mixins.json")
|
||||
plugins {
|
||||
// Note: This is only needed for multi-loader projects
|
||||
// The main architectury loom version is set at the start of the root build.gradle
|
||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||
}
|
||||
|
||||
file("build/sourcesSets/main/META-INF/").mkdirs()
|
||||
accessTransformer(aw2at(
|
||||
project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener"),
|
||||
file("build/sourcesSets/main/META-INF/accesstransformer.cfg") // We'd wanna output the access transformer to somewhere where it'll only appear in the final jar
|
||||
))
|
||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
neoForge()
|
||||
}
|
||||
|
||||
// TODO this is already defined in the main settings.gradle file, why doesn't it work unless also defined here? (If compiling does work without this block feel free to remove)
|
||||
repositories {
|
||||
maven {
|
||||
name "Neoforge"
|
||||
url "https://maven.neoforged.net/releases/"
|
||||
}
|
||||
}
|
||||
|
||||
//loom {
|
||||
// forge {
|
||||
// convertAccessWideners.set(true)
|
||||
// extraAccessWideners.add("lod.accesswidener")
|
||||
// mixinConfigs("DistantHorizons.mixins.json")
|
||||
// }
|
||||
//}
|
||||
|
||||
loom {
|
||||
silentMojangMappingsLicense() // Shut the licencing warning
|
||||
accessWidenerPath = project(":common").file("src/main/resources/${accessWidenerVersion}.distanthorizons.accesswidener")
|
||||
|
||||
neoForge {
|
||||
// Access wideners are now defined in the `remapJar.atAccessWideners`
|
||||
// convertAccessWideners = true
|
||||
// extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
|
||||
|
||||
// Mixins are now defined in the `mods.toml`
|
||||
// mixinConfigs = [
|
||||
// "DistantHorizons.mixins.json"
|
||||
// ]
|
||||
}
|
||||
mixin {
|
||||
// Mixins are now defined in the `mods.toml`
|
||||
// mixinConfigs = [
|
||||
// "DistantHorizons.mixins.json"
|
||||
// ]
|
||||
}
|
||||
|
||||
// "runs" isn't required, but when we do need it then it can be useful
|
||||
runs {
|
||||
client {
|
||||
client()
|
||||
setConfigName("NeoForge Client")
|
||||
ideConfigGenerated(true)
|
||||
runDir("../run")
|
||||
// vmArgs("-XX:-OmitStackTraceInFastThrow", minecraftMemoryJavaArg)
|
||||
}
|
||||
server {
|
||||
server()
|
||||
setConfigName("NeoForge Server")
|
||||
ideConfigGenerated(true)
|
||||
runDir("../run")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
remapJar {
|
||||
inputFile = shadowJar.archiveFile
|
||||
dependsOn shadowJar
|
||||
// classifier null
|
||||
|
||||
atAccessWideners.add("distanthorizons.accesswidener")
|
||||
}
|
||||
|
||||
def addMod(path, enabled) {
|
||||
if (enabled == "2")
|
||||
dependencies { modImplementation(path) }
|
||||
dependencies { implementation(path) }
|
||||
else if (enabled == "1")
|
||||
dependencies { compileOnly(path) }
|
||||
dependencies { modCompileOnly(path) }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Architectury API
|
||||
// if (minecraft_version == "1.16.5") {
|
||||
// implementation("me.shedaniel:architectury-forge:${rootProject.architectury_version}")
|
||||
// } else {
|
||||
// implementation("dev.architectury:architectury-forge:${rootProject.architectury_version}")
|
||||
// }
|
||||
|
||||
// Starlight
|
||||
addMod("curse.maven:starlight-forge-526854:${rootProject.starlight_version_forge}", rootProject.enable_starlight_forge)
|
||||
// annotationProcessor "org.spongepowered:mixin:0.8.4:processor"
|
||||
|
||||
addMod("curse.maven:TerraForged-363820:${rootProject.terraforged_version}", rootProject.enable_terraforged)
|
||||
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
||||
mappings loom.layered() {
|
||||
// Mojmap mappings
|
||||
officialMojangMappings()
|
||||
// Parchment mappings (it adds parameter mappings & javadoc)
|
||||
parchment("org.parchmentmc.data:parchment-${rootProject.parchment_version}@zip")
|
||||
}
|
||||
|
||||
// Neoforge
|
||||
neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}"
|
||||
addMod("curse.maven:TerraFirmaCraft-302973:4616004", rootProject.enable_terrafirmacraft)
|
||||
|
||||
// annotationProcessor "org.spongepowered:mixin:0.8.5:processor"
|
||||
|
||||
// if (System.getProperty("idea.sync.active") != "true") {
|
||||
// annotationProcessor "org.spongepowered:mixin:0.8.4:processor"
|
||||
// }
|
||||
}
|
||||
|
||||
task deleteResources(type: Delete) {
|
||||
@@ -54,20 +108,11 @@ processResources {
|
||||
dependsOn(tasks.named('copyAllResources'))
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
runClient {
|
||||
dependsOn(tasks.named('copyAllResources'))
|
||||
finalizedBy(deleteResources)
|
||||
}
|
||||
tasks.named('runClient') {
|
||||
dependsOn(tasks.named('copyAllResources'))
|
||||
finalizedBy(deleteResources)
|
||||
}
|
||||
|
||||
remapJar {
|
||||
inputFile = shadowJar.archiveFile
|
||||
dependsOn shadowJar
|
||||
// classifier null
|
||||
}
|
||||
|
||||
|
||||
sourcesJar {
|
||||
def commonSources = project(":common").sourcesJar
|
||||
dependsOn commonSources
|
||||
|
||||
@@ -151,7 +151,7 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
||||
return;
|
||||
}
|
||||
|
||||
LOGGER.trace("interact or block place event at blockPos: " + event.getPos());
|
||||
//LOGGER.trace("interact or block place event at blockPos: " + event.getPos());
|
||||
|
||||
LevelAccessor level = event.getLevel();
|
||||
|
||||
@@ -166,7 +166,7 @@ public class NeoforgeClientProxy implements AbstractModInitializer.IEventProxy
|
||||
return;
|
||||
}
|
||||
|
||||
LOGGER.trace("break or block attack at blockPos: " + event.getPos());
|
||||
//LOGGER.trace("break or block attack at blockPos: " + event.getPos());
|
||||
|
||||
LevelAccessor level = event.getLevel();
|
||||
|
||||
|
||||
-15
@@ -29,7 +29,6 @@ import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import org.joml.Matrix4f;
|
||||
#endif
|
||||
import com.seibel.distanthorizons.common.rendering.SeamlessOverdraw;
|
||||
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||
import com.seibel.distanthorizons.common.wrappers.chunk.ChunkWrapper;
|
||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||
@@ -138,20 +137,6 @@ public class MixinLevelRenderer
|
||||
if (renderType.equals(RenderType.solid()))
|
||||
{
|
||||
ClientApi.INSTANCE.renderLods(ClientLevelWrapper.getWrapper(level), mcModelViewMatrix, mcProjectionMatrix, Minecraft.getInstance().getFrameTime());
|
||||
|
||||
// experimental proof-of-concept option
|
||||
if (Config.Client.Advanced.Graphics.AdvancedGraphics.seamlessOverdraw.get())
|
||||
{
|
||||
float[] matrixFloatArray = SeamlessOverdraw.overwriteMinecraftNearFarClipPlanes(mcProjectionMatrix, previousPartialTicks);
|
||||
|
||||
#if MC_VER == MC_1_16_5
|
||||
SeamlessOverdraw.applyLegacyProjectionMatrix(matrixFloatArray);
|
||||
#elif MC_VER < MC_1_19_4
|
||||
projectionMatrix.load(FloatBuffer.wrap(matrixFloatArray));
|
||||
#else
|
||||
projectionMatrix.set(matrixFloatArray);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (renderType.equals(RenderType.translucent()))
|
||||
{
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.seibel.distanthorizons.neoforge.mixins.client;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.EUpdateBranch;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiUpdateBranch;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.updater.UpdateModScreen;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
@@ -76,7 +76,7 @@ public class MixinMinecraft
|
||||
Minecraft.getInstance().setScreen(new UpdateModScreen(
|
||||
// TODO: Change to runnable, instead of tittle screen
|
||||
new TitleScreen(false), // We don't want to use the vanilla title screen as it would fade the buttons
|
||||
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
||||
(Config.Client.Advanced.AutoUpdater.updateBranch.get() == EDhApiUpdateBranch.STABLE ? ModrinthGetter.getLatestIDForVersion(SingletonInjector.INSTANCE.get(IVersionConstants.class).getMinecraftVersion()) : GitlabGetter.INSTANCE.projectPipelines.get(0).get("sha"))
|
||||
));
|
||||
};
|
||||
}
|
||||
|
||||
+5
-12
@@ -10,9 +10,13 @@ pluginManagement {
|
||||
url "https://maven.minecraftforge.net/"
|
||||
}
|
||||
maven {
|
||||
name "NeoForge"
|
||||
name "NeoForge Releases"
|
||||
url "https://maven.neoforged.net/releases/"
|
||||
}
|
||||
maven {
|
||||
name "NeoForge Snapshot"
|
||||
url "https://maven.neoforged.net/snapshots/"
|
||||
}
|
||||
maven {
|
||||
name "Architectury (Better Forge because regular Forge is annoying)" // TODO: Once we switch to NeoForge, would it's gradle work better? or will it have Forge's problems in it
|
||||
url "https://maven.architectury.dev/"
|
||||
@@ -29,12 +33,6 @@ pluginManagement {
|
||||
name "ParchmentMC"
|
||||
url "https://maven.parchmentmc.org"
|
||||
}
|
||||
maven {
|
||||
url = "https://maven.wagyourtail.xyz/releases"
|
||||
}
|
||||
maven {
|
||||
url = "https://maven.wagyourtail.xyz/snapshots"
|
||||
}
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
|
||||
@@ -43,11 +41,6 @@ pluginManagement {
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
// handles JVM and toolchain downloading
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Throw an error and a little help message if the user forgot to clone the core sub-project
|
||||
|
||||
@@ -21,7 +21,7 @@ fabric_api_version=0.42.0+1.16
|
||||
immersive_portals_version=
|
||||
canvas_version=
|
||||
|
||||
fabric_incompatibility_list={ }
|
||||
fabric_incompatibility_list={ "iris": "*" }
|
||||
fabric_recommend_list={ "indium": "*" }
|
||||
|
||||
# Fabric mod run
|
||||
|
||||
@@ -21,7 +21,7 @@ fabric_api_version=0.46.1+1.17
|
||||
immersive_portals_version=
|
||||
canvas_version=
|
||||
|
||||
fabric_incompatibility_list={ }
|
||||
fabric_incompatibility_list={ "iris": "*" }
|
||||
fabric_recommend_list={ "indium": "*" }
|
||||
|
||||
# Fabric mod run
|
||||
|
||||
@@ -22,7 +22,7 @@ fabric_api_version=0.76.0+1.18.2
|
||||
immersive_portals_version=v1.4.11-1.18
|
||||
canvas_version=mc118:1.0.2616
|
||||
|
||||
fabric_incompatibility_list={ }
|
||||
fabric_incompatibility_list={ "iris": "*" }
|
||||
fabric_recommend_list={ "indium": "*" }
|
||||
|
||||
# Fabric mod run
|
||||
|
||||
@@ -21,7 +21,7 @@ fabric_api_version=0.76.1+1.19.2
|
||||
immersive_portals_version=
|
||||
canvas_version=mc119-1.0.2480
|
||||
|
||||
fabric_incompatibility_list={ }
|
||||
fabric_incompatibility_list={ "iris": "*" }
|
||||
fabric_recommend_list={ "indium": "*" }
|
||||
|
||||
# Fabric mod run
|
||||
|
||||
@@ -20,7 +20,7 @@ fabric_api_version=0.87.1+1.19.4
|
||||
immersive_portals_version=
|
||||
canvas_version=
|
||||
|
||||
fabric_incompatibility_list={ }
|
||||
fabric_incompatibility_list={ "iris": "*" }
|
||||
fabric_recommend_list={ "indium": "*" }
|
||||
|
||||
# Fabric mod run
|
||||
|
||||
@@ -20,7 +20,7 @@ fabric_api_version=0.90.4+1.20.1
|
||||
immersive_portals_version=
|
||||
canvas_version=
|
||||
|
||||
fabric_incompatibility_list={ }
|
||||
fabric_incompatibility_list={ "iris": "<=1.6.20" }
|
||||
fabric_recommend_list={ "indium": "*" }
|
||||
|
||||
# Fabric mod run
|
||||
|
||||
@@ -20,7 +20,7 @@ fabric_api_version=0.90.4+1.20.2
|
||||
immersive_portals_version=
|
||||
canvas_version=
|
||||
|
||||
fabric_incompatibility_list={ }
|
||||
fabric_incompatibility_list={ "iris": "<=1.6.20" }
|
||||
fabric_recommend_list={ "indium": "*" }
|
||||
|
||||
# Fabric mod run
|
||||
|
||||
@@ -4,7 +4,8 @@ minecraft_version=1.20.4
|
||||
parchment_version=1.20.2:2023.12.10
|
||||
compatible_minecraft_versions=["1.20.3", "1.20.4"]
|
||||
accessWidenerVersion=1_20_2
|
||||
builds_for=fabric,neoforge,forge
|
||||
builds_for=fabric,forge
|
||||
# neoforge can be added once the issue with mixins has been resolved
|
||||
|
||||
# Fabric loader
|
||||
fabric_loader_version=0.15.1
|
||||
@@ -20,7 +21,7 @@ fabric_api_version=0.91.2+1.20.4
|
||||
immersive_portals_version=
|
||||
canvas_version=
|
||||
|
||||
fabric_incompatibility_list={ }
|
||||
fabric_incompatibility_list={ "iris": "<=1.6.20" }
|
||||
fabric_recommend_list={ "indium": "*" }
|
||||
|
||||
# Fabric mod run
|
||||
@@ -38,7 +39,7 @@ fabric_api_version=0.91.2+1.20.4
|
||||
|
||||
# (Neo)Forge loader
|
||||
forge_version=49.0.30
|
||||
neoforge_version=118-beta
|
||||
neoforge_version=20.4.233
|
||||
# (Neo)Forge mod versions
|
||||
starlight_version_forge=
|
||||
terraforged_version=
|
||||
|
||||
Reference in New Issue
Block a user