Compare commits
294 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 75b18f8bd8 | |||
| 60da404900 | |||
| b75eebd0dc | |||
| 72cbd1167a | |||
| e4e51ebf5b | |||
| dd2096bf1b | |||
| 393a94a7a1 | |||
| ef0023ef39 | |||
| f0994fff75 | |||
| 31f41540c0 | |||
| 81fe13b9c0 | |||
| 332df13b29 | |||
| b3af6df0c5 | |||
| 9392e618c0 | |||
| fd361a39a1 | |||
| f41de59f39 | |||
| c701cf987b | |||
| f05e878600 | |||
| dc028db5ed | |||
| c59d7a7d27 | |||
| a3dd346a02 | |||
| dba8061f71 | |||
| 3da2d961fc | |||
| aa83dc7465 | |||
| 392821c081 | |||
| 7e5fc979cc | |||
| 7ebb555b94 | |||
| 3612a2f9e0 | |||
| 42b67825f8 | |||
| 30a636c840 | |||
| e5722c19a9 | |||
| 6b6a9ab0a9 | |||
| 6da74c6f4e | |||
| 0bafa37f66 | |||
| 6ba6b11f6b | |||
| 739653f37a | |||
| 213d70f2d1 | |||
| dda3c7636b | |||
| 3956578043 | |||
| d11f067392 | |||
| 9f9fe6a231 | |||
| 486a30cb93 | |||
| 01545dc295 | |||
| 165a3799f3 | |||
| 308f809d5d | |||
| 003dbdff02 | |||
| 99f8dbb042 | |||
| 4263ea9733 | |||
| c09b07a21b | |||
| 4e0160648b | |||
| ad367f681d | |||
| a5a70cd65b | |||
| 4ff37cfdad | |||
| 9a1abdefa1 | |||
| 37cc7e7b37 | |||
| 04cbb1e92c | |||
| 5033175808 | |||
| 689928708c | |||
| 98327e6fdf | |||
| 5aef0977c0 | |||
| e6738f1c80 | |||
| b55c1b8f56 | |||
| 3764a4cc9e | |||
| d6bbb9d8dc | |||
| a38e7a00e4 | |||
| 2ec84ae3cf | |||
| f03035e3f9 | |||
| 1d914b8f8a | |||
| ee947b36a2 | |||
| ba393f61e5 | |||
| 796c8e7bef | |||
| fe60de314d | |||
| d237db3302 | |||
| f665b452b0 | |||
| 17750691d6 | |||
| 89ba5b9d15 | |||
| cea44a3f8a | |||
| a99c9aff76 | |||
| 1827ab646c | |||
| db00f7ebec | |||
| 0b93c7b5dc | |||
| 97204f3a3c | |||
| 02a6db0a62 | |||
| 577af4d854 | |||
| 68155142c3 | |||
| 43897e1298 | |||
| bf2c520966 | |||
| ee1528f694 | |||
| 8bd7556c89 | |||
| facbb174f5 | |||
| 9d3ce5307c | |||
| 54f3e9e12d | |||
| e294fc79eb | |||
| a750aaf90a | |||
| be8e09eb9b | |||
| 016d26a6f7 | |||
| 539698c456 | |||
| bcc11b8f0c | |||
| c2a960162e | |||
| c42a3a5fb3 | |||
| 59d6289177 | |||
| 4f028d118d | |||
| b555e35016 | |||
| 26b4c3a2d9 | |||
| 2a5199f851 | |||
| 408dbc2169 | |||
| c9ffcfb1e8 | |||
| 3bd1eedcb8 | |||
| 8500ec7a00 | |||
| 223570a0b7 | |||
| de8c063731 | |||
| 0cffa30286 | |||
| 1d3a282c60 | |||
| 9b6cd955b5 | |||
| 8e1559ac61 | |||
| ce597576ba | |||
| d53a7a5fc4 | |||
| 35bb5cdc92 | |||
| 26e9cc21fd | |||
| 71fd448b7f | |||
| 93e18230f0 | |||
| d305741be2 | |||
| 5830c8d87a | |||
| 5161439536 | |||
| deb6ada6cc | |||
| e72a0546be | |||
| e27b43f03a | |||
| daf4f06a30 | |||
| e5ef93a26d | |||
| b158dff2c6 | |||
| 23bbbce749 | |||
| 898be82aab | |||
| dc9ed37de2 | |||
| b390e54801 | |||
| 9736d2169e | |||
| b507f459b3 | |||
| 51a7053d7e | |||
| 3ba40dd910 | |||
| 248f8e5e70 | |||
| 49b0911aaf | |||
| e4b40c9383 | |||
| 328ac93178 | |||
| d91f86aed5 | |||
| 8119cc06ad | |||
| 94c9d0e276 | |||
| e262dfa14a | |||
| 5e0b63347e | |||
| b7df3bad22 | |||
| 6a56c0c96f | |||
| fd8a94d77c | |||
| 7d38fac16d | |||
| 235ffb03a5 | |||
| fa2702209c | |||
| f9f9f98750 | |||
| 0c46947f4d | |||
| b5b57dfaba | |||
| 39e7812f8b | |||
| 025e8b3f9b | |||
| 35e3a4262b | |||
| 562c8154ff | |||
| e23244181a | |||
| 6aa6c32299 | |||
| fbdabf52e7 | |||
| f4c1f1bcd7 | |||
| 965c19d426 | |||
| 239a876fcf | |||
| d53165881f | |||
| 40733ea1fc | |||
| 66a16ee508 | |||
| b1a9a8ac8d | |||
| 06a2f9f336 | |||
| 978bc58c11 | |||
| a5577e80f1 | |||
| 9daf5a013c | |||
| 72e2cb8a64 | |||
| db819698af | |||
| 09e427ab97 | |||
| a6b3a7ea5a | |||
| 4d08339f79 | |||
| 2ba32a8c94 | |||
| ebedd5e181 | |||
| 357c355e26 | |||
| faca159721 | |||
| 3556528932 | |||
| 8513e46fdc | |||
| 323eced2a4 | |||
| 6a87539ca3 | |||
| fe725b6795 | |||
| 02862a770f | |||
| a7759ab8e9 | |||
| da1b2051dd | |||
| 4fdc596474 | |||
| d0c710b7e1 | |||
| 41ee9dcd99 | |||
| 506ce87f5f | |||
| 08e42ebfe5 | |||
| 699d27afd2 | |||
| 4a64ce0bed | |||
| b3b94d29b5 | |||
| 3a30516088 | |||
| 6f469737f3 | |||
| 183720d1e5 | |||
| b2dcc66bd0 | |||
| 5c67be30de | |||
| 4ad4e2c29c | |||
| d1f805d178 | |||
| 73071119fa | |||
| 97c52834f5 | |||
| 3e472e454a | |||
| 7ddab31337 | |||
| fd5b9be523 | |||
| f9dd870067 | |||
| 4908acd7ac | |||
| 87486f6825 | |||
| c721c14e27 | |||
| 3521af9792 | |||
| ff94dba348 | |||
| 31d0a45555 | |||
| 41c1473e04 | |||
| d5f12466b2 | |||
| bdd9ef6b40 | |||
| 9b6895ec68 | |||
| a3854561fc | |||
| a66df74ec9 | |||
| eb4b31e876 | |||
| 6015b9a1dc | |||
| 146d42bbe9 | |||
| 16b14bc424 | |||
| a37e4ca232 | |||
| 8103c16064 | |||
| 6ae41b0caa | |||
| ba81f31027 | |||
| 71c72e26e7 | |||
| 97828f465d | |||
| ec37803572 | |||
| b7a54eff7a | |||
| 9604ce297c | |||
| 5ad961d80e | |||
| 843ec2fef8 | |||
| 1b3e90b669 | |||
| 55aadb73f1 | |||
| e3d87c70c4 | |||
| 8b1205f79e | |||
| 291f5d247c | |||
| ad63825194 | |||
| b0e0cd107d | |||
| 5f60cd8d4d | |||
| d0e17ccab7 | |||
| 38a4643cf3 | |||
| 938adca022 | |||
| e2ec80134e | |||
| 903f166041 | |||
| a9bdbfda4e | |||
| 378349b870 | |||
| 190ce716ff | |||
| d2c3a87fa8 | |||
| 2d5acbbf45 | |||
| 4e973099f9 | |||
| ee4f43cc59 | |||
| 3e64b7400e | |||
| c44daa759c | |||
| 17c662b10f | |||
| 3cfbb69dd9 | |||
| 470668265b | |||
| b6ced30d70 | |||
| d3e0f1e14d | |||
| 910350ba3a | |||
| 8dcf30e776 | |||
| 30d4bcd6a1 | |||
| 66300cbe70 | |||
| 50ae719f24 | |||
| dccad778fb | |||
| f163e31cd2 | |||
| 5499079ada | |||
| 8d1277db1b | |||
| 34fcac25c2 | |||
| cb0516cae8 | |||
| 4fdad05252 | |||
| dc785b4fe1 | |||
| 8df7e1762a | |||
| 43d9b41648 | |||
| 880559f94a | |||
| 6f04ddce87 | |||
| 6eb065f7c9 | |||
| 17ebad9141 | |||
| 9bcc799b0b | |||
| f247410ae4 | |||
| 2f3bb2ec34 | |||
| 5c47170ef4 | |||
| 29d152b312 | |||
| aa48f0f5c6 | |||
| 05ea683fcf | |||
| 65163a2477 | |||
| 9dc4c46b99 |
+1
-1
@@ -50,4 +50,4 @@ classes/
|
||||
Merged/
|
||||
|
||||
# file from notepad++
|
||||
*.bak
|
||||
*.bak
|
||||
+10
-10
@@ -3,9 +3,9 @@ image: gradle:eclipse-temurin
|
||||
|
||||
# all stages need to be defined here
|
||||
stages:
|
||||
- gradleSetup
|
||||
- build
|
||||
- merge
|
||||
- gradleSetup
|
||||
- build
|
||||
- merge
|
||||
|
||||
variables:
|
||||
# Disable the Gradle daemon for Continuous Integration servers as correctness
|
||||
@@ -34,11 +34,11 @@ gradleSetup:
|
||||
image: eclipse-temurin:17
|
||||
cache:
|
||||
key:
|
||||
files:
|
||||
- gradle/wrapper/gradle-wrapper.properties
|
||||
files:
|
||||
- gradle/wrapper/gradle-wrapper.properties
|
||||
policy: push
|
||||
paths:
|
||||
- cache/
|
||||
- cache/
|
||||
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ build:
|
||||
- .gradle
|
||||
- cache/
|
||||
artifacts:
|
||||
name: "NightlyBuild-$CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||
name: "NightlyBuild-$CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||
paths:
|
||||
# relative to the root directory
|
||||
- fabric/build/libs
|
||||
@@ -89,7 +89,7 @@ build:
|
||||
# third stage
|
||||
merge:
|
||||
stage: merge
|
||||
script: ./gradlew merge --gradle-user-home cache/
|
||||
script: ./gradlew merge --gradle-user-home cache/
|
||||
# build using Java 17
|
||||
image: eclipse-temurin:17
|
||||
cache:
|
||||
@@ -100,7 +100,7 @@ merge:
|
||||
- .gradle
|
||||
- cache/
|
||||
artifacts:
|
||||
name: "Merged_NightlyBuild-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||
name: "Merged_NightlyBuild-${CI_COMMIT_SHORT_SHA}-${CI_COMMIT_TIMESTAMP}"
|
||||
paths:
|
||||
# relative to the root directory
|
||||
- Merged
|
||||
@@ -129,4 +129,4 @@ merge:
|
||||
# - name: 'Fabric Jars'
|
||||
# url: 'https://gitlab.com/jeseibel/minecraft-lod-mod/cw/-/jobs/${GE_JOB_ID}/artifacts/file/fabric/build/libs'
|
||||
# - name: 'Forge Jars'
|
||||
# url: 'https://gitlab.com/jeseibel/minecraft-lod-mod/cw/-/jobs/${GE_JOB_ID}/artifacts/file/forge/build/libs'
|
||||
# url: 'https://gitlab.com/jeseibel/minecraft-lod-mod/cw/-/jobs/${GE_JOB_ID}/artifacts/file/forge/build/libs'
|
||||
|
||||
@@ -10,38 +10,39 @@ If you want to see a quick demo, check out a video covering the mod here:
|
||||
<a href="https://www.youtube.com/watch?v=H2tnvEVbO1c" target="_blank"></a>
|
||||
|
||||
Architectury version: 3.4-SNAPSHOT\
|
||||
Forge version: 36.1.0\
|
||||
Fabric version: 0.12.3\
|
||||
Fabric API version: 0.34.2+1.16
|
||||
Forge version: 39.0.5 and 38.0.14\
|
||||
Fabric version: 0.12.12\
|
||||
Fabric API version: 0.44.0+1.18
|
||||
|
||||
Modmenu version: 1.16.22\
|
||||
Sodium version: mc1.16.5-0.2.0
|
||||
Modmenu version: 3.0.0\
|
||||
Sodium version: mc1.18-0.4.0-alpha5
|
||||
|
||||
Notes:\
|
||||
This version has been confirmed to work in Eclipse and Retail Minecraft.\
|
||||
(Retail running forge version 1.16.5-36.1.0 and fabric version 1.16.5-0.12.3)
|
||||
(Retail running forge version 1.18.1-39.0.5 and fabric version 1.18-0.12.12 and 1.18.1-0.12.12)
|
||||
|
||||
|
||||
## source code installation
|
||||
|
||||
See the Forge Documentation online for more detailed instructions:\
|
||||
http://mcforge.readthedocs.io/en/latest/gettingstarted/
|
||||
See the Fabric Documentation online for more detailed instructions:\
|
||||
https://fabricmc.net/wiki/tutorial:setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* A Java Development Kit (JDK) for Java 16 (recommended) or newer. Visit https://www.oracle.com/java/technologies/downloads/ for installers.
|
||||
* A Java Development Kit (JDK) for Java 17 (recommended) or newer. Visit https://www.oracle.com/java/technologies/downloads/ for installers.
|
||||
* Git or someway to clone git projects. Visit https://git-scm.com/ for installers.
|
||||
* (Not required) Any Java IDE, for example Intellij IDEA and Eclipse. You may also use any other code editors, such as Visual Studio Code. (Optional)
|
||||
It's better to use IntelliJ IDEA since Eclipse is not supported by Architectury, but it still works.
|
||||
It's better to use IntelliJ IDEA since Eclipse is not supported by Architectury, but it still works.
|
||||
|
||||
**If using IntelliJ:**
|
||||
1. open IDEA and import the build.gradle
|
||||
2. refresh the Gradle project in IDEA if required
|
||||
|
||||
**If using Ecplise:**
|
||||
Not supported...
|
||||
|
||||
Side note: invalidate caches and restart if required
|
||||
1. run the command: `./gradlew geneclipseruns`
|
||||
2. run the command: `./gradlew eclipse`
|
||||
3. Make sure eclipse has the JDK 17 installed. (This is needed so that eclipse can run minecraft)
|
||||
4. Import the project into eclipse
|
||||
|
||||
## Compiling
|
||||
|
||||
@@ -51,7 +52,7 @@ Side note: invalidate caches and restart if required
|
||||
3. The compiled jar file will be in the folder `fabric/build/libs/` and `forge/build/libs/`
|
||||
|
||||
**If in terminal:**
|
||||
1. `git clone -b 1.16.5_architectury --recurse-submodules https://gitlab.com/jeseibel/minecraft-lod-mod.git`
|
||||
1. `git clone -b 1.18.X --recurse-submodules https://gitlab.com/jeseibel/minecraft-lod-mod.git`
|
||||
2. `cd minecraft-lod-mod`
|
||||
3. `./gradlew assemble` or `./gradlew build`
|
||||
4. The build should be in `fabric/build/libs/` and `forge/build/libs/`
|
||||
@@ -75,8 +76,7 @@ Source code uses Mojang mappings.
|
||||
Build only Fabric: `./gradlew fabric:assemble` or `./gradlew fabric:build`\
|
||||
Build only Forge: `./gradlew fabric:assemble` or `./gradlew forge:build`\
|
||||
Run the Fabric client (for debugging): `./gradlew fabric:runClient`\
|
||||
Run the Forge client (**THIS DOST WORK** due to a bug with architectury): `./gradlew forge:runClient`\
|
||||
To use a custom version of Java use `-D` then the path for Java
|
||||
Run the Forge client (for debugging): `./gradlew forge:runClient`
|
||||
|
||||
## Open Source Acknowledgements
|
||||
|
||||
@@ -84,4 +84,4 @@ XZ for Java (data compression)\
|
||||
https://tukaani.org/xz/java.html
|
||||
|
||||
DHJarMerger (To merge multiple mod versions into one jar)\
|
||||
https://github.com/Ran-helo/DHJarMerger
|
||||
https://github.com/Ran-helo/DHJarMerger
|
||||
+44
-9
@@ -52,7 +52,7 @@ subprojects { p ->
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
allprojects { p ->
|
||||
apply plugin: "java"
|
||||
apply plugin: "architectury-plugin"
|
||||
apply plugin: "maven-publish"
|
||||
@@ -98,19 +98,54 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
|
||||
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
|
||||
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
|
||||
// We'll use that if it's available, but otherwise we'll use the older option.
|
||||
def targetVersion = 8
|
||||
if (JavaVersion.current().isJava9Compatible()) {
|
||||
options.release = targetVersion
|
||||
// Put stuff from gradle.properties into the mod info
|
||||
processResources {
|
||||
def resourceTargets = ["fabric.mod.json", "META-INF/mods.toml"] // Location of where to put
|
||||
def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder
|
||||
def replaceProperties = [
|
||||
version: mod_version,
|
||||
mod_name: mod_name,
|
||||
authors: mod_authors,
|
||||
description: mod_description,
|
||||
homepage: mod_homepage,
|
||||
source: mod_source,
|
||||
issues: mod_issues
|
||||
] // The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties
|
||||
|
||||
inputs.properties replaceProperties
|
||||
replaceProperties.put 'project', project
|
||||
filesMatching(resourceTargets) {
|
||||
expand replaceProperties
|
||||
}
|
||||
|
||||
intoTargets.each { target ->
|
||||
if (file(target).exists()) {
|
||||
copy {
|
||||
from(sourceSets.main.resources) {
|
||||
include resourceTargets
|
||||
expand replaceProperties
|
||||
}
|
||||
into target
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
if (p != project(":core")) {
|
||||
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
|
||||
options.release = 17
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
if (p == project(":core") || p == project(":common")) {
|
||||
runClient.enabled = false
|
||||
runServer.enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ import com.seibel.lod.common.forge.LodForgeMethodCaller;
|
||||
import com.seibel.lod.common.networking.NetworkInterface;
|
||||
import com.seibel.lod.common.wrappers.DependencySetup;
|
||||
import com.seibel.lod.common.wrappers.config.ConfigGui;
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
import com.seibel.lod.core.Config;
|
||||
import com.seibel.lod.core.config.ConfigBase;
|
||||
|
||||
/**
|
||||
* This is the common main class
|
||||
@@ -16,6 +17,8 @@ public class LodCommonMain {
|
||||
public static LodForgeMethodCaller forgeMethodCaller;
|
||||
public static NetworkInterface networkInterface;
|
||||
|
||||
public static final boolean IsNewConfig = false;
|
||||
|
||||
public static void startup(LodForgeMethodCaller caller, boolean serverSided) {
|
||||
LodCommonMain.serverSided = serverSided;
|
||||
if (caller != null) {
|
||||
@@ -26,8 +29,10 @@ public class LodCommonMain {
|
||||
DependencySetup.createInitialBindings();
|
||||
}
|
||||
|
||||
|
||||
public static void initConfig() {
|
||||
ConfigGui.init(Config.class);
|
||||
if (!IsNewConfig)
|
||||
ConfigGui.init(OldConfig.class);
|
||||
}
|
||||
|
||||
public static void registerNetworking(NetworkInterface networkInterface) {
|
||||
|
||||
+8
-8
@@ -27,14 +27,13 @@ import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IAdvanced.*;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IGraphics.*;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IWorldGenerator;
|
||||
import net.minecraft.client.renderer.DimensionSpecialEffects;
|
||||
|
||||
/**
|
||||
* This handles any configuration the user has access to.
|
||||
* @author coolGi2007
|
||||
* @version 12-12-2021
|
||||
*/
|
||||
public class Config extends ConfigGui
|
||||
public class OldConfig
|
||||
//public class Config extends TinyConfig
|
||||
{
|
||||
// CONFIG STRUCTURE
|
||||
@@ -146,7 +145,7 @@ public class Config extends ConfigGui
|
||||
public static boolean disableVanillaFog = IFogQuality.DISABLE_VANILLA_FOG_DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class AdvancedGraphics
|
||||
{
|
||||
@ConfigAnnotations.FileComment
|
||||
@@ -181,16 +180,16 @@ public class Config extends ConfigGui
|
||||
@ConfigAnnotations.Entry
|
||||
public static boolean enableDistantGeneration = IWorldGenerator.ENABLE_DISTANT_GENERATION_DEFAULT;
|
||||
|
||||
// @ConfigAnnotations.FileComment
|
||||
// @ConfigAnnotations.FileComment
|
||||
// public static String _distanceGenerationMode = IWorldGenerator.getDistanceGenerationModeDesc();
|
||||
@ConfigAnnotations.Entry
|
||||
public static DistanceGenerationMode distanceGenerationMode = IWorldGenerator.DISTANCE_GENERATION_MODE_DEFAULT;
|
||||
|
||||
|
||||
@ConfigAnnotations.FileComment
|
||||
public static String _lightGenerationMode = IWorldGenerator.LIGHT_GENERATION_MODE_DESC;
|
||||
@ConfigAnnotations.Entry
|
||||
public static LightGenerationMode lightGenerationMode = IWorldGenerator.LIGHT_GENERATION_MODE_DEFAULT;
|
||||
|
||||
|
||||
@ConfigAnnotations.FileComment
|
||||
public static String _generationPriority = IWorldGenerator.GENERATION_PRIORITY_DESC;
|
||||
@ConfigAnnotations.Entry
|
||||
@@ -199,10 +198,11 @@ public class Config extends ConfigGui
|
||||
/*
|
||||
@ConfigAnnotations.FileComment
|
||||
public static String _allowUnstableFeatureGeneration = IWorldGenerator.ALLOW_UNSTABLE_FEATURE_GENERATION_DESC;
|
||||
// FIXME: Temperary override. In 1.18, the newer Unstable gnerator is more usable
|
||||
@ConfigAnnotations.Entry
|
||||
public static boolean allowUnstableFeatureGeneration = IWorldGenerator.ALLOW_UNSTABLE_FEATURE_GENERATION_DEFAULT;
|
||||
public static boolean allowUnstableFeatureGeneration = true;//IWorldGenerator.ALLOW_UNSTABLE_FEATURE_GENERATION_DEFAULT;
|
||||
*/
|
||||
|
||||
|
||||
@ConfigAnnotations.FileComment
|
||||
public static String _blocksToAvoid = IWorldGenerator.BLOCKS_TO_AVOID_DESC;
|
||||
@ConfigAnnotations.Entry
|
||||
@@ -1,11 +1,8 @@
|
||||
package com.seibel.lod.common.networking;
|
||||
|
||||
import com.seibel.lod.common.LodCommonMain;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* This class holds most of the networking code for the mod.
|
||||
* @author Ran
|
||||
|
||||
@@ -30,8 +30,10 @@ public class DependencySetup {
|
||||
SingletonHandler.bind(IMinecraftWrapper.class, MinecraftWrapper.INSTANCE);
|
||||
SingletonHandler.bind(IMinecraftRenderWrapper.class, MinecraftRenderWrapper.INSTANCE);
|
||||
SingletonHandler.bind(IReflectionHandler.class, ReflectionHandler.createSingleton(MinecraftWrapper.INSTANCE.getOptions().getClass().getDeclaredFields(), MinecraftWrapper.INSTANCE.getOptions()));
|
||||
SingletonHandler.bind(IVersionConstants.class, VersionConstants.INSTANCE);
|
||||
}
|
||||
SingletonHandler.bind(IVersionConstants.class, VersionConstants.INSTANCE);
|
||||
|
||||
SingletonHandler.bind(IWrapperFactory.class, WrapperFactory.INSTANCE);
|
||||
DependencySetupDoneCheck.isDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.seibel.lod.common.wrappers;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class DependencySetupDoneCheck
|
||||
{
|
||||
public static boolean isDone = false;
|
||||
public static Supplier<Boolean> getIsCurrentThreadDistantGeneratorThread = (() -> {return false;});
|
||||
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
package com.seibel.lod.common.wrappers;
|
||||
|
||||
import com.seibel.lod.core.enums.config.DistanceGenerationMode;
|
||||
@@ -7,49 +8,54 @@ import com.seibel.lod.core.wrapperInterfaces.IVersionConstants;
|
||||
* @author James Seibel
|
||||
* @version 12-11-2021
|
||||
*/
|
||||
public class VersionConstants implements IVersionConstants {
|
||||
public static final VersionConstants INSTANCE = new VersionConstants();
|
||||
|
||||
|
||||
private VersionConstants() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getMinimumWorldHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWorldGeneratorSingleThreaded(DistanceGenerationMode distanceGenerationMode) {
|
||||
// We are always asking the server to generate the chunk,
|
||||
// so no use running this stuff multithreaded.
|
||||
return true;
|
||||
/*
|
||||
switch (distanceGenerationMode) {
|
||||
default:
|
||||
case NONE:
|
||||
case BIOME_ONLY:
|
||||
case BIOME_ONLY_SIMULATE_HEIGHT:
|
||||
case SURFACE:
|
||||
case FEATURES:
|
||||
return false;
|
||||
|
||||
case FULL:
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWorldGenerationCountPerThread() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
public class VersionConstants implements IVersionConstants
|
||||
{
|
||||
public static final VersionConstants INSTANCE = new VersionConstants();
|
||||
|
||||
|
||||
private VersionConstants()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasBatchGenerationImplementation() {
|
||||
public int getMinimumWorldHeight()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWorldGeneratorSingleThreaded(DistanceGenerationMode distanceGenerationMode)
|
||||
{
|
||||
// We are always asking the server to generate the chunk,
|
||||
// so no use running this stuff multithreaded.
|
||||
return true;
|
||||
/*
|
||||
switch (distanceGenerationMode) {
|
||||
default:
|
||||
case NONE:
|
||||
case BIOME_ONLY:
|
||||
case BIOME_ONLY_SIMULATE_HEIGHT:
|
||||
case SURFACE:
|
||||
case FEATURES:
|
||||
return false;
|
||||
|
||||
case FULL:
|
||||
return true;
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWorldGenerationCountPerThread()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasBatchGenerationImplementation()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -38,53 +38,67 @@ import com.seibel.lod.common.wrappers.worldGeneration.WorldGeneratorWrapper;
|
||||
* @author James Seibel
|
||||
* @version 11-20-2021
|
||||
*/
|
||||
public class WrapperFactory implements IWrapperFactory {
|
||||
public static final WrapperFactory INSTANCE = new WrapperFactory();
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractBlockPosWrapper createBlockPos() {
|
||||
return new BlockPosWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractBlockPosWrapper createBlockPos(int x, int y, int z) {
|
||||
return new BlockPosWrapper(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractChunkPosWrapper createChunkPos() {
|
||||
return new ChunkPosWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractChunkPosWrapper createChunkPos(long xAndZPositionCombined) {
|
||||
return new ChunkPosWrapper(xAndZPositionCombined);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractChunkPosWrapper createChunkPos(int x, int z) {
|
||||
return new ChunkPosWrapper(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractChunkPosWrapper createChunkPos(AbstractChunkPosWrapper newChunkPos) {
|
||||
return new ChunkPosWrapper(newChunkPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractChunkPosWrapper createChunkPos(AbstractBlockPosWrapper blockPos) {
|
||||
return new ChunkPosWrapper(blockPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractWorldGeneratorWrapper createWorldGenerator(LodBuilder newLodBuilder, LodDimension newLodDimension, IWorldWrapper worldWrapper) {
|
||||
return new WorldGeneratorWrapper(newLodBuilder, newLodDimension, worldWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractBatchGenerationEnvionmentWrapper createBatchGenerator(LodBuilder newLodBuilder, LodDimension newLodDimension, IWorldWrapper worldWrapper) {
|
||||
public class WrapperFactory implements IWrapperFactory
|
||||
{
|
||||
public static final WrapperFactory INSTANCE = new WrapperFactory();
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractBlockPosWrapper createBlockPos()
|
||||
{
|
||||
return new BlockPosWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractBlockPosWrapper createBlockPos(int x, int y, int z)
|
||||
{
|
||||
return new BlockPosWrapper(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractChunkPosWrapper createChunkPos()
|
||||
{
|
||||
return new ChunkPosWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractChunkPosWrapper createChunkPos(long xAndZPositionCombined)
|
||||
{
|
||||
return new ChunkPosWrapper(xAndZPositionCombined);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractChunkPosWrapper createChunkPos(int x, int z)
|
||||
{
|
||||
return new ChunkPosWrapper(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractChunkPosWrapper createChunkPos(AbstractChunkPosWrapper newChunkPos)
|
||||
{
|
||||
return new ChunkPosWrapper(newChunkPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractChunkPosWrapper createChunkPos(AbstractBlockPosWrapper blockPos)
|
||||
{
|
||||
return new ChunkPosWrapper(blockPos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractWorldGeneratorWrapper createWorldGenerator(LodBuilder newLodBuilder, LodDimension newLodDimension, IWorldWrapper worldWrapper)
|
||||
{
|
||||
return new WorldGeneratorWrapper(newLodBuilder, newLodDimension, worldWrapper);
|
||||
}
|
||||
|
||||
public AbstractBatchGenerationEnvionmentWrapper createBatchGenerator(LodBuilder newLodBuilder,
|
||||
LodDimension newLodDimension, IWorldWrapper worldWrapper)
|
||||
{
|
||||
return new BatchGenerationEnvironment(worldWrapper, newLodBuilder, newLodDimension);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.seibel.lod.common.LodCommonMain;
|
||||
import com.seibel.lod.common.wrappers.minecraft.MinecraftWrapper;
|
||||
import com.seibel.lod.core.util.ColorUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
|
||||
@@ -81,16 +80,15 @@ public class BlockColorWrapper implements IBlockColorWrapper
|
||||
public static IBlockColorWrapper getBlockColorWrapper(Block block)
|
||||
{
|
||||
//first we check if the block has already been wrapped
|
||||
if (blockColorWrapperMap.containsKey(block) && blockColorWrapperMap.get(block) != null)
|
||||
return blockColorWrapperMap.get(block);
|
||||
|
||||
BlockColorWrapper colorWrapper = blockColorWrapperMap.get(block);
|
||||
if (colorWrapper != null)
|
||||
return colorWrapper;
|
||||
|
||||
//if it hasn't been created yet, we create it and save it in the map
|
||||
BlockColorWrapper blockWrapper = new BlockColorWrapper(block);
|
||||
blockColorWrapperMap.put(block, blockWrapper);
|
||||
|
||||
colorWrapper = new BlockColorWrapper(block);
|
||||
BlockColorWrapper colorWrapperCAS = blockColorWrapperMap.putIfAbsent(block, colorWrapper);
|
||||
//we return the newly created wrapper
|
||||
return blockWrapper;
|
||||
return colorWrapperCAS==null ? colorWrapper : colorWrapperCAS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,13 +133,12 @@ public class BlockColorWrapper implements IBlockColorWrapper
|
||||
if (!quads.isEmpty())
|
||||
{
|
||||
isColored = true;
|
||||
texture = quads.get(0).sprite;
|
||||
texture = quads.get(0).getSprite();
|
||||
}
|
||||
else
|
||||
{
|
||||
isColored = true;
|
||||
texture = mc.getModelManager().getBlockModelShaper().getParticleIcon(block.defaultBlockState());
|
||||
texture = mc.getModelManager().getBlockModelShaper().getParticleIcon(block.defaultBlockState());
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
@@ -155,12 +152,9 @@ public class BlockColorWrapper implements IBlockColorWrapper
|
||||
|
||||
// generate the block's color
|
||||
// for (int frameIndex = 0; frameIndex < texture.getFrameCount(); frameIndex++)
|
||||
boolean lookForTint = false;
|
||||
if (grassInstance() || leavesInstance() || waterIstance())
|
||||
lookForTint = true;
|
||||
|
||||
// generate the block's color
|
||||
for (int frameIndex = 0; frameIndex < texture.getFrameCount(); frameIndex++)
|
||||
boolean lookForTint = grassInstance() || leavesInstance() || waterIstance();
|
||||
|
||||
int frameIndex = 0; // TODO
|
||||
{
|
||||
// textures normally use u and v instead of x and y
|
||||
for (int u = 0; u < texture.getWidth(); u++)
|
||||
@@ -169,7 +163,7 @@ public class BlockColorWrapper implements IBlockColorWrapper
|
||||
{
|
||||
tempColor = TextureAtlasSpriteWrapper.getPixelRGBA(texture, frameIndex, u, v);
|
||||
|
||||
if (texture.isTransparent(frameIndex, u, v))
|
||||
if (ColorUtil.getAlpha(TextureAtlasSpriteWrapper.getPixelRGBA(texture, frameIndex, u, v)) == 0)
|
||||
continue;
|
||||
|
||||
if (lookForTint)
|
||||
@@ -224,7 +218,7 @@ public class BlockColorWrapper implements IBlockColorWrapper
|
||||
this.foliageTint = leavesInstance() && toTint;
|
||||
|
||||
this.waterTint = waterIstance() && toTint;
|
||||
|
||||
|
||||
//hardcoded leaves
|
||||
if (block == Blocks.SPRUCE_LEAVES)
|
||||
color = ColorUtil.multiplyRGBcolors(tempColor, 0xFF619961);
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.minecraft.core.BlockPos;
|
||||
*/
|
||||
public class BlockPosWrapper extends AbstractBlockPosWrapper
|
||||
{
|
||||
private BlockPos.MutableBlockPos blockPos;
|
||||
private final BlockPos.MutableBlockPos blockPos;
|
||||
|
||||
|
||||
public BlockPosWrapper()
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockShapeWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
import com.seibel.lod.common.wrappers.chunk.ChunkWrapper;
|
||||
@@ -59,16 +58,15 @@ public class BlockShapeWrapper implements IBlockShapeWrapper
|
||||
static public BlockShapeWrapper getBlockShapeWrapper(Block block, ChunkWrapper chunkWrapper, int x, int y, int z)
|
||||
{
|
||||
//first we check if the block has already been wrapped
|
||||
if (blockShapeWrapperMap.containsKey(block) && blockShapeWrapperMap.get(block) != null)
|
||||
return blockShapeWrapperMap.get(block);
|
||||
|
||||
BlockShapeWrapper blockWrapper = blockShapeWrapperMap.get(block);
|
||||
if (blockWrapper != null)
|
||||
return blockWrapper;
|
||||
|
||||
//if it hasn't been created yet, we create it and save it in the map
|
||||
BlockShapeWrapper blockWrapper = new BlockShapeWrapper(block, chunkWrapper, x, y, z);
|
||||
blockShapeWrapperMap.put(block, blockWrapper);
|
||||
|
||||
blockWrapper = new BlockShapeWrapper(block, chunkWrapper, x, y, z);
|
||||
BlockShapeWrapper blockWrapperCAS = blockShapeWrapperMap.putIfAbsent(block, blockWrapper);
|
||||
//we return the newly created wrapper
|
||||
return blockWrapper;
|
||||
return blockWrapperCAS==null ? blockWrapper : blockWrapperCAS;
|
||||
}
|
||||
|
||||
private void setupShapes(IChunkWrapper chunkWrapper, int x, int y, int z)
|
||||
@@ -156,4 +154,4 @@ public class BlockShapeWrapper implements IBlockShapeWrapper
|
||||
{
|
||||
return Objects.hash(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -18,7 +18,11 @@ public class TextureAtlasSpriteWrapper {
|
||||
* The code has been modified to use TextureAtlasSprite
|
||||
*/
|
||||
public static int getPixelRGBA(TextureAtlasSprite sprite, int frameIndex, int x, int y) {
|
||||
// Require access widener
|
||||
return sprite.mainImage[0].getPixelRGBA(x + sprite.framesX[frameIndex] * sprite.getWidth(), y + sprite.framesY[frameIndex] * sprite.getHeight());
|
||||
if (sprite.animatedTexture != null) {
|
||||
x += sprite.animatedTexture.getFrameX(frameIndex) * sprite.width;
|
||||
y += sprite.animatedTexture.getFrameY(frameIndex) * sprite.height;
|
||||
}
|
||||
|
||||
return sprite.mainImage[0].getPixelRGBA(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import net.minecraft.world.level.ChunkPos;
|
||||
*/
|
||||
public class ChunkPosWrapper extends AbstractChunkPosWrapper
|
||||
{
|
||||
private net.minecraft.world.level.ChunkPos chunkPos;
|
||||
private final net.minecraft.world.level.ChunkPos chunkPos;
|
||||
|
||||
public ChunkPosWrapper()
|
||||
{
|
||||
@@ -44,12 +44,12 @@ public class ChunkPosWrapper extends AbstractChunkPosWrapper
|
||||
{
|
||||
this.chunkPos = new ChunkPos(chunkX, chunkZ);
|
||||
}
|
||||
|
||||
public ChunkPosWrapper(long l)
|
||||
{
|
||||
this.chunkPos = new ChunkPos(l);
|
||||
|
||||
public ChunkPosWrapper(long l) {
|
||||
this.chunkPos = new ChunkPos(l);
|
||||
}
|
||||
|
||||
|
||||
public ChunkPosWrapper(ChunkPos pos)
|
||||
{
|
||||
this.chunkPos = pos;
|
||||
@@ -85,29 +85,29 @@ public class ChunkPosWrapper extends AbstractChunkPosWrapper
|
||||
@Override
|
||||
public int getRegionX()
|
||||
{
|
||||
return LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, chunkPos.x, LodUtil.REGION_DETAIL_LEVEL);
|
||||
return LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, chunkPos.x, LodUtil.REGION_DETAIL_LEVEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRegionZ()
|
||||
{
|
||||
return LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, chunkPos.z, LodUtil.REGION_DETAIL_LEVEL);
|
||||
return LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, chunkPos.z, LodUtil.REGION_DETAIL_LEVEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLong() {
|
||||
return chunkPos.toLong();
|
||||
}
|
||||
|
||||
public ChunkPos getChunkPos()
|
||||
{
|
||||
return chunkPos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLong() {
|
||||
return chunkPos.toLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
// If the object is compared with itself then return true
|
||||
// If the object is compared with itself then return true
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
@@ -129,9 +129,8 @@ public class ChunkPosWrapper extends AbstractChunkPosWrapper
|
||||
public AbstractBlockPosWrapper getWorldPosition()
|
||||
{
|
||||
// the parameter here is the y position
|
||||
BlockPos blockPos = chunkPos.getWorldPosition();
|
||||
BlockPos blockPos = chunkPos.getMiddleBlockPosition(0);
|
||||
return new BlockPosWrapper(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,14 +12,19 @@ import com.seibel.lod.common.wrappers.block.BlockShapeWrapper;
|
||||
import com.seibel.lod.common.wrappers.world.BiomeWrapper;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.QuartPos;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.level.block.AirBlock;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.LiquidBlock;
|
||||
import net.minecraft.world.level.block.LiquidBlockContainer;
|
||||
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
|
||||
/**
|
||||
@@ -29,24 +34,24 @@ import net.minecraft.world.level.levelgen.Heightmap;
|
||||
*/
|
||||
public class ChunkWrapper implements IChunkWrapper
|
||||
{
|
||||
private ChunkAccess chunk;
|
||||
private BlockAndTintGetter lightSource;
|
||||
private final ChunkAccess chunk;
|
||||
private final BlockAndTintGetter lightSource;
|
||||
|
||||
@Override
|
||||
public int getHeight(){
|
||||
return 255;
|
||||
return chunk.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinBuildHeight()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getMaxBuildHeight()
|
||||
{
|
||||
return chunk.getMaxBuildHeight();
|
||||
}
|
||||
@Override
|
||||
public int getMinBuildHeight()
|
||||
{
|
||||
return chunk.getMinBuildHeight();
|
||||
}
|
||||
@Override
|
||||
public int getMaxBuildHeight()
|
||||
{
|
||||
return chunk.getMaxBuildHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeightMapValue(int xRel, int zRel)
|
||||
@@ -57,8 +62,8 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
@Override
|
||||
public IBiomeWrapper getBiome(int x, int y, int z)
|
||||
{
|
||||
return BiomeWrapper.getBiomeWrapper(chunk.getBiomes().getNoiseBiome(
|
||||
x >> 2, y >> 2, z >> 2));
|
||||
return BiomeWrapper.getBiomeWrapper(chunk.getNoiseBiome(
|
||||
QuartPos.fromBlock(x), QuartPos.fromBlock(y), QuartPos.fromBlock(z)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,7 +88,8 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
this.chunk = chunk;
|
||||
this.lightSource = null;
|
||||
}
|
||||
public ChunkWrapper(ChunkAccess chunk, BlockAndTintGetter lightSource) {
|
||||
public ChunkWrapper(ChunkAccess chunk, BlockAndTintGetter lightSource)
|
||||
{
|
||||
this.chunk = chunk;
|
||||
this.lightSource = lightSource;
|
||||
}
|
||||
@@ -104,12 +110,12 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
|
||||
@Override
|
||||
public int getRegionPosX(){
|
||||
return LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, getChunkPosX(), LodUtil.REGION_DETAIL_LEVEL);
|
||||
return LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, chunk.getPos().x, LodUtil.REGION_DETAIL_LEVEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRegionPosZ(){
|
||||
return LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, getChunkPosZ(), LodUtil.REGION_DETAIL_LEVEL);
|
||||
return LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, chunk.getPos().z, LodUtil.REGION_DETAIL_LEVEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,10 +139,19 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
public int getMinZ() {
|
||||
return chunk.getPos().getMinBlockZ();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLongChunkPos() {
|
||||
return chunk.getPos().toLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLightCorrect(){
|
||||
return true;//chunk.isLightCorrect();
|
||||
//return true;
|
||||
if (chunk instanceof LevelChunk) {
|
||||
return ((LevelChunk) chunk).isClientLightReady();
|
||||
}
|
||||
return chunk.isLightCorrect();
|
||||
}
|
||||
|
||||
public boolean isWaterLogged(int x, int y, int z)
|
||||
@@ -154,20 +169,16 @@ public class ChunkWrapper implements IChunkWrapper
|
||||
return chunk.getLightEmission(new BlockPos(x,y,z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight(int x, int y, int z) {
|
||||
if (lightSource == null) return -1;
|
||||
@Override
|
||||
public int getBlockLight(int x, int y, int z) {
|
||||
if (lightSource == null) return -1;
|
||||
return lightSource.getBrightness(LightLayer.BLOCK, new BlockPos(x,y,z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight(int x, int y, int z) {
|
||||
if (lightSource == null) return -1;
|
||||
return lightSource.getBrightness(LightLayer.SKY, new BlockPos(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLongChunkPos() {
|
||||
return chunk.getPos().toLong();
|
||||
public int getSkyLight(int x, int y, int z) {
|
||||
if (lightSource == null) return -1;
|
||||
return lightSource.getBrightness(LightLayer.SKY, new BlockPos(x,y,z));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+29
-29
@@ -3,7 +3,7 @@ package com.seibel.lod.common.wrappers.config;
|
||||
import com.seibel.lod.core.enums.config.*;
|
||||
import com.seibel.lod.core.enums.rendering.*;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
import com.seibel.lod.common.Config;
|
||||
import com.seibel.lod.common.OldConfig;
|
||||
|
||||
/**
|
||||
* This holds the config defaults and setters/getters
|
||||
@@ -53,7 +53,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public boolean getOptionsButton()
|
||||
{
|
||||
return Config.optionsButton;
|
||||
return OldConfig.optionsButton;
|
||||
}
|
||||
@Override
|
||||
public void setOptionsButton(boolean newOptionsButton)
|
||||
@@ -117,7 +117,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public HorizontalResolution getDrawResolution()
|
||||
{
|
||||
return Config.Client.Graphics.Quality.drawResolution;
|
||||
return OldConfig.Client.Graphics.Quality.drawResolution;
|
||||
}
|
||||
@Override
|
||||
public void setDrawResolution(HorizontalResolution newHorizontalResolution)
|
||||
@@ -130,7 +130,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public int getLodChunkRenderDistance()
|
||||
{
|
||||
return Config.Client.Graphics.Quality.lodChunkRenderDistance;
|
||||
return OldConfig.Client.Graphics.Quality.lodChunkRenderDistance;
|
||||
}
|
||||
@Override
|
||||
public void setLodChunkRenderDistance(int newLodChunkRenderDistance)
|
||||
@@ -143,7 +143,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public VerticalQuality getVerticalQuality()
|
||||
{
|
||||
return Config.Client.Graphics.Quality.verticalQuality;
|
||||
return OldConfig.Client.Graphics.Quality.verticalQuality;
|
||||
}
|
||||
@Override
|
||||
public void setVerticalQuality(VerticalQuality newVerticalQuality)
|
||||
@@ -156,7 +156,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public int getHorizontalScale()
|
||||
{
|
||||
return Config.Client.Graphics.Quality.horizontalScale;
|
||||
return OldConfig.Client.Graphics.Quality.horizontalScale;
|
||||
}
|
||||
@Override
|
||||
public void setHorizontalScale(int newHorizontalScale)
|
||||
@@ -169,7 +169,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public HorizontalQuality getHorizontalQuality()
|
||||
{
|
||||
return Config.Client.Graphics.Quality.horizontalQuality;
|
||||
return OldConfig.Client.Graphics.Quality.horizontalQuality;
|
||||
}
|
||||
@Override
|
||||
public void setHorizontalQuality(HorizontalQuality newHorizontalQuality)
|
||||
@@ -177,10 +177,10 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
ConfigGui.editSingleOption.getEntry("client.graphics.quality.horizontalQuality").value = newHorizontalQuality;
|
||||
ConfigGui.editSingleOption.saveOption("client.graphics.quality.horizontalQuality");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DropoffQuality getDropoffQuality() {
|
||||
return Config.Client.Graphics.Quality.dropoffQuality;
|
||||
return OldConfig.Client.Graphics.Quality.dropoffQuality;
|
||||
}
|
||||
@Override
|
||||
public void setDropoffQuality(DropoffQuality newDropoffQuality) {
|
||||
@@ -195,7 +195,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public FogDistance getFogDistance()
|
||||
{
|
||||
return Config.Client.Graphics.FogQuality.fogDistance;
|
||||
return OldConfig.Client.Graphics.FogQuality.fogDistance;
|
||||
}
|
||||
@Override
|
||||
public void setFogDistance(FogDistance newFogDistance)
|
||||
@@ -208,7 +208,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public FogDrawMode getFogDrawMode()
|
||||
{
|
||||
return Config.Client.Graphics.FogQuality.fogDrawMode;
|
||||
return OldConfig.Client.Graphics.FogQuality.fogDrawMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -222,7 +222,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public FogColorMode getFogColorMode()
|
||||
{
|
||||
return Config.Client.Graphics.FogQuality.fogColorMode;
|
||||
return OldConfig.Client.Graphics.FogQuality.fogColorMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -236,7 +236,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public boolean getDisableVanillaFog()
|
||||
{
|
||||
return Config.Client.Graphics.FogQuality.disableVanillaFog;
|
||||
return OldConfig.Client.Graphics.FogQuality.disableVanillaFog;
|
||||
}
|
||||
@Override
|
||||
public void setDisableVanillaFog(boolean newDisableVanillaFog)
|
||||
@@ -252,7 +252,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public boolean getDisableDirectionalCulling()
|
||||
{
|
||||
return Config.Client.Graphics.AdvancedGraphics.disableDirectionalCulling;
|
||||
return OldConfig.Client.Graphics.AdvancedGraphics.disableDirectionalCulling;
|
||||
}
|
||||
@Override
|
||||
public void setDisableDirectionalCulling(boolean newDisableDirectionalCulling)
|
||||
@@ -265,7 +265,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public VanillaOverdraw getVanillaOverdraw()
|
||||
{
|
||||
return Config.Client.Graphics.AdvancedGraphics.vanillaOverdraw;
|
||||
return OldConfig.Client.Graphics.AdvancedGraphics.vanillaOverdraw;
|
||||
}
|
||||
@Override
|
||||
public void setVanillaOverdraw(VanillaOverdraw newVanillaOverdraw)
|
||||
@@ -277,7 +277,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public int getBacksideCullingRange()
|
||||
{
|
||||
return Config.Client.Graphics.AdvancedGraphics.backsideCullingRange;
|
||||
return OldConfig.Client.Graphics.AdvancedGraphics.backsideCullingRange;
|
||||
}
|
||||
@Override
|
||||
public void setBacksideCullingRange(int newBacksideCullingRange)
|
||||
@@ -285,11 +285,11 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
ConfigGui.editSingleOption.getEntry("client.graphics.advancedGraphics.backsideCullingRange").value = newBacksideCullingRange;
|
||||
ConfigGui.editSingleOption.saveOption("client.graphics.advancedGraphics.backsideCullingRange");
|
||||
}*/
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getUseExtendedNearClipPlane()
|
||||
{
|
||||
return Config.Client.Graphics.AdvancedGraphics.useExtendedNearClipPlane;
|
||||
return OldConfig.Client.Graphics.AdvancedGraphics.useExtendedNearClipPlane;
|
||||
}
|
||||
@Override
|
||||
public void setUseExtendedNearClipPlane(boolean newUseExtendedNearClipPlane)
|
||||
@@ -311,7 +311,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public GenerationPriority getGenerationPriority()
|
||||
{
|
||||
return Config.Client.WorldGenerator.generationPriority;
|
||||
return OldConfig.Client.WorldGenerator.generationPriority;
|
||||
}
|
||||
@Override
|
||||
public void setGenerationPriority(GenerationPriority newGenerationPriority)
|
||||
@@ -324,7 +324,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public DistanceGenerationMode getDistanceGenerationMode()
|
||||
{
|
||||
return Config.Client.WorldGenerator.distanceGenerationMode;
|
||||
return OldConfig.Client.WorldGenerator.distanceGenerationMode;
|
||||
}
|
||||
@Override
|
||||
public void setDistanceGenerationMode(DistanceGenerationMode newDistanceGenerationMode)
|
||||
@@ -337,7 +337,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public boolean getAllowUnstableFeatureGeneration()
|
||||
{
|
||||
return Config.Client.WorldGenerator.allowUnstableFeatureGeneration;
|
||||
return OldConfig.Client.WorldGenerator.allowUnstableFeatureGeneration;
|
||||
}
|
||||
@Override
|
||||
public void setAllowUnstableFeatureGeneration(boolean newAllowUnstableFeatureGeneration)
|
||||
@@ -350,7 +350,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public BlocksToAvoid getBlocksToAvoid()
|
||||
{
|
||||
return Config.Client.WorldGenerator.blocksToAvoid;
|
||||
return OldConfig.Client.WorldGenerator.blocksToAvoid;
|
||||
}
|
||||
@Override
|
||||
public void setBlockToAvoid(BlocksToAvoid newBlockToAvoid)
|
||||
@@ -361,7 +361,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public boolean getEnableDistantGeneration()
|
||||
{
|
||||
return Config.Client.WorldGenerator.enableDistantGeneration;
|
||||
return (boolean) ConfigGui.editSingleOption.getEntry("client.worldGenerator.enableDistantGeneration").value;
|
||||
}
|
||||
@Override
|
||||
public void setEnableDistantGeneration(boolean newEnableDistantGeneration)
|
||||
@@ -372,7 +372,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public LightGenerationMode getLightGenerationMode()
|
||||
{
|
||||
return Config.Client.WorldGenerator.lightGenerationMode;
|
||||
return OldConfig.Client.WorldGenerator.lightGenerationMode;
|
||||
}
|
||||
@Override
|
||||
public void setLightGenerationMode(LightGenerationMode newLightGenerationMode)
|
||||
@@ -428,7 +428,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public int getNumberOfWorldGenerationThreads()
|
||||
{
|
||||
return Config.Client.Advanced.Threading.numberOfWorldGenerationThreads;
|
||||
return OldConfig.Client.Advanced.Threading.numberOfWorldGenerationThreads;
|
||||
}
|
||||
@Override
|
||||
public void setNumberOfWorldGenerationThreads(int newNumberOfWorldGenerationThreads)
|
||||
@@ -441,7 +441,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public int getNumberOfBufferBuilderThreads()
|
||||
{
|
||||
return Config.Client.Advanced.Threading.numberOfBufferBuilderThreads;
|
||||
return OldConfig.Client.Advanced.Threading.numberOfBufferBuilderThreads;
|
||||
}
|
||||
@Override
|
||||
public void setNumberOfBufferBuilderThreads(int newNumberOfWorldBuilderThreads)
|
||||
@@ -505,7 +505,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public GpuUploadMethod getGpuUploadMethod()
|
||||
{
|
||||
return Config.Client.Advanced.Buffers.gpuUploadMethod;
|
||||
return OldConfig.Client.Advanced.Buffers.gpuUploadMethod;
|
||||
}
|
||||
@Override
|
||||
public void setGpuUploadMethod(GpuUploadMethod newDisableVanillaFog)
|
||||
@@ -518,7 +518,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public int getGpuUploadPerMegabyteInMilliseconds()
|
||||
{
|
||||
return Config.Client.Advanced.Buffers.gpuUploadPerMegabyteInMilliseconds;
|
||||
return OldConfig.Client.Advanced.Buffers.gpuUploadPerMegabyteInMilliseconds;
|
||||
}
|
||||
@Override
|
||||
public void setGpuUploadPerMegabyteInMilliseconds(int newMilliseconds) {
|
||||
@@ -530,7 +530,7 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
@Override
|
||||
public BufferRebuildTimes getRebuildTimes()
|
||||
{
|
||||
return Config.Client.Advanced.Buffers.rebuildTimes;
|
||||
return OldConfig.Client.Advanced.Buffers.rebuildTimes;
|
||||
}
|
||||
@Override
|
||||
public void setRebuildTimes(BufferRebuildTimes newBufferRebuildTimes)
|
||||
|
||||
+505
@@ -0,0 +1,505 @@
|
||||
package com.seibel.lod.common.wrappers.config;
|
||||
|
||||
import com.seibel.lod.core.enums.config.*;
|
||||
import com.seibel.lod.core.enums.rendering.*;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
import com.seibel.lod.core.Config;
|
||||
|
||||
/**
|
||||
* This is temporary for testing the new config
|
||||
*
|
||||
* @author coolGi2007
|
||||
* @version 02-13-2022
|
||||
*/
|
||||
public class NewLodConfigWrapperSingleton implements ILodConfigWrapperSingleton
|
||||
{
|
||||
public static final NewLodConfigWrapperSingleton INSTANCE = new NewLodConfigWrapperSingleton();
|
||||
|
||||
|
||||
private static final Client client = new Client();
|
||||
@Override
|
||||
public IClient client()
|
||||
{
|
||||
return client;
|
||||
}
|
||||
|
||||
public static class Client implements IClient
|
||||
{
|
||||
public final IGraphics graphics;
|
||||
public final IWorldGenerator worldGenerator;
|
||||
public final IAdvanced advanced;
|
||||
|
||||
|
||||
@Override
|
||||
public IGraphics graphics()
|
||||
{
|
||||
return graphics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWorldGenerator worldGenerator()
|
||||
{
|
||||
return worldGenerator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAdvanced advanced()
|
||||
{
|
||||
return advanced;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getOptionsButton()
|
||||
{
|
||||
return Config.client.optionsButton.get();
|
||||
}
|
||||
@Override
|
||||
public void setOptionsButton(boolean newOptionsButton)
|
||||
{
|
||||
Config.client.optionsButton.set(newOptionsButton);
|
||||
}
|
||||
|
||||
|
||||
//================//
|
||||
// Client Configs //
|
||||
//================//
|
||||
public Client()
|
||||
{
|
||||
graphics = new Graphics();
|
||||
worldGenerator = new WorldGenerator();
|
||||
advanced = new Advanced();
|
||||
}
|
||||
|
||||
|
||||
//==================//
|
||||
// Graphics Configs //
|
||||
//==================//
|
||||
public static class Graphics implements IGraphics
|
||||
{
|
||||
public final IQuality quality;
|
||||
public final IFogQuality fogQuality;
|
||||
public final IAdvancedGraphics advancedGraphics;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IQuality quality()
|
||||
{
|
||||
return quality;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFogQuality fogQuality()
|
||||
{
|
||||
return fogQuality;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAdvancedGraphics advancedGraphics()
|
||||
{
|
||||
return advancedGraphics;
|
||||
}
|
||||
|
||||
|
||||
Graphics()
|
||||
{
|
||||
quality = new Quality();
|
||||
fogQuality = new FogQuality();
|
||||
advancedGraphics = new AdvancedGraphics();
|
||||
}
|
||||
|
||||
|
||||
public static class Quality implements IQuality
|
||||
{
|
||||
@Override
|
||||
public HorizontalResolution getDrawResolution()
|
||||
{
|
||||
return Config.Client.Graphics.Quality.drawResolution.get();
|
||||
}
|
||||
@Override
|
||||
public void setDrawResolution(HorizontalResolution newHorizontalResolution)
|
||||
{
|
||||
Config.Client.Graphics.Quality.drawResolution.set(newHorizontalResolution);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getLodChunkRenderDistance()
|
||||
{
|
||||
return Config.Client.Graphics.Quality.lodChunkRenderDistance.get();
|
||||
}
|
||||
@Override
|
||||
public void setLodChunkRenderDistance(int newLodChunkRenderDistance)
|
||||
{
|
||||
Config.Client.Graphics.Quality.lodChunkRenderDistance.set(newLodChunkRenderDistance);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VerticalQuality getVerticalQuality()
|
||||
{
|
||||
return Config.Client.Graphics.Quality.verticalQuality.get();
|
||||
}
|
||||
@Override
|
||||
public void setVerticalQuality(VerticalQuality newVerticalQuality)
|
||||
{
|
||||
Config.Client.Graphics.Quality.verticalQuality.set(newVerticalQuality);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getHorizontalScale()
|
||||
{
|
||||
return Config.Client.Graphics.Quality.horizontalScale.get();
|
||||
}
|
||||
@Override
|
||||
public void setHorizontalScale(int newHorizontalScale)
|
||||
{
|
||||
Config.Client.Graphics.Quality.horizontalScale.set(newHorizontalScale);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HorizontalQuality getHorizontalQuality()
|
||||
{
|
||||
return Config.Client.Graphics.Quality.horizontalQuality.get();
|
||||
}
|
||||
@Override
|
||||
public void setHorizontalQuality(HorizontalQuality newHorizontalQuality)
|
||||
{
|
||||
Config.Client.Graphics.Quality.horizontalQuality.set(newHorizontalQuality);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DropoffQuality getDropoffQuality() {
|
||||
return Config.Client.Graphics.Quality.dropoffQuality.get();
|
||||
}
|
||||
@Override
|
||||
public void setDropoffQuality(DropoffQuality newDropoffQuality) {
|
||||
Config.Client.Graphics.Quality.dropoffQuality.set(newDropoffQuality);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class FogQuality implements IFogQuality
|
||||
{
|
||||
@Override
|
||||
public FogDistance getFogDistance()
|
||||
{
|
||||
return Config.Client.Graphics.FogQuality.fogDistance.get();
|
||||
}
|
||||
@Override
|
||||
public void setFogDistance(FogDistance newFogDistance)
|
||||
{
|
||||
Config.Client.Graphics.FogQuality.fogDistance.set(newFogDistance);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FogDrawMode getFogDrawMode()
|
||||
{
|
||||
return Config.Client.Graphics.FogQuality.fogDrawMode.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFogDrawMode(FogDrawMode setFogDrawMode)
|
||||
{
|
||||
Config.Client.Graphics.FogQuality.fogDrawMode.set(setFogDrawMode);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FogColorMode getFogColorMode()
|
||||
{
|
||||
return Config.Client.Graphics.FogQuality.fogColorMode.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFogColorMode(FogColorMode newFogColorMode)
|
||||
{
|
||||
Config.Client.Graphics.FogQuality.fogColorMode.set(newFogColorMode);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getDisableVanillaFog()
|
||||
{
|
||||
return Config.Client.Graphics.FogQuality.disableVanillaFog.get();
|
||||
}
|
||||
@Override
|
||||
public void setDisableVanillaFog(boolean newDisableVanillaFog)
|
||||
{
|
||||
Config.Client.Graphics.FogQuality.disableVanillaFog.set(newDisableVanillaFog);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class AdvancedGraphics implements IAdvancedGraphics
|
||||
{
|
||||
@Override
|
||||
public boolean getDisableDirectionalCulling()
|
||||
{
|
||||
return Config.Client.Graphics.AdvancedGraphics.disableDirectionalCulling.get();
|
||||
}
|
||||
@Override
|
||||
public void setDisableDirectionalCulling(boolean newDisableDirectionalCulling)
|
||||
{
|
||||
Config.Client.Graphics.AdvancedGraphics.disableDirectionalCulling.set(newDisableDirectionalCulling);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VanillaOverdraw getVanillaOverdraw()
|
||||
{
|
||||
return Config.Client.Graphics.AdvancedGraphics.vanillaOverdraw.get();
|
||||
}
|
||||
@Override
|
||||
public void setVanillaOverdraw(VanillaOverdraw newVanillaOverdraw)
|
||||
{
|
||||
Config.Client.Graphics.AdvancedGraphics.vanillaOverdraw.set(newVanillaOverdraw);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getUseExtendedNearClipPlane()
|
||||
{
|
||||
return Config.Client.Graphics.AdvancedGraphics.useExtendedNearClipPlane.get();
|
||||
}
|
||||
@Override
|
||||
public void setUseExtendedNearClipPlane(boolean newUseExtendedNearClipPlane)
|
||||
{
|
||||
Config.Client.Graphics.AdvancedGraphics.useExtendedNearClipPlane.set(newUseExtendedNearClipPlane);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//========================//
|
||||
// WorldGenerator Configs //
|
||||
//========================//
|
||||
public static class WorldGenerator implements IWorldGenerator
|
||||
{
|
||||
@Override
|
||||
public GenerationPriority getGenerationPriority()
|
||||
{
|
||||
return Config.Client.WorldGenerator.generationPriority.get();
|
||||
}
|
||||
@Override
|
||||
public void setGenerationPriority(GenerationPriority newGenerationPriority)
|
||||
{
|
||||
Config.Client.WorldGenerator.generationPriority.set(newGenerationPriority);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DistanceGenerationMode getDistanceGenerationMode()
|
||||
{
|
||||
return Config.Client.WorldGenerator.distanceGenerationMode.get();
|
||||
}
|
||||
@Override
|
||||
public void setDistanceGenerationMode(DistanceGenerationMode newDistanceGenerationMode)
|
||||
{
|
||||
Config.Client.WorldGenerator.distanceGenerationMode.set(newDistanceGenerationMode);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public boolean getAllowUnstableFeatureGeneration()
|
||||
{
|
||||
return Config.Client.WorldGenerator.allowUnstableFeatureGeneration;
|
||||
}
|
||||
@Override
|
||||
public void setAllowUnstableFeatureGeneration(boolean newAllowUnstableFeatureGeneration)
|
||||
{
|
||||
ConfigGui.editSingleOption.getEntry("client.worldGenerator.allowUnstableFeatureGeneration").value = newAllowUnstableFeatureGeneration;
|
||||
ConfigGui.editSingleOption.saveOption("client.worldGenerator.allowUnstableFeatureGeneration");
|
||||
}*/
|
||||
|
||||
|
||||
@Override
|
||||
public BlocksToAvoid getBlocksToAvoid()
|
||||
{
|
||||
return Config.Client.WorldGenerator.blocksToAvoid.get();
|
||||
}
|
||||
@Override
|
||||
public void setBlockToAvoid(BlocksToAvoid newBlockToAvoid)
|
||||
{
|
||||
Config.Client.WorldGenerator.blocksToAvoid.set(newBlockToAvoid);
|
||||
}
|
||||
@Override
|
||||
public boolean getEnableDistantGeneration()
|
||||
{
|
||||
return Config.Client.WorldGenerator.enableDistantGeneration.get();
|
||||
}
|
||||
@Override
|
||||
public void setEnableDistantGeneration(boolean newEnableDistantGeneration)
|
||||
{
|
||||
Config.Client.WorldGenerator.enableDistantGeneration.set(newEnableDistantGeneration);
|
||||
}
|
||||
@Override
|
||||
public LightGenerationMode getLightGenerationMode()
|
||||
{
|
||||
return Config.Client.WorldGenerator.lightGenerationMode.get();
|
||||
}
|
||||
@Override
|
||||
public void setLightGenerationMode(LightGenerationMode newLightGenerationMode)
|
||||
{
|
||||
Config.Client.WorldGenerator.lightGenerationMode.set(newLightGenerationMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//============================//
|
||||
// AdvancedModOptions Configs //
|
||||
//============================//
|
||||
public static class Advanced implements IAdvanced
|
||||
{
|
||||
public final IThreading threading;
|
||||
public final IDebugging debugging;
|
||||
public final IBuffers buffers;
|
||||
|
||||
|
||||
@Override
|
||||
public IThreading threading()
|
||||
{
|
||||
return threading;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IDebugging debugging()
|
||||
{
|
||||
return debugging;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IBuffers buffers()
|
||||
{
|
||||
return buffers;
|
||||
}
|
||||
|
||||
|
||||
public Advanced()
|
||||
{
|
||||
threading = new Threading();
|
||||
debugging = new Debugging();
|
||||
buffers = new Buffers();
|
||||
}
|
||||
|
||||
public static class Threading implements IThreading
|
||||
{
|
||||
@Override
|
||||
public int getNumberOfWorldGenerationThreads()
|
||||
{
|
||||
return Config.Client.Advanced.Threading.numberOfWorldGenerationThreads.get();
|
||||
}
|
||||
@Override
|
||||
public void setNumberOfWorldGenerationThreads(int newNumberOfWorldGenerationThreads)
|
||||
{
|
||||
Config.Client.Advanced.Threading.numberOfWorldGenerationThreads.set(newNumberOfWorldGenerationThreads);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getNumberOfBufferBuilderThreads()
|
||||
{
|
||||
return Config.Client.Advanced.Threading.numberOfBufferBuilderThreads.get();
|
||||
}
|
||||
@Override
|
||||
public void setNumberOfBufferBuilderThreads(int newNumberOfWorldBuilderThreads)
|
||||
{
|
||||
Config.Client.Advanced.Threading.numberOfBufferBuilderThreads.set(newNumberOfWorldBuilderThreads);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//===============//
|
||||
// Debug Options //
|
||||
//===============//
|
||||
public static class Debugging implements IDebugging
|
||||
{
|
||||
@Override
|
||||
public boolean getDrawLods()
|
||||
{
|
||||
return Config.Client.Advanced.Debugging.drawLods.get();
|
||||
}
|
||||
@Override
|
||||
public void setDrawLods(boolean newDrawLods)
|
||||
{
|
||||
Config.Client.Advanced.Debugging.drawLods.set(newDrawLods);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DebugMode getDebugMode()
|
||||
{
|
||||
return Config.Client.Advanced.Debugging.debugMode.get();
|
||||
}
|
||||
@Override
|
||||
public void setDebugMode(DebugMode newDebugMode)
|
||||
{
|
||||
Config.Client.Advanced.Debugging.debugMode.set(newDebugMode);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getDebugKeybindingsEnabled()
|
||||
{
|
||||
return Config.Client.Advanced.Debugging.enableDebugKeybindings.get();
|
||||
}
|
||||
@Override
|
||||
public void setDebugKeybindingsEnabled(boolean newEnableDebugKeybindings)
|
||||
{
|
||||
Config.Client.Advanced.Debugging.enableDebugKeybindings.set(newEnableDebugKeybindings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class Buffers implements IBuffers
|
||||
{
|
||||
|
||||
@Override
|
||||
public GpuUploadMethod getGpuUploadMethod()
|
||||
{
|
||||
return Config.Client.Advanced.Buffers.gpuUploadMethod.get();
|
||||
}
|
||||
@Override
|
||||
public void setGpuUploadMethod(GpuUploadMethod newDisableVanillaFog)
|
||||
{
|
||||
Config.Client.Advanced.Buffers.gpuUploadMethod.set(newDisableVanillaFog);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getGpuUploadPerMegabyteInMilliseconds()
|
||||
{
|
||||
return Config.Client.Advanced.Buffers.gpuUploadPerMegabyteInMilliseconds.get();
|
||||
}
|
||||
@Override
|
||||
public void setGpuUploadPerMegabyteInMilliseconds(int newMilliseconds) {
|
||||
Config.Client.Advanced.Buffers.gpuUploadPerMegabyteInMilliseconds.set(newMilliseconds);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BufferRebuildTimes getRebuildTimes()
|
||||
{
|
||||
return Config.Client.Advanced.Buffers.rebuildTimes.get();
|
||||
}
|
||||
@Override
|
||||
public void setRebuildTimes(BufferRebuildTimes newBufferRebuildTimes)
|
||||
{
|
||||
Config.Client.Advanced.Buffers.rebuildTimes.set(newBufferRebuildTimes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
-20
@@ -2,9 +2,8 @@ package com.seibel.lod.common.wrappers.config;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.ImageButton;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
@@ -12,9 +11,9 @@ import net.minecraft.resources.ResourceLocation;
|
||||
* Creates a button with a texture on it
|
||||
*/
|
||||
public class TexturedButtonWidget extends ImageButton {
|
||||
// public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, ResourceLocation texture, OnPress pressAction) {
|
||||
// super(x, y, width, height, u, v, texture, pressAction);
|
||||
// }
|
||||
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, ResourceLocation texture, OnPress pressAction) {
|
||||
super(x, y, width, height, u, v, texture, pressAction);
|
||||
}
|
||||
public TexturedButtonWidget(int x, int y, int width, int height, int u, int v, int hoveredVOffset, ResourceLocation texture, int textureWidth, int textureHeight, OnPress pressAction) {
|
||||
super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction);
|
||||
}
|
||||
@@ -27,20 +26,18 @@ public class TexturedButtonWidget extends ImageButton {
|
||||
super(x, y, width, height, u, v, hoveredVOffset, texture, textureWidth, textureHeight, pressAction, tooltipSupplier, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
|
||||
@Override
|
||||
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta) {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderTexture(0, WIDGETS_LOCATION);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, this.alpha);
|
||||
int i = this.getYImage(this.isHovered);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.enableDepthTest();
|
||||
this.blit(matrices, this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height);
|
||||
this.blit(matrices, this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
||||
|
||||
Minecraft.getInstance().getTextureManager().bind(WIDGETS_LOCATION);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
|
||||
int i = getYImage(isHovered());
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.enableDepthTest();
|
||||
this.blit(matrices, this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height);
|
||||
this.blit(matrices, this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2,
|
||||
this.height);
|
||||
|
||||
super.renderButton(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
super.renderButton(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
}
|
||||
|
||||
+89
-84
@@ -7,47 +7,40 @@ import java.util.stream.Collectors;
|
||||
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.math.Vector3d;
|
||||
import com.seibel.lod.common.wrappers.WrapperFactory;
|
||||
import com.seibel.lod.common.wrappers.misc.LightMapWrapper;
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.api.ModAccessorApi;
|
||||
import com.seibel.lod.core.handlers.IReflectionHandler;
|
||||
import com.seibel.lod.core.handlers.ReflectionHandler;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectList;
|
||||
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.seibel.lod.core.objects.math.Mat4f;
|
||||
import com.seibel.lod.core.objects.math.Vec3d;
|
||||
import com.seibel.lod.core.objects.math.Vec3f;
|
||||
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
|
||||
import com.seibel.lod.common.wrappers.McObjectConverter;
|
||||
import com.seibel.lod.common.wrappers.WrapperFactory;
|
||||
import com.seibel.lod.common.wrappers.block.BlockPosWrapper;
|
||||
import com.seibel.lod.common.wrappers.chunk.ChunkPosWrapper;
|
||||
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.FogRenderer;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher.CompiledChunk;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.FogType;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
|
||||
@@ -56,7 +49,7 @@ import net.minecraft.world.phys.Vec3;
|
||||
* related to rendering in Minecraft.
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 12-14-2021
|
||||
* @version 12-12-2021
|
||||
*/
|
||||
public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
{
|
||||
@@ -66,8 +59,6 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
private static final GameRenderer GAME_RENDERER = MC.gameRenderer;
|
||||
private static final WrapperFactory FACTORY = WrapperFactory.INSTANCE;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Vec3f getLookAtVector()
|
||||
{
|
||||
@@ -102,7 +93,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public Mat4f getDefaultProjectionMatrix(float partialTicks)
|
||||
{
|
||||
return McObjectConverter.Convert(GAME_RENDERER.getProjectionMatrix(GAME_RENDERER.getMainCamera(), partialTicks, true));
|
||||
return McObjectConverter.Convert(GAME_RENDERER.getProjectionMatrix(GAME_RENDERER.getFov(GAME_RENDERER.getMainCamera(), partialTicks, true)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,9 +103,9 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getFogColor(float partialTick) {
|
||||
float[] colorValues = new float[4];
|
||||
GL15.glGetFloatv(GL15.GL_FOG_COLOR, colorValues);
|
||||
public Color getFogColor(float partialTicks) {
|
||||
FogRenderer.setupColor(GAME_RENDERER.getMainCamera(), partialTicks, MC.level, 1, GAME_RENDERER.getDarkenWorldAmount(partialTicks));
|
||||
float[] colorValues = RenderSystem.getShaderFogColor();
|
||||
return new Color(colorValues[0], colorValues[1], colorValues[2], colorValues[3]);
|
||||
}
|
||||
// getSpecialFogColor() is the same as getFogColor()
|
||||
@@ -122,7 +113,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public Color getSkyColor() {
|
||||
if (MC.level.dimensionType().hasSkyLight()) {
|
||||
Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getBlockPosition(), MC.getFrameTime());
|
||||
Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getPosition(), MC.getFrameTime());
|
||||
return new Color((float) colorValues.x, (float) colorValues.y, (float) colorValues.z);
|
||||
} else
|
||||
return new Color(0, 0, 0);
|
||||
@@ -157,55 +148,74 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
* is going to render this frame. <br><br>
|
||||
* <p>
|
||||
*/
|
||||
|
||||
public boolean usingBackupGetVanillaRenderedChunks = false;
|
||||
@Override
|
||||
public HashSet<AbstractChunkPosWrapper> getVanillaRenderedChunks()
|
||||
{
|
||||
ISodiumAccessor sodium = ModAccessorApi.get(ISodiumAccessor.class);
|
||||
if (sodium != null)
|
||||
{
|
||||
return sodium.getNormalRenderedChunks();
|
||||
}
|
||||
IOptifineAccessor optifine = ModAccessorApi.get(IOptifineAccessor.class);
|
||||
if (optifine != null)
|
||||
{
|
||||
HashSet<AbstractChunkPosWrapper> pos = optifine.getNormalRenderedChunks();
|
||||
if (pos == null)
|
||||
pos = getMaximumRenderedChunks();
|
||||
return pos;
|
||||
}
|
||||
if (!usingBackupGetVanillaRenderedChunks) {
|
||||
try {
|
||||
LevelRenderer levelRenderer = MC.levelRenderer;
|
||||
LinkedHashSet<LevelRenderer.RenderChunkInfo> chunks = levelRenderer.renderChunkStorage.get().renderChunks;
|
||||
return (chunks.stream().map((chunk) -> {
|
||||
AABB chunkBoundingBox = chunk.chunk.bb;
|
||||
return FACTORY.createChunkPos(Math.floorDiv((int) chunkBoundingBox.minX, 16),
|
||||
Math.floorDiv((int) chunkBoundingBox.minZ, 16));
|
||||
}).collect(Collectors.toCollection(HashSet::new)));
|
||||
} catch (LinkageError e) {
|
||||
try {
|
||||
MinecraftWrapper.INSTANCE.sendChatMessage(
|
||||
"\u00A7e\u00A7l\u00A7uWRANING: Distant Horizons: getVanillaRenderedChunks method failed."
|
||||
+ " Using Backup Method.");
|
||||
MinecraftWrapper.INSTANCE.sendChatMessage(
|
||||
"\u00A7eOverdraw prevention will be worse than normal.");
|
||||
} catch (Exception e2) {}
|
||||
ClientApi.LOGGER.error("getVanillaRenderedChunks Error: {}", e);
|
||||
usingBackupGetVanillaRenderedChunks = true;
|
||||
}
|
||||
}
|
||||
return getMaximumRenderedChunks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<AbstractChunkPosWrapper> getVanillaRenderedChunks()
|
||||
{
|
||||
ISodiumAccessor sodium = ModAccessorApi.get(ISodiumAccessor.class);
|
||||
if (sodium != null)
|
||||
{
|
||||
return sodium.getNormalRenderedChunks();
|
||||
}
|
||||
IOptifineAccessor optifine = ModAccessorApi.get(IOptifineAccessor.class);
|
||||
if (optifine != null)
|
||||
{
|
||||
HashSet<AbstractChunkPosWrapper> pos = optifine.getNormalRenderedChunks();
|
||||
if (pos==null) pos = getMaximumRenderedChunks();
|
||||
return pos;
|
||||
}
|
||||
LevelRenderer levelRenderer = MC.levelRenderer;
|
||||
ObjectList<LevelRenderer.RenderChunkInfo> chunks = levelRenderer.renderChunks;
|
||||
return (chunks.stream().map((chunk) -> {
|
||||
AABB chunkBoundingBox = chunk.chunk.bb;
|
||||
return FACTORY.createChunkPos(Math.floorDiv((int) chunkBoundingBox.minX, 16),
|
||||
Math.floorDiv((int) chunkBoundingBox.minZ, 16));
|
||||
}).collect(Collectors.toCollection(HashSet::new)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<AbstractChunkPosWrapper> getMaximumRenderedChunks()
|
||||
{
|
||||
IMinecraftWrapper mcWrapper = SingletonHandler.get(IMinecraftWrapper.class);
|
||||
IWrapperFactory factory = SingletonHandler.get(IWrapperFactory.class);
|
||||
|
||||
int chunkRenderDist = this.getRenderDistance();
|
||||
|
||||
AbstractChunkPosWrapper centerChunkPos = mcWrapper.getPlayerChunkPos();
|
||||
int startChunkX = centerChunkPos.getX() - chunkRenderDist;
|
||||
int startChunkZ = centerChunkPos.getZ() - chunkRenderDist;
|
||||
|
||||
// add every position within render distance
|
||||
HashSet<AbstractChunkPosWrapper> renderedPos = new HashSet<AbstractChunkPosWrapper>();
|
||||
for (int chunkX = 0; chunkX < (chunkRenderDist * 2+1); chunkX++)
|
||||
{
|
||||
for(int chunkZ = 0; chunkZ < (chunkRenderDist * 2+1); chunkZ++)
|
||||
{
|
||||
renderedPos.add(factory.createChunkPos(startChunkX + chunkX, startChunkZ + chunkZ));
|
||||
}
|
||||
}
|
||||
|
||||
return renderedPos;
|
||||
}
|
||||
|
||||
public HashSet<AbstractChunkPosWrapper> getMaximumRenderedChunks()
|
||||
{
|
||||
//TODO: Make this a circle
|
||||
IMinecraftWrapper mcWrapper = SingletonHandler.get(IMinecraftWrapper.class);
|
||||
IWrapperFactory factory = SingletonHandler.get(IWrapperFactory.class);
|
||||
|
||||
int chunkRenderDist = this.getRenderDistance();
|
||||
|
||||
AbstractChunkPosWrapper centerChunkPos = mcWrapper.getPlayerChunkPos();
|
||||
int startChunkX = centerChunkPos.getX() - chunkRenderDist;
|
||||
int startChunkZ = centerChunkPos.getZ() - chunkRenderDist;
|
||||
|
||||
// add every position within render distance
|
||||
HashSet<AbstractChunkPosWrapper> renderedPos = new HashSet<AbstractChunkPosWrapper>();
|
||||
for (int chunkX = 0; chunkX < (chunkRenderDist * 2+1); chunkX++)
|
||||
{
|
||||
for(int chunkZ = 0; chunkZ < (chunkRenderDist * 2+1); chunkZ++)
|
||||
{
|
||||
renderedPos.add(factory.createChunkPos(startChunkX + chunkX, startChunkZ + chunkZ));
|
||||
}
|
||||
}
|
||||
|
||||
return renderedPos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@@ -220,7 +230,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
int lightMapHeight = getLightmapTextureHeight();
|
||||
int lightMapWidth = getLightmapTextureWidth();
|
||||
|
||||
int pixels[] = new int[lightMapWidth * lightMapHeight];
|
||||
int[] pixels = new int[lightMapWidth * lightMapHeight];
|
||||
for (int u = 0; u < lightMapWidth; u++)
|
||||
{
|
||||
for (int v = 0; v < lightMapWidth; v++)
|
||||
@@ -245,7 +255,6 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
((c.getBlue() & 0xFF)) | // red
|
||||
((c.getAlpha() & 0xFF) << 24); // alpha
|
||||
|
||||
|
||||
// 2D array stored in a 1D array.
|
||||
// Thank you Tim from College ;)
|
||||
pixels[u * lightMapWidth + v] = col;
|
||||
@@ -307,20 +316,16 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
|
||||
return glFormat;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isFogStateSpecial() {
|
||||
Camera camera = GAME_RENDERER.getMainCamera();
|
||||
FluidState fluidState = camera.getFluidInCamera();
|
||||
Entity entity = camera.getEntity();
|
||||
boolean isUnderWater = (entity instanceof LivingEntity) && ((LivingEntity)entity).hasEffect(MobEffects.BLINDNESS);
|
||||
isUnderWater |= fluidState.is(FluidTags.WATER);
|
||||
isUnderWater |= fluidState.is(FluidTags.LAVA);
|
||||
return isUnderWater;
|
||||
Entity entity = GAME_RENDERER.getMainCamera().getEntity();
|
||||
boolean isBlind = (entity instanceof LivingEntity) && ((LivingEntity)entity).hasEffect(MobEffects.BLINDNESS);
|
||||
return GAME_RENDERER.getMainCamera().getFluidInCamera() != FogType.NONE || isBlind;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean tryDisableVanillaFog() {
|
||||
return true; // Handled via the MixinFogRenderer at fabric and forge
|
||||
return true; // Handled via MixinFogRenderer in both forge and fabric
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +240,8 @@ public class MinecraftWrapper implements IMinecraftWrapper
|
||||
@Override
|
||||
public ChunkPosWrapper getPlayerChunkPos()
|
||||
{
|
||||
return new ChunkPosWrapper(getPlayer().xChunk, getPlayer().zChunk);
|
||||
ChunkPos playerPos = getPlayer().chunkPosition();
|
||||
return new ChunkPosWrapper(playerPos.x, playerPos.z);
|
||||
}
|
||||
|
||||
public Options getOptions()
|
||||
|
||||
@@ -36,7 +36,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
{
|
||||
|
||||
public static final ConcurrentMap<Biome, BiomeWrapper> biomeWrapperMap = new ConcurrentHashMap<>();
|
||||
private Biome biome;
|
||||
private final Biome biome;
|
||||
|
||||
public BiomeWrapper(Biome biome)
|
||||
{
|
||||
@@ -119,12 +119,12 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
|
||||
return colorInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
||||
@Override public String getName()
|
||||
{
|
||||
return biome.toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getGrassTint(int x, int z)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ import net.minecraft.world.level.dimension.DimensionType;
|
||||
public class DimensionTypeWrapper implements IDimensionTypeWrapper
|
||||
{
|
||||
private static final ConcurrentMap<DimensionType, DimensionTypeWrapper> dimensionTypeWrapperMap = new ConcurrentHashMap<>();
|
||||
private DimensionType dimensionType;
|
||||
private final DimensionType dimensionType;
|
||||
|
||||
public DimensionTypeWrapper(DimensionType dimensionType)
|
||||
{
|
||||
|
||||
@@ -23,13 +23,11 @@ import java.io.File;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.seibel.lod.common.wrappers.chunk.ChunkWrapper;
|
||||
import com.seibel.lod.core.enums.WorldType;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IWorldWrapper;
|
||||
import com.seibel.lod.common.wrappers.block.BlockPosWrapper;
|
||||
import com.seibel.lod.common.wrappers.chunk.ChunkWrapper;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -39,6 +37,7 @@ import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -141,6 +140,12 @@ public class WorldWrapper implements IWorldWrapper
|
||||
return world.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getMinHeight()
|
||||
{
|
||||
return (short) world.getMinBuildHeight();
|
||||
}
|
||||
|
||||
/** @throws UnsupportedOperationException if the WorldWrapper isn't for a ServerWorld */
|
||||
@Override
|
||||
public File getSaveFolder() throws UnsupportedOperationException
|
||||
@@ -168,11 +173,13 @@ public class WorldWrapper implements IWorldWrapper
|
||||
// TODO this is depreciated, what should we use instead?
|
||||
return world.getSeaLevel();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ChunkWrapper tryGetChunk(AbstractChunkPosWrapper pos) {
|
||||
ChunkAccess chunk = world.getChunk(pos.getX(), pos.getZ(), ChunkStatus.EMPTY, false);
|
||||
if (chunk == null) return null;
|
||||
return new ChunkWrapper(chunk, world);
|
||||
public IChunkWrapper tryGetChunk(AbstractChunkPosWrapper pos) {
|
||||
ChunkAccess chunk = world.getChunk(pos.getX(), pos.getZ(), ChunkStatus.EMPTY, false);
|
||||
if (chunk == null) return null;
|
||||
return new ChunkWrapper(chunk, world);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+274
-134
@@ -23,22 +23,25 @@ import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.builders.lodBuilding.LodBuilder;
|
||||
import com.seibel.lod.core.builders.lodBuilding.LodBuilderConfig;
|
||||
import com.seibel.lod.core.enums.config.DistanceGenerationMode;
|
||||
import com.seibel.lod.core.enums.config.LightGenerationMode;
|
||||
import com.seibel.lod.core.objects.lod.LodDimension;
|
||||
import com.seibel.lod.core.util.GridList;
|
||||
import com.seibel.lod.core.util.LodThreadFactory;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IWorldWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.worldGeneration.AbstractBatchGenerationEnvionmentWrapper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.seibel.lod.common.wrappers.DependencySetupDoneCheck;
|
||||
import com.seibel.lod.common.wrappers.chunk.ChunkWrapper;
|
||||
import com.seibel.lod.common.wrappers.world.WorldWrapper;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.mimicObject.ChunkLoader;
|
||||
@@ -56,10 +59,15 @@ import com.seibel.lod.common.wrappers.worldGeneration.step.StepSurface;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
import net.minecraft.world.level.chunk.UpgradeData;
|
||||
import net.minecraft.world.level.levelgen.DebugLevelSource;
|
||||
import net.minecraft.world.level.levelgen.FlatLevelSource;
|
||||
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
|
||||
@@ -77,14 +85,15 @@ Feature Step: 0.389072425s
|
||||
Lod Generation: 0.269023348s
|
||||
*/
|
||||
|
||||
public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnvionmentWrapper {
|
||||
public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnvionmentWrapper
|
||||
{
|
||||
public static final boolean ENABLE_PERF_LOGGING = false;
|
||||
public static final boolean ENABLE_EVENT_LOGGING = false;
|
||||
public static final boolean ENABLE_LOAD_EVENT_LOGGING = false;
|
||||
public static final boolean DISABLE_LOADING_SAVES = false;
|
||||
// TODO: Make actual proper support for StarLight
|
||||
|
||||
public static class PrefEvent {
|
||||
//TODO: Make actual proper support for StarLight
|
||||
|
||||
public static class PrefEvent
|
||||
{
|
||||
long beginNano = 0;
|
||||
long emptyNano = 0;
|
||||
long structStartNano = 0;
|
||||
@@ -96,20 +105,27 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
long featureNano = 0;
|
||||
long lightNano = 0;
|
||||
long endNano = 0;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "beginNano: " + beginNano + ",\n" + "emptyNano: " + emptyNano + ",\n" + "structStartNano: "
|
||||
+ structStartNano + ",\n" + "structRefNano: " + structRefNano + ",\n" + "biomeNano: " + biomeNano
|
||||
+ ",\n" + "noiseNano: " + noiseNano + ",\n" + "surfaceNano: " + surfaceNano + ",\n" + "carverNano: "
|
||||
+ carverNano + ",\n" + "featureNano: " + featureNano + ",\n" + "lightNano: " + lightNano + ",\n"
|
||||
+ "endNano: " + endNano + "\n";
|
||||
public String toString()
|
||||
{
|
||||
return "beginNano: " + beginNano + ",\n" +
|
||||
"emptyNano: " + emptyNano + ",\n" +
|
||||
"structStartNano: " + structStartNano + ",\n" +
|
||||
"structRefNano: " + structRefNano + ",\n" +
|
||||
"biomeNano: " + biomeNano + ",\n" +
|
||||
"noiseNano: " + noiseNano + ",\n" +
|
||||
"surfaceNano: " + surfaceNano + ",\n" +
|
||||
"carverNano: " + carverNano + ",\n" +
|
||||
"featureNano: " + featureNano + ",\n" +
|
||||
"lightNano: " + lightNano + ",\n" +
|
||||
"endNano: " + endNano + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
public static class PerfCalculator {
|
||||
public static final int SIZE = 10;
|
||||
private int dataCount = 0;
|
||||
|
||||
public static class PerfCalculator
|
||||
{
|
||||
public static final int SIZE = 50;
|
||||
Rolling totalTime = new Rolling(SIZE);
|
||||
Rolling emptyTime = new Rolling(SIZE);
|
||||
Rolling structStartTime = new Rolling(SIZE);
|
||||
@@ -121,56 +137,65 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
Rolling featureTime = new Rolling(SIZE);
|
||||
Rolling lightTime = new Rolling(SIZE);
|
||||
Rolling lodTime = new Rolling(SIZE);
|
||||
|
||||
public void recordEvent(PrefEvent e) {
|
||||
dataCount++;
|
||||
|
||||
public void recordEvent(PrefEvent e)
|
||||
{
|
||||
long preTime = e.beginNano;
|
||||
totalTime.add(e.endNano - preTime);
|
||||
if (e.emptyNano != 0) {
|
||||
if (e.emptyNano != 0)
|
||||
{
|
||||
emptyTime.add(e.emptyNano - preTime);
|
||||
preTime = e.emptyNano;
|
||||
}
|
||||
if (e.structStartNano != 0) {
|
||||
if (e.structStartNano != 0)
|
||||
{
|
||||
structStartTime.add(e.structStartNano - preTime);
|
||||
preTime = e.structStartNano;
|
||||
}
|
||||
if (e.structRefNano != 0) {
|
||||
if (e.structRefNano != 0)
|
||||
{
|
||||
structRefTime.add(e.structRefNano - preTime);
|
||||
preTime = e.structRefNano;
|
||||
}
|
||||
if (e.biomeNano != 0) {
|
||||
if (e.biomeNano != 0)
|
||||
{
|
||||
biomeTime.add(e.biomeNano - preTime);
|
||||
preTime = e.biomeNano;
|
||||
}
|
||||
if (e.noiseNano != 0) {
|
||||
if (e.noiseNano != 0)
|
||||
{
|
||||
noiseTime.add(e.noiseNano - preTime);
|
||||
preTime = e.noiseNano;
|
||||
}
|
||||
if (e.surfaceNano != 0) {
|
||||
if (e.surfaceNano != 0)
|
||||
{
|
||||
surfaceTime.add(e.surfaceNano - preTime);
|
||||
preTime = e.surfaceNano;
|
||||
}
|
||||
if (e.carverNano != 0) {
|
||||
if (e.carverNano != 0)
|
||||
{
|
||||
carverTime.add(e.carverNano - preTime);
|
||||
preTime = e.carverNano;
|
||||
}
|
||||
if (e.featureNano != 0) {
|
||||
if (e.featureNano != 0)
|
||||
{
|
||||
featureTime.add(e.featureNano - preTime);
|
||||
preTime = e.featureNano;
|
||||
}
|
||||
if (e.lightNano != 0) {
|
||||
if (e.lightNano != 0)
|
||||
{
|
||||
lightTime.add(e.lightNano - preTime);
|
||||
preTime = e.lightNano;
|
||||
}
|
||||
if (e.endNano != 0) {
|
||||
if (e.endNano != 0)
|
||||
{
|
||||
lodTime.add(e.endNano - preTime);
|
||||
preTime = e.endNano;
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
if (dataCount < SIZE)
|
||||
return "Pref Calculator collecting samples...";
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "Total: " + Duration.ofNanos((long) totalTime.getAverage()) + ", Empty/LoadChunk: "
|
||||
+ Duration.ofNanos((long) emptyTime.getAverage()) + ", StructStart: "
|
||||
+ Duration.ofNanos((long) structStartTime.getAverage()) + ", StructRef: "
|
||||
@@ -184,40 +209,68 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
+ Duration.ofNanos((long) lodTime.getAverage());
|
||||
}
|
||||
}
|
||||
|
||||
public static final int TIMEOUT_SECONDS = 30;
|
||||
|
||||
// =================Generation Step===================
|
||||
|
||||
|
||||
public static final int TIMEOUT_SECONDS = 60;
|
||||
|
||||
//=================Generation Step===================
|
||||
|
||||
public final LinkedList<GenerationEvent> events = new LinkedList<GenerationEvent>();
|
||||
public final GlobalParameters params;
|
||||
public final StepStructureStart stepStructureStart = new StepStructureStart(this);
|
||||
public final StepStructureReference stepStructureReference = new StepStructureReference();
|
||||
public final StepStructureReference stepStructureReference = new StepStructureReference(this);
|
||||
public final StepBiomes stepBiomes = new StepBiomes(this);
|
||||
public final StepNoise stepNoise = new StepNoise(this);
|
||||
public final StepSurface stepSurface = new StepSurface(this);
|
||||
public final StepFeatures stepFeatures = new StepFeatures(this);
|
||||
public final StepLight stepLight = new StepLight(this);
|
||||
static private final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
|
||||
|
||||
public boolean unsafeThreadingRecorded = false;
|
||||
//public boolean safeMode = false;
|
||||
private static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
|
||||
private static final IMinecraftWrapper MC = SingletonHandler.get(IMinecraftWrapper.class);
|
||||
public static final long EXCEPTION_TIMER_RESET_TIME = TimeUnit.NANOSECONDS.convert(1, TimeUnit.SECONDS);
|
||||
public static final int EXCEPTION_COUNTER_TRIGGER = 20;
|
||||
public int unknownExceptionCount = 0;
|
||||
public long lastExceptionTriggerTime = 0;
|
||||
|
||||
public static final LodThreadFactory threadFactory = new LodThreadFactory("Gen-Worker-Thread", Thread.MIN_PRIORITY);
|
||||
|
||||
|
||||
public static ThreadLocal<Boolean> isDistantGeneratorThread = new ThreadLocal<Boolean>();
|
||||
|
||||
public static boolean isCurrentThreadDistantGeneratorThread() {
|
||||
return (isDistantGeneratorThread.get() != null);
|
||||
}
|
||||
|
||||
static {
|
||||
DependencySetupDoneCheck.getIsCurrentThreadDistantGeneratorThread = BatchGenerationEnvironment::isCurrentThreadDistantGeneratorThread;
|
||||
}
|
||||
|
||||
public ExecutorService executors = Executors.newFixedThreadPool(
|
||||
CONFIG.client().advanced().threading().getNumberOfWorldGenerationThreads(), threadFactory);
|
||||
|
||||
@Override
|
||||
public void resizeThreadPool(int newThreadCount) {
|
||||
public <T> T joinSync(CompletableFuture<T> f) {
|
||||
if (!unsafeThreadingRecorded && !f.isDone()) {
|
||||
MC.sendChatMessage("\u00A74\u00A7l\u00A7uERROR: Distant Horizons: Unsafe Threading in Chunk Generator Detected!");
|
||||
MC.sendChatMessage("\u00A7eTo increase stability, it is recommended to set world generation threads count to 1.");
|
||||
ClientApi.LOGGER.error("Unsafe Threading in Chunk Generator: ", new RuntimeException("Concurrent future"));
|
||||
unsafeThreadingRecorded = true;
|
||||
}
|
||||
return f.join();
|
||||
}
|
||||
|
||||
public void resizeThreadPool(int newThreadCount)
|
||||
{
|
||||
executors = Executors.newFixedThreadPool(newThreadCount,
|
||||
new LodThreadFactory("Gen-Worker-Thread", Thread.MIN_PRIORITY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryAddPoint(int px, int pz, int range, Steps target, boolean genAllDetails) {
|
||||
|
||||
public boolean tryAddPoint(int px, int pz, int range, Steps target, boolean genAllDetails)
|
||||
{
|
||||
int boxSize = range * 2 + 1;
|
||||
int x = Math.floorDiv(px, boxSize) * boxSize + range;
|
||||
int z = Math.floorDiv(pz, boxSize) * boxSize + range;
|
||||
|
||||
for (GenerationEvent event : events) {
|
||||
|
||||
for (GenerationEvent event : events)
|
||||
{
|
||||
if (event.tooClose(x, z, range))
|
||||
return false;
|
||||
}
|
||||
@@ -225,64 +278,108 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
events.add(new GenerationEvent(new ChunkPos(x, z), range, this, target, genAllDetails));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllFutures() {
|
||||
|
||||
public void updateAllFutures()
|
||||
{
|
||||
if (unknownExceptionCount > 0) {
|
||||
if (System.nanoTime() - lastExceptionTriggerTime >= EXCEPTION_TIMER_RESET_TIME) {
|
||||
unknownExceptionCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Update all current out standing jobs
|
||||
Iterator<GenerationEvent> iter = events.iterator();
|
||||
while (iter.hasNext()) {
|
||||
while (iter.hasNext())
|
||||
{
|
||||
GenerationEvent event = iter.next();
|
||||
if (event.isCompleted()) {
|
||||
try {
|
||||
if (event.isCompleted())
|
||||
{
|
||||
try
|
||||
{
|
||||
event.join();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
while (e.getCause() != null) {
|
||||
e = e.getCause();
|
||||
e.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
ClientApi.LOGGER.error("Batching World Generator: Event {} gotten an exception", event);
|
||||
ClientApi.LOGGER.error("Exception: ", e);
|
||||
unknownExceptionCount++;
|
||||
lastExceptionTriggerTime = System.nanoTime();
|
||||
}
|
||||
finally
|
||||
{
|
||||
iter.remove();
|
||||
}
|
||||
} else if (event.hasTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
|
||||
}
|
||||
else if (event.hasTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS))
|
||||
{
|
||||
ClientApi.LOGGER.error("Batching World Generator: " + event + " timed out and terminated!");
|
||||
ClientApi.LOGGER.info("Dump PrefEvent: " + event.pEvent);
|
||||
try {
|
||||
try
|
||||
{
|
||||
if (!event.terminate())
|
||||
ClientApi.LOGGER.error("Failed to terminate the stuck generation event!");
|
||||
} finally {
|
||||
}
|
||||
finally
|
||||
{
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (unknownExceptionCount > EXCEPTION_COUNTER_TRIGGER) {
|
||||
try {
|
||||
MC.sendChatMessage("\u00A74\u00A7l\u00A7uERROR: Distant Horizons: Too many exceptions in Batching World Generator! Disabling the generator.");
|
||||
} catch (Exception e) {}
|
||||
ClientApi.LOGGER.error("Too many exceptions in Batching World Generator! Now disabling.");
|
||||
unknownExceptionCount = 0;
|
||||
CONFIG.client().worldGenerator().setEnableDistantGeneration(false);
|
||||
}
|
||||
}
|
||||
|
||||
public BatchGenerationEnvironment(IWorldWrapper serverlevel, LodBuilder lodBuilder, LodDimension lodDim) {
|
||||
|
||||
public BatchGenerationEnvironment(IWorldWrapper serverlevel, LodBuilder lodBuilder, LodDimension lodDim)
|
||||
{
|
||||
super(serverlevel, lodBuilder, lodDim);
|
||||
ClientApi.LOGGER.info("================WORLD_GEN_STEP_INITING=============");
|
||||
ChunkGenerator generator = ((WorldWrapper) serverlevel).getServerWorld().getChunkSource().getGenerator();
|
||||
if (!(generator instanceof NoiseBasedChunkGenerator ||
|
||||
generator instanceof DebugLevelSource ||
|
||||
generator instanceof FlatLevelSource)) {
|
||||
MC.sendChatMessage("\u00A74\u00A7l\u00A7uWARNING: Distant Horizons: Unknown Chunk Generator Detected! Distant Generation May Fail!");
|
||||
MC.sendChatMessage("\u00A7eIf it does crash, set Distant Generation to OFF or Generation Mode to None.");
|
||||
ClientApi.LOGGER.warn("Unknown Chunk Generator detected: {}", generator.getClass());
|
||||
}
|
||||
params = new GlobalParameters((ServerLevel) ((WorldWrapper) serverlevel).getWorld(), lodBuilder, lodDim);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
private static ChunkAccess loadOrMakeChunk(ChunkPos chunkPos, ServerLevel level, LevelLightEngine lightEngine) {
|
||||
if (DISABLE_LOADING_SAVES) {
|
||||
return new ProtoChunk(chunkPos, UpgradeData.EMPTY);
|
||||
}
|
||||
public static ChunkAccess loadOrMakeChunk(ChunkPos chunkPos, ServerLevel level, LevelLightEngine lightEngine)
|
||||
{
|
||||
CompoundTag chunkData = null;
|
||||
try {
|
||||
try
|
||||
{
|
||||
chunkData = level.getChunkSource().chunkMap.readChunk(chunkPos);
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ClientApi.LOGGER.error("DistantHorizons: Couldn't load chunk {}", chunkPos, e);
|
||||
}
|
||||
if (chunkData == null) {
|
||||
return new ProtoChunk(chunkPos, UpgradeData.EMPTY);
|
||||
} else {
|
||||
return ChunkLoader.read(level, lightEngine, chunkPos, chunkData);
|
||||
if (chunkData == null)
|
||||
{
|
||||
return new ProtoChunk(chunkPos, UpgradeData.EMPTY, level, level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), null);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
try {
|
||||
return ChunkLoader.read(level, lightEngine, chunkPos, chunkData);
|
||||
} catch (Exception e) {
|
||||
ClientApi.LOGGER.error("DistantHorizons: Couldn't load chunk {}", chunkPos, e);
|
||||
return new ProtoChunk(chunkPos, UpgradeData.EMPTY, level, level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void generateLodFromList(GenerationEvent e) {
|
||||
|
||||
public void generateLodFromList(GenerationEvent e)
|
||||
{
|
||||
if (ENABLE_EVENT_LOGGING)
|
||||
ClientApi.LOGGER.info("Lod Generate Event: " + e.pos);
|
||||
e.pEvent.beginNano = System.nanoTime();
|
||||
@@ -291,52 +388,61 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
LightedWorldGenRegion region;
|
||||
WorldGenLevelLightEngine lightEngine;
|
||||
LightGetterAdaptor adaptor;
|
||||
|
||||
try {
|
||||
|
||||
try
|
||||
{
|
||||
adaptor = new LightGetterAdaptor(params.level);
|
||||
lightEngine = new WorldGenLevelLightEngine(adaptor);
|
||||
|
||||
|
||||
int cx = e.pos.x;
|
||||
int cy = e.pos.z;
|
||||
int rangeEmpty = e.range + 1;
|
||||
GridList<ChunkAccess> chunks = new GridList<ChunkAccess>(rangeEmpty);
|
||||
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
EmptyChunkGenerator generator = (int x, int z) -> {
|
||||
EmptyChunkGenerator generator = (int x, int z) ->
|
||||
{
|
||||
ChunkPos chunkPos = new ChunkPos(x, z);
|
||||
ChunkAccess target = null;
|
||||
try {
|
||||
try
|
||||
{
|
||||
target = loadOrMakeChunk(chunkPos, params.level, lightEngine);
|
||||
} catch (RuntimeException e2) {
|
||||
}
|
||||
catch (RuntimeException e2)
|
||||
{
|
||||
// Continue...
|
||||
e2.printStackTrace();
|
||||
}
|
||||
if (target == null)
|
||||
target = new ProtoChunk(chunkPos, UpgradeData.EMPTY);
|
||||
target = new ProtoChunk(chunkPos, UpgradeData.EMPTY, params.level,
|
||||
params.biomes, null);
|
||||
return target;
|
||||
};
|
||||
|
||||
for (int oy = -rangeEmpty; oy <= rangeEmpty; oy++) {
|
||||
for (int ox = -rangeEmpty; ox <= rangeEmpty; ox++) {
|
||||
|
||||
for (int oy = -rangeEmpty; oy <= rangeEmpty; oy++)
|
||||
{
|
||||
for (int ox = -rangeEmpty; ox <= rangeEmpty; ox++)
|
||||
{
|
||||
ChunkAccess target = generator.generate(cx + ox, cy + oy);
|
||||
chunks.add(target);
|
||||
}
|
||||
}
|
||||
e.pEvent.emptyNano = System.nanoTime();
|
||||
e.refreshTimeout();
|
||||
region = new LightedWorldGenRegion(params.level, lightEngine, e.tParam.structFeat, chunks,
|
||||
ChunkStatus.STRUCTURE_STARTS, rangeEmpty, e.lightMode, generator);
|
||||
region = new LightedWorldGenRegion(params.level, lightEngine, e.tParam.structFeat, chunks, ChunkStatus.STRUCTURE_STARTS, rangeEmpty, e.lightMode, generator);
|
||||
adaptor.setRegion(region);
|
||||
e.tParam.makeStructFeat(region);
|
||||
referencedChunks = chunks.subGrid(e.range);
|
||||
referencedChunks = generateDirect(e, referencedChunks, e.target, region);
|
||||
|
||||
} catch (StructStartCorruptedException f) {
|
||||
|
||||
}
|
||||
catch (StepStructureStart.StructStartCorruptedException f)
|
||||
{
|
||||
e.tParam.markAsInvalid();
|
||||
return;
|
||||
}
|
||||
|
||||
switch (e.target) {
|
||||
|
||||
switch (e.target)
|
||||
{
|
||||
case Empty:
|
||||
case StructureStart:
|
||||
case StructureReference:
|
||||
@@ -344,7 +450,6 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
break;
|
||||
case Biomes:
|
||||
generationMode = DistanceGenerationMode.BIOME_ONLY;
|
||||
break;
|
||||
case Noise:
|
||||
generationMode = DistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT;
|
||||
break;
|
||||
@@ -361,43 +466,71 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
return;
|
||||
}
|
||||
int centreIndex = referencedChunks.size() / 2;
|
||||
|
||||
for (int oy = -e.range; oy <= e.range; oy++) {
|
||||
for (int ox = -e.range; ox <= e.range; ox++) {
|
||||
|
||||
for (int oy = -e.range; oy <= e.range; oy++)
|
||||
{
|
||||
for (int ox = -e.range; ox <= e.range; ox++)
|
||||
{
|
||||
int targetIndex = referencedChunks.offsetOf(centreIndex, ox, oy);
|
||||
ChunkAccess target = referencedChunks.get(targetIndex);
|
||||
target.setLightCorrect(true);
|
||||
ChunkWrapper wrappedChunk = new ChunkWrapper(target, region);
|
||||
if (!wrappedChunk.isLightCorrect()) {
|
||||
throw new RuntimeException("The generated chunk somehow has isLightCorrect() returning false");
|
||||
}
|
||||
|
||||
boolean isFull = target.getStatus() == ChunkStatus.FULL || target instanceof LevelChunk;
|
||||
if (isFull) {
|
||||
boolean isPartial = target.isOldNoiseGeneration();
|
||||
if (isFull)
|
||||
{
|
||||
if (ENABLE_LOAD_EVENT_LOGGING)
|
||||
ClientApi.LOGGER.info("Detected full existing chunk at {}", target.getPos());
|
||||
params.lodBuilder.generateLodNodeFromChunk(params.lodDim, new ChunkWrapper(target, region),
|
||||
params.lodBuilder.generateLodNodeFromChunk(params.lodDim, wrappedChunk,
|
||||
new LodBuilderConfig(DistanceGenerationMode.FULL), true, e.genAllDetails);
|
||||
} else if (target.getStatus() == ChunkStatus.EMPTY && generationMode == DistanceGenerationMode.NONE) {
|
||||
params.lodBuilder.generateLodNodeFromChunk(params.lodDim, new ChunkWrapper(target, region),
|
||||
LodBuilderConfig.getFillVoidConfig(), true, e.genAllDetails);
|
||||
} else {
|
||||
params.lodBuilder.generateLodNodeFromChunk(params.lodDim, new ChunkWrapper(target, region),
|
||||
}
|
||||
else if (isPartial)
|
||||
{
|
||||
if (ENABLE_LOAD_EVENT_LOGGING)
|
||||
ClientApi.LOGGER.info("Detected old existing chunk at {}", target.getPos());
|
||||
params.lodBuilder.generateLodNodeFromChunk(params.lodDim, wrappedChunk,
|
||||
new LodBuilderConfig(generationMode), true, e.genAllDetails);
|
||||
}
|
||||
lightEngine.retainData(target.getPos(), false);
|
||||
else if (target.getStatus() == ChunkStatus.EMPTY && generationMode == DistanceGenerationMode.NONE)
|
||||
{
|
||||
params.lodBuilder.generateLodNodeFromChunk(params.lodDim,wrappedChunk,
|
||||
LodBuilderConfig.getFillVoidConfig(), true, e.genAllDetails);
|
||||
}
|
||||
else
|
||||
{
|
||||
params.lodBuilder.generateLodNodeFromChunk(params.lodDim, wrappedChunk,
|
||||
new LodBuilderConfig(generationMode), true, e.genAllDetails);
|
||||
}
|
||||
if (e.lightMode == LightGenerationMode.FANCY || isFull)
|
||||
{
|
||||
lightEngine.retainData(target.getPos(), false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
e.pEvent.endNano = System.nanoTime();
|
||||
e.refreshTimeout();
|
||||
if (ENABLE_PERF_LOGGING) {
|
||||
if (ENABLE_PERF_LOGGING)
|
||||
{
|
||||
e.tParam.perf.recordEvent(e.pEvent);
|
||||
ClientApi.LOGGER.info(e.tParam.perf);
|
||||
}
|
||||
}
|
||||
|
||||
GridList<ChunkAccess> generateDirect(GenerationEvent e, GridList<ChunkAccess> subRange, Steps step,
|
||||
LightedWorldGenRegion region) {
|
||||
try {
|
||||
subRange.forEach((chunk) -> {
|
||||
if (chunk instanceof ProtoChunk) {
|
||||
|
||||
public GridList<ChunkAccess> generateDirect(GenerationEvent e, GridList<ChunkAccess> subRange, Steps step,
|
||||
LightedWorldGenRegion region)
|
||||
{
|
||||
try
|
||||
{
|
||||
subRange.forEach((chunk) ->
|
||||
{
|
||||
if (chunk instanceof ProtoChunk)
|
||||
{
|
||||
((ProtoChunk) chunk).setLightEngine(region.getLightEngine());
|
||||
//region.getLightEngine().retainData(chunk.getPos(), true);
|
||||
region.getLightEngine().retainData(chunk.getPos(), true);
|
||||
}
|
||||
});
|
||||
if (step == Steps.Empty)
|
||||
@@ -433,15 +566,23 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
e.pEvent.featureNano = System.nanoTime();
|
||||
e.refreshTimeout();
|
||||
return subRange;
|
||||
} finally {
|
||||
switch (region.lightMode) {
|
||||
}
|
||||
finally
|
||||
{
|
||||
switch (region.lightMode)
|
||||
{
|
||||
case FANCY:
|
||||
stepLight.generateGroup(region.getLightEngine(), subRange);
|
||||
break;
|
||||
case FAST:
|
||||
subRange.forEach((p) -> {
|
||||
subRange.forEach((p) ->
|
||||
{
|
||||
if (p instanceof ProtoChunk)
|
||||
((ProtoChunk) p).setLightCorrect(true);
|
||||
if (p instanceof LevelChunk) {
|
||||
((LevelChunk) p).setLightCorrect(true);
|
||||
((LevelChunk) p).setClientLightReady(true);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -449,8 +590,9 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
e.refreshTimeout();
|
||||
}
|
||||
}
|
||||
|
||||
public interface EmptyChunkGenerator {
|
||||
|
||||
public interface EmptyChunkGenerator
|
||||
{
|
||||
ChunkAccess generate(int x, int z);
|
||||
}
|
||||
|
||||
@@ -463,14 +605,12 @@ public final class BatchGenerationEnvironment extends AbstractBatchGenerationEnv
|
||||
public void stop(boolean blocking) {
|
||||
ClientApi.LOGGER.info("Batch Chunk Generator shutting down...");
|
||||
executors.shutdownNow();
|
||||
if (blocking) {
|
||||
try {
|
||||
if (!executors.awaitTermination(10, TimeUnit.SECONDS)) {
|
||||
ClientApi.LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads...");
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
ClientApi.LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads...", e);
|
||||
if (blocking) try {
|
||||
if (!executors.awaitTermination(10, TimeUnit.SECONDS)) {
|
||||
ClientApi.LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads...");
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
ClientApi.LOGGER.error("Batch Chunk Generator shutdown failed! Ignoring child threads...", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
-25
@@ -1,3 +1,4 @@
|
||||
|
||||
package com.seibel.lod.common.wrappers.worldGeneration;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@@ -14,9 +15,10 @@ import com.seibel.lod.core.wrapperInterfaces.worldGeneration.AbstractBatchGenera
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
|
||||
//======================= Main Event class======================
|
||||
public final class GenerationEvent {
|
||||
public final class GenerationEvent
|
||||
{
|
||||
static private final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
|
||||
|
||||
|
||||
private static int generationFutureDebugIDs = 0;
|
||||
final ThreadedParameters tParam;
|
||||
final ChunkPos pos;
|
||||
@@ -28,8 +30,9 @@ public final class GenerationEvent {
|
||||
final LightGenerationMode lightMode;
|
||||
final PrefEvent pEvent = new PrefEvent();
|
||||
final boolean genAllDetails;
|
||||
|
||||
public GenerationEvent(ChunkPos pos, int range, BatchGenerationEnvironment generationGroup, Steps target, boolean genAllDetails) {
|
||||
|
||||
public GenerationEvent(ChunkPos pos, int range, BatchGenerationEnvironment generationGroup, Steps target, boolean genAllDetails)
|
||||
{
|
||||
nanotime = System.nanoTime();
|
||||
this.pos = pos;
|
||||
this.range = range;
|
||||
@@ -37,54 +40,70 @@ public final class GenerationEvent {
|
||||
this.target = target;
|
||||
this.tParam = ThreadedParameters.getOrMake(generationGroup.params);
|
||||
LightGenerationMode mode = CONFIG.client().worldGenerator().getLightGenerationMode();
|
||||
|
||||
|
||||
this.lightMode = mode;
|
||||
this.genAllDetails = genAllDetails;
|
||||
|
||||
future = generationGroup.executors.submit(() -> {
|
||||
generationGroup.generateLodFromList(this);
|
||||
|
||||
future = generationGroup.executors.submit(() ->
|
||||
{
|
||||
BatchGenerationEnvironment.isDistantGeneratorThread.set(true);
|
||||
try {
|
||||
generationGroup.generateLodFromList(this);
|
||||
} finally {
|
||||
BatchGenerationEnvironment.isDistantGeneratorThread.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isCompleted() {
|
||||
|
||||
public boolean isCompleted()
|
||||
{
|
||||
return future.isDone();
|
||||
}
|
||||
|
||||
public boolean hasTimeout(int duration, TimeUnit unit) {
|
||||
|
||||
public boolean hasTimeout(int duration, TimeUnit unit)
|
||||
{
|
||||
long currentTime = System.nanoTime();
|
||||
long delta = currentTime - nanotime;
|
||||
return (delta > TimeUnit.NANOSECONDS.convert(duration, unit));
|
||||
}
|
||||
|
||||
public boolean terminate() {
|
||||
|
||||
public boolean terminate()
|
||||
{
|
||||
future.cancel(true);
|
||||
ClientApi.LOGGER.info("======================DUMPING ALL THREADS FOR WORLD GEN=======================");
|
||||
BatchGenerationEnvironment.threadFactory.dumpAllThreadStacks();
|
||||
return future.isCancelled();
|
||||
}
|
||||
|
||||
public void join() {
|
||||
try {
|
||||
|
||||
public void join()
|
||||
{
|
||||
try
|
||||
{
|
||||
future.get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch (InterruptedException | ExecutionException e)
|
||||
{
|
||||
throw new RuntimeException(e.getCause()==null? e : e.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean tooClose(int cx, int cz, int cr) {
|
||||
|
||||
public boolean tooClose(int cx, int cz, int cr)
|
||||
{
|
||||
int distX = Math.abs(cx - pos.x);
|
||||
int distZ = Math.abs(cz - pos.z);
|
||||
int minRange = cr + range + 1; // Need one to account for the center
|
||||
minRange += 1 + 1; // Account for required empty chunks
|
||||
return distX < minRange && distZ < minRange;
|
||||
}
|
||||
|
||||
public void refreshTimeout() {
|
||||
|
||||
public void refreshTimeout()
|
||||
{
|
||||
nanotime = System.nanoTime();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
public String toString()
|
||||
{
|
||||
return id + ":" + range + "@" + pos + "(" + target + ")";
|
||||
}
|
||||
}
|
||||
+17
-5
@@ -1,8 +1,11 @@
|
||||
|
||||
package com.seibel.lod.common.wrappers.worldGeneration;
|
||||
|
||||
import com.mojang.datafixers.DataFixer;
|
||||
import com.seibel.lod.core.builders.lodBuilding.LodBuilder;
|
||||
import com.seibel.lod.core.objects.lod.LodDimension;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
@@ -10,14 +13,21 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ThreadedLevelLightEngine;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.BiomeManager;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.storage.ChunkScanAccess;
|
||||
import net.minecraft.world.level.levelgen.DebugLevelSource;
|
||||
import net.minecraft.world.level.levelgen.FlatLevelSource;
|
||||
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
||||
import net.minecraft.world.level.storage.WorldData;
|
||||
|
||||
public final class GlobalParameters {
|
||||
public final class GlobalParameters
|
||||
{
|
||||
public final ChunkGenerator generator;
|
||||
public final StructureManager structures;
|
||||
public final BiomeManager biomeManager;
|
||||
public final WorldGenSettings worldGenSettings;
|
||||
public final ThreadedLevelLightEngine lightEngine;
|
||||
public final LodBuilder lodBuilder;
|
||||
@@ -25,10 +35,12 @@ public final class GlobalParameters {
|
||||
public final Registry<Biome> biomes;
|
||||
public final RegistryAccess registry;
|
||||
public final long worldSeed;
|
||||
public final ChunkScanAccess chunkScanner;
|
||||
public final ServerLevel level; // TODO: Figure out a way to remove this. Maybe ClientLevel also works?
|
||||
public final DataFixer fixerUpper;
|
||||
|
||||
public GlobalParameters(ServerLevel level, LodBuilder lodBuilder, LodDimension lodDim) {
|
||||
|
||||
public GlobalParameters(ServerLevel level, LodBuilder lodBuilder, LodDimension lodDim)
|
||||
{
|
||||
this.lodBuilder = lodBuilder;
|
||||
this.lodDim = lodDim;
|
||||
this.level = level;
|
||||
@@ -39,10 +51,10 @@ public final class GlobalParameters {
|
||||
registry = server.registryAccess();
|
||||
biomes = registry.registryOrThrow(Registry.BIOME_REGISTRY);
|
||||
worldSeed = worldGenSettings.seed();
|
||||
// biomeManager = new BiomeManager(level,
|
||||
// BiomeManager.obfuscateSeed(worldSeed));
|
||||
biomeManager = new BiomeManager(level, BiomeManager.obfuscateSeed(worldSeed));
|
||||
structures = server.getStructureManager();
|
||||
generator = level.getChunkSource().getGenerator();
|
||||
chunkScanner = level.getChunkSource().chunkScanner();
|
||||
fixerUpper = server.getFixerUpper();
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,34 @@
|
||||
|
||||
package com.seibel.lod.common.wrappers.worldGeneration;
|
||||
|
||||
//FIXME: Move this outside the WorldGenerationStep thingy
|
||||
public class Rolling {
|
||||
|
||||
public class Rolling
|
||||
{
|
||||
|
||||
private final int size;
|
||||
private double total = 0d;
|
||||
private int index = 0;
|
||||
private final double[] samples;
|
||||
|
||||
public Rolling(int size) {
|
||||
|
||||
public Rolling(int size)
|
||||
{
|
||||
this.size = size;
|
||||
samples = new double[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
samples[i] = 0d;
|
||||
}
|
||||
|
||||
public void add(double x) {
|
||||
|
||||
public void add(double x)
|
||||
{
|
||||
total -= samples[index];
|
||||
samples[index] = x;
|
||||
total += x;
|
||||
if (++index == size)
|
||||
index = 0; // cheaper than modulus
|
||||
}
|
||||
|
||||
public double getAverage() {
|
||||
|
||||
public double getAverage()
|
||||
{
|
||||
return total / size;
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
package com.seibel.lod.common.wrappers.worldGeneration;
|
||||
|
||||
public class StructStartCorruptedException extends RuntimeException {
|
||||
private static final long serialVersionUID = -8987434342051563358L;
|
||||
|
||||
public StructStartCorruptedException(ArrayIndexOutOfBoundsException e) {
|
||||
super("StructStartCorruptedException");
|
||||
super.initCause(e);
|
||||
fillInStackTrace();
|
||||
}
|
||||
}
|
||||
+21
-11
@@ -1,3 +1,4 @@
|
||||
|
||||
package com.seibel.lod.common.wrappers.worldGeneration;
|
||||
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment.PerfCalculator;
|
||||
@@ -5,16 +6,19 @@ import com.seibel.lod.common.wrappers.worldGeneration.mimicObject.WorldGenStruct
|
||||
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureCheck;
|
||||
|
||||
public final class ThreadedParameters {
|
||||
public final class ThreadedParameters
|
||||
{
|
||||
private static final ThreadLocal<ThreadedParameters> localParam = new ThreadLocal<ThreadedParameters>();
|
||||
final ServerLevel level;
|
||||
public final WorldGenStructFeatManager structFeat;
|
||||
public final StructureCheck structCheck;
|
||||
boolean isValid = true;
|
||||
public final PerfCalculator perf = new PerfCalculator();
|
||||
|
||||
public static ThreadedParameters getOrMake(GlobalParameters param) {
|
||||
|
||||
public static ThreadedParameters getOrMake(GlobalParameters param)
|
||||
{
|
||||
ThreadedParameters tParam = localParam.get();
|
||||
if (tParam != null && tParam.isValid && tParam.level == param.level)
|
||||
return tParam;
|
||||
@@ -22,17 +26,23 @@ public final class ThreadedParameters {
|
||||
localParam.set(tParam);
|
||||
return tParam;
|
||||
}
|
||||
|
||||
public void markAsInvalid() {
|
||||
|
||||
public void markAsInvalid()
|
||||
{
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
private ThreadedParameters(GlobalParameters param) {
|
||||
|
||||
private ThreadedParameters(GlobalParameters param)
|
||||
{
|
||||
level = param.level;
|
||||
structFeat = new WorldGenStructFeatManager(level, param.worldGenSettings, null);
|
||||
structCheck = new StructureCheck(param.chunkScanner, param.registry, param.structures,
|
||||
param.level.dimension(), param.generator, level, param.generator.getBiomeSource(), param.worldSeed,
|
||||
param.fixerUpper);
|
||||
structFeat = new WorldGenStructFeatManager(level, param.worldGenSettings, null, structCheck);
|
||||
}
|
||||
|
||||
public void makeStructFeat(WorldGenLevel genLevel) {
|
||||
|
||||
public void makeStructFeat(WorldGenLevel genLevel)
|
||||
{
|
||||
structFeat.setGenLevel(genLevel);
|
||||
}
|
||||
}
|
||||
+72
-63
@@ -1,63 +1,72 @@
|
||||
package com.seibel.lod.common.wrappers.worldGeneration;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
package com.seibel.lod.common.wrappers.worldGeneration;
|
||||
|
||||
import com.seibel.lod.core.builders.lodBuilding.LodBuilder;
|
||||
import com.seibel.lod.core.builders.lodBuilding.LodBuilderConfig;
|
||||
import com.seibel.lod.core.enums.config.DistanceGenerationMode;
|
||||
import com.seibel.lod.core.objects.lod.LodDimension;
|
||||
//import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
|
||||
//import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IWorldWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.worldGeneration.AbstractWorldGeneratorWrapper;
|
||||
|
||||
import com.seibel.lod.common.wrappers.chunk.ChunkWrapper;
|
||||
import com.seibel.lod.common.wrappers.world.WorldWrapper;
|
||||
|
||||
import net.minecraft.server.level.ChunkHolder;
|
||||
import net.minecraft.server.level.ServerChunkCache;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.chunk.*;
|
||||
/* */
|
||||
/* */ import net.minecraft.server.level.ServerLevel;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
* @version 11-13-2021
|
||||
*/
|
||||
public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper {
|
||||
public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
|
||||
{
|
||||
public final ServerLevel serverWorld;
|
||||
public final LodDimension lodDim;
|
||||
public final LodBuilder lodBuilder;
|
||||
|
||||
public WorldGeneratorWrapper(LodBuilder newLodBuilder, LodDimension newLodDimension, IWorldWrapper worldWrapper) {
|
||||
|
||||
public WorldGeneratorWrapper(LodBuilder newLodBuilder, LodDimension newLodDimension, IWorldWrapper worldWrapper)
|
||||
{
|
||||
super(newLodBuilder, newLodDimension, worldWrapper);
|
||||
|
||||
|
||||
lodBuilder = newLodBuilder;
|
||||
lodDim = newLodDimension;
|
||||
serverWorld = ((WorldWrapper) worldWrapper).getServerWorld();
|
||||
}
|
||||
|
||||
|
||||
/** takes about 2-5 ms */
|
||||
@Override
|
||||
public void generateBiomesOnly(AbstractChunkPosWrapper pos, DistanceGenerationMode generationMode) {
|
||||
public void generateBiomesOnly(AbstractChunkPosWrapper pos, DistanceGenerationMode generationMode)
|
||||
{
|
||||
generate(pos.getX(), pos.getZ(), generationMode);
|
||||
}
|
||||
|
||||
|
||||
/** takes about 10 - 20 ms */
|
||||
@Override
|
||||
public void generateSurface(AbstractChunkPosWrapper pos) {
|
||||
public void generateSurface(AbstractChunkPosWrapper pos)
|
||||
{
|
||||
generate(pos.getX(), pos.getZ(), DistanceGenerationMode.SURFACE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* takes about 15 - 20 ms
|
||||
* <p>
|
||||
*/
|
||||
@Override
|
||||
public void generateFeatures(AbstractChunkPosWrapper pos) {
|
||||
public void generateFeatures(AbstractChunkPosWrapper pos)
|
||||
{
|
||||
generate(pos.getX(), pos.getZ(), DistanceGenerationMode.FEATURES);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates using MC's ServerWorld.
|
||||
* <p>
|
||||
@@ -70,18 +79,19 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper {
|
||||
* (Higher lag for generating than loading)
|
||||
*/
|
||||
@Override
|
||||
public void generateFull(AbstractChunkPosWrapper pos) {
|
||||
public void generateFull(AbstractChunkPosWrapper pos)
|
||||
{
|
||||
generate(pos.getX(), pos.getZ(), DistanceGenerationMode.FULL);
|
||||
}
|
||||
|
||||
private void generate(int chunkX, int chunkZ, DistanceGenerationMode generationMode) {
|
||||
|
||||
// long t = System.nanoTime();
|
||||
|
||||
|
||||
private void generate(int chunkX, int chunkZ, DistanceGenerationMode generationMode)
|
||||
{
|
||||
|
||||
// long t = System.nanoTime();
|
||||
|
||||
ChunkStatus targetStatus;
|
||||
switch (generationMode) {
|
||||
case NONE:
|
||||
return;
|
||||
switch (generationMode)
|
||||
{
|
||||
case BIOME_ONLY:
|
||||
targetStatus = ChunkStatus.BIOMES;
|
||||
break;
|
||||
@@ -97,48 +107,47 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper {
|
||||
case FULL:
|
||||
targetStatus = ChunkStatus.FULL;
|
||||
break;
|
||||
case NONE:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// The bool=true means that we wants to generate chunk, and that the returned
|
||||
// ChunkAccess must not be null
|
||||
|
||||
|
||||
// The bool=true means that we wants to generate chunk, and that the returned ChunkAccess must not be null
|
||||
ChunkAccess ca = serverWorld.getChunkSource().getChunk(chunkX, chunkZ, targetStatus, true);
|
||||
if (ca == null)
|
||||
throw new RuntimeException("This should NEVER be null due to bool being true");
|
||||
lodBuilder.generateLodNodeFromChunk(lodDim, new ChunkWrapper(ca, serverWorld),
|
||||
new LodBuilderConfig(generationMode), false, true);
|
||||
|
||||
lodBuilder.generateLodNodeFromChunk(lodDim, new ChunkWrapper(ca, serverWorld), new LodBuilderConfig(generationMode), false, true);
|
||||
|
||||
// long duration = System.nanoTime()-t;
|
||||
|
||||
|
||||
// Debug print the duration
|
||||
// System.out.println("LodChunkGenFull["+chunkX+","+chunkZ+"]:
|
||||
// "+(double)(duration)/1000.);
|
||||
// System.out.println("LodChunkGenFull["+chunkX+","+chunkZ+"]: "+(double)(duration)/1000.);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: Ask leetom to update chart performance/generation tests related to
|
||||
|
||||
/* TODO: Update this chart
|
||||
* performance/generation tests related to
|
||||
* serverWorld.getChunk(x, z, ChunkStatus. *** )
|
||||
*
|
||||
* true/false is whether they generated blocks or not the time is how long it
|
||||
* took to generate
|
||||
*
|
||||
* ChunkStatus.EMPTY 0 - 1 ms false (empty, what did you expect? :P)
|
||||
* ChunkStatus.STRUCTURE_REFERENCES 1 - 2 ms false (no height, only generates
|
||||
* some chunks) ChunkStatus.BIOMES 1 - 10 ms false (no height) ChunkStatus.NOISE
|
||||
* 4 - 15 ms true (all blocks are stone) ChunkStatus.LIQUID_CARVERS 6 - 12 ms
|
||||
* true (no snow/trees, just grass) ChunkStatus.SURFACE 5 - 15 ms true (no
|
||||
* snow/trees, just grass) ChunkStatus.CARVERS 5 - 30 ms true (no snow/trees,
|
||||
* just grass) ChunkStatus.FEATURES 7 - 25 ms true ChunkStatus.HEIGHTMAPS 20 -
|
||||
* 40 ms true ChunkStatus.LIGHT 20 - 40 ms true ChunkStatus.FULL 30 - 50 ms true
|
||||
* ChunkStatus.SPAWN 50 - 80 ms true
|
||||
*
|
||||
*
|
||||
* At this point I would suggest using FEATURES, as it generates snow and trees
|
||||
* (and any other object that are needed to make biomes distinct)
|
||||
*
|
||||
* Otherwise, if snow/trees aren't necessary SURFACE is the next fastest
|
||||
* (although not by much)
|
||||
|
||||
true/false is whether they generated blocks or not
|
||||
the time is how long it took to generate
|
||||
|
||||
ChunkStatus.EMPTY 0 - 1 ms false (empty, what did you expect? :P)
|
||||
ChunkStatus.STRUCTURE_REFERENCES 1 - 2 ms false (no height, only generates some chunks)
|
||||
ChunkStatus.BIOMES 1 - 10 ms false (no height)
|
||||
ChunkStatus.NOISE 4 - 15 ms true (all blocks are stone)
|
||||
ChunkStatus.LIQUID_CARVERS 6 - 12 ms true (no snow/trees, just grass)
|
||||
ChunkStatus.SURFACE 5 - 15 ms true (no snow/trees, just grass)
|
||||
ChunkStatus.CARVERS 5 - 30 ms true (no snow/trees, just grass)
|
||||
ChunkStatus.FEATURES 7 - 25 ms true
|
||||
ChunkStatus.HEIGHTMAPS 20 - 40 ms true
|
||||
ChunkStatus.LIGHT 20 - 40 ms true
|
||||
ChunkStatus.FULL 30 - 50 ms true
|
||||
ChunkStatus.SPAWN 50 - 80 ms true
|
||||
|
||||
At this point I would suggest using FEATURES, as it generates snow and trees
|
||||
(and any other object that are needed to make biomes distinct)
|
||||
|
||||
Otherwise, if snow/trees aren't necessary SURFACE is the next fastest (although not by much)
|
||||
*/
|
||||
}
|
||||
}
|
||||
+199
-101
@@ -1,149 +1,247 @@
|
||||
|
||||
package com.seibel.lod.common.wrappers.worldGeneration.mimicObject;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.Dynamic;
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
|
||||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||
import it.unimi.dsi.fastutil.longs.LongSet;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.SectionPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.ChunkTickList;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.level.TickList;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biomes;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.chunk.ChunkBiomeContainer;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.DataLayer;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.chunk.ProtoTickList;
|
||||
import net.minecraft.world.level.chunk.PalettedContainer;
|
||||
import net.minecraft.world.level.chunk.UpgradeData;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
import net.minecraft.world.level.levelgen.blending.BlendingData;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
||||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
|
||||
import net.minecraft.world.ticks.LevelChunkTicks;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class ChunkLoader {
|
||||
public class ChunkLoader
|
||||
{
|
||||
private static final Codec<PalettedContainer<BlockState>> BLOCK_STATE_CODEC = PalettedContainer.codec(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState());
|
||||
private static final Logger LOGGER = ClientApi.LOGGER;
|
||||
|
||||
private static LevelChunkSection[] readSections(WorldGenLevel level, LevelLightEngine lightEngine,
|
||||
ChunkPos chunkPos, CompoundTag tagLevel) {
|
||||
boolean isLightOn = tagLevel.getBoolean("isLightOn");
|
||||
ListTag listTag = tagLevel.getList("Sections", 10);
|
||||
LevelChunkSection[] levelChunkSections = new LevelChunkSection[16];
|
||||
boolean bl2 = level.getLevel().dimensionType().hasSkyLight();
|
||||
if (isLightOn)
|
||||
lightEngine.retainData(chunkPos, true);
|
||||
for (int j = 0; j < listTag.size(); j++) {
|
||||
CompoundTag compoundTag3 = listTag.getCompound(j);
|
||||
int k = compoundTag3.getByte("Y");
|
||||
if (compoundTag3.contains("Palette", 9) && compoundTag3.contains("BlockStates", 12)) {
|
||||
LevelChunkSection levelChunkSection = new LevelChunkSection(k << 4);
|
||||
levelChunkSection.getStates().read(compoundTag3.getList("Palette", 10),
|
||||
compoundTag3.getLongArray("BlockStates"));
|
||||
levelChunkSection.recalcBlockCounts();
|
||||
if (!levelChunkSection.isEmpty())
|
||||
levelChunkSections[k] = levelChunkSection;
|
||||
}
|
||||
if (isLightOn) {
|
||||
if (compoundTag3.contains("BlockLight", 7))
|
||||
lightEngine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkPos, k),
|
||||
new DataLayer(compoundTag3.getByteArray("BlockLight")), true);
|
||||
if (bl2 && compoundTag3.contains("SkyLight", 7))
|
||||
lightEngine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkPos, k),
|
||||
new DataLayer(compoundTag3.getByteArray("SkyLight")), true);
|
||||
}
|
||||
private static final String TAG_UPGRADE_DATA = "UpgradeData";
|
||||
private static final String BLOCK_TICKS_TAG = "block_ticks";
|
||||
private static final String FLUID_TICKS_TAG = "fluid_ticks";
|
||||
|
||||
private static BlendingData readBlendingData(CompoundTag chunkData)
|
||||
{
|
||||
BlendingData blendingData = null;
|
||||
if (chunkData.contains("blending_data", 10))
|
||||
{
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
Dynamic<CompoundTag> blendingDataTag = new Dynamic(NbtOps.INSTANCE, chunkData.getCompound("blending_data"));
|
||||
blendingData = BlendingData.CODEC.parse(blendingDataTag).resultOrPartial(LOGGER::error).orElse(null);
|
||||
}
|
||||
return levelChunkSections;
|
||||
return blendingData;
|
||||
}
|
||||
|
||||
private static void readHeightmaps(LevelChunk chunk, CompoundTag chunkData) {
|
||||
|
||||
private static LevelChunkSection[] readSections(LevelAccessor level, LevelLightEngine lightEngine, ChunkPos chunkPos, CompoundTag chunkData)
|
||||
{
|
||||
Registry<Biome> biomes = level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY);
|
||||
Codec<PalettedContainer<Biome>> biomeCodec = PalettedContainer.codec(
|
||||
biomes, biomes.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getOrThrow(Biomes.PLAINS));
|
||||
|
||||
int i = level.getSectionsCount();
|
||||
LevelChunkSection[] chunkSections = new LevelChunkSection[i];
|
||||
|
||||
boolean isLightOn = chunkData.getBoolean("isLightOn");
|
||||
boolean hasSkyLight = level.dimensionType().hasSkyLight();
|
||||
ListTag tagSections = chunkData.getList("sections", 10);
|
||||
|
||||
for (int j = 0; j < tagSections.size(); ++j)
|
||||
{
|
||||
CompoundTag tagSection = tagSections.getCompound(j);
|
||||
byte sectionYPos = tagSection.getByte("Y");
|
||||
int sectionId = level.getSectionIndexFromSectionY(sectionYPos);
|
||||
if (sectionId >= 0 && sectionId < chunkSections.length)
|
||||
{
|
||||
PalettedContainer<BlockState> blockStateContainer;
|
||||
PalettedContainer<Biome> biomeContainer;
|
||||
|
||||
blockStateContainer = tagSection.contains("block_states", 10)
|
||||
? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error)
|
||||
: new PalettedContainer<BlockState>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES);
|
||||
|
||||
biomeContainer = tagSection.contains("biomes", 10)
|
||||
? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error)
|
||||
: new PalettedContainer<Biome>(biomes, biomes.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
|
||||
|
||||
chunkSections[sectionId] = new LevelChunkSection(sectionYPos, blockStateContainer, biomeContainer);
|
||||
}
|
||||
|
||||
if (!isLightOn)
|
||||
continue;
|
||||
|
||||
if (tagSection.contains("BlockLight", 7))
|
||||
lightEngine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkPos, sectionYPos), new DataLayer(tagSection.getByteArray("BlockLight")), true);
|
||||
if (hasSkyLight && tagSection.contains("SkyLight", 7))
|
||||
lightEngine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkPos, sectionYPos), new DataLayer(tagSection.getByteArray("SkyLight")), true);
|
||||
}
|
||||
return chunkSections;
|
||||
}
|
||||
|
||||
private static void readHeightmaps(LevelChunk chunk, CompoundTag chunkData)
|
||||
{
|
||||
CompoundTag tagHeightmaps = chunkData.getCompound("Heightmaps");
|
||||
for (Heightmap.Types type : ChunkStatus.FULL.heightmapsAfter()) {
|
||||
for (Heightmap.Types type : ChunkStatus.FULL.heightmapsAfter())
|
||||
{
|
||||
String heightmap = type.getSerializationKey();
|
||||
if (tagHeightmaps.contains(heightmap, 12))
|
||||
chunk.setHeightmap(type, tagHeightmaps.getLongArray(heightmap));
|
||||
}
|
||||
Heightmap.primeHeightmaps(chunk, ChunkStatus.FULL.heightmapsAfter());
|
||||
}
|
||||
|
||||
private static void readPostPocessings(LevelChunk chunk, CompoundTag chunkData) {
|
||||
|
||||
private static Map<StructureFeature<?>, StructureStart<?>> unpackStructureStart(StructurePieceSerializationContext structurePieceSerializationContext, CompoundTag compoundTag, long l)
|
||||
{
|
||||
HashMap<StructureFeature<?>, StructureStart<?>> map = Maps.newHashMap();
|
||||
CompoundTag compoundTag2 = compoundTag.getCompound("starts");
|
||||
for (String string : compoundTag2.getAllKeys())
|
||||
{
|
||||
String string2 = string.toLowerCase(Locale.ROOT);
|
||||
StructureFeature<?> structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(string2);
|
||||
if (structureFeature == null)
|
||||
{
|
||||
LOGGER.error("Unknown structure start: {}", (Object) string2);
|
||||
continue;
|
||||
}
|
||||
StructureStart<?> structureStart = StructureFeature.loadStaticStart(structurePieceSerializationContext, compoundTag2.getCompound(string), l);
|
||||
if (structureStart == null)
|
||||
continue;
|
||||
map.put(structureFeature, structureStart);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private static Map<StructureFeature<?>, LongSet> unpackStructureReferences(ChunkPos chunkPos, CompoundTag compoundTag)
|
||||
{
|
||||
HashMap<StructureFeature<?>, LongSet> map = Maps.newHashMap();
|
||||
CompoundTag compoundTag2 = compoundTag.getCompound("References");
|
||||
for (String string : compoundTag2.getAllKeys())
|
||||
{
|
||||
String string2 = string.toLowerCase(Locale.ROOT);
|
||||
StructureFeature<?> structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(string2);
|
||||
if (structureFeature == null)
|
||||
{
|
||||
LOGGER.warn("Found reference to unknown structure '{}' in chunk {}, discarding", (Object) string2, (Object) chunkPos);
|
||||
continue;
|
||||
}
|
||||
map.put(structureFeature, new LongOpenHashSet(Arrays.stream(compoundTag2.getLongArray(string)).filter(l ->
|
||||
{
|
||||
ChunkPos chunkPos2 = new ChunkPos(l);
|
||||
if (chunkPos2.getChessboardDistance(chunkPos) > 8)
|
||||
{
|
||||
LOGGER.warn("Found invalid structure reference [ {} @ {} ] for chunk {}.", (Object) string2, (Object) chunkPos2, (Object) chunkPos);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}).toArray()));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private static void readStructures(WorldGenLevel level, LevelChunk chunk, CompoundTag chunkData)
|
||||
{
|
||||
CompoundTag tagStructures = chunkData.getCompound("structures");
|
||||
chunk.setAllStarts(
|
||||
unpackStructureStart(StructurePieceSerializationContext.fromLevel(level.getLevel()), tagStructures, level.getSeed()));
|
||||
chunk.setAllReferences(unpackStructureReferences(chunk.getPos(), tagStructures));
|
||||
}
|
||||
|
||||
private static void readPostPocessings(LevelChunk chunk, CompoundTag chunkData)
|
||||
{
|
||||
ListTag tagPostProcessings = chunkData.getList("PostProcessing", 9);
|
||||
for (int n = 0; n < tagPostProcessings.size(); ++n) {
|
||||
for (int n = 0; n < tagPostProcessings.size(); ++n)
|
||||
{
|
||||
ListTag listTag3 = tagPostProcessings.getList(n);
|
||||
for (int o = 0; o < listTag3.size(); ++o) {
|
||||
for (int o = 0; o < listTag3.size(); ++o)
|
||||
{
|
||||
chunk.addPackedPostProcess(listTag3.getShort(o), n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ChunkStatus.ChunkType readChunkType(CompoundTag tagLevel) {
|
||||
ChunkStatus chunkStatus = ChunkStatus.byName(tagLevel.getString("Status"));
|
||||
if (chunkStatus != null) {
|
||||
return chunkStatus.getChunkType();
|
||||
}
|
||||
return ChunkStatus.ChunkType.PROTOCHUNK;
|
||||
|
||||
public static ChunkStatus.ChunkType readChunkType(CompoundTag compoundTag)
|
||||
{
|
||||
return ChunkStatus.byName(compoundTag.getString("Status")).getChunkType();
|
||||
}
|
||||
|
||||
public static LevelChunk read(WorldGenLevel level, LevelLightEngine lightEngine, ChunkPos chunkPos,
|
||||
CompoundTag chunkData) {
|
||||
CompoundTag tagLevel = chunkData.getCompound("Level");
|
||||
|
||||
ChunkStatus.ChunkType chunkType = readChunkType(tagLevel);
|
||||
if (chunkType != ChunkStatus.ChunkType.LEVELCHUNK)
|
||||
return null;
|
||||
|
||||
ChunkPos actualPos = new ChunkPos(tagLevel.getInt("xPos"), tagLevel.getInt("zPos"));
|
||||
if (!Objects.equals(chunkPos, actualPos)) {
|
||||
LOGGER.error("Distant Horizons: Chunk file at {} is in the wrong location; Ignoring. (Expected {}, got {})",
|
||||
(Object) chunkPos, (Object) chunkPos, (Object) actualPos);
|
||||
|
||||
public static LevelChunk read(WorldGenLevel level, LevelLightEngine lightEngine, ChunkPos chunkPos, CompoundTag chunkData)
|
||||
{
|
||||
|
||||
ChunkPos actualPos = new ChunkPos(chunkData.getInt("xPos"), chunkData.getInt("zPos"));
|
||||
if (!Objects.equals(chunkPos, actualPos))
|
||||
{
|
||||
LOGGER.error("Distant Horizons: Chunk file at {} is in the wrong location; Ignoring. (Expected {}, got {})", (Object) chunkPos, (Object) chunkPos, (Object) actualPos);
|
||||
return null;
|
||||
}
|
||||
|
||||
// ====================== Read params for making the LevelChunk
|
||||
// ============================
|
||||
|
||||
ChunkBiomeContainer chunkBiomeContainer = new ChunkBiomeContainer(
|
||||
level.getLevel().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), chunkPos,
|
||||
level.getLevel().getChunkSource().getGenerator().getBiomeSource(),
|
||||
tagLevel.contains("Biomes", 11) ? tagLevel.getIntArray("Biomes") : null);
|
||||
|
||||
UpgradeData upgradeData = tagLevel.contains("UpgradeData", 10)
|
||||
? new UpgradeData(tagLevel.getCompound("UpgradeData"))
|
||||
|
||||
ChunkStatus.ChunkType chunkType = readChunkType(chunkData);
|
||||
BlendingData blendingData = readBlendingData(chunkData);
|
||||
if (chunkType == ChunkStatus.ChunkType.PROTOCHUNK && (blendingData == null || !blendingData.oldNoise()))
|
||||
return null;
|
||||
|
||||
// Prepare the light engine
|
||||
boolean isLightOn = chunkData.getBoolean("isLightOn");
|
||||
if (isLightOn)
|
||||
level.getLightEngine().retainData(chunkPos, true);
|
||||
|
||||
// Read params for making the LevelChunk
|
||||
UpgradeData upgradeData = chunkData.contains(TAG_UPGRADE_DATA, 10)
|
||||
? new UpgradeData(chunkData.getCompound(TAG_UPGRADE_DATA), level)
|
||||
: UpgradeData.EMPTY;
|
||||
|
||||
TickList<Block> blockTicks = tagLevel.contains("TileTicks", 9)
|
||||
? ChunkTickList.create(tagLevel.getList("TileTicks", 10), Registry.BLOCK::getKey, Registry.BLOCK::get)
|
||||
: new ProtoTickList<Block>(block -> (block == null || block.defaultBlockState().isAir()), chunkPos,
|
||||
tagLevel.getList("ToBeTicked", 9));
|
||||
|
||||
TickList<Fluid> liquidTicks = tagLevel.contains("LiquidTicks", 9)
|
||||
? ChunkTickList.create(tagLevel.getList("LiquidTicks", 10), Registry.FLUID::getKey, Registry.FLUID::get)
|
||||
: new ProtoTickList<Fluid>(fluid -> (fluid == null || fluid == Fluids.EMPTY), chunkPos,
|
||||
tagLevel.getList("LiquidsToBeTicked", 9));
|
||||
|
||||
long inhabitedTime = tagLevel.getLong("InhabitedTime");
|
||||
|
||||
LevelChunkSection[] levelChunkSections = readSections(level, lightEngine, chunkPos, tagLevel);
|
||||
|
||||
// ======================== Make the chunk
|
||||
// ===========================================
|
||||
LevelChunk chunk = new LevelChunk(level.getLevel(), chunkPos, chunkBiomeContainer, upgradeData, blockTicks,
|
||||
liquidTicks, inhabitedTime, levelChunkSections, null);
|
||||
|
||||
// ========================== Post setup some chunk data
|
||||
// ==============================
|
||||
chunk.setLightCorrect(tagLevel.getBoolean("isLightOn"));
|
||||
readHeightmaps(chunk, tagLevel);
|
||||
readPostPocessings(chunk, tagLevel);
|
||||
// ClientApi.LOGGER.info("Loaded chunk @ "+chunk.getPos());
|
||||
LevelChunkTicks<Block> blockTicks = LevelChunkTicks.load(chunkData.getList(BLOCK_TICKS_TAG, 10),
|
||||
string -> Registry.BLOCK.getOptional(ResourceLocation.tryParse(string)), chunkPos);
|
||||
LevelChunkTicks<Fluid> fluidTicks = LevelChunkTicks.load(chunkData.getList(FLUID_TICKS_TAG, 10),
|
||||
string -> Registry.FLUID.getOptional(ResourceLocation.tryParse(string)), chunkPos);
|
||||
long inhabitedTime = chunkData.getLong("InhabitedTime");
|
||||
LevelChunkSection[] chunkSections = readSections(level, lightEngine, actualPos, chunkData);
|
||||
|
||||
// Make chunk
|
||||
LevelChunk chunk = new LevelChunk((Level) level, chunkPos, upgradeData, blockTicks, fluidTicks, inhabitedTime, chunkSections, null, blendingData);
|
||||
|
||||
// Set some states after object creation
|
||||
chunk.setLightCorrect(isLightOn);
|
||||
readHeightmaps(chunk, chunkData);
|
||||
readStructures(level, chunk, chunkData);
|
||||
readPostPocessings(chunk, chunkData);
|
||||
return chunk;
|
||||
}
|
||||
|
||||
private static void logErrors(ChunkPos chunkPos, int i, String string)
|
||||
{
|
||||
LOGGER.error("Distant Horizons: Recoverable errors when loading section [" + chunkPos.x + ", " + i + ", " + chunkPos.z + "]: " + string);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -4,6 +4,7 @@ import com.seibel.lod.core.api.ModAccessorApi;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
|
||||
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.LightChunkGetter;
|
||||
|
||||
@@ -33,4 +34,7 @@ public class LightGetterAdaptor implements LightChunkGetter {
|
||||
public BlockGetter getLevel() {
|
||||
return shouldReturnNull ? null : (genRegion != null ? genRegion : heightGetter);
|
||||
}
|
||||
public LevelHeightAccessor getLevelHeightAccessor() {
|
||||
return heightGetter;
|
||||
}
|
||||
}
|
||||
+25
-15
@@ -1,7 +1,6 @@
|
||||
package com.seibel.lod.common.wrappers.worldGeneration.mimicObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -17,6 +16,7 @@ import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
@@ -41,22 +41,11 @@ public class LightedWorldGenRegion extends WorldGenRegion {
|
||||
private final List<ChunkAccess> cache;
|
||||
private final StructureFeatureManager structFeat;
|
||||
Long2ObjectOpenHashMap<ChunkAccess> chunkMap = new Long2ObjectOpenHashMap<ChunkAccess>();
|
||||
private ChunkPos overrideCenterPos = null;
|
||||
|
||||
public void setOverrideCenter(ChunkPos pos) {overrideCenterPos = pos;}
|
||||
@Override
|
||||
public int getCenterX() {
|
||||
return overrideCenterPos==null ? super.getCenterX() : overrideCenterPos.x;
|
||||
}
|
||||
@Override
|
||||
public int getCenterZ() {
|
||||
return overrideCenterPos==null ? super.getCenterZ() : overrideCenterPos.z;
|
||||
}
|
||||
|
||||
public LightedWorldGenRegion(ServerLevel serverLevel, WorldGenLevelLightEngine lightEngine,
|
||||
StructureFeatureManager structFeat, List<ChunkAccess> list, ChunkStatus chunkStatus, int i,
|
||||
LightGenerationMode lightMode, EmptyChunkGenerator generator) {
|
||||
super(serverLevel, list);
|
||||
super(serverLevel, list, chunkStatus, i);
|
||||
this.lightMode = lightMode;
|
||||
this.firstPos = list.get(0).getPos();
|
||||
this.generator = generator;
|
||||
@@ -67,8 +56,29 @@ public class LightedWorldGenRegion extends WorldGenRegion {
|
||||
size = Mth.floor(Math.sqrt(list.size()));
|
||||
}
|
||||
|
||||
// Bypass BCLib mixin overrides.
|
||||
@Override
|
||||
public boolean ensureCanWrite(BlockPos blockPos) {
|
||||
int i = SectionPos.blockToSectionCoord(blockPos.getX());
|
||||
int j = SectionPos.blockToSectionCoord(blockPos.getZ());
|
||||
ChunkPos chunkPos = this.getCenter();
|
||||
ChunkAccess center = this.getChunk(chunkPos.x, chunkPos.z);
|
||||
int k = Math.abs(chunkPos.x - i);
|
||||
int l = Math.abs(chunkPos.z - j);
|
||||
if (k > this.writeRadius || l > this.writeRadius) {
|
||||
return false;
|
||||
}
|
||||
if (center.isUpgrading()) {
|
||||
LevelHeightAccessor levelHeightAccessor = center.getHeightAccessorForGeneration();
|
||||
if (blockPos.getY() < levelHeightAccessor.getMinBuildHeight() || blockPos.getY() >= levelHeightAccessor.getMaxBuildHeight()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<? extends StructureStart<?>> startsForFeature(SectionPos sectionPos,
|
||||
public List<? extends StructureStart<?>> startsForFeature(SectionPos sectionPos,
|
||||
StructureFeature<?> structureFeature) {
|
||||
return structFeat.startsForFeature(sectionPos, structureFeature);
|
||||
}
|
||||
@@ -149,7 +159,7 @@ public class LightedWorldGenRegion extends WorldGenRegion {
|
||||
public ChunkAccess getChunk(int i, int j, ChunkStatus chunkStatus, boolean bl) {
|
||||
ChunkAccess chunk = getChunkAccess(i, j, chunkStatus, bl);
|
||||
if (chunk instanceof LevelChunk) {
|
||||
chunk = new ImposterProtoChunk((LevelChunk) chunk);
|
||||
chunk = new ImposterProtoChunk((LevelChunk) chunk, true);
|
||||
}
|
||||
return chunk;
|
||||
}
|
||||
|
||||
+146
-134
@@ -5,6 +5,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.SectionPos;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.DataLayer;
|
||||
@@ -16,149 +17,160 @@ import net.minecraft.world.level.lighting.SkyLightEngine;
|
||||
|
||||
public class WorldGenLevelLightEngine extends LevelLightEngine {
|
||||
public static final int MAX_SOURCE_LEVEL = 15;
|
||||
public static final int LIGHT_SECTION_PADDING = 1;
|
||||
@Nullable
|
||||
public final BlockLightEngine blockEngine;
|
||||
@Nullable
|
||||
public final SkyLightEngine skyEngine;
|
||||
public static final int LIGHT_SECTION_PADDING = 1;
|
||||
protected final LevelHeightAccessor levelHeightAccessor;
|
||||
@Nullable
|
||||
public final BlockLightEngine blockEngine;
|
||||
@Nullable
|
||||
public final SkyLightEngine skyEngine;
|
||||
|
||||
public WorldGenLevelLightEngine(LightGetterAdaptor genRegion) {
|
||||
super(genRegion, false, false);
|
||||
this.blockEngine = new BlockLightEngine(genRegion);
|
||||
this.skyEngine = new SkyLightEngine(genRegion);
|
||||
}
|
||||
public WorldGenLevelLightEngine(LightGetterAdaptor genRegion) {
|
||||
super(genRegion, false, false);
|
||||
this.levelHeightAccessor = genRegion.getLevelHeightAccessor();
|
||||
this.blockEngine = new BlockLightEngine(genRegion);
|
||||
this.skyEngine = new SkyLightEngine(genRegion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkBlock(BlockPos blockPos) {
|
||||
if (this.blockEngine != null) {
|
||||
this.blockEngine.checkBlock(blockPos);
|
||||
}
|
||||
if (this.skyEngine != null) {
|
||||
this.skyEngine.checkBlock(blockPos);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void checkBlock(BlockPos blockPos) {
|
||||
if (this.blockEngine != null) {
|
||||
this.blockEngine.checkBlock(blockPos);
|
||||
}
|
||||
if (this.skyEngine != null) {
|
||||
this.skyEngine.checkBlock(blockPos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockEmissionIncrease(BlockPos blockPos, int i) {
|
||||
if (this.blockEngine != null) {
|
||||
this.blockEngine.onBlockEmissionIncrease(blockPos, i);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockEmissionIncrease(BlockPos blockPos, int i) {
|
||||
if (this.blockEngine != null) {
|
||||
this.blockEngine.onBlockEmissionIncrease(blockPos, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLightWork() {
|
||||
if (this.skyEngine != null && this.skyEngine.hasLightWork()) {
|
||||
return true;
|
||||
}
|
||||
return this.blockEngine != null && this.blockEngine.hasLightWork();
|
||||
}
|
||||
@Override
|
||||
public boolean hasLightWork() {
|
||||
if (this.skyEngine != null && this.skyEngine.hasLightWork()) {
|
||||
return true;
|
||||
}
|
||||
return this.blockEngine != null && this.blockEngine.hasLightWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int runUpdates(int i, boolean bl, boolean bl2) {
|
||||
if (this.blockEngine != null && this.skyEngine != null) {
|
||||
int j = i / 2;
|
||||
int k = this.blockEngine.runUpdates(j, bl, bl2);
|
||||
int l = i - j + k;
|
||||
int m = this.skyEngine.runUpdates(l, bl, bl2);
|
||||
if (k == 0 && m > 0) {
|
||||
return this.blockEngine.runUpdates(m, bl, bl2);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
if (this.blockEngine != null) {
|
||||
return this.blockEngine.runUpdates(i, bl, bl2);
|
||||
}
|
||||
if (this.skyEngine != null) {
|
||||
return this.skyEngine.runUpdates(i, bl, bl2);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
@Override
|
||||
public int runUpdates(int i, boolean bl, boolean bl2) {
|
||||
if (this.blockEngine != null && this.skyEngine != null) {
|
||||
int j = i / 2;
|
||||
int k = this.blockEngine.runUpdates(j, bl, bl2);
|
||||
int l = i - j + k;
|
||||
int m = this.skyEngine.runUpdates(l, bl, bl2);
|
||||
if (k == 0 && m > 0) {
|
||||
return this.blockEngine.runUpdates(m, bl, bl2);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
if (this.blockEngine != null) {
|
||||
return this.blockEngine.runUpdates(i, bl, bl2);
|
||||
}
|
||||
if (this.skyEngine != null) {
|
||||
return this.skyEngine.runUpdates(i, bl, bl2);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSectionStatus(SectionPos sectionPos, boolean bl) {
|
||||
if (this.blockEngine != null) {
|
||||
this.blockEngine.updateSectionStatus(sectionPos, bl);
|
||||
}
|
||||
if (this.skyEngine != null) {
|
||||
this.skyEngine.updateSectionStatus(sectionPos, bl);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void updateSectionStatus(SectionPos sectionPos, boolean bl) {
|
||||
if (this.blockEngine != null) {
|
||||
this.blockEngine.updateSectionStatus(sectionPos, bl);
|
||||
}
|
||||
if (this.skyEngine != null) {
|
||||
this.skyEngine.updateSectionStatus(sectionPos, bl);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableLightSources(ChunkPos chunkPos, boolean bl) {
|
||||
if (this.blockEngine != null) {
|
||||
this.blockEngine.enableLightSources(chunkPos, bl);
|
||||
}
|
||||
if (this.skyEngine != null) {
|
||||
this.skyEngine.enableLightSources(chunkPos, bl);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void enableLightSources(ChunkPos chunkPos, boolean bl) {
|
||||
if (this.blockEngine != null) {
|
||||
this.blockEngine.enableLightSources(chunkPos, bl);
|
||||
}
|
||||
if (this.skyEngine != null) {
|
||||
this.skyEngine.enableLightSources(chunkPos, bl);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LayerLightEventListener getLayerListener(LightLayer lightLayer) {
|
||||
if (lightLayer == LightLayer.BLOCK) {
|
||||
if (this.blockEngine == null) {
|
||||
return LayerLightEventListener.DummyLightLayerEventListener.INSTANCE;
|
||||
}
|
||||
return this.blockEngine;
|
||||
}
|
||||
if (this.skyEngine == null) {
|
||||
return LayerLightEventListener.DummyLightLayerEventListener.INSTANCE;
|
||||
}
|
||||
return this.skyEngine;
|
||||
}
|
||||
@Override
|
||||
public LayerLightEventListener getLayerListener(LightLayer lightLayer) {
|
||||
if (lightLayer == LightLayer.BLOCK) {
|
||||
if (this.blockEngine == null) {
|
||||
return LayerLightEventListener.DummyLightLayerEventListener.INSTANCE;
|
||||
}
|
||||
return this.blockEngine;
|
||||
}
|
||||
if (this.skyEngine == null) {
|
||||
return LayerLightEventListener.DummyLightLayerEventListener.INSTANCE;
|
||||
}
|
||||
return this.skyEngine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRawBrightness(BlockPos blockPos, int i) {
|
||||
int j = this.skyEngine == null ? 0 : this.skyEngine.getLightValue(blockPos) - i;
|
||||
int k = this.blockEngine == null ? 0 : this.blockEngine.getLightValue(blockPos);
|
||||
return Math.max(k, j);
|
||||
}
|
||||
@Override
|
||||
public int getRawBrightness(BlockPos blockPos, int i) {
|
||||
int j = this.skyEngine == null ? 0 : this.skyEngine.getLightValue(blockPos) - i;
|
||||
int k = this.blockEngine == null ? 0 : this.blockEngine.getLightValue(blockPos);
|
||||
return Math.max(k, j);
|
||||
}
|
||||
|
||||
public void lightChunk(ChunkAccess chunkAccess, boolean needLightBlockUpdate) {
|
||||
ChunkPos chunkPos = chunkAccess.getPos();
|
||||
chunkAccess.setLightCorrect(false);
|
||||
public void lightChunk(ChunkAccess chunkAccess, boolean needLightBlockUpdate) {
|
||||
ChunkPos chunkPos = chunkAccess.getPos();
|
||||
chunkAccess.setLightCorrect(false);
|
||||
|
||||
LevelChunkSection[] levelChunkSections = chunkAccess.getSections();
|
||||
for (int i = 0; i < chunkAccess.getSectionsCount(); ++i) {
|
||||
LevelChunkSection levelChunkSection = levelChunkSections[i];
|
||||
if (levelChunkSection.hasOnlyAir()) continue;
|
||||
int j = this.levelHeightAccessor.getSectionYFromSectionIndex(i);
|
||||
updateSectionStatus(SectionPos.of(chunkPos, j), false);
|
||||
}
|
||||
enableLightSources(chunkPos, true);
|
||||
if (needLightBlockUpdate) {
|
||||
chunkAccess.getLights().forEach(blockPos ->
|
||||
onBlockEmissionIncrease(blockPos, chunkAccess.getLightEmission(blockPos)));
|
||||
}
|
||||
|
||||
chunkAccess.setLightCorrect(true);
|
||||
}
|
||||
|
||||
LevelChunkSection[] levelChunkSections = chunkAccess.getSections();
|
||||
for (int i = 0; i < 16; i++) {
|
||||
LevelChunkSection levelChunkSection = levelChunkSections[i];
|
||||
if (!LevelChunkSection.isEmpty(levelChunkSection)) {
|
||||
updateSectionStatus(SectionPos.of(chunkPos, i), false);
|
||||
}
|
||||
}
|
||||
enableLightSources(chunkPos, true);
|
||||
if (needLightBlockUpdate) {
|
||||
chunkAccess.getLights()
|
||||
.forEach(blockPos -> onBlockEmissionIncrease(blockPos, chunkAccess.getLightEmission(blockPos)));
|
||||
}
|
||||
|
||||
chunkAccess.setLightCorrect(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDebugData(LightLayer lightLayer, SectionPos sectionPos) {
|
||||
throw new UnsupportedOperationException("This should never be used!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queueSectionData(LightLayer lightLayer, SectionPos sectionPos, @Nullable DataLayer dataLayer,
|
||||
boolean bl) {
|
||||
if (lightLayer == LightLayer.BLOCK) {
|
||||
if (this.blockEngine != null) {
|
||||
this.blockEngine.queueSectionData(sectionPos.asLong(), dataLayer, bl);
|
||||
}
|
||||
} else if (this.skyEngine != null) {
|
||||
this.skyEngine.queueSectionData(sectionPos.asLong(), dataLayer, bl);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retainData(ChunkPos chunkPos, boolean bl) {
|
||||
if (this.blockEngine != null) {
|
||||
this.blockEngine.retainData(chunkPos, bl);
|
||||
}
|
||||
if (this.skyEngine != null) {
|
||||
this.skyEngine.retainData(chunkPos, bl);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getDebugData(LightLayer lightLayer, SectionPos sectionPos) {
|
||||
throw new UnsupportedOperationException("This should never be used!");
|
||||
}
|
||||
@Override
|
||||
public void queueSectionData(LightLayer lightLayer, SectionPos sectionPos, @Nullable DataLayer dataLayer, boolean bl) {
|
||||
if (lightLayer == LightLayer.BLOCK) {
|
||||
if (this.blockEngine != null) {
|
||||
this.blockEngine.queueSectionData(sectionPos.asLong(), dataLayer, bl);
|
||||
}
|
||||
} else if (this.skyEngine != null) {
|
||||
this.skyEngine.queueSectionData(sectionPos.asLong(), dataLayer, bl);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void retainData(ChunkPos chunkPos, boolean bl) {
|
||||
if (this.blockEngine != null) {
|
||||
this.blockEngine.retainData(chunkPos, bl);
|
||||
}
|
||||
if (this.skyEngine != null) {
|
||||
this.skyEngine.retainData(chunkPos, bl);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getLightSectionCount() {
|
||||
throw new UnsupportedOperationException("This should never be used!");
|
||||
}
|
||||
@Override
|
||||
public int getMinLightSection() {
|
||||
throw new UnsupportedOperationException("This should never be used!");
|
||||
}
|
||||
@Override
|
||||
public int getMaxLightSection() {
|
||||
throw new UnsupportedOperationException("This should never be used!");
|
||||
}
|
||||
}
|
||||
+39
-16
@@ -1,7 +1,13 @@
|
||||
package com.seibel.lod.common.wrappers.worldGeneration.mimicObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import it.unimi.dsi.fastutil.longs.LongIterator;
|
||||
import it.unimi.dsi.fastutil.longs.LongSet;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.SectionPos;
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
@@ -12,45 +18,62 @@ import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureCheck;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
||||
|
||||
public class WorldGenStructFeatManager extends StructureFeatureManager {
|
||||
WorldGenLevel genLevel;
|
||||
WorldGenSettings worldGenSettings;
|
||||
|
||||
StructureCheck structureCheck;
|
||||
public WorldGenStructFeatManager(LevelAccessor levelAccessor, WorldGenSettings worldGenSettings,
|
||||
WorldGenLevel genLevel) {
|
||||
super(levelAccessor, worldGenSettings);
|
||||
WorldGenLevel genLevel, StructureCheck structureCheck) {
|
||||
super(levelAccessor, worldGenSettings, structureCheck);
|
||||
this.genLevel = genLevel;
|
||||
this.worldGenSettings = worldGenSettings;
|
||||
}
|
||||
|
||||
public void setGenLevel(WorldGenLevel genLevel) {
|
||||
this.genLevel = genLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldGenStructFeatManager forWorldGenRegion(WorldGenRegion worldGenRegion) {
|
||||
if (worldGenRegion == genLevel)
|
||||
return this;
|
||||
return new WorldGenStructFeatManager(worldGenRegion, worldGenSettings, worldGenRegion);
|
||||
return new WorldGenStructFeatManager(worldGenRegion, worldGenSettings, worldGenRegion, structureCheck);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<? extends StructureStart<?>> startsForFeature(SectionPos sectionPos2,
|
||||
public boolean hasAnyStructureAt(BlockPos blockPos) {
|
||||
SectionPos sectionPos = SectionPos.of(blockPos);
|
||||
ChunkAccess chunk = genLevel.getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_REFERENCES,
|
||||
false);
|
||||
if (chunk == null) return false;
|
||||
return chunk.hasAnyStructureReferences();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public List<? extends StructureStart<?>> startsForFeature(SectionPos sectionPos,
|
||||
StructureFeature<?> structureFeature) {
|
||||
if (genLevel == null)
|
||||
return Stream.empty();
|
||||
ChunkAccess chunk = genLevel.getChunk(sectionPos2.x(), sectionPos2.z(), ChunkStatus.STRUCTURE_REFERENCES,
|
||||
return List.of();
|
||||
ChunkAccess chunk = genLevel.getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.STRUCTURE_REFERENCES,
|
||||
false);
|
||||
if (chunk == null)
|
||||
return Stream.empty();
|
||||
return chunk.getReferencesForFeature(structureFeature).stream().map(pos -> {
|
||||
SectionPos sectPos = SectionPos.of(ChunkPos.getX(pos), 0, ChunkPos.getZ(pos));
|
||||
ChunkAccess startChunk = genLevel.getChunk(sectPos.x(), sectPos.z(), ChunkStatus.STRUCTURE_STARTS, false);
|
||||
if (startChunk == null)
|
||||
return null;
|
||||
return this.getStartForFeature(sectPos, structureFeature, startChunk);
|
||||
}).filter(structureStart -> structureStart != null && structureStart.isValid());
|
||||
return List.of();
|
||||
LongSet longSet = chunk.getReferencesForFeature(structureFeature);
|
||||
ImmutableList.Builder builder = ImmutableList.builder();
|
||||
LongIterator longIterator = longSet.iterator();
|
||||
while (longIterator.hasNext()) {
|
||||
long l = (Long)longIterator.next();
|
||||
SectionPos sectPos = SectionPos.of(new ChunkPos(l), genLevel.getMinSection());
|
||||
ChunkAccess startChunk = genLevel.getChunk(sectPos.x(), sectPos.z(), ChunkStatus.STRUCTURE_STARTS, false);
|
||||
if (startChunk == null) continue;
|
||||
StructureStart<?> structureStart = this.getStartForFeature(sectPos, structureFeature, startChunk);
|
||||
if (structureStart == null || !structureStart.isValid()) continue;
|
||||
builder.add(structureStart);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
+22
-12
@@ -3,43 +3,53 @@ package com.seibel.lod.common.wrappers.worldGeneration.step;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
import net.minecraft.world.level.levelgen.DebugLevelSource;
|
||||
import net.minecraft.world.level.levelgen.FlatLevelSource;
|
||||
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||
|
||||
public final class StepBiomes {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final BatchGenerationEnvironment envionment;
|
||||
private final BatchGenerationEnvironment environment;
|
||||
|
||||
/**
|
||||
* @param worldGenerationEnvironment
|
||||
* @param batchGenerationEnvironment
|
||||
*/
|
||||
public StepBiomes(BatchGenerationEnvironment worldGenerationEnvironment) {
|
||||
envionment = worldGenerationEnvironment;
|
||||
public StepBiomes(BatchGenerationEnvironment batchGenerationEnvironment)
|
||||
{
|
||||
environment = batchGenerationEnvironment;
|
||||
}
|
||||
|
||||
public final ChunkStatus STATUS = ChunkStatus.BIOMES;
|
||||
|
||||
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion, List<ChunkAccess> chunks) {
|
||||
|
||||
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
|
||||
List<ChunkAccess> chunks) {
|
||||
|
||||
ArrayList<ChunkAccess> chunksToDo = new ArrayList<ChunkAccess>();
|
||||
|
||||
|
||||
for (ChunkAccess chunk : chunks) {
|
||||
if (chunk.getStatus().isOrAfter(STATUS))
|
||||
continue;
|
||||
if (chunk.getStatus().isOrAfter(STATUS)) continue;
|
||||
((ProtoChunk) chunk).setStatus(STATUS);
|
||||
chunksToDo.add(chunk);
|
||||
}
|
||||
|
||||
|
||||
for (ChunkAccess chunk : chunksToDo) {
|
||||
// System.out.println("StepBiomes: "+chunk.getPos());
|
||||
envionment.params.generator.createBiomes(envionment.params.biomes, chunk);
|
||||
chunk = environment.joinSync(environment.params.generator.createBiomes(environment.params.biomes, Runnable::run, Blender.of(worldGenRegion),
|
||||
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
-15
@@ -2,49 +2,59 @@ package com.seibel.lod.common.wrappers.worldGeneration.step;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.mimicObject.LightedWorldGenRegion;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
import com.seibel.lod.core.util.GridList;
|
||||
|
||||
import net.minecraft.ReportedException;
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||
|
||||
public final class StepFeatures {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final BatchGenerationEnvironment envionment;
|
||||
private final BatchGenerationEnvironment environment;
|
||||
|
||||
/**
|
||||
* @param worldGenerationEnvironment
|
||||
* @param batchGenerationEnvironment
|
||||
*/
|
||||
public StepFeatures(BatchGenerationEnvironment worldGenerationEnvironment) {
|
||||
envionment = worldGenerationEnvironment;
|
||||
public StepFeatures(BatchGenerationEnvironment batchGenerationEnvironment)
|
||||
{
|
||||
environment = batchGenerationEnvironment;
|
||||
}
|
||||
|
||||
public final ChunkStatus STATUS = ChunkStatus.FEATURES;
|
||||
|
||||
public void generateGroup(ThreadedParameters tParams, LightedWorldGenRegion worldGenRegion, GridList<ChunkAccess> chunks) {
|
||||
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
|
||||
GridList<ChunkAccess> chunks) {
|
||||
ArrayList<ChunkAccess> chunksToDo = new ArrayList<ChunkAccess>();
|
||||
|
||||
|
||||
for (ChunkAccess chunk : chunks) {
|
||||
if (chunk.getStatus().isOrAfter(STATUS))
|
||||
continue;
|
||||
if (chunk.getStatus().isOrAfter(STATUS)) continue;
|
||||
((ProtoChunk) chunk).setStatus(STATUS);
|
||||
chunksToDo.add(chunk);
|
||||
}
|
||||
|
||||
|
||||
for (ChunkAccess chunk : chunksToDo) {
|
||||
try {
|
||||
worldGenRegion.setOverrideCenter(chunk.getPos());
|
||||
envionment.params.generator.applyBiomeDecoration(worldGenRegion, tParams.structFeat);
|
||||
environment.params.generator.applyBiomeDecoration(worldGenRegion, chunk,
|
||||
tParams.structFeat.forWorldGenRegion(worldGenRegion));
|
||||
Blender.generateBorderTicks(worldGenRegion, chunk);
|
||||
} catch (ReportedException e) {
|
||||
e.printStackTrace();
|
||||
// FIXME: Features concurrent modification issue. Something about cocobeans just
|
||||
// aren't happy
|
||||
// For now just retry.
|
||||
}
|
||||
}
|
||||
worldGenRegion.setOverrideCenter(null);
|
||||
}/*
|
||||
for (ChunkAccess chunk : chunks) {
|
||||
Heightmap.primeHeightmaps(chunk,
|
||||
EnumSet.of(Heightmap.Types.MOTION_BLOCKING, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES,
|
||||
Heightmap.Types.OCEAN_FLOOR, Heightmap.Types.WORLD_SURFACE));
|
||||
}*/
|
||||
}
|
||||
}
|
||||
+17
-15
@@ -9,48 +9,50 @@ import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
import net.minecraft.world.level.lighting.LightEventListener;
|
||||
|
||||
public final class StepLight {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final BatchGenerationEnvironment envionment;
|
||||
private final BatchGenerationEnvironment environment;
|
||||
|
||||
/**
|
||||
* @param worldGenerationEnvironment
|
||||
* @param batchGenerationEnvironment
|
||||
*/
|
||||
public StepLight(BatchGenerationEnvironment worldGenerationEnvironment) {
|
||||
envionment = worldGenerationEnvironment;
|
||||
public StepLight(BatchGenerationEnvironment batchGenerationEnvironment)
|
||||
{
|
||||
environment = batchGenerationEnvironment;
|
||||
}
|
||||
|
||||
public final ChunkStatus STATUS = ChunkStatus.LIGHT;
|
||||
|
||||
public void generateGroup(LevelLightEngine lightEngine, GridList<ChunkAccess> chunks) {
|
||||
// ArrayList<ChunkAccess> chunksToDo = new ArrayList<ChunkAccess>();
|
||||
|
||||
|
||||
public void generateGroup(LightEventListener lightEngine,
|
||||
GridList<ChunkAccess> chunks) {
|
||||
//ArrayList<ChunkAccess> chunksToDo = new ArrayList<ChunkAccess>();
|
||||
|
||||
for (ChunkAccess chunk : chunks) {
|
||||
if (chunk.getStatus().isOrAfter(STATUS))
|
||||
continue;
|
||||
if (chunk.getStatus().isOrAfter(STATUS)) continue;
|
||||
((ProtoChunk) chunk).setStatus(STATUS);
|
||||
}
|
||||
|
||||
|
||||
for (ChunkAccess chunk : chunks) {
|
||||
boolean hasCorrectBlockLight = (chunk instanceof LevelChunk && chunk.isLightCorrect());
|
||||
try {
|
||||
if (lightEngine == null) {
|
||||
// Do nothing
|
||||
} else if (lightEngine instanceof WorldGenLevelLightEngine) {
|
||||
((WorldGenLevelLightEngine) lightEngine).lightChunk(chunk, !hasCorrectBlockLight);
|
||||
((WorldGenLevelLightEngine)lightEngine).lightChunk(chunk, !hasCorrectBlockLight);
|
||||
} else if (lightEngine instanceof ThreadedLevelLightEngine) {
|
||||
((ThreadedLevelLightEngine) lightEngine).lightChunk(chunk, !hasCorrectBlockLight).join();
|
||||
} else {
|
||||
assert (false);
|
||||
assert(false);
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (chunk instanceof LevelChunk) ((LevelChunk)chunk).setClientLightReady(true);
|
||||
chunk.setLightCorrect(true);
|
||||
}
|
||||
lightEngine.runUpdates(Integer.MAX_VALUE, true, true);
|
||||
|
||||
+25
-13
@@ -1,45 +1,57 @@
|
||||
package com.seibel.lod.common.wrappers.worldGeneration.step;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.NoiseSettings;
|
||||
import net.minecraft.world.level.levelgen.blending.Blender;
|
||||
|
||||
public final class StepNoise {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final BatchGenerationEnvironment envionment;
|
||||
private final BatchGenerationEnvironment environment;
|
||||
|
||||
/**
|
||||
* @param worldGenerationEnvironment
|
||||
* @param batchGenerationEnvironment
|
||||
*/
|
||||
public StepNoise(BatchGenerationEnvironment worldGenerationEnvironment) {
|
||||
envionment = worldGenerationEnvironment;
|
||||
public StepNoise(BatchGenerationEnvironment batchGenerationEnvironment)
|
||||
{
|
||||
environment = batchGenerationEnvironment;
|
||||
}
|
||||
|
||||
|
||||
public final ChunkStatus STATUS = ChunkStatus.NOISE;
|
||||
|
||||
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion, List<ChunkAccess> chunks) {
|
||||
|
||||
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
|
||||
List<ChunkAccess> chunks) {
|
||||
|
||||
ArrayList<ChunkAccess> chunksToDo = new ArrayList<ChunkAccess>();
|
||||
|
||||
|
||||
for (ChunkAccess chunk : chunks) {
|
||||
if (chunk.getStatus().isOrAfter(STATUS))
|
||||
continue;
|
||||
if (chunk.getStatus().isOrAfter(STATUS)) continue;
|
||||
((ProtoChunk) chunk).setStatus(STATUS);
|
||||
chunksToDo.add(chunk);
|
||||
}
|
||||
|
||||
|
||||
for (ChunkAccess chunk : chunksToDo) {
|
||||
// System.out.println("StepNoise: "+chunk.getPos());
|
||||
envionment.params.generator.fillFromNoise(worldGenRegion, tParams.structFeat, chunk);
|
||||
chunk = environment.joinSync(environment.params.generator.fillFromNoise(Runnable::run, Blender.of(worldGenRegion),
|
||||
tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk));
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
-43
@@ -3,8 +3,8 @@ package com.seibel.lod.common.wrappers.worldGeneration.step;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
|
||||
import net.minecraft.CrashReport;
|
||||
import net.minecraft.CrashReportCategory;
|
||||
@@ -20,59 +20,35 @@ import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureStart;
|
||||
|
||||
public final class StepStructureReference {
|
||||
public final ChunkStatus STATUS = ChunkStatus.STRUCTURE_REFERENCES;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final BatchGenerationEnvironment environment;
|
||||
|
||||
private void createReferences(WorldGenRegion worldGenLevel, StructureFeatureManager structureFeatureManager,
|
||||
ChunkAccess chunkAccess) {
|
||||
ChunkPos chunkPos = chunkAccess.getPos();
|
||||
int j = chunkPos.x;
|
||||
int k = chunkPos.z;
|
||||
int l = chunkPos.getMinBlockX();
|
||||
int m = chunkPos.getMinBlockZ();
|
||||
|
||||
SectionPos sectionPos = SectionPos.of(chunkAccess.getPos(), 0);
|
||||
|
||||
for (int n = j - 8; n <= j + 8; n++) {
|
||||
for (int o = k - 8; o <= k + 8; o++) {
|
||||
if (!worldGenLevel.hasChunk(n, o))
|
||||
continue;
|
||||
long p = ChunkPos.asLong(n, o);
|
||||
for (StructureStart<?> structureStart : worldGenLevel.getChunk(n, o).getAllStarts().values()) {
|
||||
try {
|
||||
if (structureStart.isValid()
|
||||
&& structureStart.getBoundingBox().intersects(l, m, l + 15, m + 15)) {
|
||||
structureFeatureManager.addReferenceForFeature(sectionPos, structureStart.getFeature(), p,
|
||||
chunkAccess);
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
CrashReport crashReport = CrashReport.forThrowable(exception, "Generating structure reference");
|
||||
CrashReportCategory crashReportCategory = crashReport.addCategory("Structure");
|
||||
crashReportCategory.setDetail("Id",
|
||||
() -> Registry.STRUCTURE_FEATURE.getKey(structureStart.getFeature()).toString());
|
||||
crashReportCategory.setDetail("Name", () -> structureStart.getFeature().getFeatureName());
|
||||
crashReportCategory.setDetail("Class",
|
||||
() -> structureStart.getFeature().getClass().getCanonicalName());
|
||||
throw new ReportedException(crashReport);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param batchGenerationEnvironment
|
||||
*/
|
||||
public StepStructureReference(BatchGenerationEnvironment batchGenerationEnvironment)
|
||||
{
|
||||
environment = batchGenerationEnvironment;
|
||||
}
|
||||
|
||||
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion, List<ChunkAccess> chunks) {
|
||||
public final ChunkStatus STATUS = ChunkStatus.STRUCTURE_REFERENCES;
|
||||
|
||||
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
|
||||
List<ChunkAccess> chunks) {
|
||||
|
||||
ArrayList<ChunkAccess> chunksToDo = new ArrayList<ChunkAccess>();
|
||||
|
||||
|
||||
for (ChunkAccess chunk : chunks) {
|
||||
if (chunk.getStatus().isOrAfter(STATUS))
|
||||
continue;
|
||||
if (chunk.getStatus().isOrAfter(STATUS)) continue;
|
||||
((ProtoChunk) chunk).setStatus(STATUS);
|
||||
chunksToDo.add(chunk);
|
||||
}
|
||||
|
||||
|
||||
for (ChunkAccess chunk : chunksToDo) {
|
||||
// System.out.println("StepStructureReference: "+chunk.getPos());
|
||||
createReferences(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk);
|
||||
environment.params.generator.createReferences(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion), chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
-13
@@ -3,8 +3,8 @@ package com.seibel.lod.common.wrappers.worldGeneration.step;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
@@ -15,33 +15,52 @@ public final class StepStructureStart {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final BatchGenerationEnvironment envionment;
|
||||
private final BatchGenerationEnvironment environment;
|
||||
|
||||
/**
|
||||
* @param worldGenerationEnvironment
|
||||
* @param batchGenerationEnvironment
|
||||
*/
|
||||
public StepStructureStart(BatchGenerationEnvironment worldGenerationEnvironment) {
|
||||
envionment = worldGenerationEnvironment;
|
||||
public StepStructureStart(BatchGenerationEnvironment batchGenerationEnvironment)
|
||||
{
|
||||
environment = batchGenerationEnvironment;
|
||||
}
|
||||
|
||||
public final ChunkStatus STATUS = ChunkStatus.STRUCTURE_STARTS;
|
||||
|
||||
public static class StructStartCorruptedException extends RuntimeException {
|
||||
private static final long serialVersionUID = -8987434342051563358L;
|
||||
|
||||
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion, List<ChunkAccess> chunks) {
|
||||
public StructStartCorruptedException(ArrayIndexOutOfBoundsException e) {
|
||||
super("StructStartCorruptedException");
|
||||
super.initCause(e);
|
||||
fillInStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
|
||||
List<ChunkAccess> chunks) {
|
||||
|
||||
ArrayList<ChunkAccess> chunksToDo = new ArrayList<ChunkAccess>();
|
||||
|
||||
|
||||
for (ChunkAccess chunk : chunks) {
|
||||
if (chunk.getStatus().isOrAfter(STATUS))
|
||||
continue;
|
||||
if (chunk.getStatus().isOrAfter(STATUS)) continue;
|
||||
((ProtoChunk) chunk).setStatus(STATUS);
|
||||
chunksToDo.add(chunk);
|
||||
}
|
||||
|
||||
if (envionment.params.worldGenSettings.generateFeatures()) {
|
||||
|
||||
if (environment.params.worldGenSettings.generateFeatures()) {
|
||||
for (ChunkAccess chunk : chunksToDo) {
|
||||
// System.out.println("StepStructureStart: "+chunk.getPos());
|
||||
envionment.params.generator.createStructures(envionment.params.registry, tParams.structFeat, chunk,
|
||||
envionment.params.structures, envionment.params.worldSeed);
|
||||
environment.params.generator.createStructures(environment.params.registry, tParams.structFeat, chunk, environment.params.structures,
|
||||
environment.params.worldSeed);
|
||||
try {
|
||||
tParams.structCheck.onStructureLoad(chunk.getPos(), chunk.getAllStarts());
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
// There's a rare issue with StructStart where it throws ArrayIndexOutOfBounds
|
||||
// This means the structFeat is corrupted (For some reason) and I need to reset it.
|
||||
// TODO: Figure out in the future why this happens even though I am using new structFeat
|
||||
throw new StepStructureStart.StructStartCorruptedException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-11
@@ -3,8 +3,8 @@ package com.seibel.lod.common.wrappers.worldGeneration.step;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.ThreadedParameters;
|
||||
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
@@ -15,30 +15,32 @@ public final class StepSurface {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final BatchGenerationEnvironment envionment;
|
||||
private final BatchGenerationEnvironment environment;
|
||||
|
||||
/**
|
||||
* @param worldGenerationEnvironment
|
||||
* @param batchGenerationEnvironment
|
||||
*/
|
||||
public StepSurface(BatchGenerationEnvironment worldGenerationEnvironment) {
|
||||
envionment = worldGenerationEnvironment;
|
||||
public StepSurface(BatchGenerationEnvironment batchGenerationEnvironment)
|
||||
{
|
||||
environment = batchGenerationEnvironment;
|
||||
}
|
||||
|
||||
public final ChunkStatus STATUS = ChunkStatus.SURFACE;
|
||||
|
||||
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion, List<ChunkAccess> chunks) {
|
||||
public void generateGroup(ThreadedParameters tParams, WorldGenRegion worldGenRegion,
|
||||
List<ChunkAccess> chunks) {
|
||||
ArrayList<ChunkAccess> chunksToDo = new ArrayList<ChunkAccess>();
|
||||
|
||||
|
||||
for (ChunkAccess chunk : chunks) {
|
||||
if (chunk.getStatus().isOrAfter(STATUS))
|
||||
continue;
|
||||
if (chunk.getStatus().isOrAfter(STATUS)) continue;
|
||||
((ProtoChunk) chunk).setStatus(STATUS);
|
||||
chunksToDo.add(chunk);
|
||||
}
|
||||
|
||||
|
||||
for (ChunkAccess chunk : chunksToDo) {
|
||||
// System.out.println("StepSurface: "+chunk.getPos());
|
||||
envionment.params.generator.buildSurfaceAndBedrock(worldGenRegion, chunk);
|
||||
environment.params.generator.buildSurface(worldGenRegion, tParams.structFeat.forWorldGenRegion(worldGenRegion),
|
||||
chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,13 @@ accessWidener v1 named
|
||||
accessible field net/minecraft/world/level/storage/DimensionDataStorage dataFolder Ljava/io/File;
|
||||
|
||||
# used when rendering
|
||||
accessible field com/mojang/blaze3d/vertex/VertexBuffer indexCount I
|
||||
accessible field com/mojang/blaze3d/vertex/VertexBuffer vertextBufferId I
|
||||
accessible method net/minecraft/client/renderer/GameRenderer getFov (Lnet/minecraft/client/Camera;FZ)D
|
||||
|
||||
# used for grabbing vanilla rendered chunks
|
||||
accessible field net/minecraft/client/renderer/LevelRenderer renderChunks Lit/unimi/dsi/fastutil/objects/ObjectList;
|
||||
accessible field net/minecraft/client/renderer/LevelRenderer renderChunkStorage Ljava/util/concurrent/atomic/AtomicReference;
|
||||
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkStorage
|
||||
accessible class net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo
|
||||
accessible field net/minecraft/client/renderer/LevelRenderer$RenderChunkInfo chunk Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$RenderChunk;
|
||||
|
||||
@@ -19,15 +22,26 @@ accessible field net/minecraft/world/level/lighting/LevelLightEngine skyEngine L
|
||||
# world generation
|
||||
accessible method net/minecraft/world/level/levelgen/Heightmap setHeight (III)V
|
||||
accessible field net/minecraft/world/level/biome/Biome generationSettings Lnet/minecraft/world/level/biome/BiomeGenerationSettings;
|
||||
accessible field net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator settings Ljava/util/function/Supplier;
|
||||
accessible method net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator doFill (Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;II)Lnet/minecraft/world/level/chunk/ChunkAccess;
|
||||
accessible method net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator doCreateBiomes (Lnet/minecraft/core/Registry;Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;)V
|
||||
accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V
|
||||
accessible field net/minecraft/world/level/chunk/ChunkGenerator biomeSource Lnet/minecraft/world/level/biome/BiomeSource;
|
||||
|
||||
# lod generation from save file
|
||||
accessible field net/minecraft/server/level/ChunkMap mainThreadExecutor Lnet/minecraft/util/thread/BlockableEventLoop;
|
||||
accessible method net/minecraft/server/level/ChunkMap readChunk (Lnet/minecraft/world/level/ChunkPos;)Lnet/minecraft/nbt/CompoundTag;
|
||||
|
||||
|
||||
# grabbing textures
|
||||
accessible field net/minecraft/client/renderer/block/model/BakedQuad sprite Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite framesX [I
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite framesY [I
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite animatedTexture Lnet/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture;
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite width I
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite height I
|
||||
accessible field net/minecraft/client/renderer/texture/TextureAtlasSprite mainImage [Lcom/mojang/blaze3d/platform/NativeImage;
|
||||
accessible class net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture
|
||||
accessible method net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture getFrameX (I)I
|
||||
accessible method net/minecraft/client/renderer/texture/TextureAtlasSprite$AnimatedTexture getFrameY (I)I
|
||||
extendable class com/mojang/math/Matrix4f
|
||||
|
||||
# hacky stuff
|
||||
accessible field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore;
|
||||
mutable field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore;
|
||||
|
||||
+1
-1
Submodule core updated: 67f12c136c...2ba7c6be6e
+35
-36
@@ -1,6 +1,5 @@
|
||||
plugins {
|
||||
id "com.github.johnrengelman.shadow" version "7.0.0"
|
||||
id "com.modrinth.minotaur" version "1.2.1"
|
||||
id "com.github.johnrengelman.shadow" version "7.1.0"
|
||||
}
|
||||
|
||||
version = rootProject.mod_version+"-"+rootProject.minecraft_version+"-"+new Date().format("yyyy_MM_dd_HH_mm")
|
||||
@@ -25,6 +24,12 @@ repositories {
|
||||
maven { url "https://maven.terraformersmc.com/" }
|
||||
}
|
||||
|
||||
def addMod(path, enabled) {
|
||||
if (enabled == "2")
|
||||
dependencies { modImplementation(path) }
|
||||
else if (enabled == "1")
|
||||
dependencies { modCompileOnly(path) }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Fabric loader
|
||||
@@ -38,15 +43,37 @@ dependencies {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
}
|
||||
|
||||
// Sodium
|
||||
modImplementation "curse.maven:sodium-394468:${rootProject.sodium_version}"
|
||||
implementation "org.joml:joml:1.10.2"
|
||||
// Starlight
|
||||
addMod("curse.maven:starlight-521783:${rootProject.starlight_version_fabric}", rootProject.enable_starlight)
|
||||
|
||||
// Lithium
|
||||
// modImplementation "maven.modrinth:lithium:${rootProject.lithium_version}"
|
||||
// Sodium
|
||||
addMod("curse.maven:sodium-394468:${rootProject.sodium_version}", rootProject.enable_sodium)
|
||||
implementation "org.joml:joml:1.10.2"
|
||||
|
||||
// Lithium
|
||||
addMod("maven.modrinth:lithium:${rootProject.lithium_version}", rootProject.enable_lithium)
|
||||
|
||||
// Iris
|
||||
// modImplementation "maven.modrinth:iris:${rootProject.iris_version}"
|
||||
addMod("maven.modrinth:iris:${rootProject.iris_version}", rootProject.enable_iris)
|
||||
|
||||
// BCLib
|
||||
addMod("com.github.paulevsGitch:BCLib:${rootProject.bclib_version}", rootProject.enable_bclib)
|
||||
|
||||
// Immersive Portals
|
||||
/*
|
||||
modImplementation("com.github.qouteall.ImmersivePortalsMod:build:${rootProject.immersive_portals_version}") {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
transitive(false)
|
||||
}
|
||||
modImplementation("com.github.qouteall.ImmersivePortalsMod:imm_ptl_core:${rootProject.immersive_portals_version}") {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
transitive(false)
|
||||
}
|
||||
modImplementation("com.github.qouteall.ImmersivePortalsMod:q_misc_util:${rootProject.immersive_portals_version}") {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
transitive(false)
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -90,36 +117,8 @@ runClient {
|
||||
finalizedBy(deleteResources)
|
||||
}
|
||||
|
||||
// Put stuff from gradle.properties into the mod info stuff
|
||||
def resourceTargets = ["fabric.mod.json"]
|
||||
def intoTargets = ["$buildDir/resources/main/"]
|
||||
def replaceProperties = [
|
||||
version: mod_version,
|
||||
mod_name: mod_name,
|
||||
authors: mod_authors,
|
||||
description: mod_description
|
||||
]
|
||||
|
||||
processResources {
|
||||
dependsOn(copyAccessWidener)
|
||||
|
||||
inputs.properties replaceProperties
|
||||
replaceProperties.put 'project', project
|
||||
filesMatching(resourceTargets) {
|
||||
expand replaceProperties
|
||||
}
|
||||
|
||||
intoTargets.each { target ->
|
||||
if (file(target).exists()) {
|
||||
copy {
|
||||
from(sourceSets.main.resources) {
|
||||
include resourceTargets
|
||||
expand replaceProperties
|
||||
}
|
||||
into target
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
|
||||
@@ -29,19 +29,13 @@ import com.seibel.lod.common.wrappers.world.WorldWrapper;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
import com.seibel.lod.fabric.mixins.events.MixinClientLevel;
|
||||
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientChunkEvents;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
|
||||
import net.fabricmc.fabric.mixin.event.lifecycle.client.ClientChunkManagerMixin;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientChunkCache;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -56,7 +50,7 @@ import org.lwjgl.glfw.GLFW;
|
||||
/**
|
||||
* This handles all events sent to the client,
|
||||
* and is the starting point for most of the mod.
|
||||
*
|
||||
*
|
||||
* @author coolGi2007
|
||||
* @author Ran
|
||||
* @version 11-23-2021
|
||||
@@ -73,6 +67,8 @@ public class ClientProxy
|
||||
*/
|
||||
public void registerEvents() {
|
||||
// TODO: Fix this if it's wrong
|
||||
|
||||
/* Registor the mod accessor*/
|
||||
|
||||
/* World Events */
|
||||
//ServerTickEvents.START_SERVER_TICK.register(this::serverTickEvent);
|
||||
@@ -80,14 +76,12 @@ public class ClientProxy
|
||||
|
||||
/* World Events */
|
||||
//ServerChunkEvents.CHUNK_LOAD.register(this::chunkLoadEvent);
|
||||
ClientChunkEvents.CHUNK_LOAD.register(this::chunkLoadEvent);
|
||||
|
||||
|
||||
//ClientChunkEvents.CHUNK_LOAD.register(this::chunkLoadEvent);
|
||||
|
||||
/* World Events */
|
||||
ServerWorldEvents.LOAD.register((server, level) -> this.worldLoadEvent(level));
|
||||
ServerWorldEvents.UNLOAD.register((server, level) -> this.worldUnloadEvent(level));
|
||||
|
||||
|
||||
/* The Client World Events are in the mixins
|
||||
Client world load event is in MixinClientLevel
|
||||
Client world unload event is in MixinMinecraft */
|
||||
@@ -115,7 +109,7 @@ public class ClientProxy
|
||||
{
|
||||
eventApi.worldSaveEvent();
|
||||
}
|
||||
|
||||
|
||||
/** This is also called when a new dimension loads */
|
||||
public void worldLoadEvent(Level level)
|
||||
{
|
||||
@@ -158,8 +152,8 @@ public class ClientProxy
|
||||
// recreate the LOD where the blocks were changed
|
||||
eventApi.blockChangeEvent(chunk, dimType);
|
||||
}
|
||||
|
||||
private static final int[] KEY_TO_CHECK_FOR = {GLFW.GLFW_KEY_F6, GLFW.GLFW_KEY_F8};
|
||||
|
||||
private static final List<Integer> KEY_TO_CHECK_FOR = List.of(GLFW.GLFW_KEY_F6, GLFW.GLFW_KEY_F8);
|
||||
|
||||
HashSet<Integer> previousKeyDown = new HashSet<Integer>();
|
||||
|
||||
@@ -172,7 +166,7 @@ public class ClientProxy
|
||||
// Note: Minecraft's InputConstants is same as GLFW Key values
|
||||
//TODO: Use mixin to hook directly into the GLFW Keyboard event in minecraft KeyboardHandler
|
||||
// Check all keys we need
|
||||
for (int i = GLFW.GLFW_KEY_A; i <= GLFW.GLFW_KEY_Z; i++) {
|
||||
for (int i = InputConstants.KEY_A; i <= InputConstants.KEY_Z; i++) {
|
||||
if (InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), i)) {
|
||||
currectKeyDown.add(i);
|
||||
}
|
||||
|
||||
@@ -27,9 +27,11 @@ import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModChecker;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
|
||||
import com.seibel.lod.fabric.wrappers.modAccessor.ModChecker;
|
||||
import com.seibel.lod.fabric.wrappers.modAccessor.OptifineAccessor;
|
||||
import com.seibel.lod.fabric.wrappers.modAccessor.SodiumAccessor;
|
||||
import com.seibel.lod.fabric.wrappers.modAccessor.StarlightAccessor;
|
||||
import com.seibel.lod.fabric.wrappers.DependencySetup;
|
||||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
@@ -38,7 +40,7 @@ import net.fabricmc.api.ClientModInitializer;
|
||||
* Initialize and setup the Mod. <br>
|
||||
* If you are looking for the real start of the mod
|
||||
* check out the ClientProxy.
|
||||
*
|
||||
*
|
||||
* @author coolGi2007
|
||||
* @author Ran
|
||||
* @version 12-1-2021
|
||||
@@ -72,6 +74,9 @@ public class Main implements ClientModInitializer
|
||||
if (SingletonHandler.get(IModChecker.class).isModLoaded("sodium")) {
|
||||
ModAccessorApi.bind(ISodiumAccessor.class, new SodiumAccessor());
|
||||
}
|
||||
if (SingletonHandler.get(IModChecker.class).isModLoaded("starlight")) {
|
||||
ModAccessorApi.bind(IStarlightAccessor.class, new StarlightAccessor());
|
||||
}
|
||||
if (SingletonHandler.get(IModChecker.class).isModLoaded("optifine")) {
|
||||
ModAccessorApi.bind(IOptifineAccessor.class, new OptifineAccessor());
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.seibel.lod.fabric.mixins;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.WorldgenRandom;
|
||||
|
||||
@Mixin(ChunkGenerator.class)
|
||||
public class MixinChunkGenerator {
|
||||
@Redirect(method = "applyBiomeDecoration", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/level/biome/Biome;generate(Lnet/minecraft/world/level/StructureFeatureManager;"
|
||||
+ "Lnet/minecraft/world/level/chunk/ChunkGenerator;Lnet/minecraft/server/level/WorldGenRegion;J"
|
||||
+ "Lnet/minecraft/world/level/levelgen/WorldgenRandom;Lnet/minecraft/core/BlockPos;)V"
|
||||
|
||||
))
|
||||
private void wrapBiomeGenerateCall(Biome biome, StructureFeatureManager structFeatManager, ChunkGenerator generator,
|
||||
WorldGenRegion genRegion, long l, WorldgenRandom random, BlockPos pos) {
|
||||
synchronized((ChunkGenerator)(Object)this) {
|
||||
biome.generate(structFeatManager, (ChunkGenerator)(Object)this, genRegion, l, random, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,40 +6,35 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.renderer.FogRenderer;
|
||||
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.FogType;
|
||||
|
||||
@Mixin(FogRenderer.class)
|
||||
public class MixinFogRenderer {
|
||||
private static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
|
||||
|
||||
private static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
|
||||
|
||||
// Using this instead of Float.MAX_VALUE because Sodium don't like it.
|
||||
private static final float A_REALLY_REALLY_BIG_VALUE = 4206942069.F;
|
||||
private static final float A_EVEN_LARGER_VALUE = 420694206942069.F;
|
||||
private static final float A_REALLY_REALLY_BIG_VALUE = 420694206942069.F;
|
||||
private static final float A_EVEN_LARGER_VALUE = 42069420694206942069.F;
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZ)V")
|
||||
private static final void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, CallbackInfo callback) {
|
||||
FluidState fluidState = camera.getFluidInCamera();
|
||||
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, CallbackInfo callback) {
|
||||
FogType fogTypes = camera.getFluidInCamera();
|
||||
Entity entity = camera.getEntity();
|
||||
boolean isUnderWater = (entity instanceof LivingEntity) && ((LivingEntity)entity).hasEffect(MobEffects.BLINDNESS);
|
||||
isUnderWater |= fluidState.is(FluidTags.WATER);
|
||||
isUnderWater |= fluidState.is(FluidTags.LAVA);
|
||||
|
||||
if (!isUnderWater) {
|
||||
if (fogMode == FogMode.FOG_TERRAIN && CONFIG.client().graphics().fogQuality().getDisableVanillaFog()) {
|
||||
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
|
||||
RenderSystem.fogEnd(A_EVEN_LARGER_VALUE);
|
||||
if (fogMode == FogMode.FOG_TERRAIN && fogTypes == FogType.NONE && CONFIG.client().graphics().fogQuality().getDisableVanillaFog()) {
|
||||
RenderSystem.setShaderFogStart(A_REALLY_REALLY_BIG_VALUE);
|
||||
RenderSystem.setShaderFogEnd(A_EVEN_LARGER_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Objects;
|
||||
*
|
||||
* @author coolGi2007
|
||||
* @version 12-02-2021
|
||||
*/
|
||||
*/
|
||||
@Mixin(OptionsScreen.class)
|
||||
public class MixinOptionsScreen extends Screen {
|
||||
// Get the texture for the button
|
||||
@@ -34,19 +34,19 @@ public class MixinOptionsScreen extends Screen {
|
||||
@Inject(at = @At("HEAD"),method = "init")
|
||||
private void lodconfig$init(CallbackInfo ci) {
|
||||
if (SingletonHandler.get(ILodConfigWrapperSingleton.class).client().getOptionsButton())
|
||||
this.addButton(new TexturedButtonWidget(
|
||||
// Where the button is on the screen
|
||||
this.width / 2 - 180, this.height / 6 - 12,
|
||||
// Width and height of the button
|
||||
20, 20,
|
||||
// Offset
|
||||
0, 0,
|
||||
// Some textuary stuff
|
||||
20, ICON_TEXTURE, 20, 40,
|
||||
// Create the button and tell it where to go
|
||||
// For now it goes to the client option by default
|
||||
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, "client")),
|
||||
// Add a title to the screen
|
||||
new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title")));
|
||||
this.addRenderableWidget(new TexturedButtonWidget(
|
||||
// Where the button is on the screen
|
||||
this.width / 2 - 180, this.height / 6 - 12,
|
||||
// Width and height of the button
|
||||
20, 20,
|
||||
// Offset
|
||||
0, 0,
|
||||
// Some textuary stuff
|
||||
20, ICON_TEXTURE, 20, 40,
|
||||
// Create the button and tell it where to go
|
||||
// For now it goes to the client option by default
|
||||
(buttonWidget) -> Objects.requireNonNull(minecraft).setScreen(ConfigGui.getScreen(this, "client")),
|
||||
// Add a title to the screen
|
||||
new TranslatableComponent("text.autoconfig." + ModInfo.ID + ".title")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.seibel.lod.fabric.mixins;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import com.seibel.lod.common.wrappers.DependencySetupDoneCheck;
|
||||
import com.seibel.lod.common.wrappers.worldGeneration.BatchGenerationEnvironment;
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.util.DummyRunExecutorService;
|
||||
|
||||
import net.minecraft.Util;
|
||||
|
||||
@Mixin(Util.class)
|
||||
public class MixinUtilBackgroudThread
|
||||
{
|
||||
|
||||
@Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;",
|
||||
at = @At("HEAD"), cancellable = true)
|
||||
private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable<Runnable> ci)
|
||||
{
|
||||
if (DependencySetupDoneCheck.isDone && BatchGenerationEnvironment.isCurrentThreadDistantGeneratorThread())
|
||||
{
|
||||
//ClientApi.LOGGER.info("util wrapThreadWithTaskName(Runnable) triggered");
|
||||
ci.setReturnValue(r);
|
||||
}
|
||||
}
|
||||
@Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;",
|
||||
at = @At("HEAD"), cancellable = true)
|
||||
private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier<?> r, CallbackInfoReturnable<Supplier<?>> ci)
|
||||
{
|
||||
if (DependencySetupDoneCheck.isDone && BatchGenerationEnvironment.isCurrentThreadDistantGeneratorThread())
|
||||
{
|
||||
//ClientApi.LOGGER.info("util wrapThreadWithTaskName(Supplier) triggered");
|
||||
ci.setReturnValue(r);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "backgroundExecutor", at = @At("HEAD"), cancellable = true)
|
||||
private static void overrideUtil$backgroundExecutor(CallbackInfoReturnable<ExecutorService> ci)
|
||||
{
|
||||
if (DependencySetupDoneCheck.isDone && BatchGenerationEnvironment.isCurrentThreadDistantGeneratorThread())
|
||||
{
|
||||
//ClientApi.LOGGER.info("util backgroundExecutor triggered");
|
||||
ci.setReturnValue(new DummyRunExecutorService());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,19 +20,17 @@
|
||||
package com.seibel.lod.fabric.mixins;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import com.seibel.lod.common.wrappers.McObjectConverter;
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.objects.math.Mat4f;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.objects.math.Mat4f;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
||||
/**
|
||||
* This class is used to mix in my rendering code
|
||||
* before Minecraft starts rendering blocks.
|
||||
@@ -49,35 +47,28 @@ import net.minecraft.client.renderer.RenderType;
|
||||
@Mixin(LevelRenderer.class)
|
||||
public class MixinWorldRenderer
|
||||
{
|
||||
// TODO: Fix clouds
|
||||
private static float previousPartialTicks = 0;
|
||||
|
||||
public MixinWorldRenderer() {
|
||||
throw new NullPointerException("Null cannot be cast to non-null type.");
|
||||
}
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;F)V")
|
||||
private void renderSky(PoseStack matrixStackIn, float partialTicks, CallbackInfo callback)
|
||||
{
|
||||
// get the partial ticks since renderBlockLayer doesn't
|
||||
@Inject(method = "renderClouds", at = @At("HEAD"), cancellable = true)
|
||||
public void renderClouds(PoseStack poseStack, Matrix4f projectionMatrix, float tickDelta, double cameraX, double cameraY, double cameraZ, CallbackInfo ci) {
|
||||
// get the partial ticks since renderChunkLayer doesn't
|
||||
// have access to them
|
||||
previousPartialTicks = partialTicks;
|
||||
previousPartialTicks = tickDelta;
|
||||
}
|
||||
|
||||
// HEAD or RETURN
|
||||
@Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDD)V")
|
||||
private void renderChunkLayer(RenderType renderType, PoseStack matrixStackIn, double xIn, double yIn, double zIn, CallbackInfo callback)
|
||||
@Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V")
|
||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||
{
|
||||
// only render before solid blocks
|
||||
if (renderType.equals(RenderType.solid()))
|
||||
{
|
||||
// get MC's current projection matrix
|
||||
float[] mcProjMatrixRaw = new float[16];
|
||||
GL15.glGetFloatv(GL15.GL_PROJECTION_MATRIX, mcProjMatrixRaw);
|
||||
Mat4f mcProjectionMatrix = new Mat4f(mcProjMatrixRaw);
|
||||
// OpenGl outputs their matrices in col,row form instead of row,col
|
||||
// (or maybe vice versa I have no idea :P)
|
||||
mcProjectionMatrix.transpose();
|
||||
|
||||
|
||||
Mat4f mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose());
|
||||
Mat4f mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose());
|
||||
Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix);
|
||||
|
||||
ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks);
|
||||
}
|
||||
|
||||
@@ -18,11 +18,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
*/
|
||||
@Mixin(ClientboundBlockUpdatePacket.class)
|
||||
public abstract class MixinBlockUpdate {
|
||||
@Shadow
|
||||
public abstract BlockPos getPos();
|
||||
@Shadow public abstract BlockPos getPos();
|
||||
|
||||
@Inject(method = "handle(Lnet/minecraft/network/protocol/game/ClientGamePacketListener;)V", at = @At("TAIL"))
|
||||
private void onBlockUpdate(ClientGamePacketListener clientGamePacketListener, CallbackInfo ci) {
|
||||
Main.client_proxy.blockChangeEvent(Minecraft.getInstance().player.clientLevel, this.getPos());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.multiplayer.ClientPacketListener;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -22,7 +21,14 @@ import java.util.function.Supplier;
|
||||
@Mixin(ClientLevel.class)
|
||||
public class MixinClientLevel {
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
private void loadWorldEvent(ClientPacketListener clientPacketListener, ClientLevel.ClientLevelData clientLevelData, ResourceKey<Level> resourceKey, DimensionType dimensionType, int i, Supplier<ProfilerFiller> supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) {
|
||||
private void loadWorldEvent(ClientPacketListener clientPacketListener, ClientLevel.ClientLevelData clientLevelData, ResourceKey resourceKey, DimensionType dimensionType, int i, int j, Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) {
|
||||
Main.client_proxy.worldLoadEvent((ClientLevel) (Object) this);
|
||||
}
|
||||
@Inject(method = "setLightReady", at = @At("HEAD"))
|
||||
private void onChunkLightReady(int x, int z, CallbackInfo ci) {
|
||||
ClientLevel l = (ClientLevel) (Object) this;
|
||||
LevelChunk chunk = l.getChunkSource().getChunk(x, z, false);
|
||||
if (chunk!=null && !chunk.isClientLightReady())
|
||||
Main.client_proxy.chunkLoadEvent(l, chunk);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.seibel.lod.fabric.Main;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@@ -14,8 +14,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
*/
|
||||
@Mixin(ServerLevel.class)
|
||||
public class MixinServerLevel {
|
||||
@Inject(method = "save", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerChunkCache;save(Z)V", shift = At.Shift.AFTER))
|
||||
private void saveWorldEvent(ProgressListener progressListener, boolean bl, boolean bl2, CallbackInfo ci) {
|
||||
@Inject(method = "save", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/entity/PersistentEntitySectionManager;saveAll()V", shift = At.Shift.AFTER))
|
||||
private void saveWorldEvent_sA(ProgressListener progressListener, boolean bl, boolean bl2, CallbackInfo ci) {
|
||||
Main.client_proxy.worldSaveEvent();
|
||||
}
|
||||
|
||||
@Inject(method = "save", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/entity/PersistentEntitySectionManager;autoSave()V", shift = At.Shift.AFTER))
|
||||
private void saveWorldEvent_aS(ProgressListener progressListener, boolean bl, boolean bl2, CallbackInfo ci) {
|
||||
Main.client_proxy.worldSaveEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.seibel.lod.fabric.mixins.unsafe;
|
||||
|
||||
import net.minecraft.world.level.chunk.PalettedContainer;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
/**
|
||||
* NOTE: THIS IS NOT A FIX TO THE PROBLEM.
|
||||
* TODO: Do/Find an actual fix to this
|
||||
*
|
||||
* @author Ran
|
||||
*/
|
||||
@Mixin(PalettedContainer.class)
|
||||
public class MixinPalettedContainer {
|
||||
|
||||
@Inject(method = "acquire", at = @At("HEAD"), cancellable = true)
|
||||
private void acquire_skip(CallbackInfo ci) {
|
||||
ci.cancel();
|
||||
}
|
||||
@Inject(method = "release", at = @At("HEAD"), cancellable = true)
|
||||
private void release_skip(CallbackInfo ci) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.seibel.lod.fabric.mixins.unsafe;
|
||||
|
||||
import net.minecraft.util.ThreadingDetector;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
/**
|
||||
* Why does this exist? But okay! (Will be probably removed when the experimental generator is done)
|
||||
*/
|
||||
@Mixin(ThreadingDetector.class)
|
||||
public class MixinThreadingDectector {
|
||||
@Mutable
|
||||
@Shadow
|
||||
private Semaphore lock;
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void setSemaphore(CallbackInfo ci) {
|
||||
this.lock = new Semaphore(2);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.seibel.lod.fabric.wrappers;
|
||||
|
||||
import com.seibel.lod.common.LodCommonMain;
|
||||
import com.seibel.lod.common.wrappers.config.NewLodConfigWrapperSingleton;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
import com.seibel.lod.common.wrappers.config.LodConfigWrapperSingleton;
|
||||
@@ -18,6 +20,9 @@ public class DependencySetup
|
||||
{
|
||||
public static void createInitialBindings()
|
||||
{
|
||||
SingletonHandler.bind(ILodConfigWrapperSingleton.class, LodConfigWrapperSingleton.INSTANCE);;
|
||||
if (!LodCommonMain.IsNewConfig)
|
||||
SingletonHandler.bind(ILodConfigWrapperSingleton.class, LodConfigWrapperSingleton.INSTANCE);
|
||||
else
|
||||
SingletonHandler.bind(ILodConfigWrapperSingleton.class, NewLodConfigWrapperSingleton.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,6 @@ import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* For making the config show up in modmenu
|
||||
*/
|
||||
|
||||
+13
-14
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.seibel.lod.fabric.wrappers.modAccessor;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -9,17 +8,17 @@ import com.seibel.lod.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
public class OptifineAccessor implements IOptifineAccessor
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getModName()
|
||||
{
|
||||
return "Optifine-Fabric-1.18.X";
|
||||
}
|
||||
@Override
|
||||
public String getModName()
|
||||
{
|
||||
return "Optifine-Fabric-1.18.X";
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<AbstractChunkPosWrapper> getNormalRenderedChunks()
|
||||
{
|
||||
// TODO: Impl proper methods here
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public HashSet<AbstractChunkPosWrapper> getNormalRenderedChunks()
|
||||
{
|
||||
// TODO: Impl proper methods here
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+23
-48
@@ -3,65 +3,40 @@ package com.seibel.lod.fabric.wrappers.modAccessor;
|
||||
import java.util.HashSet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.ISodiumAccessor;
|
||||
|
||||
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
|
||||
public class SodiumAccessor implements ISodiumAccessor {
|
||||
private final IMinecraftRenderWrapper MC_RENDER = SingletonHandler.get(IMinecraftRenderWrapper.class);
|
||||
|
||||
@Override
|
||||
public String getModName() {
|
||||
|
||||
return "Sodium-Fabric-1.16.5";
|
||||
}
|
||||
IWrapperFactory factory = SingletonHandler.get(IWrapperFactory.class);
|
||||
|
||||
@Override
|
||||
public String getModName() {
|
||||
return "Sodium-Fabric-1.18.X";
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<AbstractChunkPosWrapper> getNormalRenderedChunks() {
|
||||
SodiumWorldRenderer renderer = SodiumWorldRenderer.getInstance();
|
||||
LevelAccessor height = Minecraft.getInstance().level;
|
||||
// TODO: Maybe use a mixin to make this more efficient
|
||||
return MC_RENDER.getMaximumRenderedChunks().stream().filter((AbstractChunkPosWrapper chunk) -> {
|
||||
FakeChunkEntity AABB = new FakeChunkEntity(chunk.getX(), chunk.getZ(), height.getMaxBuildHeight());
|
||||
return (renderer.isEntityVisible(AABB));
|
||||
}).collect(Collectors.toCollection(HashSet::new));
|
||||
SodiumWorldRenderer renderer = SodiumWorldRenderer.instance();
|
||||
LevelHeightAccessor height = Minecraft.getInstance().level;
|
||||
// 0b11 = Lighted chunk & loaded chunk
|
||||
return renderer.getChunkTracker().getChunks(0b00).filter(
|
||||
(long l) -> {
|
||||
return true;
|
||||
//for (int i = height.getMinSection(); i<height.getMaxSection(); i++) {
|
||||
// SectionPos p = SectionPos.of(new ChunkPos(l), i);
|
||||
// if (renderer.isBoxVisible(p.minBlockX()+1, p.minBlockY()+1, p.minBlockZ()+1,
|
||||
// p.maxBlockX()-1, p.maxBlockY()-1, p.maxBlockZ()-1)) return true;
|
||||
//}
|
||||
//return false;
|
||||
}).mapToObj((long l) -> {
|
||||
return (AbstractChunkPosWrapper)factory.createChunkPos(l);
|
||||
}).collect(Collectors.toCollection(HashSet::new));
|
||||
}
|
||||
|
||||
private static class FakeChunkEntity extends Entity {
|
||||
public int cx;
|
||||
public int cz;
|
||||
public int my;
|
||||
public FakeChunkEntity(int chunkX, int chunkZ, int maxHeight) {
|
||||
super(EntityType.AREA_EFFECT_CLOUD, null);
|
||||
cx = chunkX;
|
||||
cz = chunkZ;
|
||||
my = maxHeight;
|
||||
}
|
||||
@Override
|
||||
public AABB getBoundingBoxForCulling() {
|
||||
return new AABB(cx*16+1, 1, cz*16+1,
|
||||
cx*16+15, my-1, cz*16+15);
|
||||
}
|
||||
@Override
|
||||
protected void defineSynchedData() {}
|
||||
@Override
|
||||
protected void readAdditionalSaveData(CompoundTag paramCompoundTag) {}
|
||||
@Override
|
||||
protected void addAdditionalSaveData(CompoundTag paramCompoundTag) {}
|
||||
@Override
|
||||
public Packet<?> getAddEntityPacket() {
|
||||
throw new UnsupportedOperationException("This is a FAKE CHUNK ENTITY... For tricking the Sodium to check a AABB.");
|
||||
}}
|
||||
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.seibel.lod.fabric.wrappers.modAccessor;
|
||||
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IStarlightAccessor;
|
||||
|
||||
|
||||
public class StarlightAccessor implements IStarlightAccessor {
|
||||
|
||||
@Override
|
||||
public String getModName() {
|
||||
return "Starlight-Fabric-1.18.X";
|
||||
}
|
||||
|
||||
public StarlightAccessor() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -455,4 +455,4 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
END OF TERMS AND CONDITIONS
|
||||
@@ -2,11 +2,11 @@
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.seibel.lod.fabric.mixins",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"events.MixinServerLevel",
|
||||
"unsafe.MixinPalettedContainer",
|
||||
"MixinChunkGenerator"
|
||||
"unsafe.MixinThreadingDectector",
|
||||
"MixinUtilBackgroudThread",
|
||||
"events.MixinServerLevel"
|
||||
],
|
||||
"client": [
|
||||
"MixinMinecraft",
|
||||
@@ -21,4 +21,4 @@
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
"authors": ["${authors}"],
|
||||
|
||||
"contact": {
|
||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/lod-level-of-detail",
|
||||
"sources": "https://gitlab.com/jeseibel/minecraft-lod-mod/",
|
||||
"issues": "https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues"
|
||||
"homepage": "${homepage}",
|
||||
"sources": "${source}",
|
||||
"issues": "${issues}"
|
||||
},
|
||||
|
||||
"license": "CC0-1.0",
|
||||
@@ -34,8 +34,8 @@
|
||||
"depends": {
|
||||
"fabricloader": "*",
|
||||
"fabric": "*",
|
||||
"minecraft": "1.16.5",
|
||||
"java": ">=8"
|
||||
"minecraft": "1.18.x",
|
||||
"java": ">=17"
|
||||
},
|
||||
"suggests": {
|
||||
"another-mod": "*"
|
||||
|
||||
+14
-30
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.github.johnrengelman.shadow" version "7.0.0"
|
||||
id "com.github.johnrengelman.shadow" version "7.1.0"
|
||||
}
|
||||
|
||||
version = rootProject.mod_version+"-"+rootProject.minecraft_version+"-"+new Date().format("yyyy_MM_dd_HH_mm")
|
||||
@@ -25,10 +25,21 @@ configurations {
|
||||
developmentForge.extendsFrom common
|
||||
}
|
||||
|
||||
def addMod(path, enabled) {
|
||||
if (enabled == "2")
|
||||
dependencies { modImplementation(path) }
|
||||
else if (enabled == "1")
|
||||
dependencies { modCompileOnly(path) }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Forge loader
|
||||
forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}"
|
||||
|
||||
// Starlight
|
||||
addMod("curse.maven:starlight-forge-526854:${rootProject.starlight_version_forge}", rootProject.enable_starlight_forge)
|
||||
annotationProcessor "org.spongepowered:mixin:0.8.4:processor"
|
||||
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowMe(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
|
||||
|
||||
@@ -38,6 +49,7 @@ dependencies {
|
||||
// Toml
|
||||
shadowMe("com.electronwill.night-config:toml:${rootProject.toml_version}") {}
|
||||
|
||||
// Compression
|
||||
forgeDependencies('org.tukaani:xz:1.9')
|
||||
forgeDependencies('org.apache.commons:commons-compress:1.21')
|
||||
shadowMe 'org.tukaani:xz:1.9'
|
||||
@@ -54,37 +66,9 @@ task copyCommonResources(type: Copy) {
|
||||
into file("build/resources/main")
|
||||
}
|
||||
|
||||
// Put stuff from gradle.properties into the mod info stuff
|
||||
def resourceTargets = ["META-INF/mods.toml"]
|
||||
def intoTargets = ["$buildDir/resources/main/"]
|
||||
def replaceProperties = [
|
||||
version: mod_version,
|
||||
mod_name: mod_name,
|
||||
authors: mod_authors,
|
||||
description: mod_description
|
||||
]
|
||||
|
||||
processResources {
|
||||
dependsOn(copyCoreResources)
|
||||
dependsOn(copyCommonResources)
|
||||
|
||||
inputs.properties replaceProperties
|
||||
replaceProperties.put 'project', project
|
||||
filesMatching(resourceTargets) {
|
||||
expand replaceProperties
|
||||
}
|
||||
|
||||
intoTargets.each { target ->
|
||||
if (file(target).exists()) {
|
||||
copy {
|
||||
from(sourceSets.main.resources) {
|
||||
include resourceTargets
|
||||
expand replaceProperties
|
||||
}
|
||||
into target
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
@@ -95,7 +79,7 @@ shadowJar {
|
||||
configurations = [project.configurations.shadowMe]
|
||||
relocate 'org.tukaani', 'shaded.tukaani'
|
||||
relocate 'org.apache.commons.compress', 'shaded.apache.commons.compress'
|
||||
relocate 'com.electronwill.nightconfig', 'shaded.electronwill.nightconfig'
|
||||
relocate 'com.electronwill.nightconfig', 'shaded.electronwill.nightconfig' // This is already included with forge
|
||||
|
||||
relocate 'com.seibel.lod.common', 'forge.com.seibel.lod.common'
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
/**
|
||||
* This handles all events sent to the client,
|
||||
* and is the starting point for most of the mod.
|
||||
*
|
||||
*
|
||||
* @author James_Seibel
|
||||
* @version 11-12-2021
|
||||
*/
|
||||
@@ -48,28 +48,28 @@ public class ForgeClientProxy
|
||||
{
|
||||
private final EventApi eventApi = EventApi.INSTANCE;
|
||||
private final ClientApi clientApi = ClientApi.INSTANCE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void serverTickEvent(TickEvent.ServerTickEvent event)
|
||||
{
|
||||
if (event.phase != TickEvent.Phase.START) return;
|
||||
eventApi.serverTickEvent();
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void chunkLoadEvent(ChunkEvent.Load event)
|
||||
{
|
||||
clientApi.clientChunkLoadEvent(new ChunkWrapper(event.getChunk(), event.getWorld()), WorldWrapper.getWorldWrapper(event.getWorld()));
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void worldSaveEvent(WorldEvent.Save event)
|
||||
{
|
||||
eventApi.worldSaveEvent();
|
||||
}
|
||||
|
||||
|
||||
/** This is also called when a new dimension loads */
|
||||
@SubscribeEvent
|
||||
public void worldLoadEvent(WorldEvent.Load event)
|
||||
@@ -78,13 +78,13 @@ public class ForgeClientProxy
|
||||
eventApi.worldLoadEvent(WorldWrapper.getWorldWrapper(event.getWorld()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void worldUnloadEvent(WorldEvent.Unload event)
|
||||
{
|
||||
eventApi.worldUnloadEvent(WorldWrapper.getWorldWrapper(event.getWorld()));
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void blockChangeEvent(BlockEvent event)
|
||||
{
|
||||
@@ -97,12 +97,12 @@ public class ForgeClientProxy
|
||||
{
|
||||
IChunkWrapper chunk = new ChunkWrapper(event.getWorld().getChunk(event.getPos()), event.getWorld());
|
||||
DimensionTypeWrapper dimType = DimensionTypeWrapper.getDimensionTypeWrapper(event.getWorld().dimensionType());
|
||||
|
||||
|
||||
// recreate the LOD where the blocks were changed
|
||||
eventApi.blockChangeEvent(chunk, dimType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKeyInput(InputEvent.KeyInputEvent event)
|
||||
{
|
||||
@@ -110,7 +110,7 @@ public class ForgeClientProxy
|
||||
if (event.getAction() != GLFW.GLFW_PRESS) return;
|
||||
clientApi.keyPressedEvent(event.getKey());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -34,19 +34,22 @@ import com.seibel.lod.forge.wrappers.ForgeDependencySetup;
|
||||
|
||||
import com.seibel.lod.forge.wrappers.modAccessor.ModChecker;
|
||||
import com.seibel.lod.forge.wrappers.modAccessor.OptifineAccessor;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.ConfigGuiHandler;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.ExtensionPoint;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -55,7 +58,7 @@ import java.util.Random;
|
||||
* Initialize and setup the Mod. <br>
|
||||
* If you are looking for the real start of the mod
|
||||
* check out the ClientProxy.
|
||||
*
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 11-21-2021
|
||||
*/
|
||||
@@ -63,7 +66,7 @@ import java.util.Random;
|
||||
public class ForgeMain implements LodForgeMethodCaller
|
||||
{
|
||||
public static ForgeClientProxy forgeClientProxy;
|
||||
|
||||
|
||||
private void init(final FMLCommonSetupEvent event)
|
||||
{
|
||||
// make sure the dependencies are set up before the mod needs them
|
||||
@@ -71,33 +74,33 @@ public class ForgeMain implements LodForgeMethodCaller
|
||||
LodCommonMain.startup(this, !FMLLoader.getDist().isClient());
|
||||
ForgeDependencySetup.createInitialBindings();
|
||||
ClientApi.LOGGER.info("Distant Horizons initializing...");
|
||||
|
||||
SingletonHandler.bind(IModChecker.class, ModChecker.INSTANCE);
|
||||
|
||||
if (ReflectionHandler.instance.optifinePresent()) {
|
||||
ModAccessorApi.bind(IOptifineAccessor.class, new OptifineAccessor());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public ForgeMain()
|
||||
{
|
||||
// Register the methods
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientStart);
|
||||
|
||||
|
||||
// Register ourselves for server and other game events we are interested in
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
private void onClientStart(final FMLClientSetupEvent event)
|
||||
{
|
||||
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY,
|
||||
() -> (client, parent) -> ConfigGui.getScreen(parent, ""));
|
||||
ModLoadingContext.get().registerExtensionPoint(ConfigGuiHandler.ConfigGuiFactory.class,
|
||||
() -> new ConfigGuiHandler.ConfigGuiFactory((client, parent) -> ConfigGui.getScreen(parent, "")));
|
||||
forgeClientProxy = new ForgeClientProxy();
|
||||
MinecraftForge.EVENT_BUS.register(forgeClientProxy);
|
||||
}
|
||||
|
||||
private ModelDataMap dataMap = new ModelDataMap.Builder().build();
|
||||
private final ModelDataMap dataMap = new ModelDataMap.Builder().build();
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(MinecraftWrapper mc, Block block, BlockState blockState, Direction direction, Random random) {
|
||||
return mc.getModelManager().getBlockModelShaper().getBlockModel(block.defaultBlockState()).getQuads(blockState, direction, random, dataMap);
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.seibel.lod.forge.mixins;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.WorldgenRandom;
|
||||
|
||||
@Mixin(ChunkGenerator.class)
|
||||
public class MixinChunkGenerator {
|
||||
@Redirect(method = "applyBiomeDecoration", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/level/biome/Biome;generate(Lnet/minecraft/world/level/StructureFeatureManager;"
|
||||
+ "Lnet/minecraft/world/level/chunk/ChunkGenerator;Lnet/minecraft/server/level/WorldGenRegion;J"
|
||||
+ "Lnet/minecraft/world/level/levelgen/WorldgenRandom;Lnet/minecraft/core/BlockPos;)V"
|
||||
|
||||
))
|
||||
private void wrapBiomeGenerateCall(Biome biome, StructureFeatureManager structFeatManager, ChunkGenerator generator,
|
||||
WorldGenRegion genRegion, long l, WorldgenRandom random, BlockPos pos) {
|
||||
synchronized((ChunkGenerator)(Object)this) {
|
||||
biome.generate(structFeatManager, (ChunkGenerator)(Object)this, genRegion, l, random, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,49 +5,43 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.renderer.FogRenderer;
|
||||
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.FogType;
|
||||
|
||||
@Mixin(FogRenderer.class)
|
||||
public class MixinFogRenderer {
|
||||
|
||||
// Using this instead of Float.MAX_VALUE because Sodium don't like it. (And keeping it for forge just in case)
|
||||
private static final float A_REALLY_REALLY_BIG_VALUE = 4206942069.F;
|
||||
private static final float A_EVEN_LARGER_VALUE = 420694206942069.F;
|
||||
|
||||
// Using this instead of Float.MAX_VALUE because Sodium don't like it. (and copy paste in case someone in forge don't like it)
|
||||
private static final float A_REALLY_REALLY_BIG_VALUE = 420694206942069.F;
|
||||
private static final float A_EVEN_LARGER_VALUE = 42069420694206942069.F;
|
||||
|
||||
@Inject(at = @At("RETURN"),
|
||||
method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V")
|
||||
private static final void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float ticks, CallbackInfo callback) {
|
||||
method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V",
|
||||
remap = false) // Remap = false due to this being added by forge.
|
||||
private static void disableSetupFog(Camera camera, FogMode fogMode, float f, boolean bl, float partTick, CallbackInfo callback) {
|
||||
ILodConfigWrapperSingleton CONFIG;
|
||||
try {
|
||||
CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
|
||||
} catch (NullPointerException e) {
|
||||
return; // Can happen due to forge calling this before setting up the mod
|
||||
}
|
||||
ClientApi.LOGGER.debug("LOD: MixinSetupFog called!");
|
||||
FluidState fluidState = camera.getFluidInCamera();
|
||||
try {
|
||||
CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
|
||||
} catch (NullPointerException e) {
|
||||
return; // May happen due to forge for some reason haven't inited out thingy yet.
|
||||
}
|
||||
FogType fogTypes = camera.getFluidInCamera();
|
||||
Entity entity = camera.getEntity();
|
||||
boolean isUnderWater = (entity instanceof LivingEntity) && ((LivingEntity)entity).hasEffect(MobEffects.BLINDNESS);
|
||||
isUnderWater |= fluidState.is(FluidTags.WATER);
|
||||
isUnderWater |= fluidState.is(FluidTags.LAVA);
|
||||
|
||||
if (!isUnderWater) {
|
||||
if (fogMode == FogMode.FOG_TERRAIN && CONFIG.client().graphics().fogQuality().getDisableVanillaFog()) {
|
||||
RenderSystem.fogStart(A_REALLY_REALLY_BIG_VALUE);
|
||||
RenderSystem.fogEnd(A_EVEN_LARGER_VALUE);
|
||||
if (fogMode == FogMode.FOG_TERRAIN && fogTypes == FogType.NONE && CONFIG.client().graphics().fogQuality().getDisableVanillaFog()) {
|
||||
RenderSystem.setShaderFogStart(A_REALLY_REALLY_BIG_VALUE);
|
||||
RenderSystem.setShaderFogEnd(A_EVEN_LARGER_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class MixinOptionsScreen extends Screen {
|
||||
@Inject(at = @At("HEAD"),method = "init")
|
||||
private void lodconfig$init(CallbackInfo ci) {
|
||||
if (SingletonHandler.get(ILodConfigWrapperSingleton.class).client().getOptionsButton())
|
||||
this.addButton(new TexturedButtonWidget(
|
||||
this.addRenderableWidget(new TexturedButtonWidget(
|
||||
// Where the button is on the screen
|
||||
this.width / 2 - 180, this.height / 6 - 12,
|
||||
// Width and height of the button
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.seibel.lod.forge.mixins;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import com.seibel.lod.common.wrappers.DependencySetupDoneCheck;
|
||||
import com.seibel.lod.core.util.DummyRunExecutorService;
|
||||
|
||||
import net.minecraft.Util;
|
||||
|
||||
@Mixin(Util.class)
|
||||
public class MixinUtilBackgroudThread
|
||||
{
|
||||
|
||||
private static boolean shouldApplyOverride() {
|
||||
return DependencySetupDoneCheck.getIsCurrentThreadDistantGeneratorThread.get();
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;",
|
||||
at = @At("HEAD"), cancellable = true)
|
||||
private static void overrideUtil$wrapThreadWithTaskName(String string, Runnable r, CallbackInfoReturnable<Runnable> ci)
|
||||
{
|
||||
if (DependencySetupDoneCheck.isDone && shouldApplyOverride())
|
||||
{
|
||||
//ClientApi.LOGGER.info("util wrapThreadWithTaskName(Runnable) triggered");
|
||||
ci.setReturnValue(r);
|
||||
}
|
||||
}
|
||||
@Inject(method = "wrapThreadWithTaskName(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;",
|
||||
at = @At("HEAD"), cancellable = true)
|
||||
private static void overrideUtil$wrapThreadWithTaskNameForSupplier(String string, Supplier<?> r, CallbackInfoReturnable<Supplier<?>> ci)
|
||||
{
|
||||
if (DependencySetupDoneCheck.isDone && shouldApplyOverride())
|
||||
{
|
||||
//ClientApi.LOGGER.info("util wrapThreadWithTaskName(Supplier) triggered");
|
||||
ci.setReturnValue(r);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "backgroundExecutor", at = @At("HEAD"), cancellable = true)
|
||||
private static void overrideUtil$backgroundExecutor(CallbackInfoReturnable<ExecutorService> ci)
|
||||
{
|
||||
if (DependencySetupDoneCheck.isDone && shouldApplyOverride())
|
||||
{
|
||||
//ClientApi.LOGGER.info("util backgroundExecutor triggered");
|
||||
ci.setReturnValue(new DummyRunExecutorService());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,19 +20,17 @@
|
||||
package com.seibel.lod.forge.mixins;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import com.seibel.lod.common.wrappers.McObjectConverter;
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.objects.math.Mat4f;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.objects.math.Mat4f;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
||||
/**
|
||||
* This class is used to mix in my rendering code
|
||||
* before Minecraft starts rendering blocks.
|
||||
@@ -49,35 +47,28 @@ import net.minecraft.client.renderer.RenderType;
|
||||
@Mixin(LevelRenderer.class)
|
||||
public class MixinWorldRenderer
|
||||
{
|
||||
// TODO: Fix clouds
|
||||
private static float previousPartialTicks = 0;
|
||||
|
||||
public MixinWorldRenderer() {
|
||||
throw new NullPointerException("Null cannot be cast to non-null type.");
|
||||
}
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "renderSky(Lcom/mojang/blaze3d/vertex/PoseStack;F)V")
|
||||
private void renderSky(PoseStack matrixStackIn, float partialTicks, CallbackInfo callback)
|
||||
{
|
||||
// get the partial ticks since renderBlockLayer doesn't
|
||||
@Inject(method = "renderClouds", at = @At("HEAD"), cancellable = true)
|
||||
public void renderClouds(PoseStack poseStack, Matrix4f projectionMatrix, float tickDelta, double cameraX, double cameraY, double cameraZ, CallbackInfo ci) {
|
||||
// get the partial ticks since renderChunkLayer doesn't
|
||||
// have access to them
|
||||
previousPartialTicks = partialTicks;
|
||||
previousPartialTicks = tickDelta;
|
||||
}
|
||||
|
||||
// HEAD or RETURN
|
||||
@Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDD)V")
|
||||
private void renderChunkLayer(RenderType renderType, PoseStack matrixStackIn, double xIn, double yIn, double zIn, CallbackInfo callback)
|
||||
@Inject(at = @At("HEAD"), method = "renderChunkLayer(Lnet/minecraft/client/renderer/RenderType;Lcom/mojang/blaze3d/vertex/PoseStack;DDDLcom/mojang/math/Matrix4f;)V")
|
||||
private void renderChunkLayer(RenderType renderType, PoseStack modelViewMatrixStack, double cameraXBlockPos, double cameraYBlockPos, double cameraZBlockPos, Matrix4f projectionMatrix, CallbackInfo callback)
|
||||
{
|
||||
// only render before solid blocks
|
||||
if (renderType.equals(RenderType.solid()))
|
||||
{
|
||||
// get MC's current projection matrix
|
||||
float[] mcProjMatrixRaw = new float[16];
|
||||
GL15.glGetFloatv(GL15.GL_PROJECTION_MATRIX, mcProjMatrixRaw);
|
||||
Mat4f mcProjectionMatrix = new Mat4f(mcProjMatrixRaw);
|
||||
// OpenGl outputs their matrices in col,row form instead of row,col
|
||||
// (or maybe vice versa I have no idea :P)
|
||||
mcProjectionMatrix.transpose();
|
||||
|
||||
|
||||
Mat4f mcModelViewMatrix = McObjectConverter.Convert(matrixStackIn.last().pose());
|
||||
Mat4f mcModelViewMatrix = McObjectConverter.Convert(modelViewMatrixStack.last().pose());
|
||||
Mat4f mcProjectionMatrix = McObjectConverter.Convert(projectionMatrix);
|
||||
|
||||
ClientApi.INSTANCE.renderLods(mcModelViewMatrix, mcProjectionMatrix, previousPartialTicks);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.seibel.lod.forge.mixins.unsafe;
|
||||
|
||||
import net.minecraft.util.ThreadingDetector;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.concurrent.Semaphore;
|
||||
|
||||
/**
|
||||
* Why does this exist? But okay! (Will be probably removed when the experimental generator is done)
|
||||
*/
|
||||
@Mixin(ThreadingDetector.class)
|
||||
public class MixinThreadingDectector {
|
||||
@Mutable
|
||||
@Shadow
|
||||
private Semaphore lock;
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void setSemaphore(CallbackInfo ci) {
|
||||
this.lock = new Semaphore(2);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.seibel.lod.forge.wrappers;
|
||||
|
||||
import com.seibel.lod.common.LodCommonMain;
|
||||
import com.seibel.lod.common.wrappers.config.LodConfigWrapperSingleton;
|
||||
import com.seibel.lod.common.wrappers.config.NewLodConfigWrapperSingleton;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
|
||||
@@ -18,6 +20,9 @@ public class ForgeDependencySetup
|
||||
{
|
||||
public static void createInitialBindings()
|
||||
{
|
||||
SingletonHandler.bind(ILodConfigWrapperSingleton.class, LodConfigWrapperSingleton.INSTANCE);
|
||||
if (!LodCommonMain.IsNewConfig)
|
||||
SingletonHandler.bind(ILodConfigWrapperSingleton.class, LodConfigWrapperSingleton.INSTANCE);
|
||||
else
|
||||
SingletonHandler.bind(ILodConfigWrapperSingleton.class, NewLodConfigWrapperSingleton.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
+13
-14
@@ -1,4 +1,3 @@
|
||||
|
||||
package com.seibel.lod.forge.wrappers.modAccessor;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -9,17 +8,17 @@ import com.seibel.lod.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
public class OptifineAccessor implements IOptifineAccessor
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getModName()
|
||||
{
|
||||
return "Optifine-Forge-1.18.X";
|
||||
}
|
||||
@Override
|
||||
public String getModName()
|
||||
{
|
||||
return "Optifine-Forge-1.18.X";
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<AbstractChunkPosWrapper> getNormalRenderedChunks()
|
||||
{
|
||||
// TODO: Impl proper methods here
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public HashSet<AbstractChunkPosWrapper> getNormalRenderedChunks()
|
||||
{
|
||||
// TODO: Impl proper methods here
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
|
||||
modLoader="javafml" #//mandatory
|
||||
loaderVersion="[36,)" # // mandatory. This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
loaderVersion="[37,40)" # // mandatory. This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
license="GNU GPLv3"
|
||||
issueTrackerURL="https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues"
|
||||
issueTrackerURL="${issues}"
|
||||
|
||||
|
||||
[[mods]] #//mandatory
|
||||
modId="lod" #//mandatory
|
||||
version= "${version}" #//mandatory, gets the version number from jar populated by the build.gradle script
|
||||
displayName="${mod_name}" #//mandatory
|
||||
authors="${authors}"
|
||||
#//updateJSONURL="https://change.me.example.invalid/updates.json" # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
|
||||
displayURL="https://www.curseforge.com/minecraft/mc-mods/lod-level-of-detail"
|
||||
displayURL="${homepage}"
|
||||
description= "${description}" #//mandatory. The description text for the mod
|
||||
logoFile="logo.png"
|
||||
catalogueImageIcon="icon.png"
|
||||
credits="Massive thanks to: Leonardo, Cola, Ran, and CoolGi. For their hard work to bring Distant Horizons to where it is today. - James"
|
||||
authors="${authors}"
|
||||
#//mandatory. The description text for the mod
|
||||
description= ''' ${description} '''
|
||||
#// if not set defaults to "false"
|
||||
clientSideOnly="true"
|
||||
#// if not set defaults to "BOTH"
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.seibel.lod.forge.mixins",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"MixinChunkGenerator"
|
||||
"MixinUtilBackgroudThread"
|
||||
],
|
||||
"client": [
|
||||
"MixinOptionsScreen",
|
||||
@@ -12,4 +12,4 @@
|
||||
"MixinFogRenderer"
|
||||
],
|
||||
"server": []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "",
|
||||
"pack_format": 6
|
||||
"pack_format": 7
|
||||
}
|
||||
}
|
||||
|
||||
+33
-12
@@ -1,9 +1,9 @@
|
||||
org.gradle.jvmargs=-Xmx2048M
|
||||
|
||||
minecraft_version=1.16.5
|
||||
minecraft_version=1.18.1
|
||||
|
||||
archives_base_name=DistantHorizons
|
||||
mod_version=1.6.0a
|
||||
mod_version=1.6.1a
|
||||
maven_group=com.seibel.lod
|
||||
toml_version=3.6.4
|
||||
|
||||
@@ -12,17 +12,38 @@ mod_name=Distant Horizons
|
||||
mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow.
|
||||
mod_authors=James Seibel, Leonardo Amato, Cola, coolGi2007, Ran, Leetom
|
||||
mod_homepage=https://www.curseforge.com/minecraft/mc-mods/distant-horizons
|
||||
mod_source=https://gitlab.com/jeseibel/minecraft-lod-mod/
|
||||
mod_issues=https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues
|
||||
|
||||
# Fabric loader
|
||||
fabric_loader_version=0.12.3
|
||||
fabric_api_version=0.34.2+1.16
|
||||
# Fabric mods
|
||||
modmenu_version=1.16.22
|
||||
lithium_version=mc1.16.5-0.6.6
|
||||
sodium_version=3488820
|
||||
iris_version=1.16.x-v1.1.4
|
||||
fabric_loader_version=0.13.1
|
||||
fabric_api_version=0.46.4+1.18
|
||||
# Fabric mod versions
|
||||
modmenu_version=3.0.0
|
||||
starlight_version_fabric=3554912
|
||||
lithium_version=mc1.18.1-0.7.7
|
||||
sodium_version=3605309
|
||||
iris_version=1.18.x-v1.1.4
|
||||
bclib_version=1.2.5
|
||||
immersive_portals_version = v1.0.4-1.18
|
||||
|
||||
# Fabric mod run
|
||||
# 0 = Don't enable and don't run
|
||||
# 1 = Can be referenced in code but doesn't run
|
||||
# 2 = Can be referenced in code and runs in client
|
||||
enable_starlight=0
|
||||
enable_sodium=1
|
||||
enable_lithium=0
|
||||
enable_iris=0
|
||||
enable_bclib=0
|
||||
|
||||
# Forge loader
|
||||
forge_version=36.2.23
|
||||
# Forge mods
|
||||
## currentlly no mods ##
|
||||
forge_version=39.0.76
|
||||
# Forge mod versions
|
||||
starlight_version_forge=3559934
|
||||
|
||||
# Forge mod run
|
||||
# 0 = Dont enable and don't run
|
||||
# 1 = Can be referenced in code but doesn't run
|
||||
# 2 = Can be referenced in code and runs in client
|
||||
enable_starlight_forge=0
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
Reference in New Issue
Block a user