1.12.2 compiles again
@@ -23,6 +23,9 @@ plugins {
|
||||
|
||||
def isNotCommonProject = project.name != "common"
|
||||
|
||||
if (isNotCommonProject) {
|
||||
evaluationDependsOn(":common")
|
||||
}
|
||||
|
||||
// ==================== Version Properties ====================
|
||||
|
||||
@@ -121,6 +124,15 @@ if (isNotCommonProject) {
|
||||
'Multi-Release': true,
|
||||
'Main-Class': 'com.seibel.distanthorizons.core.jar.JarMain',
|
||||
)
|
||||
if (project.name == "cleanroom") {
|
||||
attributes(
|
||||
'ModType': 'CRL',
|
||||
'MixinConfigs': "${mod_id}.default.mixin.json,${mod_id}.mod.mixin.json",
|
||||
'FMLCorePlugin': 'com.seibel.distanthorizons.cleanroom.DistantHorizonsLoadingPlugin',
|
||||
'FMLCorePluginContainsFMLMod': true,
|
||||
'FMLAT': "src/main/resources/${gradle.ext.accessWidenerVersion}.distanthorizons_at.cfg"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,8 +145,14 @@ unimined.minecraft(sourceSets.main, true) {
|
||||
|
||||
if (gradle.ext.minecraft_version.startsWith("1.")) { // 26.1+ doesn't use obfuscation
|
||||
mappings {
|
||||
mojmap()
|
||||
devNamespace "mojmap"
|
||||
if(gradle.ext.minecraft_version.startsWith("1.12.2")){
|
||||
mcp("stable", "39-1.12")
|
||||
}
|
||||
else{
|
||||
mojmap()
|
||||
devNamespace "mojmap"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,18 +183,22 @@ if (isNotCommonProject) {
|
||||
source(project(":common").sourceSets.main.allSource)
|
||||
}
|
||||
} else {
|
||||
// Common: fabric for compilation + access widener, no jar remapping or runs
|
||||
unimined.minecraft {
|
||||
fabric {
|
||||
loader gradle.ext.fabric_loader_version
|
||||
accessWidener project.file("src/main/resources/${gradle.ext.accessWidenerVersion}.distanthorizons.accesswidener")
|
||||
if (gradle.ext.minecraft_version.equals("1.12.2")) {
|
||||
cleanroom {
|
||||
loader gradle.ext.cleanroom_loader_version
|
||||
}
|
||||
} else {
|
||||
fabric {
|
||||
loader gradle.ext.fabric_loader_version
|
||||
accessWidener project.file("src/main/resources/${gradle.ext.accessWidenerVersion}.distanthorizons.accesswidener")
|
||||
}
|
||||
}
|
||||
defaultRemapJar = false
|
||||
runs.off = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ==================== Configurations ====================
|
||||
|
||||
evaluationDependsOn(":core")
|
||||
@@ -342,16 +364,23 @@ if (isNotCommonProject) {
|
||||
// Make run tasks use the shadow jar so relocated deps work in dev.
|
||||
// Filter out jars bundled in the shadow jar, but keep jars that the loader also
|
||||
// needs (e.g. NightConfig — DH relocates it, but NeoForge needs the original).
|
||||
def shadowedPaths = configurations.shadowMe.resolve().collect { it.path }.toSet()
|
||||
def loaderPaths = configurations.minecraftLibraries.resolve().collect { it.path }.toSet()
|
||||
tasks.withType(JavaExec).configureEach { runTask ->
|
||||
dependsOn(shadowJar)
|
||||
classpath = files(shadowJar.archiveFile) + classpath.filter { file ->
|
||||
!file.path.contains(project.buildDir.path) &&
|
||||
!file.path.contains("core${File.separator}build") &&
|
||||
!file.path.contains("api${File.separator}build") &&
|
||||
!file.path.contains("common${File.separator}build") &&
|
||||
!(shadowedPaths.contains(file.path) && !loaderPaths.contains(file.path))
|
||||
// resolve lazily inside doFirst to avoid triggering
|
||||
// minecraft config resolution before Cleanroom/FG3 is ready
|
||||
true
|
||||
}
|
||||
doFirst {
|
||||
def shadowedPaths = configurations.shadowMe.resolve().collect { it.path }.toSet()
|
||||
def loaderPaths = configurations.minecraftLibraries.resolve().collect { it.path }.toSet()
|
||||
classpath = files(shadowJar.archiveFile) + classpath.filter { file ->
|
||||
!file.path.contains(project.buildDir.path) &&
|
||||
!file.path.contains("core${File.separator}build") &&
|
||||
!file.path.contains("api${File.separator}build") &&
|
||||
!file.path.contains("common${File.separator}build") &&
|
||||
!(shadowedPaths.contains(file.path) && !loaderPaths.contains(file.path))
|
||||
}
|
||||
}
|
||||
|
||||
// Shared run directory so all loaders use the same worlds
|
||||
@@ -367,20 +396,22 @@ if (isNotCommonProject) {
|
||||
}
|
||||
runTask.jvmArgs = filteredArgs
|
||||
|
||||
// fix (Neo)forge debug running
|
||||
doFirst {
|
||||
def modsDir = rootProject.file("run/${isClient ? 'client' : 'server'}/mods")
|
||||
modsDir.mkdirs()
|
||||
if(project.name == "forge" || project.name == "neoforge") {
|
||||
// fix (Neo)forge debug running
|
||||
doFirst {
|
||||
def modsDir = rootProject.file("run/${isClient ? 'client' : 'server'}/mods")
|
||||
modsDir.mkdirs()
|
||||
|
||||
// Remove any stale DH jars before copying the fresh one
|
||||
modsDir.listFiles()?.each { file ->
|
||||
if (file.name.startsWith(rootProject.mod_name)) file.delete()
|
||||
}
|
||||
// Remove any stale DH jars before copying the fresh one
|
||||
modsDir.listFiles()?.each { file ->
|
||||
if (file.name.startsWith(rootProject.mod_name)) file.delete()
|
||||
}
|
||||
|
||||
// Copy shadow jar into mods folder so (Neo)Forge discovers it properly
|
||||
copy {
|
||||
from shadowJar.archiveFile
|
||||
into modsDir
|
||||
// Copy shadow jar into mods folder so (Neo)Forge discovers it properly
|
||||
copy {
|
||||
from shadowJar.archiveFile
|
||||
into modsDir
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,6 +449,9 @@ if (isNotCommonProject) {
|
||||
|
||||
}
|
||||
}
|
||||
tasks.downgradeJar.inputFile.set(tasks.named("remapJar").flatMap { it.archiveFile })
|
||||
tasks.jar.finalizedBy(tasks.named("remapJar"))
|
||||
tasks.named("remapJar").configure { finalizedBy(tasks.shadeDowngradedApi) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +520,7 @@ if (isNotCommonProject) {
|
||||
|
||||
// Remove unused access wideners
|
||||
exclude { file ->
|
||||
if (file.name.contains(".distanthorizons.accesswidener") && file.name != "${rootProject.accessWidenerVersion}.distanthorizons.accesswidener") {
|
||||
if ((file.name.contains(".distanthorizons.accesswidener") && file.name != "${rootProject.accessWidenerVersion}.distanthorizons.accesswidener")) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -46,11 +46,3 @@ def writePreprocessorDefinitions() {
|
||||
writePreprocessorDefinitions()
|
||||
|
||||
// Wire JVMDowngrader to process remapped jars
|
||||
gradle.projectsEvaluated {
|
||||
rootProject.subprojects.each {
|
||||
if (it.tasks.findByName('remapJar') == null) return
|
||||
it.tasks.downgradeJar.inputFile = it.tasks.remapJar.archiveFile
|
||||
it.tasks.jar.finalizedBy(it.tasks.remapJar)
|
||||
it.tasks.remapJar.finalizedBy(it.tasks.shadeDowngradedApi)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
plugins {
|
||||
id 'dh-loader'
|
||||
}
|
||||
|
||||
unimined.minecraft {
|
||||
cleanroom {
|
||||
loader gradle.ext.cleanroom_loader_version
|
||||
useToolchains = false
|
||||
accessTransformer project(":common").file("src/main/resources/${gradle.ext.accessWidenerVersion}.distanthorizons_at.cfg")
|
||||
runs.all {
|
||||
systemProperty("crl.dev.mixin", "${mod_id}.default.mixin.json,${mod_id}.mod.mixin.json")
|
||||
systemProperty("fml.coreMods.load", "com.seibel.distanthorizons.cleanroom.DistantHorizonsLoadingPlugin")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,284 +1,45 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'com.gradleup.shadow' version '9.2.2'
|
||||
id 'xyz.wagyourtail.unimined' version '1.4.10-kappa'
|
||||
id 'net.kyori.blossom' version '2.1.0'
|
||||
id 'unimined-cleanroom'
|
||||
}
|
||||
|
||||
apply from: 'gradle/scripts/helpers.gradle'
|
||||
|
||||
// Early Assertions
|
||||
assertProperty 'mod_version'
|
||||
assertProperty 'maven_group'
|
||||
assertProperty 'mod_id'
|
||||
assertProperty 'mod_name'
|
||||
// ==================== Mod Dependency Helper ====================
|
||||
|
||||
version = propertyString('mod_version')
|
||||
group = propertyString('maven_group')
|
||||
|
||||
//base {
|
||||
// archivesName.set(propertyString('mod_id'))
|
||||
//}
|
||||
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
}
|
||||
//propertyBool('generate_sources_jar')
|
||||
if (true) {
|
||||
withSourcesJar()
|
||||
}
|
||||
//propertyBool('generate_javadocs_jar')
|
||||
if (false) {
|
||||
withJavadocJar()
|
||||
}
|
||||
def addMod(path, enabled) {
|
||||
if (enabled == "2")
|
||||
dependencies { modImplementation(path) }
|
||||
else if (enabled == "1")
|
||||
dependencies { compileOnly(path) }
|
||||
}
|
||||
|
||||
configurations {
|
||||
embed
|
||||
contain
|
||||
implementation.extendsFrom(embed)
|
||||
implementation.extendsFrom(contain)
|
||||
modCompileOnly
|
||||
compileOnly.extendsFrom(modCompileOnly)
|
||||
modRuntimeOnly
|
||||
runtimeOnly.extendsFrom(modRuntimeOnly)
|
||||
}
|
||||
|
||||
String remapTaskName = "remapShadowJar"
|
||||
|
||||
unimined.minecraft {
|
||||
version "1.12.2"
|
||||
|
||||
mappings {
|
||||
mcp("stable", "39-1.12")
|
||||
}
|
||||
|
||||
cleanroom {
|
||||
//propertyBool('use_access_transformer')
|
||||
if (true) {
|
||||
accessTransformer "${rootProject.projectDir}/cleanroom/src/main/resources/1_12_2_distanthorizons_at.cfg"
|
||||
}
|
||||
loader "0.4.4-alpha"
|
||||
runs.auth.username = "Developer"
|
||||
runs.all {
|
||||
systemProperty("crl.dev.mixin", "${mod_id}.default.mixin.json,${mod_id}.mod.mixin.json")
|
||||
jvmArgs += ['-Xmx4G']
|
||||
jvmArgs += [
|
||||
'-XX:+UseZGC',
|
||||
'-XX:-UseG1GC'
|
||||
]
|
||||
jvmArgs += ['-XX:+ZGenerational']
|
||||
|
||||
println "Classpath size BEFORE: ${classpath.files.size()}"
|
||||
|
||||
classpath = classpath.filter { file ->
|
||||
def remove =
|
||||
file.path.contains("DistantHorizons-common") ||
|
||||
file.path.contains("DistantHorizons-core") ||
|
||||
file.path.contains("DistantHorizons-api")
|
||||
|
||||
if (remove) {
|
||||
println "Removing from classpath: $file"
|
||||
}
|
||||
|
||||
return !remove
|
||||
}
|
||||
|
||||
println "Classpath size AFTER: ${classpath.files.size()}"
|
||||
|
||||
def extraPath = [
|
||||
sourceSets.main.output.classesDirs.asPath,
|
||||
sourceSets.main.output.resourcesDir.absolutePath,
|
||||
rootProject.project(':common').sourceSets.main.output.classesDirs.asPath,
|
||||
rootProject.project(':core').sourceSets.main.output.classesDirs.asPath,
|
||||
rootProject.project(':api').sourceSets.main.output.classesDirs.asPath,
|
||||
].join(File.pathSeparator)
|
||||
|
||||
jvmArgs -= ("-Dcrl.dev.extrapath=")
|
||||
jvmArgs += ("-Dcrl.dev.extrapath=${extraPath}")
|
||||
|
||||
if (false) {
|
||||
systemProperty("foundation.dump", "true")
|
||||
systemProperty("foundation.verbose", "true")
|
||||
}
|
||||
//propertyBool('is_coremod')
|
||||
if (true) {
|
||||
//coremod_plugin_class_name
|
||||
//forge for now bcs it will crash but correct is .cleanroom
|
||||
systemProperty("fml.coreMods.load", "com.seibel.distanthorizons.cleanroom.DistantHorizonsLoadingPlugin")
|
||||
}
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
defaultRemapJar = false
|
||||
|
||||
//propertyBool('enable_shadow')
|
||||
if (true) {
|
||||
remap(tasks.shadowJar) {
|
||||
mixinRemap {
|
||||
enableBaseMixin()
|
||||
enableMixinExtra()
|
||||
disableRefmap()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
remap(tasks.jar) {
|
||||
mixinRemap {
|
||||
enableBaseMixin()
|
||||
enableMixinExtra()
|
||||
disableRefmap()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mods {
|
||||
remap(configurations.modCompileOnly)
|
||||
remap(configurations.modRuntimeOnly)
|
||||
}
|
||||
}
|
||||
// ==================== Dependencies ====================
|
||||
|
||||
dependencies {
|
||||
compileOnly "com.cleanroommc:sponge-mixin:0.20.12+mixin.0.8.7"
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ==================== Tasks ====================
|
||||
|
||||
task deleteResources(type: Delete) {
|
||||
delete file("build/resources/main")
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
||||
inputs.property 'mod_id', propertyString('mod_id')
|
||||
inputs.property 'mod_name', propertyString('mod_name')
|
||||
inputs.property 'mod_version', propertyString('mod_version')
|
||||
inputs.property 'mod_description', propertyString('mod_description')
|
||||
inputs.property 'mod_authors', propertyString('mod_authors').replace('[', '').replace(']', '').split(',').collect { it.trim().replace('"', '') }.join('", "')
|
||||
inputs.property 'mod_credits', propertyString('mod_credits')
|
||||
inputs.property 'mod_url', propertyString('mod_homepage')
|
||||
inputs.property 'mod_update_json', propertyString('mod_update_json')
|
||||
inputs.property 'mod_logo_path', "assets/distanthorizons/icon.png"
|
||||
|
||||
def filterList = ['mcmod.info', 'pack.mcmeta']
|
||||
|
||||
filesMatching(filterList) { fcd ->
|
||||
fcd.expand(
|
||||
'mod_id': propertyString('mod_id'),
|
||||
'mod_name': propertyString('mod_name'),
|
||||
'mod_version': propertyString('mod_version'),
|
||||
'mod_description': propertyString('mod_description'),
|
||||
'mod_authors': propertyString('mod_authors').replace('[', '').replace(']', '').split(',').collect { it.trim().replace('"', '') }.join('", "'),
|
||||
'mod_credits': propertyString('mod_credits'),
|
||||
'mod_url': propertyString('mod_homepage'),
|
||||
'mod_update_json': propertyString('mod_update_json'),
|
||||
'mod_logo_path': "assets/distanthorizons/icon.png",
|
||||
)
|
||||
}
|
||||
|
||||
rename '(.+_at.cfg)', 'META-INF/$1'
|
||||
dependsOn(copyCoreResources)
|
||||
// dependsOn(copyCommonLoaderResources)
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
blossom {
|
||||
javaSources {
|
||||
property('mod_id', propertyString('mod_id'))
|
||||
property('mod_name', propertyString('mod_name'))
|
||||
property('mod_version', propertyString('mod_version'))
|
||||
property('package', "${maven_group}.${mod_id}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//propertyBool('enable_shadow')
|
||||
if (!true) {
|
||||
shadowJar.enabled = false
|
||||
tasks.named('runClient') {
|
||||
dependsOn(copyCoreResources)
|
||||
// dependsOn(copyCommonLoaderResources)
|
||||
finalizedBy(deleteResources)
|
||||
}
|
||||
|
||||
jar {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
if (configurations.contain.size() > 0) {
|
||||
into('/') {
|
||||
from configurations.contain
|
||||
}
|
||||
}
|
||||
doFirst {
|
||||
archiveClassifier = 'dev'
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
if (configurations.contain.size() > 0) {
|
||||
into('/') {
|
||||
from configurations.contain
|
||||
}
|
||||
}
|
||||
manifest {
|
||||
def attribute_map = [:]
|
||||
attribute_map['ModType'] = "CRL"
|
||||
attribute_map['MixinConfigs'] = "${mod_id}.default.mixin.json,${mod_id}.mod.mixin.json"
|
||||
if (configurations.contain.size() > 0) {
|
||||
attribute_map['ContainedDeps'] = configurations.contain.collect { it.name }.join(' ')
|
||||
attribute_map['NonModDeps'] = true
|
||||
}
|
||||
//propertyBool('is_coremod')
|
||||
if (true) {
|
||||
//coremod_plugin_class_name
|
||||
attribute_map['FMLCorePlugin'] = "com.seibel.distanthorizons.cleanroom.DistantHorizonsLoadingPlugin"
|
||||
//coremod_includes_mod
|
||||
if (true) {
|
||||
attribute_map['FMLCorePluginContainsFMLMod'] = true
|
||||
}
|
||||
}
|
||||
//propertyBool('use_access_transformer')
|
||||
if (true) {
|
||||
attribute_map['FMLAT'] = "1_12_2_distanthorizons_at.cfg"
|
||||
}
|
||||
attributes(attribute_map)
|
||||
}
|
||||
}
|
||||
finalizedBy(tasks.named(remapTaskName).get())
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
configurations = [project.configurations.shadowMe, project.configurations.shadowCommon]
|
||||
archiveClassifier = "shadow"
|
||||
|
||||
manifest {
|
||||
def attribute_map = [:]
|
||||
attribute_map['ModType'] = "CRL"
|
||||
attribute_map['MixinConfigs'] = "${mod_id}.default.mixin.json,${mod_id}.mod.mixin.json"
|
||||
attribute_map['FMLCorePlugin'] = "com.seibel.distanthorizons.cleanroom.DistantHorizonsLoadingPlugin"
|
||||
attribute_map['FMLCorePluginContainsFMLMod'] = true
|
||||
attribute_map['FMLAT'] = "1_12_2_distanthorizons_at.cfg"
|
||||
attributes(attribute_map)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named(remapTaskName).configure {
|
||||
doFirst {
|
||||
logging.captureStandardOutput LogLevel.INFO
|
||||
}
|
||||
doLast {
|
||||
logging.captureStandardOutput LogLevel.QUIET
|
||||
}
|
||||
}
|
||||
|
||||
compileTestJava {
|
||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
javaLauncher.set(javaToolchains.launcherFor {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
})
|
||||
//propertyBool('show_testing_output')
|
||||
if (false) {
|
||||
testLogging {
|
||||
showStandardStreams = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8'
|
||||
sourcesJar {
|
||||
def commonSources = project(":common").sourcesJar
|
||||
dependsOn commonSources
|
||||
from commonSources.archiveFile.map { zipTree(it) }
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
import groovy.text.SimpleTemplateEngine
|
||||
import org.codehaus.groovy.runtime.MethodClosure
|
||||
|
||||
ext.propertyString = this.&propertyString as MethodClosure
|
||||
ext.propertyBool = this.&propertyBool as MethodClosure
|
||||
ext.propertyStringList = this.&propertyStringList as MethodClosure
|
||||
ext.interpolate = this.&interpolate as MethodClosure
|
||||
ext.assertProperty = this.&assertProperty as MethodClosure
|
||||
ext.assertSubProperties = this.&assertSubProperties as MethodClosure
|
||||
ext.setDefaultProperty = this.&setDefaultProperty as MethodClosure
|
||||
ext.assertEnvironmentVariable = this.&assertEnvironmentVariable as MethodClosure
|
||||
|
||||
String propertyString(String key) {
|
||||
return $property(key).toString()
|
||||
}
|
||||
|
||||
boolean propertyBool(String key) {
|
||||
return propertyString(key).toBoolean()
|
||||
}
|
||||
|
||||
Collection<String> propertyStringList(String key) {
|
||||
return propertyStringList(key, ' ')
|
||||
}
|
||||
|
||||
Collection<String> propertyStringList(String key, String delimit) {
|
||||
return propertyString(key).split(delimit).findAll { !it.isEmpty() }
|
||||
}
|
||||
|
||||
private Object $property(String key) {
|
||||
def value = project.findProperty(key)
|
||||
if (value instanceof String) {
|
||||
return interpolate(value)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
String interpolate(String value) {
|
||||
if (value.startsWith('${{') && value.endsWith('}}')) {
|
||||
value = value.substring(3, value.length() - 2)
|
||||
Binding newBinding = new Binding(this.binding.getVariables())
|
||||
newBinding.setProperty('it', this)
|
||||
return new GroovyShell(this.getClass().getClassLoader(), newBinding).evaluate(value)
|
||||
}
|
||||
if (value.contains('${')) {
|
||||
return new SimpleTemplateEngine().createTemplate(value).make(project.properties).toString()
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
void assertProperty(String propertyName) {
|
||||
def property = property(propertyName)
|
||||
if (property == null) {
|
||||
throw new GradleException("Property ${propertyName} is not defined!")
|
||||
}
|
||||
if (property.isEmpty()) {
|
||||
throw new GradleException("Property ${propertyName} is empty!")
|
||||
}
|
||||
}
|
||||
|
||||
void assertSubProperties(String propertyName, String... subPropertyNames) {
|
||||
assertProperty(propertyName)
|
||||
if (propertyBool(propertyName)) {
|
||||
for (String subPropertyName : subPropertyNames) {
|
||||
assertProperty(subPropertyName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setDefaultProperty(String propertyName, boolean warn, defaultValue) {
|
||||
def property = property(propertyName)
|
||||
def exists = true
|
||||
if (property == null) {
|
||||
exists = false
|
||||
if (warn) {
|
||||
project.logger.log(LogLevel.WARN, "Property ${propertyName} is not defined!")
|
||||
}
|
||||
} else if (property.isEmpty()) {
|
||||
exists = false
|
||||
if (warn) {
|
||||
project.logger.log(LogLevel.WARN, "Property ${propertyName} is empty!")
|
||||
}
|
||||
}
|
||||
if (!exists) {
|
||||
project.setProperty(propertyName, defaultValue.toString())
|
||||
}
|
||||
}
|
||||
|
||||
void assertEnvironmentVariable(String propertyName) {
|
||||
def property = System.getenv(propertyName)
|
||||
if (property == null) {
|
||||
throw new GradleException("System Environment Variable $propertyName is not defined!")
|
||||
}
|
||||
if (property.isEmpty()) {
|
||||
throw new GradleException("Property $propertyName is empty!")
|
||||
}
|
||||
}
|
||||
@@ -1,647 +0,0 @@
|
||||
#PARSE_ESCAPES
|
||||
distanthorizons.title=Distant Horizons
|
||||
|
||||
|
||||
|
||||
distanthorizons.general.true=True
|
||||
distanthorizons.general.false=False
|
||||
distanthorizons.general.yes=Yes
|
||||
distanthorizons.general.no=No
|
||||
distanthorizons.general.back=Back
|
||||
distanthorizons.general.next=Next
|
||||
distanthorizons.general.done=Done
|
||||
distanthorizons.general.cancel=Cancel
|
||||
distanthorizons.general.reset=Reset
|
||||
distanthorizons.general.spacer=
|
||||
distanthorizons.general.apiOverride=API LOCK
|
||||
distanthorizons.general.disabledByApi.@tooltip=This option is controlled by another mod via DH's API \nso it cannot be changed via the UI or config file.
|
||||
|
||||
|
||||
|
||||
|
||||
distanthorizons.updater.title=Distant Horizons auto updater
|
||||
distanthorizons.updater.text1=§lNew update available!
|
||||
distanthorizons.updater.text2=§fDo you want to update from %s§f to %s§f?
|
||||
distanthorizons.updater.later=Not now
|
||||
distanthorizons.updater.never=Don't show again
|
||||
distanthorizons.updater.update=Update
|
||||
distanthorizons.updater.update.@tooltip=Updates the mod this one time\n(Updates when game is closed)
|
||||
distanthorizons.updater.silent=Always silent update
|
||||
distanthorizons.updater.silent.@tooltip=Every time an update is available, it would update\n(§6WARNING§r: This wont prompt you when updating)
|
||||
distanthorizons.updater.waitingForClose=Distant Horizons will finish updating once the game restarts
|
||||
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.title=Distant Horizons config
|
||||
distanthorizons.config.client=Client
|
||||
|
||||
distanthorizons.config.client.quickEnableRendering=Enable Rendering
|
||||
distanthorizons.config.client.quickEnableRendering.@tooltip=Determines if Distant Horizons Renders LODs.
|
||||
|
||||
distanthorizons.config.client.quickShowWorldGenProgress=Show LOD Gen/Import Progress
|
||||
distanthorizons.config.client.quickShowWorldGenProgress.@tooltip=If true then the world gen/importing progress will be displayed on the screen when running.
|
||||
|
||||
distanthorizons.config.client.qualityPresetSetting=Quality Preset
|
||||
distanthorizons.config.client.qualityPresetSetting.@tooltip=Modifies a number of graphical settings to quickly change Distant Horizons' rendering quality. \n\nLower this setting if your GPU is at max usage or you are having framerate issues.
|
||||
distanthorizons.config.client.threadPresetSetting=CPU Load
|
||||
distanthorizons.config.client.threadPresetSetting.@tooltip=Modifies how many threads Distant Horizons' will use. \n\nIncreasing this setting will improve the Distant Generator speed and LOD loading speed, \nbut will also increase CPU/memory usage and may introduce stuttering. \n\nNote: This is a CPU relative setting. \nIt should put an equal amount of strain on a 2 core CPU as a 64 core CPU.
|
||||
|
||||
distanthorizons.config.client.optionsButton=Show The Options Button
|
||||
distanthorizons.config.client.optionsButton.@tooltip=Show the config button to the left of the fov button
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced=Advanced options
|
||||
|
||||
distanthorizons.config.client.advanced.graphics=Graphics
|
||||
distanthorizons.config.client.advanced.worldGenerator=World Generator
|
||||
distanthorizons.config.client.advanced.server=Server
|
||||
distanthorizons.config.client.advanced.lodBuilding=LOD Building
|
||||
distanthorizons.config.client.advanced.multiThreading=Multi-Threading
|
||||
distanthorizons.config.client.advanced.logging=Logging
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.quality=Quality
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.quality.lodChunkRenderDistanceRadius=LOD Chunk Render Distance Radius
|
||||
distanthorizons.config.client.advanced.graphics.quality.lodChunkRenderDistanceRadius.@tooltip=Distant Horizons' render distance, measured in chunks. \n\nNote: this is a best effort number. \nThe render distance may be above or below this number \ndepending on your other graphic settings.
|
||||
distanthorizons.config.client.advanced.graphics.quality.horizontalQuality=LOD Dropoff Distance
|
||||
distanthorizons.config.client.advanced.graphics.quality.horizontalQuality.@tooltip=How far apart drops in quality are.\n\nHigher settings will increase the distance between drops\nbut will increase memory and GPU usage.
|
||||
distanthorizons.config.client.advanced.graphics.quality.maxHorizontalResolution=Max Horizontal Resolution
|
||||
distanthorizons.config.client.advanced.graphics.quality.maxHorizontalResolution.@tooltip=The maximum detail LODs are rendered at.\n\n§6Fastest:§r Chunk\n§6Fanciest:§r Block
|
||||
distanthorizons.config.client.advanced.graphics.quality.verticalQuality=Vertical Quality
|
||||
distanthorizons.config.client.advanced.graphics.quality.verticalQuality.@tooltip=How well LODs represent overhangs, caves, cliffsides, etc.\n\nHigher options will increase memory and GPU usage.
|
||||
distanthorizons.config.client.advanced.graphics.quality.horizontalScale=Horizontal Scale
|
||||
distanthorizons.config.client.advanced.graphics.quality.horizontalScale.@tooltip=How quickly LODs drop off in quality.\n\nLarger numbers will improve how distant terrain looks\nbut will increase memory and GPU usage.
|
||||
distanthorizons.config.client.advanced.graphics.quality.transparency=Transparency
|
||||
distanthorizons.config.client.advanced.graphics.quality.blocksToIgnore=Blocks To Ignore
|
||||
distanthorizons.config.client.advanced.graphics.quality.blocksToIgnore.@tooltip=Defines the types of blocks to ignore when generating LODs.
|
||||
distanthorizons.config.client.advanced.graphics.quality.tintWithAvoidedBlocks=Tint With Avoided Blocks
|
||||
distanthorizons.config.client.advanced.graphics.quality.tintWithAvoidedBlocks.@tooltip=§4Note: makes snow, carpet, and trapdoors look really bad§r\nShould the blocks underneath avoided blocks gain the color of the avoided block?\n§6True:§r a red flower on grass will tint the grass below it red\n§6False:§r skipped blocks will not change color of surface below them
|
||||
distanthorizons.config.client.advanced.graphics.quality.lodShading=LOD Shading
|
||||
distanthorizons.config.client.advanced.graphics.quality.lodShading.@tooltip=Defines how LODs should be shaded. \nCan be used to improve shader compatibility.
|
||||
distanthorizons.config.client.advanced.graphics.quality.grassSideRendering=Grass Side Rendering
|
||||
distanthorizons.config.client.advanced.graphics.quality.grassSideRendering.@tooltip=How should the sides and bottom of grass block LODs render?
|
||||
distanthorizons.config.client.advanced.graphics.quality.ditherDhFade=Fade Nearby DH LODs
|
||||
distanthorizons.config.client.advanced.graphics.quality.ditherDhFade.@tooltip=If true LODs will fade away as you get closer to them. \nIf false LODs will cut off abruptly at a set distance from the camera. \nThis setting is affected by the vanilla overdraw prevention config.
|
||||
distanthorizons.config.client.advanced.graphics.quality.vanillaFadeMode=Vanilla Fade Mode
|
||||
distanthorizons.config.client.advanced.graphics.quality.vanillaFadeMode.@tooltip=How should vanilla Minecraft fade into Distant Horizons LODs? \n\nNONE: Fastest, there will be a pronounced border between DH and MC rendering. \nSINGLE_PASS: Fades after MC's transparent pass, opaque blocks underwater won't be faded. \nDOUBLE_PASS: Slowest, fades after both MC's opaque and transparent passes, provides the smoothest transition.
|
||||
distanthorizons.config.client.advanced.graphics.quality.dhFadeFarClipPlane=Fade Before Far Clip Plane
|
||||
distanthorizons.config.client.advanced.graphics.quality.dhFadeFarClipPlane.@tooltip=Should DH fade out before reaching the far plane? \nThis is helpful to prevent DH clouds from cutting off in the distance.
|
||||
distanthorizons.config.client.advanced.graphics.quality.brightnessMultiplier=Brightness Multiplier
|
||||
distanthorizons.config.client.advanced.graphics.quality.brightnessMultiplier.@tooltip=How bright LOD colors are.\n\n0 = black \n1 = normal \n2 = near white
|
||||
distanthorizons.config.client.advanced.graphics.quality.saturationMultiplier=Saturation Multiplier
|
||||
distanthorizons.config.client.advanced.graphics.quality.saturationMultiplier.@tooltip=How saturated LOD colors are.\n\n0 = black and white \n1 = normal \n2 = vibrant
|
||||
distanthorizons.config.client.advanced.graphics.quality.lodBiomeBlending=Biome Blending
|
||||
distanthorizons.config.client.advanced.graphics.quality.lodBiomeBlending.@tooltip=This is the same as vanilla Biome Blending settings for LOD area. \n\nNote that anything other than '0' will greatly effect Lod building time\nand increase triangle count. The cost on chunk generation speed is also \nquite large if set to too high.\n\n'0' equals to Vanilla Biome Blending of '1x1', \n'1' equals to Vanilla Biome Blending of '3x3', \n'2' equals to Vanilla Biome Blending of '5x5'... \n
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.ssao=Ambient Occlusion
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.ssao.enableSsao=Enable Ambient Occlusion
|
||||
distanthorizons.config.client.advanced.graphics.ssao.enableSsao.@tooltip=Ambient Occlusion adds depth to the lighting of blocks.
|
||||
distanthorizons.config.client.advanced.graphics.ssao.sampleCount=Sample Count
|
||||
distanthorizons.config.client.advanced.graphics.ssao.sampleCount.@tooltip=Determines how many points in space are sampled for the occlusion test. \nHigher numbers will improve quality and reduce banding, but will increase GPU load.
|
||||
distanthorizons.config.client.advanced.graphics.ssao.radius=Radius
|
||||
distanthorizons.config.client.advanced.graphics.ssao.radius.@tooltip=Determines the radius Screen Space Ambient Occlusion is applied, measured in blocks.
|
||||
distanthorizons.config.client.advanced.graphics.ssao.strength=Strength
|
||||
distanthorizons.config.client.advanced.graphics.ssao.strength.@tooltip=Determines how dark the Screen Space Ambient Occlusion effect will be.
|
||||
distanthorizons.config.client.advanced.graphics.ssao.bias=Bias
|
||||
distanthorizons.config.client.advanced.graphics.ssao.bias.@tooltip=Increasing the value can reduce banding at the cost of reducing the strength of the effect.
|
||||
distanthorizons.config.client.advanced.graphics.ssao.minLight=Min Light
|
||||
distanthorizons.config.client.advanced.graphics.ssao.minLight.@tooltip=Determines how dark the occlusion shadows can be. \n0 = totally black at the corners \n1 = no shadow
|
||||
distanthorizons.config.client.advanced.graphics.ssao.blurRadius=Blur Radius
|
||||
distanthorizons.config.client.advanced.graphics.ssao.blurRadius.@tooltip=The radius, measured in pixels, that blurring is calculated for the SSAO. \nHigher numbers will reduce banding at the cost of GPU performance.
|
||||
distanthorizons.config.client.advanced.graphics.ssao.fadeDistanceInBlocks=Fade Distance
|
||||
distanthorizons.config.client.advanced.graphics.ssao.fadeDistanceInBlocks.@tooltip=The distance in blocks from the camera where the SSAO will fade out to. \nThis is done to prevent banding and noise at extreme distances.
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering=Generic Object Rendering
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.enableGenericRendering=Enable Rendering
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.enableGenericRendering.@tooltip=If true non terrain objects will be rendered in DH's terrain. \nThis includes beacon beams and clouds.
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.enableBeaconRendering=Enable Beacon Rendering
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.beaconRenderHeight=Beacon render height
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.beaconRenderHeight.@tooltip=Sets the maximum height at which beacons will render. \nThis will only affect new beacons coming into LOD render distance. \nBeacons currently visible in LOD chunks will not be affected.
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.expandDistantBeacons=Expand Distant Beacons
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.expandDistantBeacons.@tooltip=If true LOD beacon beams will be rendered wider at extreme distances, \nmaking them easier to see. \nIf false all LOD beacon beams will only ever be 1 block wide.
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.enableBeaconRendering.@tooltip=If true LOD beacon beams will be rendered.
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.enableCloudRendering=Enable Cloud Rendering
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.enableCloudRendering.@tooltip=If true LOD clouds will be rendered.
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.dimensionEnabledCloudRenderingCsv=Enable Cloud Rendering
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.dimensionEnabledCloudRenderingCsv.@tooltip=A comma separated separated list of dimension resource locations where DH clouds will render. \n\nExample: \minecraft:overworld,minecraft:the_end\ \n\nChanges will only be seen when the world is re-loaded.
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.enableUnexploredFogRendering=Enable Unexplored Fog Rendering
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.enableUnexploredFogRendering.@tooltip=If true unexplored/ungenerated LODs will be rendered as large dark gray boxes.
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.enableInstancedRendering=Enable Instanced Rendering
|
||||
distanthorizons.config.client.advanced.graphics.genericRendering.enableInstancedRendering.@tooltip=Can be disabled to use much slower but more compatible direct rendering. \nDisabling this can be used to fix some crashes on Mac.
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.fog=Fog
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.fog.enableDhFog=Enable Distant Horizons Fog
|
||||
distanthorizons.config.client.advanced.graphics.fog.enableDhFog.@tooltip=Determines if fog is drawn on DH LODs.
|
||||
distanthorizons.config.client.advanced.graphics.fog.colorMode=Fog Color Mode
|
||||
distanthorizons.config.client.advanced.graphics.fog.colorMode.@tooltip=The color of the fog on LODs.
|
||||
distanthorizons.config.client.advanced.graphics.fog.enableVanillaFog=Enable Vanilla Fog
|
||||
distanthorizons.config.client.advanced.graphics.fog.enableVanillaFog.@tooltip=§6True:§r Minecraft renders fog like normal.\n§6False:§r disables Minecraft's fog on vanilla chunks.\n\nMay cause issues with other mods that edit fog.
|
||||
distanthorizons.config.client.advanced.graphics.fog.advancedFog=Advanced Fog Options
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.fog.farFogStart=Fog Start
|
||||
distanthorizons.config.client.advanced.graphics.fog.farFogStart.@tooltip=Where should the fog start? \n\n'0.0': Fog start at player's position.\n'1.0': The fog-start's circle fit just in the lod render distance square.\n'1.414': The lod render distance square fit just in the fog-start's circle.\n
|
||||
distanthorizons.config.client.advanced.graphics.fog.farFogEnd=Fog End
|
||||
distanthorizons.config.client.advanced.graphics.fog.farFogEnd.@tooltip=Where should the fog end? \n\n'0.0': Fog end at player's position.\n'1.0': The fog-end's circle fit just in the lod render distance square.\n'1.414': The lod render distance square fit just in the fog-end's circle.\n
|
||||
distanthorizons.config.client.advanced.graphics.fog.farFogMin=Fog Min
|
||||
distanthorizons.config.client.advanced.graphics.fog.farFogMin.@tooltip=What is the minimum fog thickness? \n\n'0.0': No fog at all.\n'1.0': Fully fog color.\n
|
||||
distanthorizons.config.client.advanced.graphics.fog.farFogMax=Fog Max
|
||||
distanthorizons.config.client.advanced.graphics.fog.farFogMax.@tooltip=What is the maximum fog thickness? \n\n'0.0': No fog at all.\n'1.0': Fully fog color.\n
|
||||
distanthorizons.config.client.advanced.graphics.fog.farFogFalloff=Fog Falloff
|
||||
distanthorizons.config.client.advanced.graphics.fog.farFogFalloff.@tooltip=How should the fog thickness should be calculated? \n\nLINEAR: Linear based on distance (will ignore 'density')\nEXPONENTIAL: 1/(e^(distance*density)) \nEXPONENTIAL_SQUARED: 1/(e^((distance*density)^2)) \n
|
||||
distanthorizons.config.client.advanced.graphics.fog.farFogDensity=Fog Density
|
||||
distanthorizons.config.client.advanced.graphics.fog.farFogDensity.@tooltip=What is the fog's density?
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog=Height Fog Options
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogMixMode=Height Fog Mix Mode
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogMixMode.@tooltip=Defines how height effects fog. \nWhen in doubt start with SPHERICAL, ADDITION, or MAX. \n\nSPHERICAL: Fog is calculated based on camera distance. \nCYLINDRICAL: Ignore height, fog is calculated based on horizontal distance. \nMAX: max(heightFog, farFog) \nADDITION: heightFog + farFog \nMULTIPLY: heightFog * farFog \nINVERSE_MULTIPLY: 1 - (1-heightFog) * (1-farFog) \nLIMITED_ADDITION: farFog + max(farFog, heightFog) \nMULTIPLY_ADDITION: farFog + farFog * heightFog \nINVERSE_MULTIPLY_ADDITION: farFog + 1 - (1-heightFog) * (1-farFog) \nAVERAGE: farFog*0.5 + heightFog*0.5
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogDirection=Height Fog Direction
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogDirection.@tooltip=Where should the height fog be located? \n\nABOVE_CAMERA: Height fog starts from camera to the sky \nBELOW_CAMERA: Height fog starts from camera to the void \nABOVE_AND_BELOW_CAMERA: Height fog starts from camera to both the sky and the void \nABOVE_SET_HEIGHT: Height fog starts from a set height to the sky \nBELOW_SET_HEIGHT: Height fog starts from a set height to the void \nABOVE_AND_BELOW_SET_HEIGHT: Height fog starts from a set height to both the sky and the void \n
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogBaseHeight=Height Fog Base Height
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogBaseHeight.@tooltip=If the height fog is calculated around a set height, what is that height position?
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogStart=Height Fog Start
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogStart.@tooltip=How far the start of height fog should offset? \n\n'0.0': Fog start with no offset.\n'1.0': Fog start with offset of the entire world's height. (Include depth)\n
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogEnd=Height Fog End
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogEnd.@tooltip=How far the end of height fog should offset? \n\n'0.0': Fog end with no offset.\n'1.0': Fog end with offset of the entire world's height. (Include depth)\n
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogMin=Height Fog Min
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogMin.@tooltip=What is the minimum fog thickness? \n\n'0.0': No fog at all.\n'1.0': Fully fog color.\n
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogMax=Height Fog Max
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogMax.@tooltip=What is the maximum fog thickness? \n\n'0.0': No fog at all.\n'1.0': Fully fog color.\n
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogFalloff=Height Fog Falloff
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogFalloff.@tooltip=How should the height fog thickness should be calculated? \n\nLINEAR: Linear based on height (will ignore 'density')\nEXPONENTIAL: 1/(e^(height*density)) \nEXPONENTIAL_SQUARED: 1/(e^((height*density)^2)) \n
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogDensity=Height Fog Density
|
||||
distanthorizons.config.client.advanced.graphics.fog.heightFog.heightFogDensity.@tooltip=What is the height fog's density?
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.noiseTexture=Noise Texture
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.noiseTexture.enableNoiseTexture=Enable Noise Texture
|
||||
distanthorizons.config.client.advanced.graphics.noiseTexture.enableNoiseTexture.@tooltip=If enabled a noise texture will be applied to LODs to simulate textures.
|
||||
distanthorizons.config.client.advanced.graphics.noiseTexture.noiseSteps=Noise Steps
|
||||
distanthorizons.config.client.advanced.graphics.noiseTexture.noiseSteps.@tooltip=Determines how many steps of noise should be applied to the LODs.
|
||||
distanthorizons.config.client.advanced.graphics.noiseTexture.noiseIntensity=Noise Intensity
|
||||
distanthorizons.config.client.advanced.graphics.noiseTexture.noiseIntensity.@tooltip=Determines how intense the noise texture is.
|
||||
distanthorizons.config.client.advanced.graphics.noiseTexture.noiseDropoff=Noise Dropoff
|
||||
distanthorizons.config.client.advanced.graphics.noiseTexture.noiseDropoff.@tooltip=Defines how far should the noise texture render before it fades away. (in blocks). \nSet to 0 to disable noise from fading away.
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.culling=Culling
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.culling.overdrawPrevention=Overdraw Prevention
|
||||
distanthorizons.config.client.advanced.graphics.culling.overdrawPrevention.@tooltip=Determines how far from the camera Distant Horizons will start rendering. \nMeasured as a percentage of the vanilla render distance.\n-1 = Auto, overdraw will change based on the vanilla render distance.\n\nHigher values will prevent LODs from rendering behind vanilla blocks at a higher distance,\nbut may cause holes to appear in the LODs. \nHoles are most likely to appear when flying through unloaded terrain. \n\nIncreasing the vanilla render distance increases the effectiveness of this setting.
|
||||
distanthorizons.config.client.advanced.graphics.culling.reduceOverdrawWithFastMovement=Reduce Overdraw With Fast Movement
|
||||
distanthorizons.config.client.advanced.graphics.culling.reduceOverdrawWithFastMovement.@tooltip=If set to true the overdraw prevention radius will get closer \nto the camera when flying/moving quickly. \n\nThis helps reduce issues where Minecraft can't load or \ngenerate chunks fast enough to keep up with DH.
|
||||
distanthorizons.config.client.advanced.graphics.culling.enableCaveCulling=Cave Culling
|
||||
distanthorizons.config.client.advanced.graphics.culling.enableCaveCulling.@tooltip=If enabled caves will be culled \n\nAdditional Info: Currently this cull all faces \n with skylight value of 0 under the cave culling height in dimensions that \n do not have a ceiling. \n
|
||||
distanthorizons.config.client.advanced.graphics.culling.caveCullingHeight=Cave Culling Height
|
||||
distanthorizons.config.client.advanced.graphics.culling.caveCullingHeight.@tooltip=At what Y value should cave culling start?
|
||||
distanthorizons.config.client.advanced.graphics.culling.disableBeaconDistanceCulling=Enable Beacon Distance Culling
|
||||
distanthorizons.config.client.advanced.graphics.culling.disableBeaconDistanceCulling.@tooltip=If true beacons near the camera won't be drawn to prevent vanilla overdraw. \nIf false all beacons will be rendered.
|
||||
distanthorizons.config.client.advanced.graphics.culling.disableFrustumCulling=Disable Frustum Culling
|
||||
distanthorizons.config.client.advanced.graphics.culling.disableFrustumCulling.@tooltip=If false LODs outside the player's camera \naren't drawn, increasing GPU performance. \n\nIf true all LODs are drawn, even those behind \nthe player's camera, decreasing GPU performance. \n\nDisable this if you see LODs disappearing at the corners of your vision.
|
||||
distanthorizons.config.client.advanced.graphics.culling.disableShadowPassFrustumCulling=Disable Shadow Pass Frustum Culling
|
||||
distanthorizons.config.client.advanced.graphics.culling.disableShadowPassFrustumCulling.@tooltip=Identical to the other frustum culling option except that it is \nonly used when a shader mod is present using the DH API \nand the shadow pass is being rendered. \n\nDisable this if shadows render incorrectly.
|
||||
distanthorizons.config.client.advanced.graphics.culling.ignoredRenderBlockCsv=Ignored Block CSV
|
||||
distanthorizons.config.client.advanced.graphics.culling.ignoredRenderBlockCsv.@tooltip=A comma separated list of block resource locations that won't be rendered by DH. \nNote: air is always included in this list.
|
||||
distanthorizons.config.client.advanced.graphics.culling.ignoredRenderCaveBlockCsv=Ignored Cave Block CSV
|
||||
distanthorizons.config.client.advanced.graphics.culling.ignoredRenderCaveBlockCsv.@tooltip=A comma separated list of block resource locations that shouldn't be rendered \nif they are in a 0 sky light underground area. \nNote: air is always included in this list.
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.overrideVanillaGraphicsSettings=Override Vanilla Settings
|
||||
distanthorizons.config.client.advanced.graphics.overrideVanillaGraphicsSettings.@tooltip=If true some vanilla graphics settings will be automatically changed \nduring DH setup to provide a better experience. \n\nIE disabling vanilla clouds (which render on top of DH LODs), \nand chunk fading (DH already fades MC chunks).
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.experimental=Experimental
|
||||
|
||||
distanthorizons.config.client.advanced.graphics.experimental.earthCurveRatio=Earth Curve Ratio
|
||||
distanthorizons.config.client.advanced.graphics.experimental.earthCurveRatio.@tooltip=A value of 1 is equivalent to the curvature of Earth in real life. \nThe minimum accepted value is 50 and the maximum value is 5000. \nEverything between 1 and 49 will be rounded up to 50.
|
||||
distanthorizons.config.client.advanced.graphics.experimental.ignoredDimensionCsv=Ignored Dimension CSV
|
||||
distanthorizons.config.client.advanced.graphics.experimental.ignoredDimensionCsv.@tooltip=A comma separated list of dimension resource locations where DH won't render. Example: \minecraft:the_nether,minecraft:the_end\ \n\nNote: \nSome DH settings will be disabled and/or changed to improve \nvisuals when DH rendering is disabled.
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.autoUpdater=Auto Updater
|
||||
|
||||
distanthorizons.config.client.advanced.autoUpdater.enableAutoUpdater=Enable automatic updates
|
||||
distanthorizons.config.client.advanced.autoUpdater.enableSilentUpdates=Enable Silent Updates
|
||||
distanthorizons.config.client.advanced.autoUpdater.enableSilentUpdates.@tooltip=Automatically updates the mod when an update is available
|
||||
distanthorizons.config.client.advanced.autoUpdater.updateBranch=Update Branch
|
||||
distanthorizons.config.client.advanced.autoUpdater.updateBranch.@tooltip=Where to download the latest update from. \n\nAuto: Downloads either stable or nightly builds based on the current jar. \nStable: Stable builds from Modrinth. \nNightly: Nightly builds from Gitlab.
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.multiplayer=Multiplayer
|
||||
|
||||
distanthorizons.config.client.advanced.multiplayer.serverFolderNameMode=Server Folder Mode
|
||||
distanthorizons.config.client.advanced.multiplayer.serverFolderNameMode.@tooltip=Determines the folder format for local multiplayer data.\n\n§6Name Only:§r\nUses the server browser name. Ex: \Minecraft Server\\n§6IP Only:§r\n\192.168.1.40\\n§6Name IP:§r\n\Minecraft Server, IP 192.168.1.40\\n§6Name, IP, Port:§r\n\Minecraft Server, IP 192.168.1.40:25565\\n§6Name, IP, Port, MC Version:§r\n\Minecraft Server, IP 192.168.1.40:25565, GameVersion 1.18.1\\n\n§c§lCaution:§r changing while connected to a multiplayer server may cause glitches.
|
||||
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.debugging=Debug
|
||||
|
||||
distanthorizons.config.client.advanced.debugging.rendererMode=Renderer Mode
|
||||
distanthorizons.config.client.advanced.debugging.debugRendering=Debug Rendering
|
||||
distanthorizons.config.client.advanced.debugging.lodOnlyMode=Only Render LODs
|
||||
distanthorizons.config.client.advanced.debugging.lodOnlyMode.@tooltip=If enabled this will disable (most) vanilla Minecraft rendering. \n\nNOTE: Do not report any issues when this mode is on! \nThis setting is only for fun and debugging. \nMod compatibility is not guaranteed.
|
||||
distanthorizons.config.client.advanced.debugging.renderWireframe=Render Wireframe
|
||||
distanthorizons.config.client.advanced.debugging.renderWireframe.@tooltip=If enabled the LODs will render as wireframe.
|
||||
distanthorizons.config.client.advanced.debugging.enableDebugKeybindings=Enable debug keybindings
|
||||
distanthorizons.config.client.advanced.debugging.enableDebugKeybindings.@tooltip=If true several keys can be used to toggle debug states. \nF6 - enable/disable LOD rendering \nF7 - enable/disable LOD only rendering \nF8 - cycle through the different debug rendering modes
|
||||
distanthorizons.config.client.advanced.debugging.enableWhiteWorld=Enable white world
|
||||
distanthorizons.config.client.advanced.debugging.enableWhiteWorld.@tooltip=If enabled, vertex color will not be passed.\nUseful for debugging shaders.
|
||||
distanthorizons.config.client.advanced.debugging.showOverlappingQuadErrors=Show overlapping quad errors
|
||||
distanthorizons.config.client.advanced.debugging.showOverlappingQuadErrors.@tooltip=If true overlapping quads will be rendered as bright red for easy identification. \nIf false the quads will be rendered normally.
|
||||
distanthorizons.config.client.advanced.debugging.logBufferGarbageCollection=Log Buffer Garbage Collection
|
||||
distanthorizons.config.client.advanced.debugging.logBufferGarbageCollection.@tooltip=If true OpenGL Buffer garbage collection will be logged \nthis also includes the number of live buffers.
|
||||
distanthorizons.config.client.advanced.debugging.allowUnsafeValues=Allow Unsafe UI Values
|
||||
distanthorizons.config.client.advanced.debugging.allowUnsafeValues.@tooltip=If enabled, very limited config input validation will be performed. \n\nWarning: enabling this can cause instability or crashing, use at your own risk. \nNote: this option isn't saved between sessions.
|
||||
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.debugging.debugWireframe=Debug Wireframe
|
||||
|
||||
distanthorizons.config.client.advanced.debugging.debugWireframe.enableRendering=Enable Debug Wireframe Rendering
|
||||
distanthorizons.config.client.advanced.debugging.debugWireframe.enableRendering.@tooltip=If enabled, various wireframes for debugging internal functions will be drawn.
|
||||
distanthorizons.config.client.advanced.debugging.debugWireframe.showWorldGenQueue=Show World Gen Queue
|
||||
distanthorizons.config.client.advanced.debugging.debugWireframe.showNetworkSyncOnLoadQueue=Show Network Sync On Load Queue
|
||||
distanthorizons.config.client.advanced.debugging.debugWireframe.showRenderSectionStatus=Show Render Section Status
|
||||
distanthorizons.config.client.advanced.debugging.debugWireframe.showRenderSectionToggling=Show Render Section Toggling
|
||||
distanthorizons.config.client.advanced.debugging.debugWireframe.showQuadTreeRenderStatus=Show Quad Tree Render Status
|
||||
distanthorizons.config.client.advanced.debugging.debugWireframe.showFullDataUpdateStatus=Show Full Data Update Status
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.debugging.openGl=Open GL
|
||||
|
||||
distanthorizons.config.client.advanced.debugging.openGl.overrideVanillaGLLogger=Override Vanilla GL Logger
|
||||
distanthorizons.config.client.advanced.debugging.openGl.overrideVanillaGLLogger.@tooltip=Defines how OpenGL errors are handled. \nRequires rebooting Minecraft to change. \nWill catch OpenGL errors thrown by other mods.
|
||||
distanthorizons.config.client.advanced.debugging.openGl.onlyLogGlErrorsOnce=Only Log GL Errors Once
|
||||
distanthorizons.config.client.advanced.debugging.openGl.onlyLogGlErrorsOnce.@tooltip=If true each Open GL error will only be logged once. \nTEnabling this may cause some error logs to be missed. \nDoes nothing if overrideVanillaGLLogger is set to false. \n\nGenerally this can be kept as 'true' to prevent log spam. \nHowever, Please set this to 'false' if a developer needs your log to debug a GL issue. \n
|
||||
distanthorizons.config.client.advanced.debugging.openGl.glErrorHandlingMode=OpenGL Error Handling Mode
|
||||
distanthorizons.config.client.advanced.debugging.openGl.glErrorHandlingMode.@tooltip=Defines how OpenGL errors are handled. \n Requires rebooting Minecraft to apply. \nMay incorrectly catch OpenGL errors thrown by other mods.
|
||||
distanthorizons.config.client.advanced.debugging.openGl.validateBufferIdsBeforeRendering=Validate Buffer IDs Before Rendering
|
||||
distanthorizons.config.client.advanced.debugging.openGl.validateBufferIdsBeforeRendering.@tooltip=Massively reduces FPS. \nShould only be used if mysterious EXCEPTION_ACCESS_VIOLATION crashes are happening in DH's rendering code and you're attempting to troubleshoot it.
|
||||
distanthorizons.config.client.advanced.debugging.openGl.glUploadMode=Uploade Mode
|
||||
distanthorizons.config.client.advanced.debugging.openGl.glUploadMode.@tooltip=Only for debugging
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.debugging.columnBuilderDebugging=Render Column Builder
|
||||
|
||||
distanthorizons.config.client.advanced.debugging.columnBuilderDebugging.columnBuilderDebugEnable=Enable Column Builder Limiting
|
||||
distanthorizons.config.client.advanced.debugging.columnBuilderDebugging.columnBuilderDebugDetailLevel=Column Builder Limit - Detail Level
|
||||
distanthorizons.config.client.advanced.debugging.columnBuilderDebugging.columnBuilderDebugXPos=Column Builder Limit - X Pos
|
||||
distanthorizons.config.client.advanced.debugging.columnBuilderDebugging.columnBuilderDebugZPos=Column Builder Limit - Z Pos
|
||||
distanthorizons.config.client.advanced.debugging.columnBuilderDebugging.columnBuilderDebugXRow=Column Builder Limit - X Row
|
||||
distanthorizons.config.client.advanced.debugging.columnBuilderDebugging.columnBuilderDebugZRow=Column Builder Limit - Z Row
|
||||
distanthorizons.config.client.advanced.debugging.columnBuilderDebugging.columnBuilderDebugColumnIndex=Column Builder Limit - Col Index
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.debugging.f3Screen=F3 Screen
|
||||
|
||||
distanthorizons.config.client.advanced.debugging.f3Screen.showPlayerPos=Show Player Pos
|
||||
distanthorizons.config.client.advanced.debugging.f3Screen.playerPosSectionDetailLevel=Player Section Pos Detail Level
|
||||
distanthorizons.config.client.advanced.debugging.f3Screen.showThreadPools=Show Thread Pools
|
||||
distanthorizons.config.client.advanced.debugging.f3Screen.showCombinedObjectPools=Show Combined Object Pools
|
||||
distanthorizons.config.client.advanced.debugging.f3Screen.showSeparatedObjectPools=Show Separated Object Pools
|
||||
distanthorizons.config.client.advanced.debugging.f3Screen.showQueuedChunkUpdateCount=Show Queued Chunk Update Count
|
||||
distanthorizons.config.client.advanced.debugging.f3Screen.showLevelStatus=Show Level Status
|
||||
distanthorizons.config.client.advanced.debugging.f3Screen.onlyShowRenderingLevels=Only Show Rendering Levels
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen=Debug Config Screen
|
||||
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.debugConfigScreenNote=This screen is to debug features of the config screen
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.boolTest=Boolean test
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.byteTest=Byte test
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.intTest=Integer test
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.doubleTest=Double test
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.shortTest=Short test
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.longTest=Long test
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.floatTest=Float test
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.stringTest=String test
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.uiButtonTest=UI Button test
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.listTest=List (ArrayList) test
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.mapTest=Map (HashMap) test
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.categoryTest=Category test
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.linkableTest=Linkable test
|
||||
distanthorizons.config.client.advanced.debugging.exampleConfigScreen.linkableTest.@tooltip=The value of this should be the same as in Category Test
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.common=Common
|
||||
|
||||
|
||||
distanthorizons.config.common.worldGenerator=World Generator
|
||||
|
||||
distanthorizons.config.common.worldGenerator.enableDistantGeneration=Enable Distant Generation
|
||||
distanthorizons.config.common.worldGenerator.enableDistantGeneration.@tooltip=§6True:§r in single player LODs will be created outside the vanilla render distance.\nDepending on the Generator Mode pre-existing chunks will be important and/o\nmissing chunks will be generated.\nNote: this can use a large amount of CPU.\n\n§6False:§r LODs will only generate within the vanilla render distance.
|
||||
distanthorizons.config.common.worldGenerator.distantGeneratorMode=Distance Generator Mode
|
||||
distanthorizons.config.common.worldGenerator.distantGeneratorMode.@tooltip=How complicated the generation should be when generating LODs outside the vanilla render distance.
|
||||
distanthorizons.config.common.worldGenerator.showGenerationProgress=Show Generation Progress
|
||||
distanthorizons.config.common.worldGenerator.showGenerationProgress.@tooltip=Determines how should distant generator progress be displayed.
|
||||
distanthorizons.config.common.worldGenerator.generationProgressDisplayIntervalInSeconds=Progress Display Interval In Seconds
|
||||
distanthorizons.config.common.worldGenerator.generationProgressDisplayIntervalInSeconds.@tooltip=Determines how long between progress update displays.
|
||||
distanthorizons.config.common.worldGenerator.generationProgressDisableMessageDisplayTimeInSeconds=Seconds To Show Progress Hiding Instructions
|
||||
distanthorizons.config.common.worldGenerator.generationProgressDisableMessageDisplayTimeInSeconds.@tooltip=For how many seconds should instructions for disabling the distant generator progress be displayed? \nSetting this to 0 hides the instructional message so the world gen progress is shown immediately when it starts.
|
||||
distanthorizons.config.common.worldGenerator.generationProgressIncludeChunksPerSecond=Show Generation Speed in Chunks/Second
|
||||
distanthorizons.config.common.worldGenerator.generationProgressIncludeChunksPerSecond.@tooltip=When logging generation progress also include the rate at which chunks \nare being generated. \nThis can be useful for troubleshooting performance.
|
||||
|
||||
|
||||
distanthorizons.config.common.lodBuilding=Lod Building
|
||||
|
||||
distanthorizons.config.common.lodBuilding.disableUnchangedChunkCheck=Disable Unchanged Chunk Check
|
||||
distanthorizons.config.common.lodBuilding.disableUnchangedChunkCheck.@tooltip=Disabling this check may fix issues where LODs aren't updated after\nblocks have been changed.\n
|
||||
distanthorizons.config.common.lodBuilding.pullLightingForPregeneratedChunks=Pull Lighting For Pre-generated Chunks
|
||||
distanthorizons.config.common.lodBuilding.pullLightingForPregeneratedChunks.@tooltip=If true LOD generation for pre-existing chunks will attempt to pull the lighting data \nsaved in Minecraft's Region files. \nIf false DH will pull in chunks without lighting and re-light them. \n\nSetting this to true will result in faster LOD generation \nfor already generated worlds, but is broken by most lighting mods. \n\nSet this to false if LODs are black.
|
||||
distanthorizons.config.common.lodBuilding.assumePreExistingChunksAreFinished=Assume Pre-Existing Chunks Are Finished
|
||||
distanthorizons.config.common.lodBuilding.assumePreExistingChunksAreFinished.@tooltip=Setting this to true may solve some issues when using DH with a pre-generated world.
|
||||
distanthorizons.config.common.lodBuilding.dataCompression=Data Compression
|
||||
distanthorizons.config.common.lodBuilding.dataCompression.@tooltip=What algorithm should be used to compress new LOD data? \nThis setting will only affect new or updated LOD data, \nany data already generated when this setting is changed will be \nunaffected until it needs to be re-written to the database. \n\nFastest: LZ4 \nHighest Compression: LZMA2
|
||||
distanthorizons.config.common.lodBuilding.worldCompression=Lossy World Compression
|
||||
distanthorizons.config.common.lodBuilding.worldCompression.@tooltip=How should block data be compressed when creating LOD data? \nThis setting will only affect new or updated LOD data, \nany data already generated when this setting is changed will be \nunaffected until it is modified or re-loaded. \n\nMost Accurate: Merge Same Blocks \nHighest Compression: Visually Equal
|
||||
distanthorizons.config.common.lodBuilding.recalculateChunkHeightmaps=Recalculate Chunk Heightmaps
|
||||
distanthorizons.config.common.lodBuilding.recalculateChunkHeightmaps.@tooltip=True: Recalculate chunk height maps before chunks can be used by DH. This can fix problems with worlds created by external tools. \nFalse: Assume any height maps handled by Minecraft are correct. \n\nFastest: False\nMost Compatible: True
|
||||
distanthorizons.config.common.lodBuilding.showMigrationChatWarning=Log Migration In Chat
|
||||
|
||||
|
||||
distanthorizons.config.common.lodBuilding.experimental=Experimental
|
||||
|
||||
distanthorizons.config.common.lodBuilding.experimental.upsampleLowerDetailLodsToFillHoles=Upsample Lower Detail LODs To Fill Holes
|
||||
distanthorizons.config.common.lodBuilding.experimental.upsampleLowerDetailLodsToFillHoles.@tooltip=When active DH will attempt to fill missing LOD data \nwith any data that is present in the tree, preventing holes when moving \nwhen a N-sized generator (or server) is active. \n\n§6EXPERIMENTAL§r Will increase harddrive use and may cause rendering issues. \nSee the config file for more details.
|
||||
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.common.multiThreading=Multi-Threading
|
||||
|
||||
distanthorizons.config.common.multiThreading.numberOfThreads=NO. of threads
|
||||
distanthorizons.config.common.multiThreading.numberOfThreads.@tooltip=How many threads DH will use.
|
||||
distanthorizons.config.common.multiThreading.threadRunTimeRatio=Runtime % for threads
|
||||
distanthorizons.config.common.multiThreading.threadPriority=Thread Priority
|
||||
distanthorizons.config.common.multiThreading.threadPriority.@tooltip=What Java thread priority should DH's primary thread pools run with?\n\nYou probably don't need to change this unless you are also \nrunning C2ME and are seeing thread starvation in either C2ME or DH.
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.common.logging=Logging
|
||||
distanthorizons.config.common.logging.@tooltip=Controls how logging should be handled.
|
||||
|
||||
distanthorizons.config.common.logging.globalFileMaxLevel=Global File Max
|
||||
distanthorizons.config.common.logging.globalChatMaxLevel=Global Chat Max
|
||||
|
||||
distanthorizons.config.common.logging.logWorldGenEventToFile=World Gen Events - File
|
||||
distanthorizons.config.common.logging.logWorldGenPerformanceToFile=World Gen Performance - File
|
||||
distanthorizons.config.common.logging.logWorldGenChunkLoadEventToFile=World Gen Load Events - File
|
||||
distanthorizons.config.common.logging.logRendererEventToFile=Renderer Events - File
|
||||
distanthorizons.config.common.logging.logRendererGLEventToFile=OpenGL Events - File
|
||||
distanthorizons.config.common.logging.logRendererGLEventToChat=OpenGL Events - Chat
|
||||
distanthorizons.config.common.logging.logNetworkEventToFile=Network Events - File
|
||||
distanthorizons.config.common.logging.logConnectionConfigChangesToFile=Network Connection Config Changes - File
|
||||
|
||||
distanthorizons.config.common.logging.warning=Warnings
|
||||
distanthorizons.config.common.logging.warning.showLowMemoryWarningOnStartup=Show Low Memory Warning On Startup
|
||||
distanthorizons.config.common.logging.warning.showPoolInsufficientMemoryWarning=Show Pool Insufficient Memory Warning
|
||||
distanthorizons.config.common.logging.warning.showPoolInsufficientMemoryWarning.@tooltip=If DH detects that pooled objects are being garbage collected this will send a chat warning.
|
||||
distanthorizons.config.common.logging.warning.showHighVanillaRenderDistanceWarning=Show High Vanilla Render Distance Warning
|
||||
distanthorizons.config.common.logging.warning.showReplayWarningOnStartup=Show Replay Warning
|
||||
distanthorizons.config.common.logging.warning.showUpdateQueueOverloadedChatWarning=Show Update Queue Overloaded Warning
|
||||
distanthorizons.config.common.logging.warning.showSlowWorldGenSettingWarnings=Show Slow World Gen Warnings
|
||||
distanthorizons.config.common.logging.warning.showModCompatibilityWarningsOnStartup=Show Mod Compatibility Warnings
|
||||
distanthorizons.config.common.logging.warning.showGarbageCollectorWarning=Show Garbage Collector Warning
|
||||
distanthorizons.config.common.logging.warning.logGarbageCollectorWarning=Log Garbage Collector Warning
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.server=Server
|
||||
|
||||
|
||||
distanthorizons.config.server.sendLevelKeys=Send Level Keys
|
||||
distanthorizons.config.server.sendLevelKeys.@tooltip=Makes the server send level keys for each world.\nDisable this if you use alternative ways to send level keys.
|
||||
|
||||
distanthorizons.config.server.levelKeyPrefix=Level Key Prefix
|
||||
distanthorizons.config.server.levelKeyPrefix.@tooltip=Prefix of the level keys sent to the clients.\nIf the mod is running behind a proxy, each backend should use a unique value.\nIf this value is empty, level key will be based on the server's seed hash.
|
||||
|
||||
distanthorizons.config.server.enableServerGeneration=Enable Server Generation
|
||||
distanthorizons.config.server.enableServerGeneration.@tooltip=When enabled, Distant Horizons will attempt to download missing LODs from the server.\n\nNote: the server must have Distant Generation enabled for it to work.
|
||||
|
||||
distanthorizons.config.server.generationRequestRateLimit=Rate Limit for Generation Requests
|
||||
distanthorizons.config.server.generationRequestRateLimit.@tooltip=How many LOD generation requests per second should a client send?\nAlso limits the number of client requests allowed to stay in the server's queue.
|
||||
|
||||
distanthorizons.config.server.maxGenerationRequestDistance=Max Generation Request Distance
|
||||
distanthorizons.config.server.maxGenerationRequestDistance.@tooltip=Defines the distance allowed to generate around the player.
|
||||
|
||||
distanthorizons.config.server.enableRealTimeUpdates=Enable Real-time Updates
|
||||
distanthorizons.config.server.enableRealTimeUpdates.@tooltip=If true, clients will receive real-time LOD updates for chunks outside the client's render distance.
|
||||
|
||||
distanthorizons.config.server.realTimeUpdateDistanceRadiusInChunks=Real-time Update Radius in Chunks
|
||||
distanthorizons.config.server.realTimeUpdateDistanceRadiusInChunks.@tooltip=Defines the distance the player will receive updates around.
|
||||
|
||||
distanthorizons.config.server.synchronizeOnLoad=Synchronize LODs on Load
|
||||
distanthorizons.config.server.synchronizeOnLoad.@tooltip=If true, clients will receive updated LODs when joining or loading new LODs.
|
||||
|
||||
distanthorizons.config.server.syncOnLoadRateLimit=Rate Limit for Sync on Load
|
||||
distanthorizons.config.server.syncOnLoadRateLimit.@tooltip=How many LOD sync requests per second should a client send?\nAlso limits the number of client's requests allowed to stay in the server's queue.
|
||||
|
||||
distanthorizons.config.server.maxSyncOnLoadRequestDistance=Max Sync on Load Request Distance
|
||||
distanthorizons.config.server.maxSyncOnLoadRequestDistance.@tooltip=Defines the distance allowed to be synchronized around the player.\nShould be the same or larger than maxGenerationRequestDistance in most cases.
|
||||
|
||||
distanthorizons.config.server.playerBandwidthLimit=Per-player Bandwidth Limit, KB/s
|
||||
distanthorizons.config.server.playerBandwidthLimit.@tooltip=Maximum per-player speed for uploading LODs to the clients, in KB/s.\nValue of 0 disables the limit.
|
||||
distanthorizons.config.server.globalBandwidthLimit=Global Bandwidth Limit, KB/s
|
||||
distanthorizons.config.server.globalBandwidthLimit.@tooltip=Maximum global speed for uploading LODs to the clients, in KB/s.\nValue of 0 disables the limit.
|
||||
distanthorizons.config.server.enableAdaptiveTransferSpeed=Enable Adaptive Transfer Speed
|
||||
distanthorizons.config.server.enableAdaptiveTransferSpeed.@tooltip=Enables adaptive transfer speed based on client performance.\nIf true, DH will automatically adjust transfer rate to minimize connection lag.\nIf false, transfer speed will remain fixed.
|
||||
|
||||
|
||||
distanthorizons.config.server.experimental=Experimental
|
||||
|
||||
distanthorizons.config.server.experimental.enableNSizedGeneration=Enable N-sized generation
|
||||
distanthorizons.config.server.experimental.enableNSizedGeneration.@tooltip=When enabled on the client, this allows loading lower detail levels as needed to speed up terrain generation.\nThis must also be enabled on the server; otherwise, it will have no effect.\nFor better performance when switching LOD detail levels, enabling [upsampleLowerDetailLodsToFillHoles] is recommended.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
distanthorizons.config.enum.EDhApiQualityPreset.CUSTOM=Custom
|
||||
distanthorizons.config.enum.EDhApiQualityPreset.MINIMUM=1. Minimum
|
||||
distanthorizons.config.enum.EDhApiQualityPreset.LOW=2. Low
|
||||
distanthorizons.config.enum.EDhApiQualityPreset.MEDIUM=3. Medium
|
||||
distanthorizons.config.enum.EDhApiQualityPreset.HIGH=4. High
|
||||
distanthorizons.config.enum.EDhApiQualityPreset.EXTREME=5. Extreme
|
||||
|
||||
distanthorizons.config.enum.EDhApiThreadPreset.CUSTOM=Custom
|
||||
distanthorizons.config.enum.EDhApiThreadPreset.MINIMAL_IMPACT=1. Minimal Impact
|
||||
distanthorizons.config.enum.EDhApiThreadPreset.LOW_IMPACT=2. Low Impact
|
||||
distanthorizons.config.enum.EDhApiThreadPreset.BALANCED=3. Balanced
|
||||
distanthorizons.config.enum.EDhApiThreadPreset.AGGRESSIVE=4. Aggressive
|
||||
distanthorizons.config.enum.EDhApiThreadPreset.I_PAID_FOR_THE_WHOLE_CPU=5. I Paid For The Whole CPU
|
||||
|
||||
distanthorizons.config.enum.EDhApiMaxHorizontalResolution.BLOCK=1. Block
|
||||
distanthorizons.config.enum.EDhApiMaxHorizontalResolution.TWO_BLOCKS=2. 2 blocks
|
||||
distanthorizons.config.enum.EDhApiMaxHorizontalResolution.FOUR_BLOCKS=3. 4 blocks
|
||||
distanthorizons.config.enum.EDhApiMaxHorizontalResolution.HALF_CHUNK=4. Half a chunk
|
||||
distanthorizons.config.enum.EDhApiMaxHorizontalResolution.CHUNK=5. Chunk
|
||||
|
||||
distanthorizons.config.enum.EDhApiMcRenderingFadeMode.NONE=None
|
||||
distanthorizons.config.enum.EDhApiMcRenderingFadeMode.SINGLE_PASS=Single Pass
|
||||
distanthorizons.config.enum.EDhApiMcRenderingFadeMode.DOUBLE_PASS=Double Pass
|
||||
|
||||
distanthorizons.config.enum.EDhApiVerticalQuality.HEIGHT_MAP=1. Height Map
|
||||
distanthorizons.config.enum.EDhApiVerticalQuality.LOW=2. Low
|
||||
distanthorizons.config.enum.EDhApiVerticalQuality.MEDIUM=3. Medium
|
||||
distanthorizons.config.enum.EDhApiVerticalQuality.HIGH=4. High
|
||||
distanthorizons.config.enum.EDhApiVerticalQuality.VERY_HIGH=5. Very High
|
||||
distanthorizons.config.enum.EDhApiVerticalQuality.EXTREME=6. Extreme
|
||||
distanthorizons.config.enum.EDhApiVerticalQuality.PIXEL_ART=7. Pixel Art
|
||||
|
||||
distanthorizons.config.enum.EDhApiHorizontalQuality.LOWEST=Lowest
|
||||
distanthorizons.config.enum.EDhApiHorizontalQuality.LOW=Low
|
||||
distanthorizons.config.enum.EDhApiHorizontalQuality.MEDIUM=Medium
|
||||
distanthorizons.config.enum.EDhApiHorizontalQuality.HIGH=High
|
||||
distanthorizons.config.enum.EDhApiHorizontalQuality.EXTREME=Extreme
|
||||
|
||||
distanthorizons.config.enum.EDhApiTransparency.DISABLED=Disabled
|
||||
distanthorizons.config.enum.EDhApiTransparency.FAKE=Fake
|
||||
distanthorizons.config.enum.EDhApiTransparency.COMPLETE=Complete
|
||||
|
||||
distanthorizons.config.enum.EDhApiFogDrawMode.USE_OPTIFINE_SETTING=Use modded settings
|
||||
distanthorizons.config.enum.EDhApiFogDrawMode.FOG_ENABLED=Enabled
|
||||
distanthorizons.config.enum.EDhApiFogDrawMode.FOG_DISABLED=Disabled
|
||||
|
||||
distanthorizons.config.enum.EDhApiFogColorMode.USE_WORLD_FOG_COLOR=Use world fog
|
||||
distanthorizons.config.enum.EDhApiFogColorMode.USE_SKY_COLOR=Use sky color
|
||||
|
||||
distanthorizons.config.enum.EDhApiFogFalloff.LINEAR=Linear
|
||||
distanthorizons.config.enum.EDhApiFogFalloff.EXPONENTIAL=Exponential
|
||||
distanthorizons.config.enum.EDhApiFogFalloff.EXPONENTIAL_SQUARED=Exponential squared
|
||||
|
||||
distanthorizons.config.enum.EDhApiHeightFogMixMode.SPHERICAL=Spherical
|
||||
distanthorizons.config.enum.EDhApiHeightFogMixMode.CYLINDRICAL=Cylindrical
|
||||
distanthorizons.config.enum.EDhApiHeightFogMixMode.ADDITION=Addition
|
||||
distanthorizons.config.enum.EDhApiHeightFogMixMode.MAX=Max
|
||||
distanthorizons.config.enum.EDhApiHeightFogMixMode.MULTIPLY=Multiply
|
||||
distanthorizons.config.enum.EDhApiHeightFogMixMode.INVERSE_MULTIPLY=Inverse Multiply
|
||||
distanthorizons.config.enum.EDhApiHeightFogMixMode.LIMITED_ADDITION=Limited Addition
|
||||
distanthorizons.config.enum.EDhApiHeightFogMixMode.MULTIPLY_ADDITION=Multiply Addition
|
||||
distanthorizons.config.enum.EDhApiHeightFogMixMode.INVERSE_MULTIPLY_ADDITION=Inverse Multiply Addition
|
||||
distanthorizons.config.enum.EDhApiHeightFogMixMode.AVERAGE=Average
|
||||
|
||||
distanthorizons.config.enum.EDhApiHeightFogDirection.ABOVE_CAMERA=Above Camera
|
||||
distanthorizons.config.enum.EDhApiHeightFogDirection.BELOW_CAMERA=Below Camera
|
||||
distanthorizons.config.enum.EDhApiHeightFogDirection.ABOVE_AND_BELOW_CAMERA=Above And Below Camera
|
||||
distanthorizons.config.enum.EDhApiHeightFogDirection.ABOVE_SET_HEIGHT=Above Set Height
|
||||
distanthorizons.config.enum.EDhApiHeightFogDirection.BELOW_SET_HEIGHT=Below Set Height
|
||||
distanthorizons.config.enum.EDhApiHeightFogDirection.ABOVE_AND_BELOW_SET_HEIGHT=Above And Below Set Height
|
||||
|
||||
distanthorizons.config.enum.EDhApiVanillaOverdraw.NEVER=Never
|
||||
distanthorizons.config.enum.EDhApiVanillaOverdraw.DYNAMIC=Dynamic
|
||||
distanthorizons.config.enum.EDhApiVanillaOverdraw.ALWAYS=Always
|
||||
|
||||
distanthorizons.config.enum.EDhApiDistantGeneratorMode.NONE=1. Existing Only
|
||||
distanthorizons.config.enum.EDhApiDistantGeneratorMode.PRE_EXISTING_ONLY=2. Pre-Existing Chunks only
|
||||
distanthorizons.config.enum.EDhApiDistantGeneratorMode.BIOME_ONLY=3. Biome only
|
||||
distanthorizons.config.enum.EDhApiDistantGeneratorMode.BIOME_ONLY_SIMULATE_HEIGHT=4. Biome only simulate height
|
||||
distanthorizons.config.enum.EDhApiDistantGeneratorMode.SURFACE=5. Surface
|
||||
distanthorizons.config.enum.EDhApiDistantGeneratorMode.FEATURES=6. Features
|
||||
distanthorizons.config.enum.EDhApiDistantGeneratorMode.INTERNAL_SERVER=7. Full - Save Chunks
|
||||
|
||||
distanthorizons.config.enum.EDhApiDistantGeneratorProgressDisplayLocation.OVERLAY=Overlay
|
||||
distanthorizons.config.enum.EDhApiDistantGeneratorProgressDisplayLocation.CHAT=Chat
|
||||
distanthorizons.config.enum.EDhApiDistantGeneratorProgressDisplayLocation.LOG=Log
|
||||
distanthorizons.config.enum.EDhApiDistantGeneratorProgressDisplayLocation.DISABLED=Disabled
|
||||
|
||||
distanthorizons.config.enum.EDhApiDataCompressionMode.UNCOMPRESSED=Uncompressed
|
||||
distanthorizons.config.enum.EDhApiDataCompressionMode.LZ4=Fastest/Big - LZ4
|
||||
distanthorizons.config.enum.EDhApiDataCompressionMode.Z_STD_BLOCK=Fastest/Small - Z_STD - Block
|
||||
distanthorizons.config.enum.EDhApiDataCompressionMode.Z_STD_STREAM=Fast/Small - Z_STD - Stream
|
||||
distanthorizons.config.enum.EDhApiDataCompressionMode.LZMA2=Slow/Smallest - LZMA2
|
||||
|
||||
distanthorizons.config.enum.EDhApiWorldCompressionMode.MERGE_SAME_BLOCKS=1. Merge Same Blocks
|
||||
distanthorizons.config.enum.EDhApiWorldCompressionMode.VISUALLY_EQUAL=2. Visually Equal
|
||||
|
||||
distanthorizons.config.enum.EDhApiBlocksToAvoid.NONE=None
|
||||
distanthorizons.config.enum.EDhApiBlocksToAvoid.NON_COLLIDING=Non-Colliding
|
||||
|
||||
distanthorizons.config.enum.EDhApiServerFolderNameMode.NAME_ONLY=Name Only
|
||||
distanthorizons.config.enum.EDhApiServerFolderNameMode.IP_ONLY=IP Only
|
||||
distanthorizons.config.enum.EDhApiServerFolderNameMode.NAME_IP=Name and IP
|
||||
distanthorizons.config.enum.EDhApiServerFolderNameMode.NAME_IP_PORT=Name, IP, Port
|
||||
distanthorizons.config.enum.EDhApiServerFolderNameMode.NAME_IP_PORT_MC_VERSION=Name, IP, Port, MC version
|
||||
|
||||
distanthorizons.config.enum.EDhApiRendererMode.DEFAULT=Default
|
||||
distanthorizons.config.enum.EDhApiRendererMode.DEBUG=Debug
|
||||
distanthorizons.config.enum.EDhApiRendererMode.DISABLED=Disabled
|
||||
|
||||
distanthorizons.config.enum.EDhApiDebugRendering.OFF=Off
|
||||
distanthorizons.config.enum.EDhApiDebugRendering.SHOW_DETAIL=Show detail
|
||||
distanthorizons.config.enum.EDhApiDebugRendering.SHOW_GENMODE=Show generation mode
|
||||
distanthorizons.config.enum.EDhApiDebugRendering.SHOW_BLOCK_MATERIAL=Show Material
|
||||
distanthorizons.config.enum.EDhApiDebugRendering.SHOW_OVERLAPPING_QUADS=Show overlapping quads
|
||||
distanthorizons.config.enum.EDhApiDebugRendering.SHOW_RENDER_SOURCE_FLAG=Show render source flag
|
||||
|
||||
distanthorizons.config.enum.EDhApiGLErrorHandlingMode.IGNORE=Ignore
|
||||
distanthorizons.config.enum.EDhApiGLErrorHandlingMode.LOG=Log
|
||||
distanthorizons.config.enum.EDhApiGLErrorHandlingMode.LOG_THROW=Log-Throw
|
||||
|
||||
distanthorizons.config.enum.EDhApiGlProfileMode.CORE=Core
|
||||
distanthorizons.config.enum.EDhApiGlProfileMode.COMPAT=Compat
|
||||
distanthorizons.config.enum.EDhApiGlProfileMode.ANY=Any
|
||||
|
||||
distanthorizons.config.enum.EDhApiLoggerLevel.ALL=1. All
|
||||
distanthorizons.config.enum.EDhApiLoggerLevel.DEBUG=2. Debug
|
||||
distanthorizons.config.enum.EDhApiLoggerLevel.INFO=3. Info
|
||||
distanthorizons.config.enum.EDhApiLoggerLevel.WARN=4. Warn
|
||||
distanthorizons.config.enum.EDhApiLoggerLevel.ERROR=5. Error
|
||||
distanthorizons.config.enum.EDhApiLoggerLevel.DISABLED=6. Disabled
|
||||
|
||||
|
||||
distanthorizons.config.enum.EDhApiGpuUploadMethod.AUTO=Auto
|
||||
distanthorizons.config.enum.EDhApiGpuUploadMethod.NONE=None
|
||||
distanthorizons.config.enum.EDhApiGpuUploadMethod.BUFFER_STORAGE=Buffer storage
|
||||
distanthorizons.config.enum.EDhApiGpuUploadMethod.SUB_DATA=Sub data
|
||||
distanthorizons.config.enum.EDhApiGpuUploadMethod.BUFFER_MAPPING=Buffer mapping
|
||||
distanthorizons.config.enum.EDhApiGpuUploadMethod.DATA=Data
|
||||
|
||||
distanthorizons.config.enum.EDhApiLodShading.AUTO=Auto
|
||||
distanthorizons.config.enum.EDhApiLodShading.ENABLED=Enabled
|
||||
distanthorizons.config.enum.EDhApiLodShading.DISABLED=Disabled
|
||||
|
||||
distanthorizons.config.enum.EDhApiUpdateBranch.STABLE=Stable
|
||||
distanthorizons.config.enum.EDhApiUpdateBranch.NIGHTLY=Nightly
|
||||
distanthorizons.config.enum.EDhApiUpdateBranch.AUTO=Auto
|
||||
|
||||
distanthorizons.config.enum.EDhApiGrassSideRendering.AS_GRASS=As Grass
|
||||
distanthorizons.config.enum.EDhApiGrassSideRendering.FADE_TO_DIRT=Fade To Dirt
|
||||
distanthorizons.config.enum.EDhApiGrassSideRendering.AS_DIRT=As Dirt
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D uSourceColorTexture;
|
||||
uniform sampler2D uSourceDepthTexture;
|
||||
|
||||
// DH apply frag
|
||||
void main()
|
||||
{
|
||||
fragColor = vec4(0.0);
|
||||
|
||||
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||
// only update fragments that were drawn to
|
||||
float fragmentDepth = texture(uSourceDepthTexture, TexCoord).r;
|
||||
if (fragmentDepth != 1)
|
||||
{
|
||||
fragColor = texture(uSourceColorTexture, TexCoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
// use the original MC texture if no LODs were drawn to this fragment
|
||||
discard;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 vPosition;
|
||||
|
||||
out vec2 TexCoord;
|
||||
|
||||
/**
|
||||
* This is specifically used by application shaders.
|
||||
* IE post process or pixel transfer shaders, anything that is rendered using a single rectangle.
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(vPosition, 0.0, 1.0);
|
||||
TexCoord = vPosition.xy * 0.5 + 0.5;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D uCopyTexture;
|
||||
|
||||
// DH copy frag
|
||||
void main()
|
||||
{
|
||||
fragColor = texture(uCopyTexture, TexCoord);
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 vPosition;
|
||||
|
||||
out vec2 TexCoord;
|
||||
|
||||
// DH copy
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(vPosition, 0.0, 1.0);
|
||||
TexCoord = vPosition.xy * 0.5 + 0.5;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
layout (std140) uniform uniformBlock
|
||||
{
|
||||
mat4 uTransform;
|
||||
vec4 uColor;
|
||||
};
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = uColor;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
layout (std140) uniform uniformBlock
|
||||
{
|
||||
mat4 uTransform;
|
||||
vec4 uColor;
|
||||
};
|
||||
|
||||
in vec3 vPosition;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = uTransform * vec4(vPosition, 1.0);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
uniform vec4 uColor;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = uColor;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
uniform mat4 uTransform;
|
||||
|
||||
in vec3 vPosition;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = uTransform * vec4(vPosition, 1.0);
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
layout (std140) uniform fragUniformBlock
|
||||
{
|
||||
float uStartFadeBlockDistance;
|
||||
float uEndFadeBlockDistance;
|
||||
|
||||
// inverted model view matrix and projection matrix
|
||||
mat4 uDhInvMvmProj;
|
||||
};
|
||||
|
||||
uniform sampler2D uMcColorTexture;
|
||||
uniform sampler2D uDhDepthTexture;
|
||||
uniform sampler2D uDhColorTexture;
|
||||
|
||||
|
||||
vec3 calcViewPosition(float fragmentDepth, mat4 invMvmProj)
|
||||
{
|
||||
// normalized device coordinates
|
||||
vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0);
|
||||
ndc.xyz = ndc.xyz * 2.0 - 1.0;
|
||||
|
||||
vec4 eyeCoord = invMvmProj * ndc;
|
||||
return eyeCoord.xyz / eyeCoord.w;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to fade out vanilla chunks so the transition
|
||||
* between DH and vanilla is smoother.
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
// includes both the vanilla chunks as well as DH
|
||||
vec4 combinedMcDhColor = texture(uMcColorTexture, TexCoord);
|
||||
// just the DH render pass
|
||||
vec4 dhColor = texture(uDhColorTexture, TexCoord);
|
||||
|
||||
|
||||
|
||||
// the DH texture will have white if nothing was written to that pixel.
|
||||
if (dhColor == vec4(1))
|
||||
{
|
||||
// if not done vanilla clouds will render incorrectly at night
|
||||
dhColor = combinedMcDhColor;
|
||||
}
|
||||
|
||||
|
||||
float dhFragmentDepth = texture(uDhDepthTexture, TexCoord).r;
|
||||
vec3 dhVertexWorldPos = calcViewPosition(dhFragmentDepth, uDhInvMvmProj);
|
||||
float dhFragmentDistance = length(dhVertexWorldPos.xzy);
|
||||
|
||||
|
||||
float startFade = uEndFadeBlockDistance;
|
||||
float endFade = uStartFadeBlockDistance;
|
||||
|
||||
// Smoothly transition between combinedMcDhColor and uDhColorTexture
|
||||
// as the depth increases from the camera
|
||||
float fadeStep = smoothstep(startFade, endFade, dhFragmentDistance);
|
||||
fragColor = mix(combinedMcDhColor, dhColor, fadeStep);
|
||||
fragColor.a = 1.0;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D uMcDepthTexture;
|
||||
uniform sampler2D uCombinedMcDhColorTexture;
|
||||
|
||||
uniform sampler2D uDhDepthTexture;
|
||||
uniform sampler2D uDhColorTexture;
|
||||
|
||||
layout (std140) uniform fragUniformBlock
|
||||
{
|
||||
bool uOnlyRenderLods;
|
||||
|
||||
float uStartFadeBlockDistance;
|
||||
float uEndFadeBlockDistance;
|
||||
float uMaxLevelHeight;
|
||||
|
||||
// inverted model view matrix and projection matrix
|
||||
mat4 uDhInvMvmProj;
|
||||
mat4 uMcInvMvmProj;
|
||||
};
|
||||
|
||||
|
||||
|
||||
vec3 calcViewPosition(float fragmentDepth, mat4 invMvmProj)
|
||||
{
|
||||
// normalized device coordinates
|
||||
vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0);
|
||||
ndc.xyz = ndc.xyz * 2.0 - 1.0;
|
||||
|
||||
vec4 eyeCoord = invMvmProj * ndc;
|
||||
return eyeCoord.xyz / eyeCoord.w;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to fade out vanilla chunks so the transition
|
||||
* between DH and vanilla is smoother.
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
// includes both the vanilla chunks as well as DH
|
||||
vec4 combinedMcDhColor = texture(uCombinedMcDhColorTexture, TexCoord);
|
||||
// just the DH render pass
|
||||
vec4 dhColor = texture(uDhColorTexture, TexCoord);
|
||||
|
||||
// completely remove the MC render pass to only show LODs
|
||||
// useful for debugging/troubleshooting, but doesn't improve performance since MC is still rendering
|
||||
if (uOnlyRenderLods)
|
||||
{
|
||||
fragColor = dhColor;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// ignore anything that DH hasn't drawn to
|
||||
// We don't use DH's depth here because it would prevent the fade from running before DH has loaded
|
||||
if (dhColor == vec4(1))
|
||||
{
|
||||
// if not done vanilla clouds will render incorrectly at night
|
||||
dhColor = combinedMcDhColor;
|
||||
}
|
||||
|
||||
float mcFragmentDepth = texture(uMcDepthTexture, TexCoord).r;
|
||||
float dhFragmentDepth = texture(uDhDepthTexture, TexCoord).r;
|
||||
vec3 dhVertexWorldPos = calcViewPosition(dhFragmentDepth, uDhInvMvmProj);
|
||||
|
||||
// this is a work around to prevent MC clouds rendering behind DH clouds
|
||||
if (dhVertexWorldPos.y > uMaxLevelHeight)
|
||||
{
|
||||
fragColor = vec4(combinedMcDhColor.rgb, 0.0);
|
||||
}
|
||||
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||
// we only want to fade vanilla rendered objects, not to the sky or LODs
|
||||
else if (mcFragmentDepth < 1.0)
|
||||
{
|
||||
// fade based on distance from the camera
|
||||
vec3 mcVertexWorldPos = calcViewPosition(mcFragmentDepth, uMcInvMvmProj);
|
||||
float mcFragmentDistance = length(mcVertexWorldPos.xzy);
|
||||
|
||||
|
||||
// Smoothly transition between combinedMcDhColor and uDhColorTexture
|
||||
// as the depth increases from the camera
|
||||
float fadeStep = smoothstep(uStartFadeBlockDistance, uEndFadeBlockDistance, mcFragmentDistance);
|
||||
fragColor = mix(combinedMcDhColor, dhColor, fadeStep);
|
||||
fragColor.a = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
fragColor = vec4(combinedMcDhColor.rgb, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 vPosition;
|
||||
in vec4 vColor;
|
||||
|
||||
out vec4 fColor;
|
||||
out vec2 TexCoord;
|
||||
|
||||
// DH vert fade test
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(vPosition, 0.0, 1.0);
|
||||
fColor = vec4(vPosition, 0.0, 1.0);
|
||||
TexCoord = vPosition.xy * 0.5 + 0.5;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D uFadeColorTextureUniform;
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = texture(uFadeColorTextureUniform, TexCoord);
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
// inverted model view matrix and projection matrix
|
||||
uniform mat4 uDhInvMvmProj;
|
||||
|
||||
uniform sampler2D uDhDepthTexture;
|
||||
uniform sampler2D uMcColorTexture;
|
||||
uniform sampler2D uDhColorTexture;
|
||||
|
||||
uniform float uStartFadeBlockDistance;
|
||||
uniform float uEndFadeBlockDistance;
|
||||
|
||||
|
||||
|
||||
vec3 calcViewPosition(float fragmentDepth, mat4 invMvmProj)
|
||||
{
|
||||
// normalized device coordinates
|
||||
vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0);
|
||||
ndc.xyz = ndc.xyz * 2.0 - 1.0;
|
||||
|
||||
vec4 eyeCoord = invMvmProj * ndc;
|
||||
return eyeCoord.xyz / eyeCoord.w;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to fade out vanilla chunks so the transition
|
||||
* between DH and vanilla is smoother.
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
// includes both the vanilla chunks as well as DH
|
||||
vec4 combinedMcDhColor = texture(uMcColorTexture, TexCoord);
|
||||
// just the DH render pass
|
||||
vec4 dhColor = texture(uDhColorTexture, TexCoord);
|
||||
|
||||
|
||||
|
||||
// the DH texture will have white if nothing was written to that pixel.
|
||||
if (dhColor == vec4(1))
|
||||
{
|
||||
// if not done vanilla clouds will render incorrectly at night
|
||||
dhColor = combinedMcDhColor;
|
||||
}
|
||||
|
||||
|
||||
float dhFragmentDepth = texture(uDhDepthTexture, TexCoord).r;
|
||||
vec3 dhVertexWorldPos = calcViewPosition(dhFragmentDepth, uDhInvMvmProj);
|
||||
float dhFragmentDistance = length(dhVertexWorldPos.xzy);
|
||||
|
||||
|
||||
float startFade = uEndFadeBlockDistance;
|
||||
float endFade = uStartFadeBlockDistance;
|
||||
|
||||
// Smoothly transition between combinedMcDhColor and uDhColorTexture
|
||||
// as the depth increases from the camera
|
||||
float fadeStep = smoothstep(startFade, endFade, dhFragmentDistance);
|
||||
fragColor = mix(combinedMcDhColor, dhColor, fadeStep);
|
||||
fragColor.a = 1.0;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
// inverted model view matrix and projection matrix
|
||||
uniform mat4 uDhInvMvmProj;
|
||||
uniform mat4 uMcInvMvmProj;
|
||||
|
||||
uniform sampler2D uMcDepthTexture;
|
||||
uniform sampler2D uDhDepthTexture;
|
||||
uniform sampler2D uCombinedMcDhColorTexture;
|
||||
uniform sampler2D uDhColorTexture;
|
||||
|
||||
uniform float uStartFadeBlockDistance;
|
||||
uniform float uEndFadeBlockDistance;
|
||||
uniform float uMaxLevelHeight;
|
||||
|
||||
uniform bool uOnlyRenderLods;
|
||||
|
||||
|
||||
|
||||
vec3 calcViewPosition(float fragmentDepth, mat4 invMvmProj)
|
||||
{
|
||||
// normalized device coordinates
|
||||
vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0);
|
||||
ndc.xyz = ndc.xyz * 2.0 - 1.0;
|
||||
|
||||
vec4 eyeCoord = invMvmProj * ndc;
|
||||
return eyeCoord.xyz / eyeCoord.w;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to fade out vanilla chunks so the transition
|
||||
* between DH and vanilla is smoother.
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
// includes both the vanilla chunks as well as DH
|
||||
vec4 combinedMcDhColor = texture(uCombinedMcDhColorTexture, TexCoord);
|
||||
// just the DH render pass
|
||||
vec4 dhColor = texture(uDhColorTexture, TexCoord);
|
||||
|
||||
// completely remove the MC render pass to only show LODs
|
||||
// useful for debugging/troubleshooting, but doesn't improve performance since MC is still rendering
|
||||
if (uOnlyRenderLods)
|
||||
{
|
||||
fragColor = dhColor;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// ignore anything that DH hasn't drawn to
|
||||
// We don't use DH's depth here because it would prevent the fade from running before DH has loaded
|
||||
if (dhColor == vec4(1))
|
||||
{
|
||||
// if not done vanilla clouds will render incorrectly at night
|
||||
dhColor = combinedMcDhColor;
|
||||
}
|
||||
|
||||
float mcFragmentDepth = texture(uMcDepthTexture, TexCoord).r;
|
||||
float dhFragmentDepth = texture(uDhDepthTexture, TexCoord).r;
|
||||
vec3 dhVertexWorldPos = calcViewPosition(dhFragmentDepth, uDhInvMvmProj);
|
||||
|
||||
// this is a work around to prevent MC clouds rendering behind DH clouds
|
||||
if (dhVertexWorldPos.y > uMaxLevelHeight)
|
||||
{
|
||||
fragColor = vec4(combinedMcDhColor.rgb, 0.0);
|
||||
}
|
||||
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||
// we only want to fade vanilla rendered objects, not to the sky or LODs
|
||||
else if (mcFragmentDepth < 1.0)
|
||||
{
|
||||
// fade based on distance from the camera
|
||||
vec3 mcVertexWorldPos = calcViewPosition(mcFragmentDepth, uMcInvMvmProj);
|
||||
float mcFragmentDistance = length(mcVertexWorldPos.xzy);
|
||||
|
||||
|
||||
// Smoothly transition between combinedMcDhColor and uDhColorTexture
|
||||
// as the depth increases from the camera
|
||||
float fadeStep = smoothstep(uStartFadeBlockDistance, uEndFadeBlockDistance, mcFragmentDistance);
|
||||
fragColor = mix(combinedMcDhColor, dhColor, fadeStep);
|
||||
fragColor.a = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
fragColor = vec4(combinedMcDhColor.rgb, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,299 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
layout (std140) uniform fragUniformBlock
|
||||
{
|
||||
// fog uniforms
|
||||
vec4 uFogColor;
|
||||
float uFogScale;
|
||||
float uFogVerticalScale;
|
||||
int uFogDebugMode;
|
||||
int uFogFalloffType;
|
||||
|
||||
// fog config
|
||||
float uFarFogStart;
|
||||
float uFarFogLength;
|
||||
float uFarFogMin;
|
||||
float uFarFogRange;
|
||||
float uFarFogDensity;
|
||||
|
||||
// height fog config
|
||||
float uHeightFogStart;
|
||||
float uHeightFogLength;
|
||||
float uHeightFogMin;
|
||||
float uHeightFogRange;
|
||||
float uHeightFogDensity;
|
||||
|
||||
// ???
|
||||
bool uHeightFogEnabled;
|
||||
int uHeightFogFalloffType;
|
||||
bool uHeightBasedOnCamera;
|
||||
float uHeightFogBaseHeight;
|
||||
bool uHeightFogAppliesUp;
|
||||
bool uHeightFogAppliesDown;
|
||||
bool uUseSphericalFog;
|
||||
int uHeightFogMixingMode;
|
||||
float uCameraBlockYPos;
|
||||
|
||||
// inverted model view matrix and projection matrix
|
||||
mat4 uInvMvmProj;
|
||||
};
|
||||
|
||||
uniform sampler2D uDhDepthTexture;
|
||||
|
||||
|
||||
|
||||
//====================//
|
||||
// method definitions //
|
||||
//====================//
|
||||
|
||||
vec3 calcViewPosition(float fragmentDepth);
|
||||
|
||||
float getFarFogThickness(float dist);
|
||||
float getHeightFogThickness(float dist);
|
||||
float calculateHeightFogDepth(float worldYPos);
|
||||
float mixFogThickness(float far, float height);
|
||||
|
||||
float linearFog(float worldDist, float fogStart, float fogLength, float fogMin, float fogRange);
|
||||
float exponentialFog(float x, float fogStart, float fogLength, float fogMin, float fogRange, float fogDensity);
|
||||
float exponentialSquaredFog(float x, float fogStart, float fogLength, float fogMin, float fogRange, float fogDensity);
|
||||
|
||||
|
||||
|
||||
//======//
|
||||
// main //
|
||||
//======//
|
||||
|
||||
/**
|
||||
* Fragment shader for fog.
|
||||
* This should be run last so it applies above other affects like Ambient Occlusioning
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
float fragmentDepth = texture(uDhDepthTexture, TexCoord).r;
|
||||
fragColor = vec4(uFogColor.rgb, 0.0);
|
||||
|
||||
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||
// we only want to apply Fog to LODs, not to the sky outside the LODs
|
||||
if (fragmentDepth < 1.0)
|
||||
{
|
||||
int fogDebugMode = uFogDebugMode;
|
||||
if (fogDebugMode == 0)
|
||||
{
|
||||
// render fog based on distance from the camera
|
||||
vec3 vertexWorldPos = calcViewPosition(fragmentDepth);
|
||||
|
||||
float horizontalWorldDistance = length(vertexWorldPos.xz) * uFogScale;
|
||||
float worldDistance = length(vertexWorldPos.xyz) * uFogScale;
|
||||
float activeDistance = uUseSphericalFog ? worldDistance : horizontalWorldDistance;
|
||||
|
||||
|
||||
// far fog
|
||||
float farFogThickness = getFarFogThickness(activeDistance);
|
||||
|
||||
// height fog
|
||||
float heightFogDepth = calculateHeightFogDepth(vertexWorldPos.y);
|
||||
float heightFogThickness = getHeightFogThickness(heightFogDepth);
|
||||
|
||||
// combined fog
|
||||
float mixedFogThickness = mixFogThickness(farFogThickness, heightFogThickness);
|
||||
fragColor.a = clamp(mixedFogThickness, 0.0, 1.0);
|
||||
}
|
||||
else if (fogDebugMode == 1)
|
||||
{
|
||||
// test code
|
||||
|
||||
// render everything with the fog color
|
||||
fragColor.a = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// test code.
|
||||
|
||||
// this can be fired by manually changing the fullFogMode to a (normally)
|
||||
// invalid value (like 7).
|
||||
// By having a separate if statement defined by
|
||||
// a uniform we don't have to worry about GLSL optimizing away different
|
||||
// options when testing, causing a bunch of headaches if we just want to render the screen red.
|
||||
|
||||
float depthValue = textureLod(uDhDepthTexture, TexCoord, 0).r;
|
||||
fragColor.rgb = vec3(depthValue); // Convert depth value to grayscale color
|
||||
fragColor.a = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//================//
|
||||
// helper methods //
|
||||
//================//
|
||||
|
||||
vec3 calcViewPosition(float fragmentDepth)
|
||||
{
|
||||
vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0);
|
||||
ndc.xyz = ndc.xyz * 2.0 - 1.0;
|
||||
|
||||
vec4 eyeCoord = uInvMvmProj * ndc;
|
||||
return eyeCoord.xyz / eyeCoord.w;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=========//
|
||||
// far fog //
|
||||
//=========//
|
||||
|
||||
float getFarFogThickness(float dist)
|
||||
{
|
||||
if (uFogFalloffType == 0) // LINEAR
|
||||
{
|
||||
return linearFog(dist, uFarFogStart, uFarFogLength, uFarFogMin, uFarFogRange);
|
||||
}
|
||||
else if (uFogFalloffType == 1) // EXPONENTIAL
|
||||
{
|
||||
return exponentialFog(dist, uFarFogStart, uFarFogLength, uFarFogMin, uFarFogRange, uFarFogDensity);
|
||||
}
|
||||
else // EXPONENTIAL_SQUARED
|
||||
{
|
||||
return exponentialSquaredFog(dist, uFarFogStart, uFarFogLength, uFarFogMin, uFarFogRange, uFarFogDensity);
|
||||
}
|
||||
}
|
||||
|
||||
float getHeightFogThickness(float dist)
|
||||
{
|
||||
if (!uHeightFogEnabled)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
if (uHeightFogFalloffType == 0) // LINEAR
|
||||
{
|
||||
return linearFog(dist, uHeightFogStart, uHeightFogLength, uHeightFogMin, uHeightFogRange);
|
||||
}
|
||||
else if (uHeightFogFalloffType == 1) // EXPONENTIAL
|
||||
{
|
||||
return exponentialFog(dist, uHeightFogStart, uHeightFogLength, uHeightFogMin, uHeightFogRange, uHeightFogDensity);
|
||||
}
|
||||
else // EXPONENTIAL_SQUARED
|
||||
{
|
||||
return exponentialSquaredFog(dist, uHeightFogStart, uHeightFogLength, uHeightFogMin, uHeightFogRange, uHeightFogDensity);
|
||||
}
|
||||
}
|
||||
|
||||
float linearFog(float worldDist, float fogStart, float fogLength, float fogMin, float fogRange)
|
||||
{
|
||||
worldDist = (worldDist - fogStart) / fogLength;
|
||||
worldDist = clamp(worldDist, 0.0, 1.0);
|
||||
return fogMin + fogRange * worldDist;
|
||||
}
|
||||
|
||||
float exponentialFog(
|
||||
float x, float fogStart, float fogLength,
|
||||
float fogMin, float fogRange, float fogDensity)
|
||||
{
|
||||
x = max((x-fogStart)/fogLength, 0.0) * fogDensity;
|
||||
return fogMin + fogRange - fogRange/exp(x);
|
||||
}
|
||||
|
||||
float exponentialSquaredFog(
|
||||
float x, float fogStart, float fogLength,
|
||||
float fogMin, float fogRange, float fogDensity)
|
||||
{
|
||||
x = max((x-fogStart)/fogLength, 0.0) * fogDensity;
|
||||
return fogMin + fogRange - fogRange/exp(x*x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//============//
|
||||
// height fog //
|
||||
//============//
|
||||
|
||||
/** 1 = full fog, 0 = no fog */
|
||||
float calculateHeightFogDepth(float worldYPos)
|
||||
{
|
||||
// worldYPos -65 - 384
|
||||
|
||||
|
||||
//worldYPos = worldYPos * -1; // negative, fog below height; positive, fog above height
|
||||
//return worldYPos * uFogVerticalScale; // "* uFogVerticalScale" is done to convert world position to a percent of the world height;
|
||||
|
||||
if (!uHeightFogEnabled)
|
||||
{
|
||||
// ignore the height
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
if (!uHeightBasedOnCamera)
|
||||
{
|
||||
worldYPos -= (uHeightFogBaseHeight - uCameraBlockYPos);
|
||||
}
|
||||
|
||||
|
||||
if (uHeightFogAppliesDown && uHeightFogAppliesUp)
|
||||
{
|
||||
return abs(worldYPos) * uFogVerticalScale;
|
||||
}
|
||||
else if (uHeightFogAppliesDown)
|
||||
{
|
||||
// apploy fog below given height
|
||||
return -worldYPos * uFogVerticalScale;
|
||||
}
|
||||
else if (uHeightFogAppliesUp)
|
||||
{
|
||||
// apply fog above given height
|
||||
return worldYPos * uFogVerticalScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
// shouldn't happen,
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
float mixFogThickness(float far, float height)
|
||||
{
|
||||
switch (uHeightFogMixingMode)
|
||||
{
|
||||
case 0: // BASIC
|
||||
case 1: // IGNORE_HEIGHT
|
||||
return far;
|
||||
|
||||
case 2: // MAX
|
||||
return max(far, height);
|
||||
|
||||
case 3: // ADDITION
|
||||
return (far + height);
|
||||
|
||||
case 4: // MULTIPLY
|
||||
return far * height;
|
||||
|
||||
case 5: // INVERSE_MULTIPLY
|
||||
return (1.0 - (1.0-far)*(1.0-height));
|
||||
|
||||
case 6: // LIMITED_ADDITION
|
||||
return (far + max(far, height));
|
||||
|
||||
case 7: // MULTIPLY_ADDITION
|
||||
return (far + far*height);
|
||||
|
||||
case 8: // INVERSE_MULTIPLY_ADDITION
|
||||
return (far + 1.0 - (1.0-far)*(1.0-height));
|
||||
|
||||
case 9: // AVERAGE
|
||||
return (far*0.5 + height*0.5);
|
||||
}
|
||||
|
||||
// shouldn't happen, but default to BASIC / IGNORE_HEIGHT
|
||||
// if an invalid option is selected
|
||||
return far;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 vPosition;
|
||||
|
||||
out vec2 TexCoord;
|
||||
|
||||
/**
|
||||
* This is specifically used by application shaders.
|
||||
* IE post process or pixel transfer shaders, anything that is rendered using a single rectangle.
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(vPosition, 1.0, 1.0);
|
||||
TexCoord = vPosition.xy * 0.5 + 0.5;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D uColorTexture;
|
||||
uniform sampler2D uDepthTexture;
|
||||
|
||||
|
||||
/**
|
||||
* Fog application shader
|
||||
*
|
||||
* This merges the rendered fog onto DH's rendered LODs
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
fragColor = vec4(0.0);
|
||||
|
||||
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||
// only update fragments that were drawn to
|
||||
float fragmentDepth = textureLod(uDepthTexture, TexCoord, 0).r;
|
||||
if (fragmentDepth != 1)
|
||||
{
|
||||
fragColor = texture(uColorTexture, TexCoord);
|
||||
}
|
||||
}
|
||||
@@ -1,297 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
|
||||
|
||||
uniform sampler2D uDepthMap;
|
||||
// inverted model view matrix and projection matrix
|
||||
uniform mat4 uInvMvmProj;
|
||||
|
||||
// fog uniforms
|
||||
uniform vec4 uFogColor;
|
||||
uniform float uFogScale;
|
||||
uniform float uFogVerticalScale;
|
||||
uniform int uFogDebugMode;
|
||||
uniform int uFogFalloffType;
|
||||
|
||||
// fog config
|
||||
uniform float uFarFogStart;
|
||||
uniform float uFarFogLength;
|
||||
uniform float uFarFogMin;
|
||||
uniform float uFarFogRange;
|
||||
uniform float uFarFogDensity;
|
||||
|
||||
// height fog config
|
||||
uniform float uHeightFogStart;
|
||||
uniform float uHeightFogLength;
|
||||
uniform float uHeightFogMin;
|
||||
uniform float uHeightFogRange;
|
||||
uniform float uHeightFogDensity;
|
||||
|
||||
|
||||
uniform bool uHeightFogEnabled;
|
||||
uniform int uHeightFogFalloffType;
|
||||
uniform bool uHeightBasedOnCamera;
|
||||
uniform float uHeightFogBaseHeight;
|
||||
uniform bool uHeightFogAppliesUp;
|
||||
uniform bool uHeightFogAppliesDown;
|
||||
uniform bool uUseSphericalFog;
|
||||
uniform int uHeightFogMixingMode;
|
||||
uniform float uCameraBlockYPos;
|
||||
|
||||
|
||||
|
||||
//====================//
|
||||
// method definitions //
|
||||
//====================//
|
||||
|
||||
vec3 calcViewPosition(float fragmentDepth);
|
||||
|
||||
float getFarFogThickness(float dist);
|
||||
float getHeightFogThickness(float dist);
|
||||
float calculateHeightFogDepth(float worldYPos);
|
||||
float mixFogThickness(float far, float height);
|
||||
|
||||
float linearFog(float worldDist, float fogStart, float fogLength, float fogMin, float fogRange);
|
||||
float exponentialFog(float x, float fogStart, float fogLength, float fogMin, float fogRange, float fogDensity);
|
||||
float exponentialSquaredFog(float x, float fogStart, float fogLength, float fogMin, float fogRange, float fogDensity);
|
||||
|
||||
|
||||
|
||||
//======//
|
||||
// main //
|
||||
//======//
|
||||
|
||||
/**
|
||||
* Fragment shader for fog.
|
||||
* This should be run last so it applies above other affects like Ambient Occlusioning
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
float fragmentDepth = texture(uDepthMap, TexCoord).r;
|
||||
fragColor = vec4(uFogColor.rgb, 0.0);
|
||||
|
||||
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||
// we only want to apply Fog to LODs, not to the sky outside the LODs
|
||||
if (fragmentDepth < 1.0)
|
||||
{
|
||||
int fogDebugMode = uFogDebugMode;
|
||||
if (fogDebugMode == 0)
|
||||
{
|
||||
// render fog based on distance from the camera
|
||||
vec3 vertexWorldPos = calcViewPosition(fragmentDepth);
|
||||
|
||||
float horizontalWorldDistance = length(vertexWorldPos.xz) * uFogScale;
|
||||
float worldDistance = length(vertexWorldPos.xyz) * uFogScale;
|
||||
float activeDistance = uUseSphericalFog ? worldDistance : horizontalWorldDistance;
|
||||
|
||||
|
||||
// far fog
|
||||
float farFogThickness = getFarFogThickness(activeDistance);
|
||||
|
||||
// height fog
|
||||
float heightFogDepth = calculateHeightFogDepth(vertexWorldPos.y);
|
||||
float heightFogThickness = getHeightFogThickness(heightFogDepth);
|
||||
|
||||
// combined fog
|
||||
float mixedFogThickness = mixFogThickness(farFogThickness, heightFogThickness);
|
||||
fragColor.a = clamp(mixedFogThickness, 0.0, 1.0);
|
||||
}
|
||||
else if (fogDebugMode == 1)
|
||||
{
|
||||
// test code
|
||||
|
||||
// render everything with the fog color
|
||||
fragColor.a = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// test code.
|
||||
|
||||
// this can be fired by manually changing the fullFogMode to a (normally)
|
||||
// invalid value (like 7).
|
||||
// By having a separate if statement defined by
|
||||
// a uniform we don't have to worry about GLSL optimizing away different
|
||||
// options when testing, causing a bunch of headaches if we just want to render the screen red.
|
||||
|
||||
float depthValue = textureLod(uDepthMap, TexCoord, 0).r;
|
||||
fragColor.rgb = vec3(depthValue); // Convert depth value to grayscale color
|
||||
fragColor.a = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//================//
|
||||
// helper methods //
|
||||
//================//
|
||||
|
||||
vec3 calcViewPosition(float fragmentDepth)
|
||||
{
|
||||
vec4 ndc = vec4(TexCoord.xy, fragmentDepth, 1.0);
|
||||
ndc.xyz = ndc.xyz * 2.0 - 1.0;
|
||||
|
||||
vec4 eyeCoord = uInvMvmProj * ndc;
|
||||
return eyeCoord.xyz / eyeCoord.w;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=========//
|
||||
// far fog //
|
||||
//=========//
|
||||
|
||||
float getFarFogThickness(float dist)
|
||||
{
|
||||
if (uFogFalloffType == 0) // LINEAR
|
||||
{
|
||||
return linearFog(dist, uFarFogStart, uFarFogLength, uFarFogMin, uFarFogRange);
|
||||
}
|
||||
else if (uFogFalloffType == 1) // EXPONENTIAL
|
||||
{
|
||||
return exponentialFog(dist, uFarFogStart, uFarFogLength, uFarFogMin, uFarFogRange, uFarFogDensity);
|
||||
}
|
||||
else // EXPONENTIAL_SQUARED
|
||||
{
|
||||
return exponentialSquaredFog(dist, uFarFogStart, uFarFogLength, uFarFogMin, uFarFogRange, uFarFogDensity);
|
||||
}
|
||||
}
|
||||
|
||||
float getHeightFogThickness(float dist)
|
||||
{
|
||||
if (!uHeightFogEnabled)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
if (uHeightFogFalloffType == 0) // LINEAR
|
||||
{
|
||||
return linearFog(dist, uHeightFogStart, uHeightFogLength, uHeightFogMin, uHeightFogRange);
|
||||
}
|
||||
else if (uHeightFogFalloffType == 1) // EXPONENTIAL
|
||||
{
|
||||
return exponentialFog(dist, uHeightFogStart, uHeightFogLength, uHeightFogMin, uHeightFogRange, uHeightFogDensity);
|
||||
}
|
||||
else // EXPONENTIAL_SQUARED
|
||||
{
|
||||
return exponentialSquaredFog(dist, uHeightFogStart, uHeightFogLength, uHeightFogMin, uHeightFogRange, uHeightFogDensity);
|
||||
}
|
||||
}
|
||||
|
||||
float linearFog(float worldDist, float fogStart, float fogLength, float fogMin, float fogRange)
|
||||
{
|
||||
worldDist = (worldDist - fogStart) / fogLength;
|
||||
worldDist = clamp(worldDist, 0.0, 1.0);
|
||||
return fogMin + fogRange * worldDist;
|
||||
}
|
||||
|
||||
float exponentialFog(
|
||||
float x, float fogStart, float fogLength,
|
||||
float fogMin, float fogRange, float fogDensity)
|
||||
{
|
||||
x = max((x-fogStart)/fogLength, 0.0) * fogDensity;
|
||||
return fogMin + fogRange - fogRange/exp(x);
|
||||
}
|
||||
|
||||
float exponentialSquaredFog(
|
||||
float x, float fogStart, float fogLength,
|
||||
float fogMin, float fogRange, float fogDensity)
|
||||
{
|
||||
x = max((x-fogStart)/fogLength, 0.0) * fogDensity;
|
||||
return fogMin + fogRange - fogRange/exp(x*x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//============//
|
||||
// height fog //
|
||||
//============//
|
||||
|
||||
/** 1 = full fog, 0 = no fog */
|
||||
float calculateHeightFogDepth(float worldYPos)
|
||||
{
|
||||
// worldYPos -65 - 384
|
||||
|
||||
|
||||
//worldYPos = worldYPos * -1; // negative, fog below height; positive, fog above height
|
||||
//return worldYPos * uFogVerticalScale; // "* uFogVerticalScale" is done to convert world position to a percent of the world height;
|
||||
|
||||
if (!uHeightFogEnabled)
|
||||
{
|
||||
// ignore the height
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
if (!uHeightBasedOnCamera)
|
||||
{
|
||||
worldYPos -= (uHeightFogBaseHeight - uCameraBlockYPos);
|
||||
}
|
||||
|
||||
|
||||
if (uHeightFogAppliesDown && uHeightFogAppliesUp)
|
||||
{
|
||||
return abs(worldYPos) * uFogVerticalScale;
|
||||
}
|
||||
else if (uHeightFogAppliesDown)
|
||||
{
|
||||
// apploy fog below given height
|
||||
return -worldYPos * uFogVerticalScale;
|
||||
}
|
||||
else if (uHeightFogAppliesUp)
|
||||
{
|
||||
// apply fog above given height
|
||||
return worldYPos * uFogVerticalScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
// shouldn't happen,
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
float mixFogThickness(float far, float height)
|
||||
{
|
||||
switch (uHeightFogMixingMode)
|
||||
{
|
||||
case 0: // BASIC
|
||||
case 1: // IGNORE_HEIGHT
|
||||
return far;
|
||||
|
||||
case 2: // MAX
|
||||
return max(far, height);
|
||||
|
||||
case 3: // ADDITION
|
||||
return (far + height);
|
||||
|
||||
case 4: // MULTIPLY
|
||||
return far * height;
|
||||
|
||||
case 5: // INVERSE_MULTIPLY
|
||||
return (1.0 - (1.0-far)*(1.0-height));
|
||||
|
||||
case 6: // LIMITED_ADDITION
|
||||
return (far + max(far, height));
|
||||
|
||||
case 7: // MULTIPLY_ADDITION
|
||||
return (far + far*height);
|
||||
|
||||
case 8: // INVERSE_MULTIPLY_ADDITION
|
||||
return (far + 1.0 - (1.0-far)*(1.0-height));
|
||||
|
||||
case 9: // AVERAGE
|
||||
return (far*0.5 + height*0.5);
|
||||
}
|
||||
|
||||
// shouldn't happen, but default to BASIC / IGNORE_HEIGHT
|
||||
// if an invalid option is selected
|
||||
return far;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec4 fColor;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = fColor;
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
#version 330 core
|
||||
|
||||
//layout (location = 1) in vec4 aColor; // RGBA_FLOAT_COLOR
|
||||
//layout (location = 2) in vec3 aScale; // VEC3_SCALE
|
||||
//layout (location = 3) in ivec3 aTranslateChunk; // IVEC3_SCALE
|
||||
//layout (location = 4) in vec3 aTranslateSubChunk; // VEC3_SCALE
|
||||
//layout (location = 5) in int aMaterial; // IRIS_MATERIAL
|
||||
|
||||
//uniform sampler2D /*vec4*/ uColorMap;
|
||||
//uniform sampler2D /*vec3*/ uScaleMap;
|
||||
//uniform sampler2D /*int*/ uTranslateChunkXMap;
|
||||
//uniform sampler2D /*int*/ uTranslateChunkYMap;
|
||||
//uniform sampler2D /*int*/ uTranslateChunkZMap;
|
||||
//uniform sampler2D /*vec3*/ uTranslateSubChunkMap;
|
||||
//uniform sampler2D /*int*/ uMaterialMap;
|
||||
//
|
||||
//in vec3 vPosition;
|
||||
|
||||
in vec3 vPosition;
|
||||
in vec4 aColor; // RGBA_FLOAT_COLOR
|
||||
in int aMaterial; // IRIS_MATERIAL
|
||||
|
||||
layout (std140) uniform vertUniformBlock
|
||||
{
|
||||
ivec3 uOffsetChunk;
|
||||
vec3 uOffsetSubChunk;
|
||||
ivec3 uCameraPosChunk;
|
||||
vec3 uCameraPosSubChunk;
|
||||
|
||||
mat4 uProjectionMvm;
|
||||
int uSkyLight;
|
||||
int uBlockLight;
|
||||
|
||||
float uNorthShading;
|
||||
float uSouthShading;
|
||||
float uEastShading;
|
||||
float uWestShading;
|
||||
float uTopShading;
|
||||
float uBottomShading;
|
||||
};
|
||||
|
||||
uniform sampler2D uLightMap;
|
||||
|
||||
out vec4 fColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 aScale = vec3(1);
|
||||
|
||||
if (aMaterial == 999)
|
||||
{
|
||||
aScale = vec3(2);
|
||||
}
|
||||
|
||||
// vec4 aColor = texelFetch(uColorMap, ivec2(gl_InstanceID,0), 0);
|
||||
// vec3 aScale = texelFetch(uScaleMap, ivec2(gl_InstanceID,0), 0).xyz;
|
||||
//
|
||||
// float chunkX = int(texelFetch(uTranslateChunkXMap, ivec2(gl_InstanceID,0), 0).x);
|
||||
// float chunkY = int(texelFetch(uTranslateChunkYMap, ivec2(gl_InstanceID,0), 0).x);
|
||||
// float chunkZ = int(texelFetch(uTranslateChunkZMap, ivec2(gl_InstanceID,0), 0).x);
|
||||
// ivec3 aTranslateChunk = ivec3(chunkX, chunkY, chunkZ);
|
||||
//
|
||||
// vec3 aTranslateSubChunk = texelFetch(uTranslateSubChunkMap, ivec2(gl_InstanceID,0), 0).xyz;
|
||||
// int aMaterial = int(texelFetch(uMaterialMap, ivec2(gl_InstanceID,0), 0).x);
|
||||
|
||||
// aTranslate - moves the vertex to the boxGroup's relative position
|
||||
// uOffset - moves the vertex to the boxGroup's world position
|
||||
// uCameraPos - moves the vertex into camera space
|
||||
vec3 trans = (uOffsetChunk - uCameraPosChunk) * 16.0f;
|
||||
// separate float and int values are to fix percission loss at extreme distances from the origin (IE 10,000,000+)
|
||||
// luckily large translate values minus large cameraPos generally equal values that cleanly fit in a float
|
||||
trans += (uOffsetSubChunk - uCameraPosSubChunk);
|
||||
|
||||
// combination translation and scaling matrix
|
||||
mat4 transform = mat4(
|
||||
aScale.x, 0.0, 0.0, 0.0,
|
||||
0.0, aScale.y, 0.0, 0.0,
|
||||
0.0, 0.0, aScale.z, 0.0,
|
||||
trans.x, trans.y, trans.z, 1.0
|
||||
);
|
||||
|
||||
gl_Position = uProjectionMvm * transform * vec4(vPosition, 1.0);
|
||||
|
||||
float blockLight = (float(uBlockLight)+0.5) / 16.0;
|
||||
float skyLight = (float(uSkyLight)+0.5) / 16.0;
|
||||
vec4 lightColor = vec4(texture(uLightMap, vec2(blockLight, skyLight)).xyz, 1.0);
|
||||
|
||||
|
||||
fColor = lightColor * aColor;
|
||||
|
||||
int vertexIndex = gl_VertexID % 24;
|
||||
|
||||
// apply directional shading
|
||||
if (vertexIndex >= 0 && vertexIndex < 4) { fColor.rgb *= uNorthShading; }
|
||||
else if (vertexIndex >= 4 && vertexIndex < 8) { fColor.rgb *= uSouthShading; }
|
||||
else if (vertexIndex >= 8 && vertexIndex < 12) { fColor.rgb *= uWestShading; }
|
||||
else if (vertexIndex >= 12 && vertexIndex < 16) { fColor.rgb *= uEastShading; }
|
||||
else if (vertexIndex >= 16 && vertexIndex < 20) { fColor.rgb *= uBottomShading; }
|
||||
else if (vertexIndex >= 20 && vertexIndex < 24) { fColor.rgb *= uTopShading; }
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec4 fColor;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = fColor;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
uniform mat4 uTransform;
|
||||
uniform vec4 uColor;
|
||||
uniform int uSkyLight;
|
||||
uniform int uBlockLight;
|
||||
uniform sampler2D uLightMap;
|
||||
|
||||
uniform float uNorthShading;
|
||||
uniform float uSouthShading;
|
||||
uniform float uEastShading;
|
||||
uniform float uWestShading;
|
||||
uniform float uTopShading;
|
||||
uniform float uBottomShading;
|
||||
|
||||
|
||||
in vec3 vPosition;
|
||||
|
||||
out vec4 fColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = uTransform * vec4(vPosition, 1.0);
|
||||
|
||||
|
||||
float blockLight = (float(uBlockLight)+0.5) / 16.0;
|
||||
float skyLight = (float(uSkyLight)+0.5) / 16.0;
|
||||
vec4 lightColor = vec4(texture(uLightMap, vec2(blockLight, skyLight)).xyz, 1.0);
|
||||
|
||||
|
||||
fColor = lightColor * uColor;
|
||||
|
||||
// apply directional shading
|
||||
if (gl_VertexID >= 0 && gl_VertexID < 4) { fColor.rgb *= uNorthShading; }
|
||||
else if (gl_VertexID >= 4 && gl_VertexID < 8) { fColor.rgb *= uSouthShading; }
|
||||
else if (gl_VertexID >= 8 && gl_VertexID < 12) { fColor.rgb *= uWestShading; }
|
||||
else if (gl_VertexID >= 12 && gl_VertexID < 16) { fColor.rgb *= uEastShading; }
|
||||
else if (gl_VertexID >= 16 && gl_VertexID < 20) { fColor.rgb *= uBottomShading; }
|
||||
else if (gl_VertexID >= 20 && gl_VertexID < 24) { fColor.rgb *= uTopShading; }
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec4 fColor;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = fColor;
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
#version 330 core
|
||||
|
||||
layout (location = 1) in vec4 aColor;
|
||||
layout (location = 2) in vec3 aScale;
|
||||
layout (location = 3) in ivec3 aTranslateChunk;
|
||||
layout (location = 4) in vec3 aTranslateSubChunk;
|
||||
layout (location = 5) in int aMaterial;
|
||||
|
||||
uniform ivec3 uOffsetChunk;
|
||||
uniform vec3 uOffsetSubChunk;
|
||||
uniform ivec3 uCameraPosChunk;
|
||||
uniform vec3 uCameraPosSubChunk;
|
||||
|
||||
uniform mat4 uProjectionMvm;
|
||||
uniform int uSkyLight;
|
||||
uniform int uBlockLight;
|
||||
uniform sampler2D uLightMap;
|
||||
|
||||
uniform float uNorthShading;
|
||||
uniform float uSouthShading;
|
||||
uniform float uEastShading;
|
||||
uniform float uWestShading;
|
||||
uniform float uTopShading;
|
||||
uniform float uBottomShading;
|
||||
|
||||
|
||||
in vec3 vPosition;
|
||||
|
||||
out vec4 fColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
// aTranslate - moves the vertex to the boxGroup's relative position
|
||||
// uOffset - moves the vertex to the boxGroup's world position
|
||||
// uCameraPos - moves the vertex into camera space
|
||||
vec3 trans = (aTranslateChunk + uOffsetChunk - uCameraPosChunk) * 16.0f;
|
||||
// separate float and int values are to fix percission loss at extreme distances from the origin (IE 10,000,000+)
|
||||
// luckily large translate values minus large cameraPos generally equal values that cleanly fit in a float
|
||||
trans += (aTranslateSubChunk + uOffsetSubChunk - uCameraPosSubChunk);
|
||||
|
||||
// combination translation and scaling matrix
|
||||
mat4 transform = mat4(
|
||||
aScale.x, 0.0, 0.0, 0.0,
|
||||
0.0, aScale.y, 0.0, 0.0,
|
||||
0.0, 0.0, aScale.z, 0.0,
|
||||
trans.x, trans.y, trans.z, 1.0
|
||||
);
|
||||
|
||||
gl_Position = uProjectionMvm * transform * vec4(vPosition, 1.0);
|
||||
|
||||
float blockLight = (float(uBlockLight)+0.5) / 16.0;
|
||||
float skyLight = (float(uSkyLight)+0.5) / 16.0;
|
||||
vec4 lightColor = vec4(texture(uLightMap, vec2(blockLight, skyLight)).xyz, 1.0);
|
||||
|
||||
|
||||
fColor = lightColor * aColor;
|
||||
|
||||
// apply directional shading
|
||||
if (gl_VertexID >= 0 && gl_VertexID < 4) { fColor.rgb *= uNorthShading; }
|
||||
else if (gl_VertexID >= 4 && gl_VertexID < 8) { fColor.rgb *= uSouthShading; }
|
||||
else if (gl_VertexID >= 8 && gl_VertexID < 12) { fColor.rgb *= uWestShading; }
|
||||
else if (gl_VertexID >= 12 && gl_VertexID < 16) { fColor.rgb *= uEastShading; }
|
||||
else if (gl_VertexID >= 16 && gl_VertexID < 20) { fColor.rgb *= uBottomShading; }
|
||||
else if (gl_VertexID >= 20 && gl_VertexID < 24) { fColor.rgb *= uTopShading; }
|
||||
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
#version 150
|
||||
|
||||
in vec4 vertexColor;
|
||||
in vec3 vertexWorldPos;
|
||||
in vec3 vPos;
|
||||
in vec4 gl_FragCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
layout (std140) uniform fragUniformBlock
|
||||
{
|
||||
// Fade/Clip Uniforms
|
||||
float uClipDistance;
|
||||
|
||||
// Noise Uniforms
|
||||
float uNoiseIntensity;
|
||||
int uNoiseSteps;
|
||||
int uNoiseDropoff;
|
||||
bool uDitherDhRendering;
|
||||
bool uNoiseEnabled;
|
||||
};
|
||||
|
||||
|
||||
// The random functions for diffrent dimentions
|
||||
float rand(float co) { return fract(sin(co*(91.3458)) * 47453.5453); }
|
||||
float rand(vec2 co) { return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); }
|
||||
float rand(vec3 co) { return rand(co.xy + rand(co.z)); }
|
||||
|
||||
// Puts steps in a float
|
||||
// EG. setting stepSize to 4 then this would be the result of this function
|
||||
// In: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, ..., 1.1, 1.2, 1.3
|
||||
// Out: 0.0, 0.0, 0.0, 0.25, 0.25, 0.5, 0.5, ..., 1.0, 1.0, 1.25
|
||||
vec3 quantize(vec3 val, int stepSize)
|
||||
{
|
||||
return floor(val * stepSize) / stepSize;
|
||||
}
|
||||
|
||||
void applyNoise(inout vec4 fragColor, const in float viewDist)
|
||||
{
|
||||
vec3 vertexNormal = normalize(cross(dFdy(vPos.xyz), dFdx(vPos.xyz)));
|
||||
// This bit of code is required to fix the vertex position problem cus of floats in the verted world position varuable
|
||||
vec3 fixedVPos = vPos.xyz + vertexNormal * 0.001;
|
||||
|
||||
float noiseAmplification = uNoiseIntensity;
|
||||
float lum = (fragColor.r + fragColor.g + fragColor.b) / 3.0;
|
||||
noiseAmplification = (1.0 - pow(lum * 2.0 - 1.0, 2.0)) * noiseAmplification; // Lessen the effect on depending on how dark the object is, equasion for this is -(2x-1)^{2}+1
|
||||
noiseAmplification *= fragColor.a; // The effect would lessen on transparent objects
|
||||
|
||||
// Random value for each position
|
||||
float randomValue = rand(quantize(fixedVPos, uNoiseSteps))
|
||||
* 2.0 * noiseAmplification - noiseAmplification;
|
||||
|
||||
// Modifies the color
|
||||
// A value of 0 on the randomValue will result in the original color, while a value of 1 will result in a fully bright color
|
||||
vec3 newCol = fragColor.rgb + (1.0 - fragColor.rgb) * randomValue;
|
||||
newCol = clamp(newCol, 0.0, 1.0);
|
||||
|
||||
if (uNoiseDropoff != 0) {
|
||||
float distF = min(viewDist / uNoiseDropoff, 1.0);
|
||||
newCol = mix(newCol, fragColor.rgb, distF); // The further away it gets, the less noise gets applied
|
||||
}
|
||||
|
||||
fragColor.rgb = newCol;
|
||||
}
|
||||
|
||||
/** returns a normalized value between 0.0 and 1.0 */
|
||||
float bayerMatrix4x4(vec2 st)
|
||||
{
|
||||
int x = int(mod(st.x, 4.0));
|
||||
int y = int(mod(st.y, 4.0));
|
||||
|
||||
// Flattened 4x4 Bayer matrix
|
||||
float bayer4x4[16] = float[16](
|
||||
0.0, 8.0, 2.0, 10.0,
|
||||
12.0, 4.0, 14.0, 6.0,
|
||||
3.0, 11.0, 1.0, 9.0,
|
||||
15.0, 7.0, 13.0, 5.0
|
||||
);
|
||||
|
||||
// Calculate the 1D index from the 2D coordinates
|
||||
int index = y * 4 + x;
|
||||
|
||||
// Return the Bayer value normalized between 0.0 and 1.0
|
||||
return bayer4x4[index] / 16.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = vertexColor;
|
||||
|
||||
float viewDist = length(vertexWorldPos);
|
||||
|
||||
if (uDitherDhRendering)
|
||||
{
|
||||
// Dither out the fragment based on distance and noise.
|
||||
// Dithering is used since it works for both opaque and transparent rendering
|
||||
|
||||
// noise increases as the distance increases
|
||||
// the fragCoord is used since it is stable and small so the dithering is cleaner
|
||||
float worldNoise = bayerMatrix4x4(gl_FragCoord.xy);
|
||||
// minor fudge factor to make sure all pixels fade out
|
||||
// if not included 1 in 16 pixels would never fade away
|
||||
worldNoise += 0.001;
|
||||
|
||||
float fadeStep = smoothstep(uClipDistance, uClipDistance * 1.5, viewDist);
|
||||
if (fadeStep <= worldNoise)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (viewDist < uClipDistance && uClipDistance > 0.0)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
||||
if (uNoiseEnabled)
|
||||
{
|
||||
applyNoise(fragColor, viewDist);
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
#version 150
|
||||
|
||||
in uvec3 vPosition;
|
||||
in uint meta; // contains light and micro-offset data
|
||||
in vec4 vColor;
|
||||
in int irisMaterial;
|
||||
in int irisNormal;
|
||||
|
||||
out vec3 vPos;
|
||||
out vec4 vertexColor;
|
||||
out vec3 vertexWorldPos;
|
||||
out float vertexYPos;
|
||||
|
||||
layout (std140) uniform vertUniqueUniformBlock
|
||||
{
|
||||
vec3 uModelOffset;
|
||||
};
|
||||
|
||||
layout (std140) uniform vertSharedUniformBlock
|
||||
{
|
||||
bool uIsWhiteWorld;
|
||||
|
||||
float uWorldYOffset;
|
||||
float uMircoOffset;
|
||||
float uEarthRadius;
|
||||
|
||||
vec3 uCameraPos;
|
||||
mat4 uCombinedMatrix;
|
||||
};
|
||||
|
||||
uniform sampler2D uLightMap;
|
||||
|
||||
/**
|
||||
* LOD terrain Vertex Shader
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
vPos = vPosition; // This is so it can be passed to the fragment shader
|
||||
|
||||
vertexWorldPos = vPosition.xyz + (uModelOffset - uCameraPos);
|
||||
|
||||
vertexYPos = vPosition.y + uWorldYOffset;
|
||||
|
||||
uint mirco = (meta & 0xFF00u) >> 8u; // mirco offset which is a xyz 2bit value
|
||||
// 0b00 = no offset
|
||||
// 0b01 = positive offset
|
||||
// 0b11 = negative offset
|
||||
// format is: 0b00zzyyxx
|
||||
float mx = (mirco & 1u)!=0u ? uMircoOffset : 0.0;
|
||||
mx = (mirco & 2u)!=0u ? -mx : mx;
|
||||
//float my = (mirco & 4u)!=0u ? uMircoOffset : 0.0;
|
||||
//my = (mirco & 8u)!=0u ? -my : my;
|
||||
float mz = (mirco & 16u)!=0u ? uMircoOffset : 0.0;
|
||||
mz = (mirco & 32u)!=0u ? -mz : mz;
|
||||
|
||||
vertexWorldPos.x += mx;
|
||||
//vertexWorldPos.y += my;
|
||||
vertexWorldPos.z += mz;
|
||||
|
||||
// apply the earth curvature if needed
|
||||
if (uEarthRadius < -1.0f || uEarthRadius > 1.0f)
|
||||
{
|
||||
// vertex transformation logic - stduhpf
|
||||
float localRadius = uEarthRadius + vertexYPos;
|
||||
float phi = length(vertexWorldPos.xz) / localRadius;
|
||||
vertexWorldPos.y += (cos(phi) - 1.0) * localRadius;
|
||||
vertexWorldPos.xz = vertexWorldPos.xz * sin(phi) / phi;
|
||||
}
|
||||
|
||||
uint lights = meta & 0xFFu;
|
||||
float skyLight = (float(lights/16u)+0.5) / 16.0;
|
||||
float blockLight = (mod(float(lights), 16.0)+0.5) / 16.0;
|
||||
vertexColor = vec4(texture(uLightMap, vec2(skyLight, blockLight)).xyz, 1.0);
|
||||
|
||||
if (!uIsWhiteWorld)
|
||||
{
|
||||
vertexColor *= vColor;
|
||||
}
|
||||
|
||||
gl_Position = uCombinedMatrix * vec4(vertexWorldPos, 1.0);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D gDhColorTexture;
|
||||
uniform sampler2D gDhDepthTexture;
|
||||
|
||||
|
||||
/**
|
||||
* LOD application shader
|
||||
*
|
||||
* This merges the rendered LODs into Minecraft's texture/FBO
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
fragColor = vec4(0.0);
|
||||
|
||||
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||
// only update fragments that were drawn to
|
||||
float fragmentDepth = texture(gDhDepthTexture, TexCoord).r;
|
||||
if (fragmentDepth != 1)
|
||||
{
|
||||
fragColor = texture(gDhColorTexture, TexCoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
// use the original MC texture if no LODs were drawn to this fragment
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
#version 150
|
||||
|
||||
in vec4 vertexColor;
|
||||
in vec3 vertexWorldPos;
|
||||
in vec4 vPos;
|
||||
in vec4 gl_FragCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
|
||||
// Fade/Clip Uniforms
|
||||
uniform float uClipDistance = 0.0;
|
||||
|
||||
// Noise Uniforms
|
||||
uniform bool uNoiseEnabled;
|
||||
uniform int uNoiseSteps;
|
||||
uniform float uNoiseIntensity;
|
||||
uniform int uNoiseDropoff;
|
||||
uniform bool uDitherDhRendering;
|
||||
|
||||
|
||||
// The random functions for diffrent dimentions
|
||||
float rand(float co) { return fract(sin(co*(91.3458)) * 47453.5453); }
|
||||
float rand(vec2 co) { return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); }
|
||||
float rand(vec3 co) { return rand(co.xy + rand(co.z)); }
|
||||
|
||||
// Puts steps in a float
|
||||
// EG. setting stepSize to 4 then this would be the result of this function
|
||||
// In: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, ..., 1.1, 1.2, 1.3
|
||||
// Out: 0.0, 0.0, 0.0, 0.25, 0.25, 0.5, 0.5, ..., 1.0, 1.0, 1.25
|
||||
vec3 quantize(vec3 val, int stepSize)
|
||||
{
|
||||
return floor(val * stepSize) / stepSize;
|
||||
}
|
||||
|
||||
void applyNoise(inout vec4 fragColor, const in float viewDist)
|
||||
{
|
||||
vec3 vertexNormal = normalize(cross(dFdy(vPos.xyz), dFdx(vPos.xyz)));
|
||||
// This bit of code is required to fix the vertex position problem cus of floats in the verted world position varuable
|
||||
vec3 fixedVPos = vPos.xyz + vertexNormal * 0.001;
|
||||
|
||||
float noiseAmplification = uNoiseIntensity;
|
||||
float lum = (fragColor.r + fragColor.g + fragColor.b) / 3.0;
|
||||
noiseAmplification = (1.0 - pow(lum * 2.0 - 1.0, 2.0)) * noiseAmplification; // Lessen the effect on depending on how dark the object is, equasion for this is -(2x-1)^{2}+1
|
||||
noiseAmplification *= fragColor.a; // The effect would lessen on transparent objects
|
||||
|
||||
// Random value for each position
|
||||
float randomValue = rand(quantize(fixedVPos, uNoiseSteps))
|
||||
* 2.0 * noiseAmplification - noiseAmplification;
|
||||
|
||||
// Modifies the color
|
||||
// A value of 0 on the randomValue will result in the original color, while a value of 1 will result in a fully bright color
|
||||
vec3 newCol = fragColor.rgb + (1.0 - fragColor.rgb) * randomValue;
|
||||
newCol = clamp(newCol, 0.0, 1.0);
|
||||
|
||||
if (uNoiseDropoff != 0) {
|
||||
float distF = min(viewDist / uNoiseDropoff, 1.0);
|
||||
newCol = mix(newCol, fragColor.rgb, distF); // The further away it gets, the less noise gets applied
|
||||
}
|
||||
|
||||
fragColor.rgb = newCol;
|
||||
}
|
||||
|
||||
/** returns a normalized value between 0.0 and 1.0 */
|
||||
float bayerMatrix4x4(vec2 st)
|
||||
{
|
||||
int x = int(mod(st.x, 4.0));
|
||||
int y = int(mod(st.y, 4.0));
|
||||
|
||||
// Flattened 4x4 Bayer matrix
|
||||
float bayer4x4[16] = float[16](
|
||||
0.0, 8.0, 2.0, 10.0,
|
||||
12.0, 4.0, 14.0, 6.0,
|
||||
3.0, 11.0, 1.0, 9.0,
|
||||
15.0, 7.0, 13.0, 5.0
|
||||
);
|
||||
|
||||
// Calculate the 1D index from the 2D coordinates
|
||||
int index = y * 4 + x;
|
||||
|
||||
// Return the Bayer value normalized between 0.0 and 1.0
|
||||
return bayer4x4[index] / 16.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = vertexColor;
|
||||
|
||||
float viewDist = length(vertexWorldPos);
|
||||
|
||||
if (uDitherDhRendering)
|
||||
{
|
||||
// Dither out the fragment based on distance and noise.
|
||||
// Dithering is used since it works for both opaque and transparent rendering
|
||||
|
||||
// noise increases as the distance increases
|
||||
// the fragCoord is used since it is stable and small so the dithering is cleaner
|
||||
float worldNoise = bayerMatrix4x4(gl_FragCoord.xy);
|
||||
// minor fudge factor to make sure all pixels fade out
|
||||
// if not included 1 in 16 pixels would never fade away
|
||||
worldNoise += 0.001;
|
||||
|
||||
float fadeStep = smoothstep(uClipDistance, uClipDistance * 1.5, viewDist);
|
||||
if (fadeStep <= worldNoise)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (viewDist < uClipDistance && uClipDistance > 0.0)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
||||
if (uNoiseEnabled)
|
||||
{
|
||||
applyNoise(fragColor, viewDist);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 vPosition;
|
||||
|
||||
out vec2 TexCoord;
|
||||
|
||||
/**
|
||||
* This is specifically used by application shaders.
|
||||
* IE post process or pixel transfer shaders, anything that is rendered using a single rectangle.
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(vPosition, 1.0, 1.0);
|
||||
TexCoord = vPosition.xy * 0.5 + 0.5;
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in uvec4 vPosition;
|
||||
in vec4 color;
|
||||
|
||||
out vec4 vPos;
|
||||
out vec4 vertexColor;
|
||||
out vec3 vertexWorldPos;
|
||||
out float vertexYPos;
|
||||
|
||||
uniform bool uIsWhiteWorld;
|
||||
|
||||
uniform mat4 uCombinedMatrix;
|
||||
uniform vec3 uModelOffset;
|
||||
uniform float uWorldYOffset;
|
||||
|
||||
uniform sampler2D uLightMap;
|
||||
uniform float uMircoOffset;
|
||||
|
||||
uniform float uEarthRadius;
|
||||
|
||||
/**
|
||||
* Vertex Shader
|
||||
*
|
||||
* author: James Seibel
|
||||
* author: TomTheFurry
|
||||
* author: stduhpf
|
||||
* updated: coolGi
|
||||
*
|
||||
* version: 2025-12-22
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
vPos = vPosition; // This is so it can be passed to the fragment shader
|
||||
|
||||
vertexWorldPos = vPosition.xyz + uModelOffset;
|
||||
|
||||
vertexYPos = vPosition.y + uWorldYOffset;
|
||||
|
||||
uint meta = vPosition.a;
|
||||
|
||||
uint mirco = (meta & 0xFF00u) >> 8u; // mirco offset which is a xyz 2bit value
|
||||
// 0b00 = no offset
|
||||
// 0b01 = positive offset
|
||||
// 0b11 = negative offset
|
||||
// format is: 0b00zzyyxx
|
||||
float mx = (mirco & 1u)!=0u ? uMircoOffset : 0.0;
|
||||
mx = (mirco & 2u)!=0u ? -mx : mx;
|
||||
//float my = (mirco & 4u)!=0u ? uMircoOffset : 0.0;
|
||||
//my = (mirco & 8u)!=0u ? -my : my;
|
||||
float mz = (mirco & 16u)!=0u ? uMircoOffset : 0.0;
|
||||
mz = (mirco & 32u)!=0u ? -mz : mz;
|
||||
|
||||
vertexWorldPos.x += mx;
|
||||
//vertexWorldPos.y += my;
|
||||
vertexWorldPos.z += mz;
|
||||
|
||||
// apply the earth curvature if needed
|
||||
if (uEarthRadius < -1.0f || uEarthRadius > 1.0f)
|
||||
{
|
||||
// vertex transformation logic - stduhpf
|
||||
float localRadius = uEarthRadius + vertexYPos;
|
||||
float phi = length(vertexWorldPos.xz) / localRadius;
|
||||
vertexWorldPos.y += (cos(phi) - 1.0) * localRadius;
|
||||
vertexWorldPos.xz = vertexWorldPos.xz * sin(phi) / phi;
|
||||
}
|
||||
|
||||
uint lights = meta & 0xFFu;
|
||||
float skyLight = (float(lights/16u)+0.5) / 16.0;
|
||||
float blockLight = (mod(float(lights), 16.0)+0.5) / 16.0;
|
||||
vertexColor = vec4(texture(uLightMap, vec2(skyLight, blockLight)).xyz, 1.0);
|
||||
|
||||
if (!uIsWhiteWorld)
|
||||
{
|
||||
vertexColor *= color;
|
||||
}
|
||||
|
||||
gl_Position = uCombinedMatrix * vec4(vertexWorldPos, 1.0);
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D uSourceColorTexture;
|
||||
uniform sampler2D uSourceDepthTexture;
|
||||
|
||||
layout (std140) uniform applyFragUniformBlock
|
||||
{
|
||||
vec2 uViewSize;
|
||||
int uBlurRadius;
|
||||
float uNearClipPlane; // in blocks
|
||||
float uFarClipPlane; // in blocks
|
||||
};
|
||||
|
||||
|
||||
float linearizeDepth(const in float depth) { return (uNearClipPlane * uFarClipPlane) / (depth * (uNearClipPlane - uFarClipPlane) + uFarClipPlane); }
|
||||
|
||||
float Gaussian(const in float sigma, const in float x) { return exp(-(x*x) / (2.0 * (sigma*sigma))); }
|
||||
|
||||
float BilateralGaussianBlur(const in vec2 texcoord, const in float linearDepth, const in float g_sigmaV)
|
||||
{
|
||||
float g_sigmaX = 1.6;
|
||||
float g_sigmaY = 1.6;
|
||||
|
||||
int radius = clamp(uBlurRadius, 1, 3);
|
||||
|
||||
vec2 pixelSize = 1.0 / uViewSize;
|
||||
|
||||
float accum = 0.0;
|
||||
float total = 0.0;
|
||||
for (int iy = -radius; iy <= radius; iy++)
|
||||
{
|
||||
float fy = Gaussian(g_sigmaY, iy);
|
||||
|
||||
for (int ix = -radius; ix <= radius; ix++)
|
||||
{
|
||||
float fx = Gaussian(g_sigmaX, ix);
|
||||
|
||||
vec2 sampleTexCoord = texcoord + ivec2(ix, iy) * pixelSize;
|
||||
|
||||
float sampleValue = textureLod(uSourceColorTexture, sampleTexCoord, 0).r;
|
||||
|
||||
float sampleDepth = textureLod(uSourceDepthTexture, sampleTexCoord, 0).r;
|
||||
float sampleLinearDepth = linearizeDepth(sampleDepth);
|
||||
|
||||
float depthDiff = abs(sampleLinearDepth - linearDepth);
|
||||
float fv = Gaussian(g_sigmaV, depthDiff);
|
||||
|
||||
float weight = fx*fy*fv;
|
||||
accum += weight * sampleValue;
|
||||
total += weight;
|
||||
}
|
||||
}
|
||||
|
||||
if (total <= 1.e-4)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
return accum / total;
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = vec4(1.0);
|
||||
|
||||
float fragmentDepth = textureLod(uSourceDepthTexture, TexCoord, 0).r;
|
||||
|
||||
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||
// we only want to apply SSAO to LODs, not to the sky outside the LODs
|
||||
if (fragmentDepth < 1)
|
||||
{
|
||||
if (uBlurRadius > 0)
|
||||
{
|
||||
float fragmentDepthLinear = linearizeDepth(fragmentDepth);
|
||||
fragColor.a = BilateralGaussianBlur(TexCoord, fragmentDepthLinear, 1.6);
|
||||
}
|
||||
else
|
||||
{
|
||||
fragColor.a = texelFetch(uSourceColorTexture, ivec2(gl_FragCoord.xy), 0).r;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
#version 150 core
|
||||
#extension GL_ARB_derivative_control : enable
|
||||
|
||||
#define SAMPLE_MAX 64
|
||||
|
||||
#define saturate(x) (clamp((x), 0.0, 1.0))
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
|
||||
layout (std140) uniform fragUniformBlock
|
||||
{
|
||||
int uSampleCount;
|
||||
|
||||
float uRadius;
|
||||
float uStrength;
|
||||
float uMinLight;
|
||||
float uBias;
|
||||
float uFadeDistanceInBlocks;
|
||||
|
||||
mat4 uInvProj;
|
||||
mat4 uProj;
|
||||
};
|
||||
|
||||
uniform sampler2D uDhDepthTexture;
|
||||
|
||||
const float EPSILON = 1.e-6;
|
||||
const float GOLDEN_ANGLE = 2.39996323;
|
||||
const vec3 MAGIC = vec3(0.06711056, 0.00583715, 52.9829189);
|
||||
const float PI = 3.1415926538;
|
||||
const float TAU = PI * 2.0;
|
||||
|
||||
|
||||
vec3 unproject(vec4 pos)
|
||||
{
|
||||
return pos.xyz / pos.w;
|
||||
}
|
||||
|
||||
float InterleavedGradientNoise(const in vec2 pixel)
|
||||
{
|
||||
float x = dot(pixel, MAGIC.xy);
|
||||
return fract(MAGIC.z * fract(x));
|
||||
}
|
||||
|
||||
vec3 calcViewPosition(const in vec3 clipPos)
|
||||
{
|
||||
vec4 viewPos = uInvProj * vec4(clipPos * 2.0 - 1.0, 1.0);
|
||||
return viewPos.xyz / viewPos.w;
|
||||
}
|
||||
|
||||
float GetSpiralOcclusion(const in vec2 uv, const in vec3 viewPos, const in vec3 viewNormal)
|
||||
{
|
||||
float dither = InterleavedGradientNoise(gl_FragCoord.xy);
|
||||
float rotatePhase = dither * TAU;
|
||||
float rStep = uRadius / uSampleCount;
|
||||
|
||||
vec2 offset;
|
||||
|
||||
float ao = 0.0;
|
||||
int sampleCount = 0;
|
||||
float radius = rStep;
|
||||
for (int i = 0; i < clamp(uSampleCount, 1, SAMPLE_MAX); i++) {
|
||||
vec2 offset = vec2(
|
||||
sin(rotatePhase),
|
||||
cos(rotatePhase)
|
||||
) * radius;
|
||||
|
||||
radius += rStep;
|
||||
rotatePhase += GOLDEN_ANGLE;
|
||||
|
||||
vec3 sampleViewPos = viewPos + vec3(offset, -0.1);
|
||||
vec3 sampleClipPos = unproject(uProj * vec4(sampleViewPos, 1.0)) * 0.5 + 0.5;
|
||||
sampleClipPos = saturate(sampleClipPos);
|
||||
|
||||
float sampleClipDepth = textureLod(uDhDepthTexture, sampleClipPos.xy, 0.0).r;
|
||||
if (sampleClipDepth >= 1.0 - EPSILON) continue;
|
||||
|
||||
sampleClipPos.z = sampleClipDepth;
|
||||
sampleViewPos = unproject(uInvProj * vec4(sampleClipPos * 2.0 - 1.0, 1.0));
|
||||
|
||||
vec3 diff = sampleViewPos - viewPos;
|
||||
float sampleDist = length(diff);
|
||||
vec3 sampleNormal = diff / sampleDist;
|
||||
|
||||
float sampleNoLm = max(dot(viewNormal, sampleNormal) - uBias, 0.0);
|
||||
float aoF = 1.0 - saturate(sampleDist / uRadius);
|
||||
ao += sampleNoLm * aoF;
|
||||
sampleCount++;
|
||||
}
|
||||
|
||||
ao /= max(sampleCount, 1);
|
||||
ao = smoothstep(0.0, uStrength, ao);
|
||||
|
||||
return ao * (1.0 - uMinLight);
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
float fragmentDepth = textureLod(uDhDepthTexture, TexCoord, 0).r;
|
||||
float occlusion = 0.0;
|
||||
|
||||
// Do not apply to sky
|
||||
if (fragmentDepth < 1.0)
|
||||
{
|
||||
vec3 viewPos = calcViewPosition(vec3(TexCoord, fragmentDepth));
|
||||
|
||||
// fading is done to prevent banding/noise
|
||||
// at super far distance
|
||||
float distanceFromCamera = length(viewPos);
|
||||
float fadeDistance = uFadeDistanceInBlocks;
|
||||
if (distanceFromCamera < fadeDistance)
|
||||
{
|
||||
#ifdef GL_ARB_derivative_control
|
||||
// Get higher precision derivatives when available
|
||||
vec3 viewNormal = cross(dFdxFine(viewPos.xyz), dFdyFine(viewPos.xyz));
|
||||
#else
|
||||
vec3 viewNormal = cross(dFdx(viewPos.xyz), dFdy(viewPos.xyz));
|
||||
#endif
|
||||
|
||||
viewNormal = normalize(viewNormal);
|
||||
occlusion = GetSpiralOcclusion(TexCoord, viewPos, viewNormal);
|
||||
|
||||
// linearly fade with distance
|
||||
occlusion *= (fadeDistance - distanceFromCamera) / fadeDistance;
|
||||
}
|
||||
else
|
||||
{
|
||||
// we're out of range, no need to do any SSAO calculations
|
||||
occlusion = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
fragColor = vec4(vec3(1.0 - occlusion), 1.0);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 vPosition;
|
||||
|
||||
out vec2 TexCoord;
|
||||
|
||||
/**
|
||||
* This is specifically used by application shaders.
|
||||
* IE post process or pixel transfer shaders, anything that is rendered using a single rectangle.
|
||||
*/
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(vPosition, 1.0, 1.0);
|
||||
TexCoord = vPosition.xy * 0.5 + 0.5;
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
#version 150 core
|
||||
#extension GL_ARB_derivative_control : enable
|
||||
|
||||
#define SAMPLE_MAX 64
|
||||
|
||||
#define saturate(x) (clamp((x), 0.0, 1.0))
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D uDepthMap;
|
||||
uniform int uSampleCount;
|
||||
uniform float uRadius;
|
||||
uniform float uStrength;
|
||||
uniform float uMinLight;
|
||||
uniform float uBias;
|
||||
uniform mat4 uInvProj;
|
||||
uniform mat4 uProj;
|
||||
uniform float uFadeDistanceInBlocks;
|
||||
|
||||
const float EPSILON = 1.e-6;
|
||||
const float GOLDEN_ANGLE = 2.39996323;
|
||||
const vec3 MAGIC = vec3(0.06711056, 0.00583715, 52.9829189);
|
||||
const float PI = 3.1415926538;
|
||||
const float TAU = PI * 2.0;
|
||||
|
||||
|
||||
vec3 unproject(vec4 pos)
|
||||
{
|
||||
return pos.xyz / pos.w;
|
||||
}
|
||||
|
||||
float InterleavedGradientNoise(const in vec2 pixel)
|
||||
{
|
||||
float x = dot(pixel, MAGIC.xy);
|
||||
return fract(MAGIC.z * fract(x));
|
||||
}
|
||||
|
||||
vec3 calcViewPosition(const in vec3 clipPos)
|
||||
{
|
||||
vec4 viewPos = uInvProj * vec4(clipPos * 2.0 - 1.0, 1.0);
|
||||
return viewPos.xyz / viewPos.w;
|
||||
}
|
||||
|
||||
float GetSpiralOcclusion(const in vec2 uv, const in vec3 viewPos, const in vec3 viewNormal)
|
||||
{
|
||||
float dither = InterleavedGradientNoise(gl_FragCoord.xy);
|
||||
float rotatePhase = dither * TAU;
|
||||
float rStep = uRadius / uSampleCount;
|
||||
|
||||
vec2 offset;
|
||||
|
||||
float ao = 0.0;
|
||||
int sampleCount = 0;
|
||||
float radius = rStep;
|
||||
for (int i = 0; i < clamp(uSampleCount, 1, SAMPLE_MAX); i++) {
|
||||
vec2 offset = vec2(
|
||||
sin(rotatePhase),
|
||||
cos(rotatePhase)
|
||||
) * radius;
|
||||
|
||||
radius += rStep;
|
||||
rotatePhase += GOLDEN_ANGLE;
|
||||
|
||||
vec3 sampleViewPos = viewPos + vec3(offset, -0.1);
|
||||
vec3 sampleClipPos = unproject(uProj * vec4(sampleViewPos, 1.0)) * 0.5 + 0.5;
|
||||
sampleClipPos = saturate(sampleClipPos);
|
||||
|
||||
float sampleClipDepth = textureLod(uDepthMap, sampleClipPos.xy, 0.0).r;
|
||||
if (sampleClipDepth >= 1.0 - EPSILON) continue;
|
||||
|
||||
sampleClipPos.z = sampleClipDepth;
|
||||
sampleViewPos = unproject(uInvProj * vec4(sampleClipPos * 2.0 - 1.0, 1.0));
|
||||
|
||||
vec3 diff = sampleViewPos - viewPos;
|
||||
float sampleDist = length(diff);
|
||||
vec3 sampleNormal = diff / sampleDist;
|
||||
|
||||
float sampleNoLm = max(dot(viewNormal, sampleNormal) - uBias, 0.0);
|
||||
float aoF = 1.0 - saturate(sampleDist / uRadius);
|
||||
ao += sampleNoLm * aoF;
|
||||
sampleCount++;
|
||||
}
|
||||
|
||||
ao /= max(sampleCount, 1);
|
||||
ao = smoothstep(0.0, uStrength, ao);
|
||||
|
||||
return ao * (1.0 - uMinLight);
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
float fragmentDepth = textureLod(uDepthMap, TexCoord, 0).r;
|
||||
float occlusion = 0.0;
|
||||
|
||||
// Do not apply to sky
|
||||
if (fragmentDepth < 1.0)
|
||||
{
|
||||
vec3 viewPos = calcViewPosition(vec3(TexCoord, fragmentDepth));
|
||||
|
||||
// fading is done to prevent banding/noise
|
||||
// at super far distance
|
||||
float distanceFromCamera = length(viewPos);
|
||||
float fadeDistance = uFadeDistanceInBlocks;
|
||||
if (distanceFromCamera < fadeDistance)
|
||||
{
|
||||
#ifdef GL_ARB_derivative_control
|
||||
// Get higher precision derivatives when available
|
||||
vec3 viewNormal = cross(dFdxFine(viewPos.xyz), dFdyFine(viewPos.xyz));
|
||||
#else
|
||||
vec3 viewNormal = cross(dFdx(viewPos.xyz), dFdy(viewPos.xyz));
|
||||
#endif
|
||||
|
||||
viewNormal = normalize(viewNormal);
|
||||
occlusion = GetSpiralOcclusion(TexCoord, viewPos, viewNormal);
|
||||
|
||||
// linearly fade with distance
|
||||
occlusion *= (fadeDistance - distanceFromCamera) / fadeDistance;
|
||||
}
|
||||
else
|
||||
{
|
||||
// we're out of range, no need to do any SSAO calculations
|
||||
occlusion = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
fragColor = vec4(vec3(1.0 - occlusion), 1.0);
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D gSSAOMap;
|
||||
uniform sampler2D gDepthMap;
|
||||
uniform vec2 gViewSize;
|
||||
uniform int gBlurRadius;
|
||||
uniform float gNear;
|
||||
uniform float gFar;
|
||||
|
||||
|
||||
float linearizeDepth(const in float depth) {
|
||||
return (gNear * gFar) / (depth * (gNear - gFar) + gFar);
|
||||
}
|
||||
|
||||
float Gaussian(const in float sigma, const in float x) {
|
||||
return exp(-(x*x) / (2.0 * (sigma*sigma)));
|
||||
}
|
||||
|
||||
float BilateralGaussianBlur(const in vec2 texcoord, const in float linearDepth, const in float g_sigmaV) {
|
||||
float g_sigmaX = 1.6;
|
||||
float g_sigmaY = 1.6;
|
||||
|
||||
int radius = clamp(gBlurRadius, 1, 3);
|
||||
|
||||
vec2 pixelSize = 1.0 / gViewSize;
|
||||
|
||||
float accum = 0.0;
|
||||
float total = 0.0;
|
||||
for (int iy = -radius; iy <= radius; iy++) {
|
||||
float fy = Gaussian(g_sigmaY, iy);
|
||||
|
||||
for (int ix = -radius; ix <= radius; ix++) {
|
||||
float fx = Gaussian(g_sigmaX, ix);
|
||||
|
||||
vec2 sampleTex = texcoord + ivec2(ix, iy) * pixelSize;
|
||||
float sampleValue = textureLod(gSSAOMap, sampleTex, 0).r;
|
||||
float sampleDepth = textureLod(gDepthMap, sampleTex, 0).r;
|
||||
float sampleLinearDepth = linearizeDepth(sampleDepth);
|
||||
|
||||
float depthDiff = abs(sampleLinearDepth - linearDepth);
|
||||
float fv = Gaussian(g_sigmaV, depthDiff);
|
||||
|
||||
float weight = fx*fy*fv;
|
||||
accum += weight * sampleValue;
|
||||
total += weight;
|
||||
}
|
||||
}
|
||||
|
||||
if (total <= 1.e-4) return 1.0;
|
||||
return accum / total;
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = vec4(1.0);
|
||||
|
||||
float fragmentDepth = textureLod(gDepthMap, TexCoord, 0).r;
|
||||
|
||||
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||
// we only want to apply SSAO to LODs, not to the sky outside the LODs
|
||||
if (fragmentDepth < 1)
|
||||
{
|
||||
if (gBlurRadius > 0)
|
||||
{
|
||||
float fragmentDepthLinear = linearizeDepth(fragmentDepth);
|
||||
fragColor.a = BilateralGaussianBlur(TexCoord, fragmentDepthLinear, 1.6);
|
||||
}
|
||||
else
|
||||
{
|
||||
fragColor.a = texelFetch(gSSAOMap, ivec2(gl_FragCoord.xy), 0).r;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec4 fColor;
|
||||
out vec4 fragColor;
|
||||
|
||||
// DH frag test
|
||||
void main()
|
||||
{
|
||||
fragColor = fColor;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 vPosition;
|
||||
in vec4 vColor;
|
||||
|
||||
out vec4 fColor;
|
||||
|
||||
// DH vert test
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(vPosition, 0.0, 1.0);
|
||||
fColor = vColor;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec4 fColor;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = fColor;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 vPosition;
|
||||
in vec4 color;
|
||||
|
||||
out vec4 fColor;
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(vPosition, 0.0, 1.0);
|
||||
fColor = color;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 553 B |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 299 B |
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="700pt"
|
||||
height="700pt"
|
||||
version="1.1"
|
||||
viewBox="0 0 700 700"
|
||||
id="svg4"
|
||||
sodipodi:docname="themeDark.svg"
|
||||
inkscape:version="1.2 (dc2aedaf03, 2022-05-15)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs8" />
|
||||
<sodipodi:namedview
|
||||
id="namedview6"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="pt"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.79607143"
|
||||
inkscape:cx="466.66667"
|
||||
inkscape:cy="466.03858"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1351"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4" />
|
||||
<path
|
||||
d="m573.12 450.62c-1.5625-3.2305-4.0781-5.9023-7.207-7.6562-3.1289-1.7539-6.7227-2.5-10.293-2.1445-52.113 7.4141-105.18-3.3867-150.25-30.578-45.07-27.191-79.371-69.105-97.113-118.66-17.738-49.555-17.832-103.71-0.25781-153.33 12.207-34.535 32.625-65.586 59.5-90.477 3.8047-3.4023 5.9336-8.3008 5.8242-13.406-0.10938-5.1055-2.4414-9.9102-6.3867-13.152-3.9453-3.2422-9.1094-4.5977-14.137-3.7148-55.062 7.5039-106.35 32.211-146.54 70.594s-67.223 88.48-77.246 143.14c-10.023 54.656-2.5273 111.09 21.422 161.23 23.949 50.145 63.129 91.441 111.94 118 48.816 26.559 104.77 37.016 159.89 29.883 55.109-7.1328 106.56-31.492 147-69.602 2.6758-2.5234 4.4883-5.8281 5.1797-9.4414 0.69141-3.6133 0.22656-7.3516-1.3281-10.684z"
|
||||
id="path2"
|
||||
style="fill:#003380" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -1,76 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="700pt"
|
||||
height="700pt"
|
||||
version="1.1"
|
||||
viewBox="0 0 700 700"
|
||||
id="svg22"
|
||||
sodipodi:docname="themeLight.svg"
|
||||
inkscape:version="1.2 (dc2aedaf03, 2022-05-15)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs26" />
|
||||
<sodipodi:namedview
|
||||
id="namedview24"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="pt"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.79607143"
|
||||
inkscape:cx="466.66667"
|
||||
inkscape:cy="466.03858"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-height="1351"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg22" />
|
||||
<g
|
||||
id="g20"
|
||||
style="fill:#55d400">
|
||||
<path
|
||||
d="m472.5 280c0 67.656-54.844 122.5-122.5 122.5s-122.5-54.844-122.5-122.5 54.844-122.5 122.5-122.5 122.5 54.844 122.5 122.5"
|
||||
id="path2"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m350 140c4.6406 0 9.0938-1.8438 12.375-5.125s5.125-7.7344 5.125-12.375v-87.5c0-6.2539-3.3359-12.031-8.75-15.156s-12.086-3.125-17.5 0-8.75 8.9023-8.75 15.156v87.5c0 4.6406 1.8438 9.0938 5.125 12.375s7.7344 5.125 12.375 5.125z"
|
||||
id="path4"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m226.27 180.95c3.1719 3.7031 7.7461 5.918 12.617 6.1055 4.875 0.1875 9.6016-1.6641 13.051-5.1133 3.4492-3.4492 5.3008-8.1758 5.1133-13.051-0.1875-4.8711-2.4023-9.4453-6.1055-12.617l-61.773-61.949c-4.4414-4.4375-10.91-6.1719-16.973-4.5469-6.0664 1.625-10.801 6.3594-12.426 12.426-1.625 6.0625 0.10938 12.531 4.5469 16.973z"
|
||||
id="path6"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m210 280c0-4.6406-1.8438-9.0938-5.125-12.375s-7.7344-5.125-12.375-5.125h-87.5c-6.2539 0-12.031 3.3359-15.156 8.75s-3.125 12.086 0 17.5 8.9023 8.75 15.156 8.75h87.5c4.6406 0 9.0938-1.8438 12.375-5.125s5.125-7.7344 5.125-12.375z"
|
||||
id="path8"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m226.27 379.05-61.949 61.773c-3.7031 3.1719-5.9141 7.7461-6.1016 12.617-0.19141 4.8711 1.6641 9.6016 5.1094 13.051 3.4492 3.4453 8.1797 5.3008 13.051 5.1133 4.8711-0.19141 9.4453-2.4023 12.617-6.1055l61.949-61.949c3.8594-4.5078 5.1719-10.66 3.4922-16.348-1.6836-5.6875-6.1328-10.137-11.82-11.816-5.6875-1.6836-11.84-0.37109-16.348 3.4883z"
|
||||
id="path10"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m350 420c-4.6406 0-9.0938 1.8438-12.375 5.125s-5.125 7.7344-5.125 12.375v87.5c0 6.2539 3.3359 12.031 8.75 15.156s12.086 3.125 17.5 0 8.75-8.9023 8.75-15.156v-87.5c0-4.6406-1.8438-9.0938-5.125-12.375s-7.7344-5.125-12.375-5.125z"
|
||||
id="path12"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m473.73 379.05c-4.5078-3.8594-10.66-5.1719-16.348-3.4922-5.6875 1.6836-10.137 6.1328-11.82 11.82-1.6797 5.6875-0.36719 11.84 3.4922 16.348l61.949 61.949c4.5039 3.8555 10.656 5.1719 16.348 3.4883 5.6875-1.6797 10.137-6.1289 11.816-11.816 1.6836-5.6914 0.36719-11.844-3.4883-16.348z"
|
||||
id="path14"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m595 262.5h-87.5c-6.2539 0-12.031 3.3359-15.156 8.75s-3.125 12.086 0 17.5 8.9023 8.75 15.156 8.75h87.5c6.2539 0 12.031-3.3359 15.156-8.75s3.125-12.086 0-17.5-8.9023-8.75-15.156-8.75z"
|
||||
id="path16"
|
||||
style="fill:#55d400" />
|
||||
<path
|
||||
d="m461.3 186.2c4.6523 0.027343 9.1211-1.7969 12.426-5.0742l61.949-61.949c3.8555-4.5078 5.1719-10.66 3.4883-16.348-1.6797-5.6875-6.1289-10.137-11.816-11.816-5.6914-1.6836-11.844-0.37109-16.348 3.4883l-61.949 61.773c-3.3086 3.2852-5.1719 7.75-5.1758 12.414-0.003906 4.6602 1.8516 9.1289 5.1562 12.418 3.3047 3.2891 7.7812 5.1211 12.445 5.0938z"
|
||||
id="path18"
|
||||
style="fill:#55d400" />
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.9 KiB |
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" standalone="yes"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
|
||||
<!-- No icon texture for DH -->
|
||||
|
||||
<rect width="50" height="50" x="0" y="0" style="fill:#0000FF" />
|
||||
<rect width="50" height="50" x="50" y="50" style="fill:#0000FF" />
|
||||
<rect width="50" height="50" x="50" y="0" style="fill:#000000" />
|
||||
<rect width="50" height="50" x="0" y="50" style="fill:#000000" />
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 430 B |
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,37 +0,0 @@
|
||||
|
||||
CREATE TABLE DhFullData(
|
||||
DhSectionPos TEXT NOT NULL PRIMARY KEY
|
||||
|
||||
-- meta data
|
||||
,DataDetailLevel TINYINT NULL
|
||||
,Checksum INT NULL
|
||||
,DataVersion BIGINT NULL
|
||||
,WorldGenStep NVARCHAR(32) NULL
|
||||
,DataType NVARCHAR(48) NULL
|
||||
,BinaryDataFormatVersion TINYINT NULL
|
||||
|
||||
,Data BLOB NULL
|
||||
|
||||
,CreatedDateTime DATETIME NOT NULL default CURRENT_TIMESTAMP -- in UTC
|
||||
,LastModifiedDateTime DATETIME NOT NULL default CURRENT_TIMESTAMP -- in UTC
|
||||
);
|
||||
|
||||
-- Note: each statement must be separated by the following batch comment line otherwise Java won't run anything after the first query
|
||||
--batch--
|
||||
|
||||
CREATE TABLE DhRenderData(
|
||||
DhSectionPos TEXT NOT NULL PRIMARY KEY
|
||||
|
||||
-- meta data
|
||||
,DataDetailLevel TINYINT NULL
|
||||
,Checksum INT NULL
|
||||
,DataVersion BIGINT NULL
|
||||
,WorldGenStep NVARCHAR(32) NULL
|
||||
,DataType NVARCHAR(48) NULL
|
||||
,BinaryDataFormatVersion TINYINT NULL
|
||||
|
||||
,Data BLOB NULL
|
||||
|
||||
,CreatedDateTime DATETIME NOT NULL default CURRENT_TIMESTAMP -- in UTC
|
||||
,LastModifiedDateTime DATETIME NOT NULL default CURRENT_TIMESTAMP -- in UTC
|
||||
);
|
||||
@@ -1,33 +0,0 @@
|
||||
|
||||
ALTER TABLE DhFullData RENAME TO Legacy_FullData_V1;
|
||||
|
||||
--batch--
|
||||
|
||||
ALTER TABLE Legacy_FullData_V1 ADD COLUMN MigrationFailed BIT NOT NULL DEFAULT 0;
|
||||
|
||||
--batch--
|
||||
|
||||
CREATE TABLE FullData (
|
||||
-- compound primary key
|
||||
DetailLevel TINYINT NOT NULL -- LOD detail level, not section detail level IE 0, 1, 2 not 6, 7, 8
|
||||
,PosX INT NOT NULL
|
||||
,PosZ INT NOT NULL
|
||||
|
||||
,MinY INT NOT NULL
|
||||
,DataChecksum INT NOT NULL
|
||||
|
||||
,Data BLOB NULL
|
||||
,ColumnGenerationStep BLOB NULL
|
||||
,ColumnWorldCompressionMode BLOB NULL
|
||||
,Mapping BLOB NULL
|
||||
|
||||
,DataFormatVersion TINYINT NULL
|
||||
,CompressionMode TINYINT NULL
|
||||
|
||||
,ApplyToParent BIT NULL
|
||||
|
||||
,LastModifiedUnixDateTime BIGINT NOT NULL -- in GMT 0
|
||||
,CreatedUnixDateTime BIGINT NOT NULL -- in GMT 0
|
||||
|
||||
,PRIMARY KEY (DetailLevel, PosX, PosZ)
|
||||
);
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
-- this PRAGMA will automatically commit, so we have to disable
|
||||
-- DH's automatic transactions, otherwise the connection will throw an error
|
||||
|
||||
--No Transactions--
|
||||
|
||||
-- James ran into some issues where Windows had trouble deleting the Journal file,
|
||||
-- using TRUNCATE should fix that issue
|
||||
PRAGMA journal_mode = TRUNCATE;
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
-- these PRAGMA's will automatically commit, so we have to disable
|
||||
-- DH's automatic transactions, otherwise the connection will throw an error
|
||||
|
||||
--No Transactions--
|
||||
|
||||
pragma journal_mode = WAL;
|
||||
pragma synchronous = NORMAL;
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
-- The render cache was discovered to not speed up LOD loading,
|
||||
-- so to reduce DB file size it was removed.
|
||||
drop table DhRenderData;
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
-- significantly speeds up parent update handling
|
||||
create index FullDataUpdatedIndex on FullData (ApplyToParent) where ApplyToParent = 1
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
CREATE TABLE ChunkHash(
|
||||
-- compound primary key
|
||||
ChunkPosX INT NOT NULL
|
||||
,ChunkPosZ INT NOT NULL
|
||||
|
||||
,ChunkHash INT NOT NULL
|
||||
|
||||
,LastModifiedUnixDateTime BIGINT NOT NULL -- in GMT 0
|
||||
,CreatedUnixDateTime BIGINT NOT NULL -- in GMT 0
|
||||
|
||||
,PRIMARY KEY (ChunkPosX, ChunkPosZ)
|
||||
);
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
CREATE TABLE BeaconBeam(
|
||||
-- compound primary key
|
||||
BlockPosX INT NOT NULL
|
||||
,BlockPosY INT NOT NULL
|
||||
,BlockPosZ INT NOT NULL
|
||||
|
||||
,ColorR INT NOT NULL
|
||||
,ColorG INT NOT NULL
|
||||
,ColorB INT NOT NULL
|
||||
|
||||
,LastModifiedUnixDateTime BIGINT NOT NULL -- in GMT 0
|
||||
,CreatedUnixDateTime BIGINT NOT NULL -- in GMT 0
|
||||
|
||||
,PRIMARY KEY (BlockPosX, BlockPosY, BlockPosZ)
|
||||
);
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
-- Applying to children is needed to fix a bug with N-sized generation.
|
||||
-- If we don't fill the whole tree with data, it's possible to render empty/incomplete LODs, which looks bad.
|
||||
alter table FullData add column ApplyToChildren BIT NULL;
|
||||
|
||||
--batch--
|
||||
|
||||
-- significantly speeds up update handling
|
||||
create index FullDataApplyToChildrenIndex on FullData (ApplyToChildren) where ApplyToChildren = 1;
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
-- storing adjacent data (IE a single line of data on the +X/-X/+Z/-Z axis)
|
||||
-- allows for significantly reduced render loading times since we only have to
|
||||
-- handle part of the adjacent data source vs all of it
|
||||
|
||||
alter table FullData add column NorthAdjData BLOB NULL;
|
||||
--batch--
|
||||
alter table FullData add column SouthAdjData BLOB NULL;
|
||||
--batch--
|
||||
alter table FullData add column EastAdjData BLOB NULL;
|
||||
--batch--
|
||||
alter table FullData add column WestAdjData BLOB NULL;
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
-- This is done to fix a bug where a lot of unnecessary
|
||||
-- ID mapping data is saved, which significantly reduces
|
||||
-- loading/deserializing/decompression time
|
||||
|
||||
|
||||
-- delete all data above 0 (max detail)
|
||||
-- so it can be re-created
|
||||
delete from FullData where DetailLevel > 0;
|
||||
--batch--
|
||||
|
||||
-- re-downsample all LOD data
|
||||
update FullData set ApplyToParent = 1;
|
||||
@@ -1,51 +0,0 @@
|
||||
|
||||
### All Sql scripts should be run exactly once per database and old scripts shouldn't be changed. Any necessary schema changes should be done by creating new scripts that modify the existing database.
|
||||
|
||||
This system is roughly based on the DbUp library from .NET, for information about DbUp and it's general philosophy please refer to the following doc:
|
||||
https://dbup.readthedocs.io/en/latest/philosophy-behind-dbup/
|
||||
|
||||
<br>
|
||||
|
||||
### Adding New Scripts:
|
||||
New scripts must be added to the "scriptList.txt" file, otherwise they will not be run. <br>
|
||||
(If anyone has a good way to automatically pull all resource files ending in `.sql` instead, please let us know.)
|
||||
|
||||
<br>
|
||||
|
||||
### File Naming:
|
||||
- The first 3 numbers are major scripts.
|
||||
- The 4th number is for minor/related scripts or if a bug fix needs to be applied between scripts.
|
||||
- flavor of database the script is for (for now this is just sqlite)
|
||||
- description of the script
|
||||
|
||||
<br>
|
||||
|
||||
### Mutli-query Scripts:
|
||||
When creating a script with multiple queries the queries must be separated with the SQL comment `--batch--` otherwise only the first query will be executed.
|
||||
|
||||
Example:
|
||||
```roomsql
|
||||
CREATE TABLE TableOne(
|
||||
DhSectionPos TEXT NOT NULL PRIMARY KEY
|
||||
,Data BLOB NULL
|
||||
);
|
||||
|
||||
--batch--
|
||||
|
||||
CREATE TABLE TableTwo(
|
||||
DhSectionPos TEXT NOT NULL PRIMARY KEY
|
||||
,Data BLOB NULL
|
||||
);
|
||||
```
|
||||
|
||||
### PRAGMA Auto Commits
|
||||
|
||||
Certain queries will auto commit after running, specifically certain `PRAGMA` commands. In that case we have to disable DH's automatic transactions by putting `--No Transactions--` somewhere in the file. Otherwise, when the system attempts to commit, it will fail due to the PRAGMA having already committed itself.
|
||||
|
||||
Due to how these commands work it's best to only have a single command in the file to prevent confusion and potential database corruption.
|
||||
|
||||
```roomsql
|
||||
--No Transactions--
|
||||
|
||||
PRAGMA journal_mode = TRUNCATE;
|
||||
```
|
||||
@@ -1,12 +0,0 @@
|
||||
|
||||
0010-sqlite-createInitialDataTables.sql
|
||||
0020-sqlite-createFullDataSourceV2Tables.sql
|
||||
0030-sqlite-changeTableJournaling.sql
|
||||
0031-sqlite-useSqliteWalJournaling.sql
|
||||
0040-sqlite-removeRenderCache.sql
|
||||
0050-sqlite-addApplyToParentIndex.sql
|
||||
0060-sqlite-createChunkHashTable.sql
|
||||
0070-sqlite-createBeaconBeamTable.sql
|
||||
0080-sqlite-addApplyToChildrenColumn.sql
|
||||
0090-sqlite-addAdjacentFullDataColumns.sql
|
||||
0100-sqlite-deleteLowDetailDataForRegen.sql
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.seibel.distanthorizons.common;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiRenderApi;
|
||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiAfterDhInitEvent;
|
||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiBeforeDhInitEvent;
|
||||
@@ -30,7 +29,6 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModAccesso
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IModChecker;
|
||||
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.dedicated.DedicatedServer;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
@@ -39,6 +37,11 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Base for all mod loader initializers
|
||||
* and handles most setup.
|
||||
@@ -62,7 +65,9 @@ public abstract class AbstractModInitializer
|
||||
protected abstract IEventProxy createServerProxy(boolean isDedicated);
|
||||
protected abstract void initializeModCompat();
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
protected abstract void subscribeRegisterCommandsEvent(Consumer<CommandDispatcher<CommandSourceStack>> eventHandler);
|
||||
#endif
|
||||
|
||||
protected abstract void subscribeClientStartedEvent(Runnable eventHandler);
|
||||
protected abstract void subscribeServerStartingEvent(Consumer<MinecraftServer> eventHandler);
|
||||
@@ -130,8 +135,10 @@ public abstract class AbstractModInitializer
|
||||
this.initializeModCompat();
|
||||
|
||||
LOGGER.info(ModInfo.READABLE_NAME + " server Initialized, adding event subscribers...");
|
||||
#if MC_VER > MC_1_12_2
|
||||
this.commandInitializer = new CommandInitializer();
|
||||
this.subscribeRegisterCommandsEvent(dispatcher -> { this.commandInitializer.initCommands(dispatcher); });
|
||||
#endif
|
||||
|
||||
this.subscribeServerStartingEvent(server ->
|
||||
{
|
||||
@@ -141,11 +148,13 @@ public abstract class AbstractModInitializer
|
||||
Initializer.postConfigInit();
|
||||
this.postInit();
|
||||
this.postServerInit();
|
||||
#if MC_VER > MC_1_12_2
|
||||
this.commandInitializer.onServerReady();
|
||||
#endif
|
||||
|
||||
this.checkForUpdates();
|
||||
|
||||
LOGGER.info(ModInfo.READABLE_NAME + " server Initialized at " + server.getServerDirectory());
|
||||
LOGGER.info(ModInfo.READABLE_NAME + " server Initialized at " + server.#if MC_VER <= MC_1_12_2 getDataDirectory() #else getServerDirectory() #endif);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -6,15 +6,20 @@ import com.seibel.distanthorizons.core.api.internal.ServerApi;
|
||||
import com.seibel.distanthorizons.core.api.internal.SharedApi;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IServerLevelWrapper;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
#else
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ProtoChunk;
|
||||
#endif
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
public class MixinChunkMapCommon
|
||||
{
|
||||
|
||||
public static void onChunkSave(ServerLevel level, ChunkAccess chunk, CallbackInfoReturnable<Boolean> ci)
|
||||
public static void onChunkSave(#if MC_VER <= MC_1_12_2 WorldServer #else ServerLevel #endif level, #if MC_VER <= MC_1_12_2 Chunk #else ChunkAccess #endif chunk #if MC_VER > MC_1_12_2, CallbackInfoReturnable<Boolean> ci #endif)
|
||||
{
|
||||
IServerLevelWrapper levelWrapper = ServerLevelWrapper.getWrapper(level);
|
||||
|
||||
@@ -37,7 +42,7 @@ public class MixinChunkMapCommon
|
||||
|
||||
|
||||
// is this chunk being saved to disk?
|
||||
boolean savingChunkToDisk = ci.getReturnValue();
|
||||
boolean savingChunkToDisk = #if MC_VER <= MC_1_12_2 true #else ci.getReturnValue() #endif;
|
||||
// true means a chunk was saved to disk
|
||||
if (!savingChunkToDisk)
|
||||
{
|
||||
@@ -50,7 +55,12 @@ public class MixinChunkMapCommon
|
||||
|
||||
// MC has a tendency to try saving incomplete or corrupted chunks (which show up as empty or black chunks)
|
||||
// this logic should prevent that from happening
|
||||
#if MC_VER <= MC_1_17_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
if (!chunk.isTerrainPopulated() || !chunk.isLightPopulated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
#elif MC_VER <= MC_1_17_1
|
||||
if (chunk.isUnsaved() || chunk.getUpgradeData() != null || !chunk.isLightCorrect())
|
||||
{
|
||||
return;
|
||||
@@ -68,7 +78,7 @@ public class MixinChunkMapCommon
|
||||
|
||||
// some chunks may be missing their biomes, which cause issues when attempting to save them
|
||||
#if MC_VER <= MC_1_17_1
|
||||
if (chunk.getBiomes() == null)
|
||||
if (chunk.#if MC_VER <= MC_1_12_2 getBiomeArray() #else getBiomes() #endif == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -9,24 +9,23 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftCli
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapper;
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
#else
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
||||
#if MC_VER < MC_1_17_1
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.init.MobEffects;
|
||||
#elif MC_VER < MC_1_17_1
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.client.renderer.FogRenderer;
|
||||
import net.minecraft.client.renderer.FogRenderer.FogMode;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
#elif MC_VER < MC_1_21_3
|
||||
@@ -57,16 +56,18 @@ import net.minecraft.world.level.material.FogType;
|
||||
public class MixinVanillaFogCommon
|
||||
{
|
||||
|
||||
|
||||
#if MC_VER < MC_1_21_6
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public static boolean cancelFog(int startCoords, Minecraft mc)
|
||||
#elif MC_VER < MC_1_21_6
|
||||
public static boolean cancelFog(Camera camera, FogRenderer.FogMode fogMode)
|
||||
#else
|
||||
public static boolean cancelFog()
|
||||
#endif
|
||||
{
|
||||
|
||||
|
||||
#if MC_VER < MC_1_21_6
|
||||
#if MC_VER <= MC_1_12_2
|
||||
EntityPlayerSP entity = mc.player;
|
||||
#elif MC_VER < MC_1_21_6
|
||||
Entity entity = camera.getEntity();
|
||||
#elif MC_VER <= MC_1_21_10
|
||||
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
|
||||
@@ -77,12 +78,18 @@ public class MixinVanillaFogCommon
|
||||
#endif
|
||||
|
||||
|
||||
boolean cameraNotInFluid = cameraNotInFluid(camera);
|
||||
boolean cameraNotInFluid = cameraNotInFluid(mc);
|
||||
#if MC_VER <= MC_1_12_2
|
||||
boolean isSpecialFog = entity.isPotionActive(MobEffects.BLINDNESS);
|
||||
#else
|
||||
boolean isSpecialFog = (entity instanceof LivingEntity) && ((LivingEntity) entity).hasEffect(MobEffects.BLINDNESS);
|
||||
#endif
|
||||
|
||||
boolean cancelFog = !isSpecialFog;
|
||||
cancelFog = cancelFog && cameraNotInFluid;
|
||||
#if MC_VER < MC_1_21_6
|
||||
#if MC_VER <= MC_1_12_2
|
||||
cancelFog = cancelFog && startCoords == 0;
|
||||
#elif MC_VER < MC_1_21_6
|
||||
cancelFog = cancelFog && (fogMode == FogRenderer.FogMode.FOG_TERRAIN);
|
||||
#endif
|
||||
|
||||
@@ -92,10 +99,15 @@ public class MixinVanillaFogCommon
|
||||
|
||||
return cancelFog;
|
||||
}
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
private static boolean cameraNotInFluid(Minecraft mc)
|
||||
#else
|
||||
private static boolean cameraNotInFluid(Camera camera)
|
||||
#endif
|
||||
{
|
||||
#if MC_VER < MC_1_17_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
boolean cameraNotInFluid = mc.getRenderViewEntity() != null && !mc.world.getBlockState(mc.getRenderViewEntity().getPosition()).getMaterial().isLiquid();
|
||||
#elif MC_VER < MC_1_17_1
|
||||
FluidState fluidState = camera.getFluidInCamera();
|
||||
boolean cameraNotInFluid = fluidState.isEmpty();
|
||||
#else
|
||||
@@ -105,6 +117,4 @@ public class MixinVanillaFogCommon
|
||||
|
||||
return cameraNotInFluid;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -28,12 +28,15 @@ import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
import net.minecraft.world.level.Level;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||
|
||||
#if MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
||||
#if MC_VER > MC_1_12_2
|
||||
import net.minecraft.world.level.Level;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
#elif MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
||||
import net.minecraft.core.Registry;
|
||||
#elif MC_VER == MC_1_18_2 || MC_VER == MC_1_19_2
|
||||
import net.minecraft.core.Holder;
|
||||
@@ -45,14 +48,21 @@ import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_10
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
#elif MC_VER <= MC_1_21_10
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
#else
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.core.component.DataComponentMap;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.world.biome.Biome;
|
||||
#else
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
#endif
|
||||
|
||||
|
||||
#if MC_VER >= MC_1_18_2
|
||||
import net.minecraft.world.level.biome.Biomes;
|
||||
@@ -219,8 +229,10 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
|
||||
// generate the serial string //
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
Level level = (Level)levelWrapper.getWrappedMcObject();
|
||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_10
|
||||
ResourceLocation resourceLocation;
|
||||
@@ -228,7 +240,9 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
Identifier resourceLocation;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_17_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
resourceLocation = biome.getRegistryName();
|
||||
#elif MC_VER <= MC_1_17_1
|
||||
resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome);
|
||||
#elif MC_VER <= MC_1_19_2
|
||||
resourceLocation = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).getKey(this.biome.value());
|
||||
@@ -293,10 +307,13 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
{
|
||||
try
|
||||
{
|
||||
#if MC_VER > MC_1_12_2
|
||||
Level level = (Level) levelWrapper.getWrappedMcObject();
|
||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||
#endif
|
||||
|
||||
|
||||
BiomeDeserializeResult deserializeResult = deserializeBiome(resourceLocationString, registryAccess);
|
||||
BiomeDeserializeResult deserializeResult = deserializeBiome(resourceLocationString #if MC_VER > MC_1_12_2, registryAccess #endif);
|
||||
|
||||
|
||||
|
||||
@@ -325,7 +342,7 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
}
|
||||
}
|
||||
|
||||
public static BiomeDeserializeResult deserializeBiome(String resourceLocationString, net.minecraft.core.RegistryAccess registryAccess) throws IOException
|
||||
public static BiomeDeserializeResult deserializeBiome(String resourceLocationString #if MC_VER > MC_1_12_2, net.minecraft.core.RegistryAccess registryAccess #endif) throws IOException
|
||||
{
|
||||
// parse the resource location
|
||||
int separatorIndex = resourceLocationString.indexOf(":");
|
||||
@@ -356,7 +373,10 @@ public class BiomeWrapper implements IBiomeWrapper
|
||||
|
||||
|
||||
boolean success;
|
||||
#if MC_VER <= MC_1_17_1
|
||||
#if MC_VER == MC_1_12_2
|
||||
Biome biome = Biome.REGISTRY.getObject(resourceLocation);
|
||||
success = (biome != null);
|
||||
#elif MC_VER == MC_1_16_5 || MC_VER == MC_1_17_1
|
||||
Biome biome = registryAccess.registryOrThrow(Registry.BIOME_REGISTRY).get(resourceLocation);
|
||||
success = (biome != null);
|
||||
#elif MC_VER <= MC_1_19_2
|
||||
|
||||
@@ -32,12 +32,23 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrappe
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
#else
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.world.level.block.BeaconBeamBlock;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
#endif
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -61,7 +72,7 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.level.EmptyBlockGetter;
|
||||
#else
|
||||
#elif MC_VER > MC_1_12_2
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -70,12 +81,15 @@ import net.minecraft.world.level.EmptyBlockGetter;
|
||||
import net.minecraft.core.Holder;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_10
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
#elif MC_VER <= MC_1_21_10
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
#else
|
||||
import net.minecraft.resources.Identifier;
|
||||
#endif
|
||||
|
||||
|
||||
public class BlockStateWrapper implements IBlockStateWrapper
|
||||
{
|
||||
/** example "minecraft:water" */
|
||||
@@ -87,7 +101,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
// must be defined before AIR, otherwise a null pointer will be thrown
|
||||
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||
|
||||
public static final ConcurrentHashMap<BlockState, BlockStateWrapper> WRAPPER_BY_BLOCK_STATE = new ConcurrentHashMap<>();
|
||||
public static final ConcurrentHashMap<#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif, BlockStateWrapper> WRAPPER_BY_BLOCK_STATE = new ConcurrentHashMap<>();
|
||||
public static final ConcurrentHashMap<String, BlockStateWrapper> WRAPPER_BY_RESOURCE_LOCATION = new ConcurrentHashMap<>();
|
||||
|
||||
public static final String AIR_STRING = "AIR";
|
||||
@@ -114,7 +128,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
// properties //
|
||||
|
||||
@Nullable
|
||||
public final BlockState blockState;
|
||||
public final #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState;
|
||||
/** technically final, but since it requires a method call to generate it can't be marked as such */
|
||||
private String serialString;
|
||||
private final int hashCode;
|
||||
@@ -139,15 +153,21 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
// constructors //
|
||||
//==============//
|
||||
//region
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
/**
|
||||
* Can be faster than {@link BlockStateWrapper#fromBlockState(IBlockState, ILevelWrapper)}
|
||||
* in cases where the same block state is expected to be referenced multiple times.
|
||||
*/
|
||||
#else
|
||||
/**
|
||||
* Can be faster than {@link BlockStateWrapper#fromBlockState(BlockState, ILevelWrapper)}
|
||||
* in cases where the same block state is expected to be referenced multiple times.
|
||||
*/
|
||||
public static BlockStateWrapper fromBlockState(BlockState blockState, ILevelWrapper levelWrapper, IBlockStateWrapper guess)
|
||||
#endif
|
||||
public static BlockStateWrapper fromBlockState(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, ILevelWrapper levelWrapper, IBlockStateWrapper guess)
|
||||
{
|
||||
BlockState guessBlockState = (guess == null || guess.isAir()) ? null : (BlockState) guess.getWrappedMcObject();
|
||||
BlockState inputBlockState = (blockState == null || blockState.isAir()) ? null : blockState;
|
||||
#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif guessBlockState = (guess == null || guess.isAir()) ? null : (#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif) guess.getWrappedMcObject();
|
||||
#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif inputBlockState = (blockState == null || #if MC_VER <= MC_1_12_2 blockState.getBlock() == Blocks.AIR #else blockState.isAir() #endif) ? null : blockState;
|
||||
|
||||
if (guess instanceof BlockStateWrapper
|
||||
&& guessBlockState == inputBlockState)
|
||||
@@ -159,7 +179,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
return fromBlockState(blockState, levelWrapper);
|
||||
}
|
||||
}
|
||||
public static BlockStateWrapper fromBlockState(@Nullable BlockState blockState, ILevelWrapper levelWrapper)
|
||||
public static BlockStateWrapper fromBlockState(@Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, ILevelWrapper levelWrapper)
|
||||
{
|
||||
// air is a special case
|
||||
if (isAir(blockState))
|
||||
@@ -209,7 +229,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
}
|
||||
}
|
||||
private BlockStateWrapper(
|
||||
@Nullable BlockState blockState, ILevelWrapper levelWrapper,
|
||||
@Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, ILevelWrapper levelWrapper,
|
||||
@Nullable DhApiBlockStateWrapperCreatedEvent.EventParam overrideEventParam)
|
||||
{
|
||||
this.blockState = blockState;
|
||||
@@ -228,10 +248,12 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
}
|
||||
else
|
||||
{
|
||||
#if MC_VER < MC_1_20_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.isLiquid = this.blockState.getMaterial().isLiquid() || this.blockState.getBlock() instanceof IFluidBlock;
|
||||
#elif MC_VER < MC_1_20_1
|
||||
this.isLiquid = this.blockState.getMaterial().isLiquid() || !this.blockState.getFluidState().isEmpty();
|
||||
#else
|
||||
this.isLiquid = !this.blockState.getFluidState().isEmpty();
|
||||
this.isLiquid = !this.blockState.getFluidState().isEmpty();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -327,6 +349,8 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
|
||||
// beacon tint color
|
||||
Color beaconTintColor = null;
|
||||
// 1.12.2 doesn't have block for beacon beam
|
||||
#if MC_VER > MC_1_12_2
|
||||
if (this.blockState != null
|
||||
// beacon blocks also show up here, but since they block the beacon beam we don't want their color
|
||||
&& !this.isBeaconBlock)
|
||||
@@ -344,6 +368,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
beaconTintColor = ColorUtil.toColorObjRGB(colorInt);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
this.beaconTintColor = beaconTintColor;
|
||||
|
||||
|
||||
@@ -392,8 +417,10 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
if (this.blockState != null)
|
||||
{
|
||||
int mcColor = 0;
|
||||
|
||||
#if MC_VER < MC_1_20_1
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
mcColor = this.blockState.getMaterial().getMaterialMapColor().colorValue;
|
||||
#elif MC_VER < MC_1_20_1
|
||||
mcColor = this.blockState.getMaterial().getColor().col;
|
||||
#else
|
||||
mcColor = this.blockState.getMapColor(EmptyBlockGetter.INSTANCE, BlockPos.ZERO).col;
|
||||
@@ -420,7 +447,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
#if MC_VER < MC_1_20_1
|
||||
this.isSolid = this.blockState.getMaterial().isSolid();
|
||||
#else
|
||||
this.isSolid = !this.blockState.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO).isEmpty();
|
||||
this.isSolid = !this.blockState.getCollisionShape(EmptyBlockGetter.INSTANCE, BlockPos.ZERO).isEmpty();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -432,7 +459,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
//region
|
||||
|
||||
private static EDhApiBlockMaterial calculateEDhApiBlockMaterialId(
|
||||
@Nullable BlockState blockState,
|
||||
@Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState,
|
||||
String lowercaseSerialString,
|
||||
boolean isLiquid
|
||||
)
|
||||
@@ -443,7 +470,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
}
|
||||
|
||||
|
||||
if (blockState.is(BlockTags.LEAVES)
|
||||
if (#if MC_VER <= MC_1_12_2 blockState.getBlock() instanceof BlockLeaves #else blockState.is(BlockTags.LEAVES) #endif
|
||||
|| lowercaseSerialString.contains("bamboo")
|
||||
|| lowercaseSerialString.contains("cactus")
|
||||
|| lowercaseSerialString.contains("chorus_flower")
|
||||
@@ -452,16 +479,15 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
{
|
||||
return EDhApiBlockMaterial.LEAVES;
|
||||
}
|
||||
else if (blockState.is(Blocks.LAVA))
|
||||
else if (#if MC_VER <= MC_1_12_2 blockState.getBlock() == Blocks.LAVA || blockState.getBlock() == Blocks.FLOWING_LAVA #else blockState.is(Blocks.LAVA) #endif)
|
||||
{
|
||||
return EDhApiBlockMaterial.LAVA;
|
||||
}
|
||||
else if (isLiquid
|
||||
|| blockState.is(Blocks.WATER))
|
||||
else if (isLiquid || #if MC_VER <= MC_1_12_2 blockState.getBlock() == Blocks.WATER || blockState.getBlock() == Blocks.FLOWING_WATER #else this.blockState.is(Blocks.WATER) #endif)
|
||||
{
|
||||
return EDhApiBlockMaterial.WATER;
|
||||
}
|
||||
else if (blockState.getSoundType() == SoundType.WOOD
|
||||
else if (#if MC_VER <= MC_1_12_2 blockState.getBlock().getSoundType() #else blockState.getSoundType() #endif == SoundType.WOOD
|
||||
|| lowercaseSerialString.contains("root")
|
||||
#if MC_VER >= MC_1_19_4
|
||||
|| blockState.getSoundType() == SoundType.CHERRY_WOOD
|
||||
@@ -470,7 +496,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
{
|
||||
return EDhApiBlockMaterial.WOOD;
|
||||
}
|
||||
else if (blockState.getSoundType() == SoundType.METAL
|
||||
else if (#if MC_VER <= MC_1_12_2 blockState.getBlock().getSoundType() #else blockState.getSoundType() #endif == SoundType.METAL
|
||||
#if MC_VER >= MC_1_19_2
|
||||
|| blockState.getSoundType() == SoundType.COPPER
|
||||
#endif
|
||||
@@ -521,7 +547,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
{
|
||||
return EDhApiBlockMaterial.TERRACOTTA;
|
||||
}
|
||||
else if (blockState.is(BlockTags.BASE_STONE_NETHER))
|
||||
else if (#if MC_VER <= MC_1_12_2 blockState.getBlock() == Blocks.NETHERRACK #else blockState.is(BlockTags.BASE_STONE_NETHER) #endif)
|
||||
{
|
||||
return EDhApiBlockMaterial.NETHER_STONE;
|
||||
}
|
||||
@@ -530,7 +556,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
{
|
||||
return EDhApiBlockMaterial.STONE;
|
||||
}
|
||||
else if (blockState.getLightEmission() > 0)
|
||||
else if (#if MC_VER <= MC_1_12_2 blockState.getLightValue() #else blockState.getLightEmission() #endif > 0)
|
||||
{
|
||||
return EDhApiBlockMaterial.ILLUMINATED;
|
||||
}
|
||||
@@ -541,7 +567,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
}
|
||||
|
||||
private static int calculateOpacity(
|
||||
@Nullable BlockState blockState,
|
||||
@Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState,
|
||||
boolean isAir, boolean isLiquid
|
||||
)
|
||||
{
|
||||
@@ -582,24 +608,30 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
|
||||
return opacity;
|
||||
}
|
||||
private static boolean getCanOcclude(@Nullable BlockState blockState)
|
||||
private static boolean getCanOcclude(@Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState)
|
||||
{
|
||||
// defaults to the value used by air
|
||||
boolean canOcclude = false;
|
||||
if (blockState != null)
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
canOcclude = blockState.isOpaqueCube();
|
||||
#else
|
||||
canOcclude = blockState.canOcclude();
|
||||
#endif
|
||||
}
|
||||
|
||||
return canOcclude;
|
||||
}
|
||||
private static boolean getPropagatesSkyLightDown(@Nullable BlockState blockState)
|
||||
private static boolean getPropagatesSkyLightDown(@Nullable #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState)
|
||||
{
|
||||
// defaults to the value used by air
|
||||
boolean propagatesSkyLightDown = true;
|
||||
if (blockState != null)
|
||||
{
|
||||
#if MC_VER < MC_1_21_3
|
||||
#if MC_VER <= MC_1_12_2
|
||||
propagatesSkyLightDown = blockState.getBlock().getLightOpacity(blockState) == 0;
|
||||
#elif MC_VER < MC_1_21_3
|
||||
propagatesSkyLightDown = blockState.propagatesSkylightDown(EmptyBlockGetter.INSTANCE, BlockPos.ZERO);
|
||||
#else
|
||||
propagatesSkyLightDown = blockState.propagatesSkylightDown();
|
||||
@@ -740,8 +772,12 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
if (defaultBlockStateToIgnore != AIR)
|
||||
{
|
||||
// add all possible blockstates (to account for light blocks with different light values and such)
|
||||
#if MC_VER <= MC_1_12_2
|
||||
List<IBlockState> blockStatesToIgnore = defaultBlockStateToIgnore.blockState.getBlock().getBlockState().getValidStates();
|
||||
#else
|
||||
List<BlockState> blockStatesToIgnore = defaultBlockStateToIgnore.blockState.getBlock().getStateDefinition().getPossibleStates();
|
||||
for (BlockState blockState : blockStatesToIgnore)
|
||||
#endif
|
||||
for (#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState : blockStatesToIgnore)
|
||||
{
|
||||
BlockStateWrapper newBlockToIgnore = fromBlockState(blockState, levelWrapper);
|
||||
blockStateWrappers.add(newBlockToIgnore);
|
||||
@@ -788,7 +824,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
public int getOpacity() { return this.opacity; }
|
||||
|
||||
@Override
|
||||
public int getLightEmission() { return (this.blockState != null) ? this.blockState.getLightEmission() : 0; }
|
||||
public int getLightEmission() { return (this.blockState != null) ? #if MC_VER <= MC_1_12_2 this.blockState.getLightValue() #else this.blockState.getLightEmission() #endif : 0; }
|
||||
|
||||
@Override
|
||||
public String getSerialString() { return this.serialString; }
|
||||
@@ -798,7 +834,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
|
||||
@Override
|
||||
public boolean isAir() { return isAir(this.blockState); }
|
||||
public static boolean isAir(BlockState blockState) { return blockState == null || blockState.isAir(); }
|
||||
public static boolean isAir(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState) { return blockState == null || #if MC_VER <= MC_1_12_2 blockState.getBlock() == Blocks.AIR #else blockState.isAir() #endif; }
|
||||
|
||||
@Override
|
||||
public boolean isSolid() { return this.isSolid; }
|
||||
@@ -832,7 +868,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
//=======================//
|
||||
//region
|
||||
|
||||
private static String serialize(BlockState blockState, ILevelWrapper levelWrapper)
|
||||
private static String serialize(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, ILevelWrapper levelWrapper)
|
||||
{
|
||||
if (blockState == null)
|
||||
{
|
||||
@@ -854,7 +890,9 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
Identifier resourceLocation;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_17_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
resourceLocation = blockState.getBlock().getRegistryName();
|
||||
#elif MC_VER <= MC_1_17_1
|
||||
resourceLocation = Registry.BLOCK.getKey(blockState.getBlock());
|
||||
#elif MC_VER <= MC_1_19_2
|
||||
resourceLocation = registryAccess.registryOrThrow(Registry.BLOCK_REGISTRY).getKey(blockState.getBlock());
|
||||
@@ -953,7 +991,9 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
#endif
|
||||
|
||||
Block block;
|
||||
#if MC_VER <= MC_1_17_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
block = Block.REGISTRY.getObject(resourceLocation);
|
||||
#elif MC_VER <= MC_1_17_1
|
||||
block = Registry.BLOCK.get(resourceLocation);
|
||||
#elif MC_VER <= MC_1_19_2
|
||||
net.minecraft.core.RegistryAccess registryAccess = level.registryAccess();
|
||||
@@ -982,11 +1022,15 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
|
||||
|
||||
// attempt to find the blockstate from all possibilities
|
||||
BlockState foundState = null;
|
||||
#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif foundState = null;
|
||||
if (blockStatePropertiesString != null)
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
List<IBlockState> possibleStateList = block.getBlockState().getValidStates();
|
||||
#else
|
||||
List<BlockState> possibleStateList = block.getStateDefinition().getPossibleStates();
|
||||
for (BlockState possibleState : possibleStateList)
|
||||
#endif
|
||||
for (#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif possibleState : possibleStateList)
|
||||
{
|
||||
String possibleStatePropertiesString = serializeBlockStateProperties(possibleState);
|
||||
if (possibleStatePropertiesString.equals(blockStatePropertiesString))
|
||||
@@ -1010,7 +1054,7 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
}
|
||||
}
|
||||
|
||||
foundState = block.defaultBlockState();
|
||||
foundState = #if MC_VER <= MC_1_12_2 block.getDefaultState() #else block.defaultBlockState() #endif;
|
||||
}
|
||||
|
||||
foundWrapper = fromBlockState(foundState, levelWrapper);
|
||||
@@ -1035,26 +1079,35 @@ public class BlockStateWrapper implements IBlockStateWrapper
|
||||
}
|
||||
|
||||
/** used to compare and save BlockStates based on their properties */
|
||||
private static String serializeBlockStateProperties(BlockState blockState)
|
||||
private static String serializeBlockStateProperties(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState)
|
||||
{
|
||||
// get the property list for this block (doesn't contain this block state's values, just the names and possible values)
|
||||
java.util.Collection<net.minecraft.world.level.block.state.properties.Property<?>> blockPropertyCollection = blockState.getProperties();
|
||||
#if MC_VER <= MC_1_12_2
|
||||
java.util.Collection<IProperty<?>> blockPropertyCollection = blockState.getPropertyKeys();
|
||||
#else
|
||||
java.util.Collection<Property<?>> blockPropertyCollection = blockState.getProperties();;
|
||||
#endif
|
||||
|
||||
// alphabetically sort the list so they are always in the same order
|
||||
List<net.minecraft.world.level.block.state.properties.Property<?>> sortedBlockPropteryList = new ArrayList<>(blockPropertyCollection);
|
||||
List<#if MC_VER <= MC_1_12_2 IProperty<?> #else Property<?> #endif> sortedBlockPropteryList = new ArrayList<>(blockPropertyCollection);
|
||||
sortedBlockPropteryList.sort((a, b) -> a.getName().compareTo(b.getName()));
|
||||
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (net.minecraft.world.level.block.state.properties.Property<?> property : sortedBlockPropteryList)
|
||||
for (#if MC_VER <= MC_1_12_2 IProperty<?> #else Property<?> #endif property : sortedBlockPropteryList)
|
||||
{
|
||||
String propertyName = property.getName();
|
||||
|
||||
String value = "NULL";
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
value = blockState.getValue(property).toString();
|
||||
#else
|
||||
if (blockState.hasProperty(property))
|
||||
{
|
||||
value = blockState.getValue(property).toString();
|
||||
}
|
||||
#endif
|
||||
|
||||
stringBuilder.append("{");
|
||||
stringBuilder.append(propertyName).append(RESOURCE_LOCATION_SEPARATOR).append(value);
|
||||
|
||||
@@ -32,22 +32,30 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.world.IClientLevelWrapp
|
||||
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.block.BlockRotatedPillar;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
#else
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.*;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import net.minecraft.world.level.block.state.properties.SlabType;
|
||||
#endif
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
#if MC_VER >= MC_1_19_2
|
||||
import net.minecraft.util.RandomSource;
|
||||
#else
|
||||
import java.util.Random;
|
||||
#endif
|
||||
|
||||
#if MC_VER < MC_1_21_5
|
||||
@@ -62,6 +70,15 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.client.color.block.BlockTintSource;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
/**
|
||||
* This stores and calculates the colors
|
||||
* the given {@link IBlockState} should have based
|
||||
* on the given {@link IClientLevelWrapper}.
|
||||
*
|
||||
* @see ColorUtil
|
||||
*/
|
||||
#else
|
||||
/**
|
||||
* This stores and calculates the colors
|
||||
* the given {@link BlockState} should have based
|
||||
@@ -69,14 +86,15 @@ import net.minecraft.client.color.block.BlockTintSource;
|
||||
*
|
||||
* @see ColorUtil
|
||||
*/
|
||||
#endif
|
||||
public class ClientBlockStateColorCache
|
||||
{
|
||||
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||
|
||||
private static final Minecraft MC = Minecraft.getInstance();
|
||||
private static final Minecraft MC = Minecraft.#if MC_VER <= MC_1_12_2 getMinecraft() #else getInstance() #endif;
|
||||
|
||||
private static final HashSet<BlockState> BLOCK_STATES_THAT_NEED_LEVEL = new HashSet<>();
|
||||
private static final HashSet<BlockState> BROKEN_BLOCK_STATES = new HashSet<>();
|
||||
private static final HashSet<#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif> BLOCK_STATES_THAT_NEED_LEVEL = new HashSet<>();
|
||||
private static final HashSet<#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif> BROKEN_BLOCK_STATES = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Methods using MC's "RandomSource" object aren't thread safe <br>
|
||||
@@ -90,15 +108,15 @@ public class ClientBlockStateColorCache
|
||||
|
||||
|
||||
/** This is the order each direction on a block is processed when attempting to get the texture/color */
|
||||
private static final @Nullable Direction[] COLOR_RESOLUTION_DIRECTION_ORDER =
|
||||
{
|
||||
Direction.UP,
|
||||
private static final @Nullable #if MC_VER <= MC_1_12_2 EnumFacing #else Direction #endif[] COLOR_RESOLUTION_DIRECTION_ORDER =
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2 EnumFacing #else Direction #endif.UP,
|
||||
null, // null represents "unculled" faces, IE the top of farmland
|
||||
Direction.NORTH,
|
||||
Direction.EAST,
|
||||
Direction.WEST,
|
||||
Direction.SOUTH,
|
||||
Direction.DOWN
|
||||
#if MC_VER <= MC_1_12_2 EnumFacing #else Direction #endif.NORTH,
|
||||
#if MC_VER <= MC_1_12_2 EnumFacing #else Direction #endif.EAST,
|
||||
#if MC_VER <= MC_1_12_2 EnumFacing #else Direction #endif.WEST,
|
||||
#if MC_VER <= MC_1_12_2 EnumFacing #else Direction #endif.SOUTH,
|
||||
#if MC_VER <= MC_1_12_2 EnumFacing #else Direction #endif.DOWN
|
||||
};
|
||||
|
||||
private static final int FLOWER_COLOR_SCALE = 5;
|
||||
@@ -113,7 +131,7 @@ public class ClientBlockStateColorCache
|
||||
#endif
|
||||
|
||||
private final IClientLevelWrapper clientLevelWrapper;
|
||||
private final BlockState blockState;
|
||||
private final #if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState;
|
||||
private final BlockStateWrapper blockStateWrapper;
|
||||
|
||||
private boolean isColorResolved = false;
|
||||
@@ -191,8 +209,10 @@ public class ClientBlockStateColorCache
|
||||
};
|
||||
|
||||
// these are threadlocals since AbstractDhTintGetter use local variables to handle color queries
|
||||
#if MC_VER > MC_1_12_2
|
||||
private static final ThreadLocal<TintWithoutLevelOverrider> TintWithoutLevelOverrideGetter = ThreadLocal.withInitial(TintWithoutLevelOverrider::new);
|
||||
private static final ThreadLocal<TintGetterOverride> TintOverrideGetter = ThreadLocal.withInitial(TintGetterOverride::new);
|
||||
#endif
|
||||
private static final ThreadLocal<DhApiBlockColorOverrideEvent.EventParam> ColorOverrideEventParamGetter = ThreadLocal.withInitial(DhApiBlockColorOverrideEvent.EventParam::new);
|
||||
|
||||
//endregion
|
||||
@@ -204,7 +224,7 @@ public class ClientBlockStateColorCache
|
||||
//=============//
|
||||
//region
|
||||
|
||||
public ClientBlockStateColorCache(BlockState blockState, IClientLevelWrapper clientLevelWrapper)
|
||||
public ClientBlockStateColorCache(#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif blockState, IClientLevelWrapper clientLevelWrapper)
|
||||
{
|
||||
this.blockState = blockState;
|
||||
this.blockStateWrapper = BlockStateWrapper.fromBlockState(blockState, clientLevelWrapper);
|
||||
@@ -232,18 +252,26 @@ public class ClientBlockStateColorCache
|
||||
{
|
||||
// getQuads() isn't thread safe so we need to put this logic in a lock
|
||||
RESOLVE_LOCK.lock();
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
if (this.blockState.getMaterial().isLiquid())
|
||||
#else
|
||||
if (this.blockState.getFluidState().isEmpty())
|
||||
#endif
|
||||
{
|
||||
// look for the first non-empty direction
|
||||
List<BakedQuad> quads = null;
|
||||
for (Direction direction : COLOR_RESOLUTION_DIRECTION_ORDER)
|
||||
for (#if MC_VER <= MC_1_12_2 EnumFacing #else Direction #endif direction : COLOR_RESOLUTION_DIRECTION_ORDER)
|
||||
{
|
||||
quads = this.getQuadsForDirection(direction);
|
||||
if (quads != null && !quads.isEmpty()
|
||||
&& !(
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.blockState.getBlock() instanceof BlockRotatedPillar
|
||||
&& direction == EnumFacing.UP
|
||||
#else
|
||||
this.blockState.getBlock() instanceof RotatedPillarBlock
|
||||
&& direction == Direction.UP
|
||||
#endif
|
||||
)
|
||||
)
|
||||
{
|
||||
@@ -263,8 +291,10 @@ public class ClientBlockStateColorCache
|
||||
try
|
||||
{
|
||||
BakedQuad firstQuad = quads.get(0);
|
||||
|
||||
#if MC_VER <= MC_1_21_11
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.needPostTinting = firstQuad.hasTintIndex();
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
this.needPostTinting = firstQuad.isTinted();
|
||||
#else
|
||||
this.needPostTinting = firstQuad.materialInfo().isTinted();
|
||||
@@ -278,7 +308,7 @@ public class ClientBlockStateColorCache
|
||||
this.tintIndex = firstQuad.materialInfo().tintIndex();
|
||||
#endif
|
||||
|
||||
#if MC_VER < MC_1_17_1
|
||||
#if MC_VER < MC_1_17_1 && MC_VER > MC_1_12_2
|
||||
this.baseColor = calculateColorFromTexture(
|
||||
firstQuad.sprite,
|
||||
EColorMode.getColorMode(this.blockState.getBlock()));
|
||||
@@ -338,20 +368,35 @@ public class ClientBlockStateColorCache
|
||||
@Nullable
|
||||
private List<BakedQuad> getUnculledQuads() { return this.getQuadsForDirection(null); }
|
||||
@Nullable
|
||||
private List<BakedQuad> getQuadsForDirection(@Nullable Direction direction)
|
||||
private List<BakedQuad> getQuadsForDirection(@Nullable #if MC_VER <= MC_1_12_2 EnumFacing #else Direction #endif direction)
|
||||
{
|
||||
BlockState effectiveBlockState = this.blockState;
|
||||
#if MC_VER <= MC_1_12_2 IBlockState #else BlockState #endif effectiveBlockState = this.blockState;
|
||||
|
||||
// if this block is a slab, use it's double variant so we can get the top face,
|
||||
// otherwise the color will use the side, which isn't as accurate
|
||||
#if MC_VER <= MC_1_12_2
|
||||
if (this.blockState.getBlock() instanceof BlockSlab && !((BlockSlab) this.blockState.getBlock()).isDouble())
|
||||
{
|
||||
effectiveBlockState = this.blockState.withProperty(BlockSlab.HALF, BlockSlab.EnumBlockHalf.TOP);
|
||||
}
|
||||
#else
|
||||
if (this.blockState.getBlock() instanceof SlabBlock)
|
||||
{
|
||||
effectiveBlockState = this.blockState.setValue( SlabBlock.TYPE, SlabType.DOUBLE );
|
||||
}
|
||||
#endif
|
||||
|
||||
List<BakedQuad> quads;
|
||||
|
||||
#if MC_VER < MC_1_21_5
|
||||
#if MC_VER <= MC_1_12_2
|
||||
try {
|
||||
quads = MC.getBlockRendererDispatcher().getModelForState(effectiveBlockState).getQuads(effectiveBlockState, direction, RANDOM.nextLong());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
quads = Collections.emptyList();
|
||||
}
|
||||
#elif MC_VER < MC_1_21_5
|
||||
quads = MC.getModelManager().getBlockModelShaper().
|
||||
getBlockModel(effectiveBlockState).getQuads(effectiveBlockState, direction, RANDOM);
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
@@ -408,10 +453,18 @@ public class ClientBlockStateColorCache
|
||||
//_ OpenGL RGBA format Java Order: 0xAA BB GG RR
|
||||
tempColor = TextureAtlasSpriteWrapper.getPixelRGBA(texture, 0, u, v);
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
int b = (tempColor & 0x000000FF);
|
||||
int g = (tempColor & 0x0000FF00) >>> 8;
|
||||
int r = (tempColor & 0x00FF0000) >>> 16;
|
||||
int a = (tempColor & 0xFF000000) >>> 24;
|
||||
#else
|
||||
int r = (tempColor & 0x000000FF);
|
||||
int g = (tempColor & 0x0000FF00) >>> 8;
|
||||
int b = (tempColor & 0x00FF0000) >>> 16;
|
||||
int a = (tempColor & 0xFF000000) >>> 24;
|
||||
#endif
|
||||
|
||||
int scale = 1;
|
||||
if (colorMode == EColorMode.Leaves)
|
||||
{
|
||||
@@ -468,7 +521,9 @@ public class ClientBlockStateColorCache
|
||||
}
|
||||
private static int getTextureWidth(TextureAtlasSprite texture)
|
||||
{
|
||||
#if MC_VER < MC_1_19_4
|
||||
#if MC_VER <= MC_1_12_2
|
||||
return texture.getIconWidth();
|
||||
#elif MC_VER < MC_1_19_4
|
||||
return texture.getWidth();
|
||||
#else
|
||||
return texture.contents().width();
|
||||
@@ -476,7 +531,9 @@ public class ClientBlockStateColorCache
|
||||
}
|
||||
private static int getTextureHeight(TextureAtlasSprite texture)
|
||||
{
|
||||
#if MC_VER < MC_1_19_4
|
||||
#if MC_VER <= MC_1_12_2
|
||||
return texture.getIconHeight();
|
||||
#elif MC_VER < MC_1_19_4
|
||||
return texture.getHeight();
|
||||
#else
|
||||
return texture.contents().height();
|
||||
@@ -510,7 +567,9 @@ public class ClientBlockStateColorCache
|
||||
private int getParticleIconColor()
|
||||
{
|
||||
return calculateColorFromTexture(
|
||||
#if MC_VER <= MC_1_21_11
|
||||
#if MC_VER <= MC_1_12_2
|
||||
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(this.blockState),
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
Minecraft.getInstance().getModelManager().getBlockModelShaper().getParticleIcon(this.blockState),
|
||||
#else
|
||||
Minecraft.getInstance().getModelManager().getBlockStateModelSet().get(this.blockState).particleMaterial().sprite(),
|
||||
@@ -527,7 +586,12 @@ public class ClientBlockStateColorCache
|
||||
public int getColor(BiomeWrapper biomeWrapper, FullDataSourceV2 fullDataSource, DhBlockPos blockPos)
|
||||
{
|
||||
// only get the tint if the block needs to be tinted
|
||||
#if MC_VER <= MC_1_12_2
|
||||
int tintColor = -1;
|
||||
#else
|
||||
int tintColor = AbstractDhTintGetter.INVALID_COLOR;
|
||||
#endif
|
||||
|
||||
if (this.needPostTinting)
|
||||
{
|
||||
// don't try tinting blocks that don't support our method of tint getting
|
||||
@@ -540,11 +604,44 @@ public class ClientBlockStateColorCache
|
||||
// attempt to get the tint
|
||||
try
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
// 1.12.2 doesn't have BlockAndTintGetter -> get tintColor from biome
|
||||
WorldClient world = (WorldClient) this.clientLevelWrapper.getWrappedMcObject();
|
||||
BlockPos mcPos = new BlockPos(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
Block block = this.blockState.getBlock();
|
||||
if (block instanceof BlockGrass || block instanceof BlockBush)
|
||||
{
|
||||
tintColor = biomeWrapper.biome.getGrassColorAtPos(mcPos);
|
||||
}
|
||||
else if (block instanceof BlockLeaves)
|
||||
{
|
||||
tintColor = biomeWrapper.biome.getFoliageColorAtPos(mcPos);
|
||||
}
|
||||
else if (block instanceof BlockLiquid) // We don't want lava to fall into the else block
|
||||
{
|
||||
if(block == Blocks.WATER || block == Blocks.FLOWING_WATER)
|
||||
{
|
||||
tintColor = biomeWrapper.biome.getWaterColor();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockColors blockColors = Minecraft.getMinecraft().getBlockColors();
|
||||
tintColor = blockColors.colorMultiplier(blockState, world, mcPos, this.tintIndex);
|
||||
|
||||
if (tintColor == -1)
|
||||
{
|
||||
tintColor = blockColors.getColor(blockState, world, mcPos);
|
||||
}
|
||||
}
|
||||
#else
|
||||
// try to use the fast tint getter logic first
|
||||
if (!BLOCK_STATES_THAT_NEED_LEVEL.contains(this.blockState))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
TintWithoutLevelOverrider tintOverride = TintWithoutLevelOverrideGetter.get();
|
||||
tintOverride.update(biomeWrapper, this.blockStateWrapper, fullDataSource, this.clientLevelWrapper);
|
||||
|
||||
@@ -607,9 +704,9 @@ public class ClientBlockStateColorCache
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// level-specific logic is only needed for MC 1.21.11 and older
|
||||
#if MC_VER <= MC_1_21_11
|
||||
#endif
|
||||
// level-specific logic is only needed for MC 1.21.11 and older
|
||||
#if MC_VER <= MC_1_21_11 && MC_VER > MC_1_12_2
|
||||
// use the level logic only if requested
|
||||
if (BLOCK_STATES_THAT_NEED_LEVEL.contains(this.blockState))
|
||||
{
|
||||
@@ -645,7 +742,11 @@ public class ClientBlockStateColorCache
|
||||
|
||||
|
||||
int returnColor;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
if (tintColor != -1)
|
||||
#else
|
||||
if (tintColor != AbstractDhTintGetter.INVALID_COLOR)
|
||||
#endif
|
||||
{
|
||||
returnColor = ColorUtil.multiplyARGBwithRGB(this.baseColor, tintColor);
|
||||
}
|
||||
@@ -692,11 +793,11 @@ public class ClientBlockStateColorCache
|
||||
|
||||
static EColorMode getColorMode(Block block)
|
||||
{
|
||||
if (block instanceof LeavesBlock)
|
||||
if (block instanceof #if MC_VER <= MC_1_12_2 BlockLeaves #else LeavesBlock #endif)
|
||||
{
|
||||
return Leaves;
|
||||
}
|
||||
if (block instanceof FlowerBlock)
|
||||
if (block instanceof #if MC_VER <= MC_1_12_2 BlockFlower #else FlowerBlock #endif)
|
||||
{
|
||||
return Flower;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
package com.seibel.distanthorizons.common.wrappers.block;
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
@@ -109,3 +109,4 @@ public class TintWithoutLevelOverrider extends AbstractDhTintGetter
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -31,7 +31,6 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.ChunkLightStorage
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IMutableBlockPosWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
@@ -12,7 +12,8 @@ import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
#endif
|
||||
|
||||
#if MC_VER < MC_1_20_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
#elif MC_VER < MC_1_20_1
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -155,7 +156,4 @@ public class DhScreen extends #if MC_VER <= MC_1_12_2 GuiScreen #else Screen #en
|
||||
guiStack.setTooltipForNextFrame(font, text, x, y);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -88,11 +88,7 @@ public class GuiHelper
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public static void SetY(GuiTextField w, int y)
|
||||
{
|
||||
#if MC_VER < MC_1_19_4
|
||||
w.y = y;
|
||||
#else
|
||||
w.setY(y);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,17 +1,27 @@
|
||||
package com.seibel.distanthorizons.common.wrappers.gui;
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import org.lwjglx.opengl.Display;
|
||||
#else
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
|
||||
#endif
|
||||
|
||||
import com.seibel.distanthorizons.core.config.gui.AbstractScreen;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
#endif
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
#if MC_VER < MC_1_20_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.client.gui.GuiListExtended;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiSlot;
|
||||
#elif MC_VER < MC_1_20_1
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
@@ -24,19 +34,21 @@ import java.util.*;
|
||||
|
||||
public class MinecraftScreen
|
||||
{
|
||||
public static Screen getScreen(Screen parent, AbstractScreen screen, String translationName)
|
||||
public static #if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif getScreen(#if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif parent, AbstractScreen screen, String translationName)
|
||||
{
|
||||
return new ConfigScreenRenderer(parent, screen, translationName);
|
||||
}
|
||||
|
||||
private static class ConfigScreenRenderer extends DhScreen
|
||||
{
|
||||
private final Screen parent;
|
||||
private final #if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif parent;
|
||||
private ConfigListWidget configListWidget;
|
||||
private AbstractScreen screen;
|
||||
|
||||
|
||||
#if MC_VER < MC_1_19_2
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public static net.minecraft.util.text.TextComponentTranslation translate(String str, Object... args)
|
||||
{ return new net.minecraft.util.text.TextComponentTranslation(str, args); }
|
||||
#elif MC_VER < MC_1_19_2
|
||||
public static net.minecraft.network.chat.TranslatableComponent translate(String str, Object... args)
|
||||
{ return new net.minecraft.network.chat.TranslatableComponent(str, args); }
|
||||
#else
|
||||
@@ -44,10 +56,12 @@ public class MinecraftScreen
|
||||
{ return net.minecraft.network.chat.Component.translatable(str, args); }
|
||||
#endif
|
||||
|
||||
protected ConfigScreenRenderer(Screen parent, AbstractScreen screen, String translationName)
|
||||
protected ConfigScreenRenderer(#if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif parent, AbstractScreen screen, String translationName)
|
||||
{
|
||||
super(translate(translationName));
|
||||
#if MC_VER < MC_1_21_9
|
||||
#if MC_VER <= MC_1_12_2
|
||||
screen.minecraftWindow = Display.getWindow();
|
||||
#elif MC_VER < MC_1_21_9
|
||||
screen.minecraftWindow = Minecraft.getInstance().getWindow().getWindow();
|
||||
#else
|
||||
screen.minecraftWindow = Minecraft.getInstance().getWindow().handle();
|
||||
@@ -57,18 +71,28 @@ public class MinecraftScreen
|
||||
}
|
||||
|
||||
@Override
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public void initGui()
|
||||
#else
|
||||
protected void init()
|
||||
#endif
|
||||
{
|
||||
super.init(); // Init Minecraft's screen
|
||||
super.#if MC_VER <= MC_1_12_2 initGui(); #else init(); #endif // Init Minecraft's screen
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.screen.width = Display.getWidth();
|
||||
this.screen.height = Display.getHeight();
|
||||
#else
|
||||
Window mcWindow = this.minecraft.getWindow();
|
||||
this.screen.width = mcWindow.getWidth();
|
||||
this.screen.height = mcWindow.getHeight();
|
||||
#endif
|
||||
this.screen.scaledWidth = this.width;
|
||||
this.screen.scaledHeight = this.height;
|
||||
this.screen.init(); // Init our own config screen
|
||||
|
||||
this.configListWidget = new ConfigListWidget(this.minecraft, this.width, this.height, 0, 0, 25); // Select the area to tint
|
||||
this.configListWidget = new ConfigListWidget(#if MC_VER <= MC_1_12_2 this.mc #else this.minecraft #endif, this.width, this.height, 0, 0, 25); // Select the area to tint
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
#if MC_VER < MC_1_20_6 // no background is rendered in MC 1.20.6+
|
||||
if (this.minecraft != null && this.minecraft.level != null) // Check if in game
|
||||
{
|
||||
@@ -77,10 +101,13 @@ public class MinecraftScreen
|
||||
#endif
|
||||
|
||||
this.addWidget(this.configListWidget); // Add the tint to the things to be rendered
|
||||
#endif
|
||||
}
|
||||
|
||||
@Override
|
||||
#if MC_VER < MC_1_20_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public void drawScreen(int mouseX, int mouseY, float delta)
|
||||
#elif MC_VER < MC_1_20_1
|
||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
@@ -88,7 +115,9 @@ public class MinecraftScreen
|
||||
public void extractRenderState(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#if MC_VER < MC_1_20_2
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.drawDefaultBackground();
|
||||
#elif MC_VER < MC_1_20_2
|
||||
this.renderBackground(matrices); // Render background
|
||||
#elif MC_VER < MC_1_21_6
|
||||
this.renderBackground(matrices, mouseX, mouseY, delta); // Render background
|
||||
@@ -96,7 +125,9 @@ public class MinecraftScreen
|
||||
// background blur is already being rendered, rendering again causes the game to crash
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_11
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.configListWidget.drawScreen(mouseX, mouseY, delta);
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
this.configListWidget.render(matrices, mouseX, mouseY, delta); // Renders the items in the render list (currently only used to tint background darker)
|
||||
#else
|
||||
this.configListWidget.extractRenderState(matrices, mouseX, mouseY, delta); // Renders the items in the render list (currently only used to tint background darker)
|
||||
@@ -106,55 +137,86 @@ public class MinecraftScreen
|
||||
this.screen.mouseY = mouseY;
|
||||
this.screen.render(delta); // Render everything on the main screen
|
||||
|
||||
#if MC_VER <= MC_1_21_11
|
||||
#if MC_VER <= MC_1_12_2
|
||||
super.drawScreen(mouseX, mouseY, delta); // Render the vanilla stuff (currently only used for the background and tint)
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
super.render(matrices, mouseX, mouseY, delta); // Render the vanilla stuff (currently only used for the background and tint)
|
||||
#else
|
||||
super.extractRenderState(matrices, mouseX, mouseY, delta); // Renders the items in the render list (currently only used to tint background darker)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if MC_VER <= MC_1_21_10
|
||||
@Override
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public void setWorldAndResolution(Minecraft mc, int width, int height)
|
||||
#elif MC_VER <= MC_1_21_10
|
||||
public void resize(Minecraft mc, int width, int height)
|
||||
#else
|
||||
@Override
|
||||
public void resize(int width, int height)
|
||||
#endif
|
||||
{
|
||||
// Resize Minecraft's screen
|
||||
#if MC_VER <= MC_1_21_10
|
||||
#if MC_VER <= MC_1_12_2
|
||||
super.setWorldAndResolution(mc, width, height);
|
||||
#elif MC_VER <= MC_1_21_10
|
||||
super.resize(mc, width, height);
|
||||
#else
|
||||
super.resize(width, height);
|
||||
#endif
|
||||
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.screen.width = Display.getWidth();
|
||||
this.screen.height = Display.getHeight();
|
||||
#else
|
||||
Window mcWindow = this.minecraft.getWindow();
|
||||
this.screen.width = mcWindow.getWidth();
|
||||
this.screen.height = mcWindow.getHeight();
|
||||
#endif;
|
||||
this.screen.scaledWidth = this.width;
|
||||
this.screen.scaledHeight = this.height;
|
||||
this.screen.onResize(); // Resize our screen
|
||||
}
|
||||
|
||||
@Override
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public void updateScreen()
|
||||
#else
|
||||
public void tick()
|
||||
#endif
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
super.updateScreen(); // Tick Minecraft's screen
|
||||
#else
|
||||
super.tick(); // Tick Minecraft's screen
|
||||
#endif
|
||||
|
||||
this.screen.tick(); // Tick our screen
|
||||
if (this.screen.close) // If we decide to close the screen, then actually close the screen
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.onGuiClosed();
|
||||
#else
|
||||
this.onClose();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public void onGuiClosed()
|
||||
#else
|
||||
public void onClose()
|
||||
#endif
|
||||
{
|
||||
this.screen.onClose(); // Close our screen
|
||||
#if MC_VER <= MC_1_12_2
|
||||
Objects.requireNonNull(this.mc).displayGuiScreen(this.parent); // Goto the parent screen
|
||||
#else
|
||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent); // Goto the parent screen
|
||||
#endif
|
||||
}
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
@Override
|
||||
public void onFilesDrop(@NotNull List<Path> files)
|
||||
{ this.screen.onFilesDrop(files); }
|
||||
@@ -163,10 +225,10 @@ public class MinecraftScreen
|
||||
@Override
|
||||
public boolean shouldCloseOnEsc()
|
||||
{ return this.screen.shouldCloseOnEsc; }
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
public static class ConfigListWidget extends ContainerObjectSelectionList
|
||||
public static class ConfigListWidget extends #if MC_VER <= MC_1_12_2 GuiListExtended #else ContainerObjectSelectionList #endif
|
||||
{
|
||||
public ConfigListWidget(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing)
|
||||
{
|
||||
@@ -178,6 +240,18 @@ public class MinecraftScreen
|
||||
this.centerListVertically = false;
|
||||
}
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
@Override
|
||||
protected int getSize()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public IGuiListEntry getListEntry(int index)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,13 +19,21 @@
|
||||
|
||||
package com.seibel.distanthorizons.common.wrappers.gui;
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
import net.minecraft.network.chat.Component;
|
||||
#endif
|
||||
|
||||
#if MC_VER >= MC_1_17_1
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
#endif
|
||||
|
||||
#if MC_VER < MC_1_17_1
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
#elif MC_VER < MC_1_17_1
|
||||
import net.minecraft.client.gui.components.ImageButton;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
@@ -53,7 +61,9 @@ import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_10
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
#elif MC_VER <= MC_1_21_10
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
#else
|
||||
import net.minecraft.resources.Identifier;
|
||||
@@ -65,7 +75,10 @@ import net.minecraft.resources.Identifier;
|
||||
* @author coolGi
|
||||
* @version 2023-10-03
|
||||
*/
|
||||
#if MC_VER < MC_1_20_2
|
||||
#if MC_VER <= MC_1_12_2
|
||||
@SuppressWarnings("deprecation") // we use a few deprecated Mojang functions (as expected when running on old MC versions)
|
||||
public class TexturedButtonWidget extends GuiButton
|
||||
#elif MC_VER < MC_1_20_2
|
||||
@SuppressWarnings("deprecation") // we use a few deprecated Mojang functions (as expected when running on old MC versions)
|
||||
public class TexturedButtonWidget extends ImageButton
|
||||
#else
|
||||
@@ -75,7 +88,7 @@ public class TexturedButtonWidget extends Button
|
||||
{
|
||||
public final boolean renderBackground;
|
||||
|
||||
#if MC_VER >= MC_1_20_2
|
||||
#if MC_VER >= MC_1_20_2 || MC_VER <= MC_1_12_2
|
||||
private final int u;
|
||||
private final int v;
|
||||
private final int hoveredVOffset;
|
||||
@@ -92,28 +105,32 @@ public class TexturedButtonWidget extends Button
|
||||
|
||||
|
||||
public TexturedButtonWidget(
|
||||
int x, int y, int width, int height, int u, int v, int hoveredVOffset,
|
||||
#if MC_VER <= MC_1_12_2 int id, #endif int x, int y, int width, int height, int u, int v, int hoveredVOffset,
|
||||
#if MC_VER <= MC_1_21_10 ResourceLocation textureResourceLocation,
|
||||
#else Identifier textureResourceLocation,
|
||||
#endif
|
||||
int textureWidth, int textureHeight, OnPress pressAction, Component text)
|
||||
int textureWidth, int textureHeight, #if MC_VER > MC_1_12_2 OnPress pressAction,#endif #if MC_VER <= MC_1_12_2 String #else Component #endif text)
|
||||
{
|
||||
this(x, y, width, height, u, v, hoveredVOffset, textureResourceLocation, textureWidth, textureHeight, pressAction, text, true);
|
||||
this(#if MC_VER <= MC_1_12_2 id, #endif x, y, width, height, u, v, hoveredVOffset, textureResourceLocation, textureWidth, textureHeight, #if MC_VER > MC_1_12_2 pressAction, #endif text, true);
|
||||
}
|
||||
public TexturedButtonWidget(
|
||||
int x, int y, int width, int height, int u, int v, int hoveredVOffset,
|
||||
#if MC_VER <= MC_1_12_2 int id, #endif int x, int y, int width, int height, int u, int v, int hoveredVOffset,
|
||||
#if MC_VER <= MC_1_21_10 ResourceLocation textureResourceLocation,
|
||||
#else Identifier textureResourceLocation,
|
||||
#endif
|
||||
int textureWidth, int textureHeight, OnPress pressAction, Component text,
|
||||
int textureWidth, int textureHeight, #if MC_VER > MC_1_12_2 OnPress pressAction,#endif #if MC_VER <= MC_1_12_2 String #else Component #endif text,
|
||||
boolean renderBackground)
|
||||
{
|
||||
#if MC_VER < MC_1_20_2
|
||||
#if MC_VER <= MC_1_12_2
|
||||
super(id, x, y, width, height, text);
|
||||
#elif MC_VER < MC_1_20_2
|
||||
super(x, y, width, height, u, v, hoveredVOffset, textureResourceLocation, textureWidth, textureHeight, pressAction, text);
|
||||
#else
|
||||
// We don't pass in the text option since it will render (we normally pass it in for narration)
|
||||
super(x, y, width, height, Component.empty(), pressAction, DEFAULT_NARRATION);
|
||||
#endif
|
||||
|
||||
#if MC_VER >= MC_1_20_2 || MC_VER <= MC_1_12_2
|
||||
this.u = u;
|
||||
this.v = v;
|
||||
this.hoveredVOffset = hoveredVOffset;
|
||||
@@ -127,7 +144,27 @@ public class TexturedButtonWidget extends Button
|
||||
this.renderBackground = renderBackground;
|
||||
}
|
||||
|
||||
#if MC_VER < MC_1_20_2
|
||||
#if MC_VER <= MC_1_12_2
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
||||
if (this.visible) {
|
||||
//Render vanilla background
|
||||
mc.getTextureManager().bindTexture(BUTTON_TEXTURES);
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
int i = this.getHoverState(this.hovered);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
this.drawTexturedModalRect(this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height);
|
||||
this.drawTexturedModalRect(this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
|
||||
|
||||
//Render DH texture
|
||||
mc.getTextureManager().bindTexture(textureResourceLocation);
|
||||
drawModalRectWithCustomSizedTexture(this.x, this.y, this.u, (hoveredVOffset * (i - 1)), this.width, this.height, this.textureWidth, this.textureHeight);
|
||||
}
|
||||
}
|
||||
#elif MC_VER < MC_1_20_2
|
||||
#if MC_VER < MC_1_19_4
|
||||
@Override
|
||||
public void renderButton(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||
|
||||
@@ -12,17 +12,24 @@ import com.seibel.distanthorizons.core.config.types.enums.EConfigCommentTextPosi
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.config.IConfigGui;
|
||||
import net.minecraft.client.Minecraft;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.client.gui.*;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
#else
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
#endif
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
#if MC_VER < MC_1_20_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
#elif MC_VER < MC_1_20_1
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
@@ -94,7 +101,7 @@ public class ClassicConfigGUI
|
||||
//==============//
|
||||
|
||||
/** if you want to get this config gui's screen call this */
|
||||
public static Screen getScreen(Screen parent, String category)
|
||||
public static #if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif getScreen(#if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif parent, String category)
|
||||
{ return new DhConfigScreen(parent, category); }
|
||||
|
||||
|
||||
@@ -103,9 +110,13 @@ public class ClassicConfigGUI
|
||||
// helper classes //
|
||||
//================//
|
||||
|
||||
public static class ConfigListWidget extends ContainerObjectSelectionList<DhButtonEntry>
|
||||
{
|
||||
Font textRenderer;
|
||||
public static class ConfigListWidget extends #if MC_VER <= MC_1_12_2 GuiListExtended #else ContainerObjectSelectionList<DhButtonEntry> #endif
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public List<DhButtonEntry> children = new ArrayList<>();
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_12_2 FontRenderer #else Font #endif textRenderer;
|
||||
|
||||
public ConfigListWidget(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing)
|
||||
{
|
||||
@@ -116,40 +127,108 @@ public class ClassicConfigGUI
|
||||
#endif
|
||||
|
||||
this.centerListVertically = false;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.textRenderer = minecraftClient.fontRenderer;
|
||||
#else
|
||||
this.textRenderer = minecraftClient.font;
|
||||
#endif
|
||||
}
|
||||
|
||||
public void addButton(DhConfigScreen gui, AbstractConfigBase dhConfigType, AbstractWidget button, AbstractWidget resetButton, AbstractWidget indexButton, Component text)
|
||||
{ this.addEntry(new DhButtonEntry(gui, dhConfigType, button, text, resetButton, indexButton)); }
|
||||
#if MC_VER<= MC_1_12_2
|
||||
@Override
|
||||
protected int getSize()
|
||||
{
|
||||
return this.children.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowWidth() { return 10_000; }
|
||||
|
||||
public AbstractWidget getHoveredButton(double mouseX, double mouseY)
|
||||
public IGuiListEntry getListEntry(int index)
|
||||
{
|
||||
for (DhButtonEntry buttonEntry : this.children())
|
||||
return this.children.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawContainerBackground(Tessellator tessellator)
|
||||
{
|
||||
if (this.mc.world != null)
|
||||
{
|
||||
AbstractWidget button = buttonEntry.button;
|
||||
if (button != null
|
||||
&& button.visible)
|
||||
return; // in-game don't draw dirt background
|
||||
}
|
||||
super.drawContainerBackground(tessellator);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public void addButton(DhConfigScreen gui, AbstractConfigBase dhConfigType, Gui button, GuiButton resetButton, GuiButton indexButton, ITextComponent text)
|
||||
#else
|
||||
public void addButton(DhConfigScreen gui, AbstractConfigBase dhConfigType, AbstractWidget button, AbstractWidget resetButton, AbstractWidget indexButton, Component text)
|
||||
#endif
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.children.add(new DhButtonEntry(gui, dhConfigType, button, text, resetButton, indexButton));
|
||||
#else
|
||||
this.addEntry(new DhButtonEntry(gui, dhConfigType, button, text, resetButton, indexButton));
|
||||
#endif
|
||||
}
|
||||
|
||||
@Override
|
||||
public int #if MC_VER <= MC_1_12_2 getListWidth() #else getRowWidth() #endif { return 10_000; }
|
||||
|
||||
public #if MC_VER <= MC_1_12_2 Gui #else AbstractWidget #endif getHoveredButton(double mouseX, double mouseY)
|
||||
{
|
||||
for (DhButtonEntry buttonEntry : #if MC_VER <= MC_1_12_2 this.children #else this.children() #endif)
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
Gui gui = buttonEntry.button;
|
||||
if (gui == null) continue;
|
||||
|
||||
double minX, minY, maxX, maxY;
|
||||
|
||||
if (gui instanceof GuiButton button)
|
||||
{
|
||||
#if MC_VER < MC_1_19_4
|
||||
double minX = button.x;
|
||||
double minY = button.y;
|
||||
#else
|
||||
double minX = button.getX();
|
||||
double minY = button.getY();
|
||||
#endif
|
||||
|
||||
double maxX = minX + button.getWidth();
|
||||
double maxY = minY + button.getHeight();
|
||||
|
||||
if (mouseX >= minX && mouseX < maxX
|
||||
&& mouseY >= minY && mouseY < maxY)
|
||||
{
|
||||
return button;
|
||||
}
|
||||
if (!button.visible) continue;
|
||||
minX = button.x;
|
||||
minY = button.y;
|
||||
maxX = minX + button.width;
|
||||
maxY = minY + button.height;
|
||||
}
|
||||
else if (gui instanceof GuiTextField field)
|
||||
{
|
||||
if (!field.getVisible()) continue;
|
||||
minX = field.x;
|
||||
minY = field.y;
|
||||
maxX = minX + field.width;
|
||||
maxY = minY + field.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mouseX >= minX && mouseX < maxX && mouseY >= minY && mouseY < maxY)
|
||||
{
|
||||
return gui;
|
||||
}
|
||||
#else
|
||||
AbstractWidget button = (AbstractWidget) buttonEntry.button;
|
||||
if (button == null || !button.visible) continue;
|
||||
|
||||
#if MC_VER < MC_1_19_4
|
||||
double minX = button.x;
|
||||
double minY = button.y;
|
||||
#else
|
||||
double minX = button.getX();
|
||||
double minY = button.getY();
|
||||
#endif
|
||||
|
||||
double maxX = minX + button.getWidth();
|
||||
double maxY = minY + button.getHeight();
|
||||
|
||||
if (mouseX >= minX && mouseX < maxX && mouseY >= minY && mouseY < maxY)
|
||||
{
|
||||
return button;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -158,31 +237,40 @@ public class ClassicConfigGUI
|
||||
}
|
||||
|
||||
|
||||
public static class DhButtonEntry extends ContainerObjectSelectionList.Entry<DhButtonEntry>
|
||||
public static class DhButtonEntry #if MC_VER <= MC_1_12_2 implements GuiListExtended.IGuiListEntry #else extends ContainerObjectSelectionList.Entry<DhButtonEntry> #endif
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
private static final FontRenderer textRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
#else
|
||||
private static final Font textRenderer = Minecraft.getInstance().font;
|
||||
|
||||
private final AbstractWidget button;
|
||||
|
||||
#endif
|
||||
private final DhConfigScreen gui;
|
||||
|
||||
private final AbstractWidget resetButton;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public final Gui button;
|
||||
public final Gui resetButton;
|
||||
public final Gui indexButton;
|
||||
#else
|
||||
private final AbstractWidget indexButton;
|
||||
private final Component text;
|
||||
private final List<AbstractWidget> children = new ArrayList<>();
|
||||
private final AbstractWidget resetButton;
|
||||
private final AbstractWidget button;
|
||||
#endif
|
||||
private final #if MC_VER <= MC_1_12_2 ITextComponent #else Component #endif text;
|
||||
private final List<#if MC_VER <= MC_1_12_2 Gui #else AbstractWidget #endif> children = new ArrayList<>();
|
||||
|
||||
@NotNull
|
||||
private final EConfigCommentTextPosition textPosition;
|
||||
public final AbstractConfigBase dhConfigType;
|
||||
|
||||
public static final Map<AbstractWidget, Component> TEXT_BY_WIDGET = new HashMap<>();
|
||||
public static final Map<AbstractWidget, DhButtonEntry> BUTTON_BY_WIDGET = new HashMap<>();
|
||||
public static final Map< #if MC_VER <= MC_1_12_2 Gui #else AbstractWidget #endif, #if MC_VER <= MC_1_12_2 ITextComponent #else Component #endif> TEXT_BY_WIDGET = new HashMap<>();
|
||||
public static final Map< #if MC_VER <= MC_1_12_2 Gui #else AbstractWidget #endif, DhButtonEntry> BUTTON_BY_WIDGET = new HashMap<>();
|
||||
|
||||
|
||||
|
||||
public DhButtonEntry(
|
||||
DhConfigScreen gui, AbstractConfigBase dhConfigType,
|
||||
AbstractWidget button, Component text, AbstractWidget resetButton, AbstractWidget indexButton)
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public DhButtonEntry(DhConfigScreen gui, AbstractConfigBase dhConfigType, Gui button, ITextComponent text, GuiButton resetButton, GuiButton indexButton)
|
||||
#else
|
||||
public DhButtonEntry(DhConfigScreen gui, AbstractConfigBase dhConfigType, AbstractWidget button, Component text, AbstractWidget resetButton, AbstractWidget indexButton)
|
||||
#endif
|
||||
{
|
||||
TEXT_BY_WIDGET.put(button, text);
|
||||
BUTTON_BY_WIDGET.put(button, this);
|
||||
@@ -225,7 +313,9 @@ public class ClassicConfigGUI
|
||||
|
||||
|
||||
@Override
|
||||
#if MC_VER < MC_1_20_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected, float tickDelta)
|
||||
#elif MC_VER < MC_1_20_1
|
||||
public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
||||
#elif MC_VER < MC_1_21_9
|
||||
public void render(GuiGraphics matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta)
|
||||
@@ -250,18 +340,33 @@ public class ClassicConfigGUI
|
||||
|
||||
if (this.button != null)
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
if (this.button instanceof GuiButton guiButton)
|
||||
{
|
||||
SetY(guiButton, y);
|
||||
guiButton.drawButton(Minecraft.getMinecraft(), mouseX, mouseY, tickDelta);
|
||||
}
|
||||
if (this.button instanceof GuiTextField guiTextField)
|
||||
{
|
||||
SetY(guiTextField, y);
|
||||
guiTextField.drawTextBox();
|
||||
}
|
||||
#else
|
||||
SetY(this.button, y);
|
||||
#if MC_VER <= MC_1_21_11
|
||||
this.button.render(matrices, mouseX, mouseY, tickDelta);
|
||||
#else
|
||||
this.button.extractRenderState(matrices, mouseX, mouseY, tickDelta);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
if (this.resetButton != null)
|
||||
{
|
||||
SetY(this.resetButton, y);
|
||||
#if MC_VER <= MC_1_21_11
|
||||
SetY(#if MC_VER <= MC_1_12_2 (GuiButton) #endif this.resetButton, y);
|
||||
#if MC_VER <= MC_1_12_2
|
||||
((GuiButton) this.resetButton).drawButton(Minecraft.getMinecraft(), mouseX, mouseY, tickDelta);
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
this.resetButton.render(matrices, mouseX, mouseY, tickDelta);
|
||||
#else
|
||||
this.resetButton.extractRenderState(matrices, mouseX, mouseY, tickDelta);
|
||||
@@ -270,8 +375,10 @@ public class ClassicConfigGUI
|
||||
|
||||
if (this.indexButton != null)
|
||||
{
|
||||
SetY(this.indexButton, y);
|
||||
#if MC_VER <= MC_1_21_11
|
||||
SetY(#if MC_VER <= MC_1_12_2 (GuiButton) #endif this.indexButton, y);
|
||||
#if MC_VER <= MC_1_12_2
|
||||
((GuiButton) this.indexButton).drawButton(Minecraft.getMinecraft(), mouseX, mouseY, tickDelta);
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
this.indexButton.render(matrices, mouseX, mouseY, tickDelta);
|
||||
#else
|
||||
this.indexButton.extractRenderState(matrices, mouseX, mouseY, tickDelta);
|
||||
@@ -280,7 +387,11 @@ public class ClassicConfigGUI
|
||||
|
||||
if (this.text != null)
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
int translatedLength = textRenderer.getStringWidth(this.text.getFormattedText());
|
||||
#else
|
||||
int translatedLength = textRenderer.width(this.text);
|
||||
#endif
|
||||
|
||||
int textXPos;
|
||||
if (this.textPosition == EConfigCommentTextPosition.RIGHT_JUSTIFIED)
|
||||
@@ -313,8 +424,9 @@ public class ClassicConfigGUI
|
||||
throw new UnsupportedOperationException("No text position render defined for [" + this.textPosition + "]");
|
||||
}
|
||||
|
||||
|
||||
#if MC_VER < MC_1_20_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
textRenderer.drawString(this.text.getFormattedText(), textXPos, y + 5,0xFFFFFF);
|
||||
#elif MC_VER < MC_1_20_1
|
||||
GuiComponent.drawString(matrices, textRenderer,
|
||||
this.text,
|
||||
textXPos, y + 5,
|
||||
@@ -344,9 +456,25 @@ public class ClassicConfigGUI
|
||||
}
|
||||
}
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
@Override
|
||||
public void updatePosition(int slotIndex, int x, int y, float partialTicks) { }
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(int slotIndex, int mouseX, int mouseY, int mouseEvent, int relativeX, int relativeY)
|
||||
{
|
||||
return false; // handled in DhConfigScreen.mouseClicked
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) { }
|
||||
#endif
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
@Override
|
||||
public @NotNull List<? extends GuiEventListener> children()
|
||||
{ return this.children; }
|
||||
#endif
|
||||
|
||||
#if MC_VER >= MC_1_17_1
|
||||
@Override
|
||||
|
||||
@@ -13,14 +13,18 @@ import java.util.regex.Pattern;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.DisallowSelectingViaConfigGui;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.DhScreen;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.GuiHelper;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.TexturedButtonWidget;
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.config.ConfigGuiInfo;
|
||||
import com.seibel.distanthorizons.common.wrappers.minecraft.MinecraftClientWrapper;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.config.ConfigHandler;
|
||||
import com.seibel.distanthorizons.core.config.types.*;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.OnPressed;
|
||||
#else
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.updater.ChangelogScreen;
|
||||
|
||||
#endif
|
||||
import com.seibel.distanthorizons.core.config.types.enums.EConfigCommentTextPosition;
|
||||
import com.seibel.distanthorizons.core.config.types.enums.EConfigValidity;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
@@ -30,8 +34,15 @@ import com.seibel.distanthorizons.core.util.AnnotationUtil;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.config.IConfigGui;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.config.ILangWrapper;
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.client.gui.*;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
#else
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
@@ -40,12 +51,13 @@ import net.minecraft.client.gui.components.EditBox;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
#endif
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
#if MC_VER < MC_1_20_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
#elif MC_VER < MC_1_20_1
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
@@ -58,14 +70,18 @@ import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_10
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
#elif MC_VER <= MC_1_21_10
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
#else
|
||||
import net.minecraft.resources.Identifier;
|
||||
#endif
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
#if MC_VER > MC_1_12_2
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
#endif
|
||||
|
||||
import static com.seibel.distanthorizons.common.wrappers.gui.GuiHelper.*;
|
||||
import static com.seibel.distanthorizons.common.wrappers.gui.GuiHelper.Translatable;
|
||||
@@ -80,12 +96,12 @@ class DhConfigScreen extends DhScreen
|
||||
private static final MinecraftClientWrapper MC_CLIENT = MinecraftClientWrapper.INSTANCE;
|
||||
|
||||
|
||||
private final Screen parent;
|
||||
private final #if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif parent;
|
||||
private final String category;
|
||||
private ClassicConfigGUI.ConfigListWidget configListWidget;
|
||||
private boolean reload = false;
|
||||
|
||||
private Button doneButton;
|
||||
private #if MC_VER <= MC_1_12_2 GuiButton #else Button #endif doneButton;
|
||||
|
||||
|
||||
|
||||
@@ -93,7 +109,7 @@ class DhConfigScreen extends DhScreen
|
||||
// constructor //
|
||||
//=============//
|
||||
|
||||
protected DhConfigScreen(Screen parent, String category)
|
||||
protected DhConfigScreen(#if MC_VER <= MC_1_12_2 GuiScreen #else Screen #endif parent, String category)
|
||||
{
|
||||
super(Translatable(
|
||||
LANG_WRAPPER.langExists(ModInfo.ID + ".config" + (category.isEmpty() ? "." + category : "") + ".title") ?
|
||||
@@ -105,8 +121,14 @@ class DhConfigScreen extends DhScreen
|
||||
}
|
||||
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
@Override
|
||||
public void updateScreen() { super.updateScreen(); }
|
||||
#else
|
||||
@Override
|
||||
public void tick() { super.tick(); }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -114,15 +136,25 @@ class DhConfigScreen extends DhScreen
|
||||
// menu UI creation //
|
||||
//==================//
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
@Override
|
||||
public void initGui()
|
||||
#else
|
||||
@Override
|
||||
protected void init()
|
||||
#endif
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
super.initGui();
|
||||
#else
|
||||
super.init();
|
||||
#endif
|
||||
if (!this.reload)
|
||||
{
|
||||
ConfigHandler.INSTANCE.configFileHandler.loadFromFile();
|
||||
}
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
// Changelog button
|
||||
if (Config.Client.Advanced.AutoUpdater.enableAutoUpdater.get()
|
||||
// we only have changelogs for stable builds
|
||||
@@ -161,6 +193,7 @@ class DhConfigScreen extends DhScreen
|
||||
Translatable(ModInfo.ID + ".updater.title")
|
||||
));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// back button
|
||||
@@ -170,7 +203,11 @@ class DhConfigScreen extends DhScreen
|
||||
(button) ->
|
||||
{
|
||||
ConfigHandler.INSTANCE.configFileHandler.loadFromFile();
|
||||
#if MC_VER <= MC_1_12_2
|
||||
Objects.requireNonNull(this.mc).displayGuiScreen(this.parent);
|
||||
#else
|
||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent);
|
||||
#endif
|
||||
}));
|
||||
|
||||
// done/close button
|
||||
@@ -181,11 +218,16 @@ class DhConfigScreen extends DhScreen
|
||||
(button) ->
|
||||
{
|
||||
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
||||
#if MC_VER <= MC_1_12_2
|
||||
Objects.requireNonNull(this.mc).displayGuiScreen(this.parent);
|
||||
#else
|
||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent);
|
||||
#endif
|
||||
}));
|
||||
|
||||
this.configListWidget = new ClassicConfigGUI.ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, 32, 25);
|
||||
this.configListWidget = new ClassicConfigGUI.ConfigListWidget(#if MC_VER <= MC_1_12_2 this.mc #else this.minecraft #endif, this.width * 2, this.height, 32, 32, 25);
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
#if MC_VER < MC_1_20_6 // no background is rendered in MC 1.20.6+
|
||||
if (this.minecraft != null && this.minecraft.level != null)
|
||||
{
|
||||
@@ -194,6 +236,7 @@ class DhConfigScreen extends DhScreen
|
||||
#endif
|
||||
|
||||
this.addWidget(this.configListWidget);
|
||||
#endif
|
||||
|
||||
for (AbstractConfigBase<?> configEntry : ConfigHandler.INSTANCE.configBaseList)
|
||||
{
|
||||
@@ -356,10 +399,25 @@ class DhConfigScreen extends DhScreen
|
||||
private static void setupBooleanMenuOption(ConfigEntry<Boolean> booleanConfigEntry)
|
||||
{
|
||||
// For boolean
|
||||
#if MC_VER <= MC_1_12_2
|
||||
Function<Object, ITextComponent> func = value -> Translatable("distanthorizons.general."+((Boolean) value ? "true" : "false")).setStyle(new Style().setColor((Boolean) value ? TextFormatting.GREEN : TextFormatting.RED));
|
||||
#else
|
||||
Function<Object, Component> func = value -> Translatable("distanthorizons.general." + ((Boolean) value ? "true" : "false")).withStyle((Boolean) value ? ChatFormatting.GREEN : ChatFormatting.RED);
|
||||
#endif
|
||||
|
||||
final ConfigGuiInfo configGuiInfo = ((ConfigGuiInfo) booleanConfigEntry.guiValue);
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
configGuiInfo.buttonOptionMap =
|
||||
new AbstractMap.SimpleEntry<OnPressed, Function<Object, ITextComponent>>(
|
||||
(button) ->
|
||||
{
|
||||
button.enabled = !booleanConfigEntry.apiIsOverriding();
|
||||
|
||||
booleanConfigEntry.uiSetWithoutSaving(!booleanConfigEntry.get());
|
||||
button.displayString = func.apply(booleanConfigEntry.get()).getFormattedText();
|
||||
}, func);
|
||||
#else
|
||||
configGuiInfo.buttonOptionMap =
|
||||
new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(
|
||||
(button) ->
|
||||
@@ -369,27 +427,31 @@ class DhConfigScreen extends DhScreen
|
||||
booleanConfigEntry.uiSetWithoutSaving(!booleanConfigEntry.get());
|
||||
button.setMessage(func.apply(booleanConfigEntry.get()));
|
||||
}, func);
|
||||
#endif
|
||||
}
|
||||
private static void setupEnumMenuOption(ConfigEntry<Enum<?>> enumConfigEntry, Class<? extends Enum<?>> enumClass)
|
||||
{
|
||||
List<Enum<?>> enumList = Arrays.asList(enumClass.getEnumConstants());
|
||||
|
||||
final ConfigGuiInfo configGuiInfo = ((ConfigGuiInfo) enumConfigEntry.guiValue);
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
Function<Object, ITextComponent > getEnumTranslatableFunc = (value) -> Translatable(TRANSLATION_PREFIX + "enum." + enumClass.getSimpleName() + "." + enumConfigEntry.get().toString());
|
||||
#else
|
||||
Function<Object, Component> getEnumTranslatableFunc = (value) -> Translatable(TRANSLATION_PREFIX + "enum." + enumClass.getSimpleName() + "." + enumConfigEntry.get().toString());
|
||||
#endif
|
||||
configGuiInfo.buttonOptionMap =
|
||||
new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(
|
||||
new AbstractMap.SimpleEntry<#if MC_VER <= MC_1_12_2 OnPressed #else Button.OnPress #endif, Function<Object, #if MC_VER <= MC_1_12_2 ITextComponent #else Component #endif>>(
|
||||
(button) ->
|
||||
{
|
||||
// get the currently selected enum and enum index
|
||||
int startingIndex = enumList.indexOf(enumConfigEntry.get());
|
||||
Enum<?> enumValue = enumList.get(startingIndex);
|
||||
|
||||
boolean shiftPressed =
|
||||
InputConstants.isKeyDown(MC_CLIENT.getGlfwWindowId(), GLFW.GLFW_KEY_LEFT_SHIFT)
|
||||
|| InputConstants.isKeyDown(MC_CLIENT.getGlfwWindowId(), GLFW.GLFW_KEY_RIGHT_SHIFT);
|
||||
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
boolean shiftPressed = GuiScreen.isShiftKeyDown();
|
||||
#else
|
||||
boolean shiftPressed = InputConstants.isKeyDown(MC_CLIENT.getGlfwWindowId(), GLFW.GLFW_KEY_LEFT_SHIFT) || InputConstants.isKeyDown(MC_CLIENT.getGlfwWindowId(), GLFW.GLFW_KEY_RIGHT_SHIFT);
|
||||
#endif
|
||||
|
||||
// move forward or backwards depending on if the shift key is pressed
|
||||
int index = shiftPressed ? startingIndex - 1 : startingIndex + 1;
|
||||
@@ -441,9 +503,13 @@ class DhConfigScreen extends DhScreen
|
||||
|
||||
enumConfigEntry.uiSetWithoutSaving(enumValue);
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
button.enabled = !enumConfigEntry.apiIsOverriding();
|
||||
button.displayString = getEnumTranslatableFunc.apply(enumConfigEntry.get()).getFormattedText();
|
||||
#else
|
||||
button.active = !enumConfigEntry.apiIsOverriding();
|
||||
|
||||
button.setMessage(getEnumTranslatableFunc.apply(enumConfigEntry.get()));
|
||||
#endif
|
||||
}, getEnumTranslatableFunc);
|
||||
}
|
||||
|
||||
@@ -460,11 +526,15 @@ class DhConfigScreen extends DhScreen
|
||||
// reset button //
|
||||
//==============//
|
||||
|
||||
Button.OnPress btnAction = (button) ->
|
||||
#if MC_VER <= MC_1_12_2 OnPressed #else Button.OnPress #endif btnAction = (button) ->
|
||||
{
|
||||
configEntry.uiSetWithoutSaving(configEntry.getDefaultValue());
|
||||
this.reload = true;
|
||||
Objects.requireNonNull(this.minecraft).setScreen(this);
|
||||
#if MC_VER <= MC_1_12_2
|
||||
Objects.requireNonNull(this.mc).displayGuiScreen(ClassicConfigGUI.getScreen(this.parent, this.category));
|
||||
#else
|
||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent);
|
||||
#endif
|
||||
};
|
||||
|
||||
int resetButtonPosX = this.width
|
||||
@@ -472,20 +542,29 @@ class DhConfigScreen extends DhScreen
|
||||
- ClassicConfigGUI.ConfigScreenConfigs.SPACE_FROM_RIGHT_SCREEN;
|
||||
int resetButtonPosZ = 0;
|
||||
|
||||
Button resetButton = MakeBtn(
|
||||
#if MC_VER <= MC_1_12_2 GuiButton #else Button #endif resetButton = MakeBtn(
|
||||
#if MC_VER <= MC_1_12_2
|
||||
Translatable("distanthorizons.general.reset").setStyle(new Style().setColor(TextFormatting.RED)),
|
||||
#else
|
||||
Translatable("distanthorizons.general.reset").withStyle(ChatFormatting.RED),
|
||||
#endif
|
||||
resetButtonPosX, resetButtonPosZ,
|
||||
ClassicConfigGUI.ConfigScreenConfigs.RESET_BUTTON_WIDTH, ClassicConfigGUI.ConfigScreenConfigs.RESET_BUTTON_HEIGHT,
|
||||
btnAction);
|
||||
|
||||
if (configEntry.apiIsOverriding())
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
resetButton.enabled = false;
|
||||
resetButton.displayString = Translatable("distanthorizons.general.apiOverride").setStyle(new Style().setColor(TextFormatting.DARK_GRAY)).getFormattedText();
|
||||
#else
|
||||
resetButton.active = false;
|
||||
resetButton.setMessage(Translatable("distanthorizons.general.apiOverride").withStyle(ChatFormatting.DARK_GRAY));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
resetButton.active = true;
|
||||
resetButton.#if MC_VER <= MC_1_12_2 enabled #else active #endif = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -494,7 +573,7 @@ class DhConfigScreen extends DhScreen
|
||||
// option field //
|
||||
//==============//
|
||||
|
||||
Component textComponent = this.GetTranslatableTextComponentForConfig(configEntry);
|
||||
#if MC_VER <= MC_1_12_2 ITextComponent #else Component #endif textComponent = this.GetTranslatableTextComponentForConfig(configEntry);
|
||||
|
||||
int optionFieldPosX = this.width
|
||||
- ClassicConfigGUI.ConfigScreenConfigs.SPACE_FROM_RIGHT_SCREEN
|
||||
@@ -506,21 +585,24 @@ class DhConfigScreen extends DhScreen
|
||||
if (configGuiInfo.buttonOptionMap != null)
|
||||
{
|
||||
// enum/multi option input button
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
Map.Entry<OnPressed, Function<Object,ITextComponent>> widget = configGuiInfo.buttonOptionMap;
|
||||
#else
|
||||
Map.Entry<Button.OnPress, Function<Object, Component>> widget = configGuiInfo.buttonOptionMap;
|
||||
#endif
|
||||
if (configEntry.getType().isEnum())
|
||||
{
|
||||
widget.setValue((value) -> Translatable(TRANSLATION_PREFIX + "enum." + configEntry.getType().getSimpleName() + "." + configEntry.get().toString()));
|
||||
}
|
||||
|
||||
Button button = MakeBtn(
|
||||
#if MC_VER <= MC_1_12_2 GuiButton #else Button #endif button = MakeBtn(
|
||||
widget.getValue().apply(configEntry.get()),
|
||||
optionFieldPosX, optionFieldPosZ,
|
||||
ClassicConfigGUI.ConfigScreenConfigs.OPTION_FIELD_WIDTH, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT,
|
||||
widget.getKey());
|
||||
|
||||
// deactivate the button if the API is overriding it
|
||||
button.active = !configEntry.apiIsOverriding();
|
||||
button.#if MC_VER <= MC_1_12_2 enabled #else active #endif = !configEntry.apiIsOverriding();
|
||||
|
||||
|
||||
this.configListWidget.addButton(this, configEntry,
|
||||
@@ -535,15 +617,19 @@ class DhConfigScreen extends DhScreen
|
||||
{
|
||||
// text box input
|
||||
|
||||
EditBox widget = new EditBox(this.font,
|
||||
#if MC_VER <= MC_1_12_2 GuiTextField #else EditBox #endif widget = new #if MC_VER <= MC_1_12_2 GuiTextField #else EditBox #endif(
|
||||
#if MC_VER <= MC_1_12_2 0, #endif
|
||||
#if MC_VER <= MC_1_12_2 this.fontRenderer #else this.font #endif,
|
||||
optionFieldPosX, optionFieldPosZ,
|
||||
ClassicConfigGUI.ConfigScreenConfigs.OPTION_FIELD_WIDTH - 4, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT,
|
||||
Translatable(""));
|
||||
widget.setMaxLength(3_000_000); // hopefully 3 million characters should be enough for any normal use-case, lol
|
||||
widget.insertText(String.valueOf(configEntry.get()));
|
||||
ClassicConfigGUI.ConfigScreenConfigs.OPTION_FIELD_WIDTH - 4, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT
|
||||
#if MC_VER > MC_1_12_2 ,Translatable("") #endif);
|
||||
widget.#if MC_VER <= MC_1_12_2 setMaxStringLength(3_000_000); #else setMaxLength(3_000_000); #endif // hopefully 3 million characters should be enough for any normal use-case, lol
|
||||
widget.#if MC_VER <= MC_1_12_2 setText #else insertText #endif (String.valueOf(configEntry.get()));
|
||||
|
||||
Predicate<String> processor = configGuiInfo.tooltipFunction.apply(widget, this.doneButton);
|
||||
#if MC_VER <= MC_1_21_11
|
||||
#if MC_VER <= MC_1_12_2
|
||||
widget.setValidator(processor::test);
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
widget.setFilter(processor);
|
||||
#else
|
||||
widget.setResponder(processor::test);
|
||||
@@ -563,18 +649,22 @@ class DhConfigScreen extends DhScreen
|
||||
{
|
||||
ConfigCategory configCategory = (ConfigCategory) configType;
|
||||
|
||||
Component textComponent = this.GetTranslatableTextComponentForConfig(configCategory);
|
||||
#if MC_VER <= MC_1_12_2 ITextComponent #else Component #endif textComponent = this.GetTranslatableTextComponentForConfig(configCategory);
|
||||
|
||||
int categoryPosX = this.width - ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_WIDTH - ClassicConfigGUI.ConfigScreenConfigs.SPACE_FROM_RIGHT_SCREEN;
|
||||
int categoryPosZ = this.height - ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT; // Note: the posZ value here seems to be ignored
|
||||
|
||||
Button widget = MakeBtn(textComponent,
|
||||
#if MC_VER <= MC_1_12_2 GuiButton #else Button #endif widget = MakeBtn(textComponent,
|
||||
categoryPosX, categoryPosZ,
|
||||
ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_WIDTH, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT,
|
||||
((button) ->
|
||||
{
|
||||
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
||||
#if MC_VER <= MC_1_12_2
|
||||
Objects.requireNonNull(this.mc).displayGuiScreen(ClassicConfigGUI.getScreen(this, configCategory.getDestination()));
|
||||
#else
|
||||
Objects.requireNonNull(this.minecraft).setScreen(ClassicConfigGUI.getScreen(this, configCategory.getDestination()));
|
||||
#endif
|
||||
}));
|
||||
this.configListWidget.addButton(this, configType, widget, null, null, null);
|
||||
|
||||
@@ -589,11 +679,11 @@ class DhConfigScreen extends DhScreen
|
||||
{
|
||||
ConfigUIButton configUiButton = (ConfigUIButton) configType;
|
||||
|
||||
Component textComponent = this.GetTranslatableTextComponentForConfig(configUiButton);
|
||||
#if MC_VER <= MC_1_12_2 ITextComponent #else Component #endif textComponent = this.GetTranslatableTextComponentForConfig(configUiButton);
|
||||
|
||||
int buttonPosX = this.width - ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_WIDTH - ClassicConfigGUI.ConfigScreenConfigs.SPACE_FROM_RIGHT_SCREEN;
|
||||
|
||||
Button widget = MakeBtn(textComponent,
|
||||
#if MC_VER <= MC_1_12_2 GuiButton #else Button #endif widget = MakeBtn(textComponent,
|
||||
buttonPosX, this.height - 28,
|
||||
ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_WIDTH, ClassicConfigGUI.ConfigScreenConfigs.CATEGORY_BUTTON_HEIGHT,
|
||||
(button) -> ((ConfigUIButton) configType).runAction());
|
||||
@@ -610,7 +700,7 @@ class DhConfigScreen extends DhScreen
|
||||
{
|
||||
ConfigUIComment configUiComment = (ConfigUIComment) configType;
|
||||
|
||||
Component textComponent = this.GetTranslatableTextComponentForConfig(configUiComment);
|
||||
#if MC_VER <= MC_1_12_2 ITextComponent #else Component #endif textComponent = this.GetTranslatableTextComponentForConfig(configUiComment);
|
||||
if (configUiComment.parentConfigPath != null)
|
||||
{
|
||||
textComponent = Translatable(TRANSLATION_PREFIX + configUiComment.parentConfigPath);
|
||||
@@ -627,7 +717,7 @@ class DhConfigScreen extends DhScreen
|
||||
{
|
||||
if (configType instanceof ConfigUISpacer)
|
||||
{
|
||||
Button spacerButton = MakeBtn(Translatable("distanthorizons.general.spacer"),
|
||||
#if MC_VER <= MC_1_12_2 GuiButton #else Button #endif spacerButton = MakeBtn(Translatable("distanthorizons.general.spacer"),
|
||||
10, 10, // having too small of a size causes division by 0 errors in older MC versions (IE 1.20.1)
|
||||
1, 1,
|
||||
(button) -> { });
|
||||
@@ -652,7 +742,7 @@ class DhConfigScreen extends DhScreen
|
||||
return false;
|
||||
}
|
||||
|
||||
private Component GetTranslatableTextComponentForConfig(AbstractConfigBase<?> configType)
|
||||
private #if MC_VER <= MC_1_12_2 ITextComponent #else Component #endif GetTranslatableTextComponentForConfig(AbstractConfigBase<?> configType)
|
||||
{ return Translatable(TRANSLATION_PREFIX + configType.getNameAndCategory()); }
|
||||
|
||||
|
||||
@@ -662,15 +752,19 @@ class DhConfigScreen extends DhScreen
|
||||
//===========//
|
||||
|
||||
@Override
|
||||
#if MC_VER < MC_1_20_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public void drawScreen(int mouseX, int mouseY, float delta)
|
||||
#elif MC_VER < MC_1_20_1
|
||||
public void render(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
public void render(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
#else
|
||||
#else
|
||||
public void extractRenderState(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
#if MC_VER < MC_1_20_2 // 1.20.2 now enables this by default in the `this.list.render` function
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.drawDefaultBackground();
|
||||
#elif MC_VER < MC_1_20_2 // 1.20.2 now enables this by default in the `this.list.render` function
|
||||
this.renderBackground(matrices);
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
@@ -679,7 +773,9 @@ class DhConfigScreen extends DhScreen
|
||||
#endif
|
||||
|
||||
// Render buttons
|
||||
#if MC_VER <= MC_1_21_11
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.configListWidget.drawScreen(mouseX, mouseY, delta);
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
this.configListWidget.render(matrices, mouseX, mouseY, delta);
|
||||
#else
|
||||
this.configListWidget.extractRenderState(matrices, mouseX, mouseY, delta);
|
||||
@@ -687,43 +783,61 @@ class DhConfigScreen extends DhScreen
|
||||
|
||||
|
||||
// Render config title
|
||||
this.DhDrawCenteredString(matrices, this.font, this.title,
|
||||
this.DhDrawCenteredString(
|
||||
#if MC_VER > MC_1_12_2
|
||||
matrices, this.font,
|
||||
#endif
|
||||
this.title,
|
||||
this.width / 2, 15,
|
||||
#if MC_VER < MC_1_21_6
|
||||
#if MC_VER < MC_1_21_6
|
||||
0xFFFFFF // RGB white
|
||||
#else
|
||||
0xFFFFFFFF // ARGB white
|
||||
#endif );
|
||||
#else
|
||||
0xFFFFFFFF // ARGB white
|
||||
#endif);
|
||||
|
||||
|
||||
// render DH version
|
||||
this.DhDrawString(matrices, this.font, TextOrLiteral(ModInfo.VERSION), 2, this.height - 10,
|
||||
#if MC_VER < MC_1_21_6
|
||||
this.DhDrawString(
|
||||
#if MC_VER > MC_1_12_2
|
||||
matrices, this.font,
|
||||
#endif
|
||||
TextOrLiteral(ModInfo.VERSION), 2, this.height - 10,
|
||||
#if MC_VER < MC_1_21_6
|
||||
0xAAAAAA // RGB white
|
||||
#else
|
||||
0xFFAAAAAA // ARGB white
|
||||
#endif );
|
||||
#else
|
||||
0xFFAAAAAA // ARGB white
|
||||
#endif);
|
||||
|
||||
// If the update is pending, display this message to inform the user that it will apply when the game restarts
|
||||
if (SelfUpdater.deleteOldJarOnJvmShutdown)
|
||||
{
|
||||
this.DhDrawString(matrices, this.font, Translatable(ModInfo.ID + ".updater.waitingForClose"), 4, this.height - 42,
|
||||
#if MC_VER < MC_1_21_6
|
||||
this.DhDrawString(
|
||||
#if MC_VER > MC_1_12_2
|
||||
matrices, this.font,
|
||||
#endif
|
||||
Translatable(ModInfo.ID + ".updater.waitingForClose"), 4, this.height - 42,
|
||||
#if MC_VER < MC_1_21_6
|
||||
0xFFFFFF // RGB white
|
||||
#else
|
||||
0xFFFFFFFF // ARGB white
|
||||
#endif );
|
||||
#else
|
||||
0xFFFFFFFF // ARGB white
|
||||
#endif);
|
||||
}
|
||||
|
||||
this.renderTooltip(
|
||||
#if MC_VER > MC_1_12_2 matrices,
|
||||
#endif
|
||||
mouseX, mouseY, delta);
|
||||
|
||||
this.renderTooltip(matrices, mouseX, mouseY, delta);
|
||||
|
||||
#if MC_VER < MC_1_20_2
|
||||
#if MC_VER <= MC_1_12_2
|
||||
super.drawScreen(mouseX, mouseY, delta);
|
||||
#elif MC_VER < MC_1_20_2
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if MC_VER < MC_1_20_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
private void renderTooltip(int mouseX, int mouseY, float delta)
|
||||
#elif MC_VER < MC_1_20_1
|
||||
private void renderTooltip(PoseStack matrices, int mouseX, int mouseY, float delta)
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
private void renderTooltip(GuiGraphics matrices, int mouseX, int mouseY, float delta)
|
||||
@@ -731,7 +845,7 @@ class DhConfigScreen extends DhScreen
|
||||
private void renderTooltip(GuiGraphicsExtractor matrices, int mouseX, int mouseY, float delta)
|
||||
#endif
|
||||
{
|
||||
AbstractWidget hoveredWidget = this.configListWidget.getHoveredButton(mouseX, mouseY);
|
||||
#if MC_VER <= MC_1_12_2 Gui #else AbstractWidget #endif hoveredWidget = this.configListWidget.getHoveredButton(mouseX, mouseY);
|
||||
if (hoveredWidget == null)
|
||||
{
|
||||
return;
|
||||
@@ -763,22 +877,87 @@ class DhConfigScreen extends DhScreen
|
||||
final ConfigGuiInfo configGuiInfo = ((ConfigGuiInfo) configBase.guiValue);
|
||||
if (configGuiInfo.errorMessage != null)
|
||||
{
|
||||
this.DhRenderTooltip(matrices, this.font, configGuiInfo.errorMessage, mouseX, mouseY);
|
||||
this.DhRenderTooltip(
|
||||
#if MC_VER > MC_1_12_2
|
||||
matrices, this.font,
|
||||
#endif
|
||||
configGuiInfo.errorMessage, mouseX, mouseY);
|
||||
}
|
||||
// display the tooltip if present
|
||||
else if (LANG_WRAPPER.langExists(key))
|
||||
{
|
||||
List<Component> list = new ArrayList<>();
|
||||
List<#if MC_VER <= MC_1_12_2 ITextComponent #else Component #endif> list = new ArrayList<>();
|
||||
String lang = LANG_WRAPPER.getLang(key);
|
||||
for (String langLine : lang.split("\n"))
|
||||
{
|
||||
list.add(TextOrTranslatable(langLine));
|
||||
}
|
||||
|
||||
this.DhRenderComponentTooltip(matrices, this.font, list, mouseX, mouseY);
|
||||
this.DhRenderComponentTooltip(
|
||||
#if MC_VER > MC_1_12_2
|
||||
matrices, this.font,
|
||||
#endif
|
||||
list, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
@Override
|
||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws java.io.IOException
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
if (mouseY >= this.configListWidget.top && mouseY <= this.configListWidget.bottom)
|
||||
{
|
||||
for (ClassicConfigGUI.DhButtonEntry entry : this.configListWidget.children)
|
||||
{
|
||||
if (entry.button instanceof GuiButton btn && btn.visible)
|
||||
{
|
||||
if (btn.mousePressed(this.mc, mouseX, mouseY))
|
||||
{
|
||||
btn.playPressSound(this.mc.getSoundHandler());
|
||||
OnPressed handler = GuiHelper.HANDLER_BY_BUTTON.get(btn);
|
||||
if (handler != null) handler.pressed(btn);
|
||||
}
|
||||
}
|
||||
else if (entry.button instanceof GuiTextField field && field.getVisible())
|
||||
{
|
||||
field.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
}
|
||||
|
||||
if (entry.resetButton instanceof GuiButton reset && reset.visible)
|
||||
{
|
||||
if (reset.mousePressed(this.mc, mouseX, mouseY))
|
||||
{
|
||||
reset.playPressSound(this.mc.getSoundHandler());
|
||||
OnPressed handler = GuiHelper.HANDLER_BY_BUTTON.get(reset);
|
||||
if (handler != null) handler.pressed(reset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int keyCode) throws java.io.IOException
|
||||
{
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
for (ClassicConfigGUI.DhButtonEntry entry : this.configListWidget.children)
|
||||
{
|
||||
if (entry.button instanceof GuiTextField field)
|
||||
{
|
||||
field.textboxKeyTyped(typedChar, keyCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() throws java.io.IOException
|
||||
{
|
||||
super.handleMouseInput();
|
||||
this.configListWidget.handleMouseInput();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//==========//
|
||||
@@ -787,11 +966,16 @@ class DhConfigScreen extends DhScreen
|
||||
|
||||
/** When you close it, it goes to the previous screen and saves */
|
||||
@Override
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public void onGuiClosed()
|
||||
#else
|
||||
public void onClose()
|
||||
#endif
|
||||
{
|
||||
ConfigHandler.INSTANCE.configFileHandler.saveToFile();
|
||||
#if MC_VER > MC_1_12_2
|
||||
Objects.requireNonNull(this.minecraft).setScreen(this.parent);
|
||||
|
||||
#endif
|
||||
ClassicConfigGUI.CONFIG_CORE_INTERFACE.onScreenChangeListenerList.forEach((listener) -> listener.run());
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,9 @@ package com.seibel.distanthorizons.common.wrappers.minecraft;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
#endif
|
||||
import com.seibel.distanthorizons.common.wrappers.gui.NativeDialogUtil;
|
||||
import com.seibel.distanthorizons.common.wrappers.world.ClientLevelWrapper;
|
||||
import com.seibel.distanthorizons.core.file.structure.ClientOnlySaveStructure;
|
||||
@@ -36,19 +38,29 @@ import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.profiler.Profiler;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
#else
|
||||
import net.minecraft.CrashReport;
|
||||
import net.minecraft.client.CloudStatus;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
#endif
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
#if MC_VER < MC_1_19_2
|
||||
#if MC_VER < MC_1_19_2 && MC_VER > MC_1_12_2
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
#endif
|
||||
|
||||
@@ -57,11 +69,12 @@ import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.util.profiling.Profiler;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_21_10
|
||||
#if MC_VER <= MC_1_21_10 && MC_VER > MC_1_12_2
|
||||
import net.minecraft.client.GraphicsStatus;
|
||||
#else
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* A singleton that wraps the Minecraft object.
|
||||
*
|
||||
@@ -70,7 +83,7 @@ import net.minecraft.client.GraphicsStatus;
|
||||
public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecraftSharedWrapper
|
||||
{
|
||||
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||
private static final Minecraft MINECRAFT = Minecraft.getInstance();
|
||||
private static final Minecraft MINECRAFT = Minecraft.#if MC_VER <= MC_1_12_2 getMinecraft() #else getInstance() #endif;
|
||||
|
||||
public static final MinecraftClientWrapper INSTANCE = new MinecraftClientWrapper();
|
||||
|
||||
@@ -85,19 +98,20 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
//region
|
||||
|
||||
@Override
|
||||
public boolean hasSinglePlayerServer() { return MINECRAFT.hasSingleplayerServer(); }
|
||||
public boolean hasSinglePlayerServer() { return MINECRAFT.#if MC_VER <= MC_1_12_2 isSingleplayer() #else hasSingleplayerServer() #endif; }
|
||||
@Override
|
||||
public boolean clientConnectedToDedicatedServer()
|
||||
{
|
||||
return MINECRAFT.getCurrentServer() != null
|
||||
&& !this.hasSinglePlayerServer();
|
||||
public boolean clientConnectedToDedicatedServer()
|
||||
{
|
||||
return MINECRAFT.#if MC_VER <= MC_1_12_2 getCurrentServerData() #else getCurrentServer() #endif != null
|
||||
&& !this.hasSinglePlayerServer();
|
||||
}
|
||||
@Override
|
||||
public boolean connectedToReplay()
|
||||
{
|
||||
return MINECRAFT.getCurrentServer() == null
|
||||
&& !this.hasSinglePlayerServer() ;
|
||||
public boolean connectedToReplay()
|
||||
{
|
||||
return MINECRAFT.#if MC_VER <= MC_1_12_2 getCurrentServerData() #else getCurrentServer() #endif == null
|
||||
&& !this.hasSinglePlayerServer() ;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getCurrentServerName()
|
||||
@@ -108,8 +122,8 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerData server = MINECRAFT.getCurrentServer();
|
||||
return (server != null) ? server.name : "NULL";
|
||||
ServerData server = MINECRAFT.#if MC_VER <= MC_1_12_2 getCurrentServerData() #else getCurrentServer() #endif;
|
||||
return (server != null) ? server.#if MC_VER <= MC_1_12_2 serverName #else name #endif : "NULL";
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@@ -121,15 +135,15 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerData server = MINECRAFT.getCurrentServer();
|
||||
return (server != null) ? server.ip : "NA";
|
||||
ServerData server = MINECRAFT.#if MC_VER <= MC_1_12_2 getCurrentServerData() #else getCurrentServer() #endif;
|
||||
return (server != null) ? server.#if MC_VER <= MC_1_12_2 serverIP #else ip #endif : "NA";
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getCurrentServerVersion()
|
||||
{
|
||||
ServerData server = MINECRAFT.getCurrentServer();
|
||||
return (server != null) ? server.version.getString() : "UNKOWN";
|
||||
ServerData server = MINECRAFT.#if MC_VER <= MC_1_12_2 getCurrentServerData() #else getCurrentServer() #endif;
|
||||
return (server != null) ? server.#if MC_VER <= MC_1_12_2 gameVersion #else version.getString() #endif : "UNKOWN";
|
||||
}
|
||||
|
||||
//endregion
|
||||
@@ -141,7 +155,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
//=================//
|
||||
//region
|
||||
|
||||
public LocalPlayer getPlayer() { return MINECRAFT.player; }
|
||||
public #if MC_VER <= MC_1_12_2 EntityPlayerSP #else LocalPlayer #endif getPlayer() { return MINECRAFT.player; }
|
||||
|
||||
@Override
|
||||
public boolean playerExists() { return MINECRAFT.player != null; }
|
||||
@@ -149,26 +163,28 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
@Override
|
||||
public DhBlockPos getPlayerBlockPos()
|
||||
{
|
||||
LocalPlayer player = this.getPlayer();
|
||||
#if MC_VER <= MC_1_12_2 EntityPlayerSP #else LocalPlayer #endif player = this.getPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return new DhBlockPos(0, 0, 0);
|
||||
}
|
||||
|
||||
BlockPos playerPos = player.blockPosition();
|
||||
BlockPos playerPos = player.#if MC_VER <= MC_1_12_2 getPosition() #else blockPosition() #endif;
|
||||
return new DhBlockPos(playerPos.getX(), playerPos.getY(), playerPos.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DhChunkPos getPlayerChunkPos()
|
||||
{
|
||||
LocalPlayer player = this.getPlayer();
|
||||
#if MC_VER <= MC_1_12_2 EntityPlayerSP #else LocalPlayer #endif player = this.getPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return new DhChunkPos(0, 0);
|
||||
}
|
||||
|
||||
#if MC_VER < MC_1_17_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
ChunkPos playerPos = new ChunkPos(player.getPosition());
|
||||
#elif MC_VER < MC_1_17_1
|
||||
ChunkPos playerPos = new ChunkPos(player.blockPosition());
|
||||
#else
|
||||
ChunkPos playerPos = player.chunkPosition();
|
||||
@@ -198,7 +214,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
@Nullable
|
||||
public IClientLevelWrapper getWrappedClientLevel(boolean bypassLevelKeyManager)
|
||||
{
|
||||
ClientLevel level = MINECRAFT.level;
|
||||
#if MC_VER <= MC_1_12_2 WorldClient #else ClientLevel #endif level = MINECRAFT.#if MC_VER <= MC_1_12_2 world #else level #endif;
|
||||
if (level == null)
|
||||
{
|
||||
return null;
|
||||
@@ -219,13 +235,15 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
@Override
|
||||
public void sendChatMessage(String string)
|
||||
{
|
||||
LocalPlayer player = this.getPlayer();
|
||||
#if MC_VER <= MC_1_12_2 EntityPlayerSP #else LocalPlayer #endif player = this.getPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if MC_VER < MC_1_19_2
|
||||
#if MC_VER <= MC_1_12_2
|
||||
player.sendMessage(new TextComponentString(string));
|
||||
#elif MC_VER < MC_1_19_2
|
||||
player.sendMessage(new TextComponent(string), getPlayer().getUUID());
|
||||
#elif MC_VER < MC_1_21_9
|
||||
player.displayClientMessage(net.minecraft.network.chat.Component.translatable(string), /*isOverlay*/false);
|
||||
@@ -245,13 +263,15 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
@Override
|
||||
public void sendOverlayMessage(String string)
|
||||
{
|
||||
LocalPlayer player = this.getPlayer();
|
||||
#if MC_VER <= MC_1_12_2 EntityPlayerSP #else LocalPlayer #endif player = this.getPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#if MC_VER < MC_1_19_2
|
||||
#if MC_VER <= MC_1_12_2
|
||||
MINECRAFT.ingameGUI.setOverlayMessage(string, /*animateColor*/false);
|
||||
#elif MC_VER < MC_1_19_2
|
||||
player.displayClientMessage(new TextComponent(string), /*isOverlay*/true);
|
||||
#elif MC_VER <= MC_1_21_11
|
||||
player.displayClientMessage(net.minecraft.network.chat.Component.translatable(string), /*isOverlay*/true);
|
||||
@@ -273,7 +293,9 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
{
|
||||
LOGGER.info("Disabling vanilla clouds... This is done to prevent vanilla clouds from rendering on top of Distant Horizons LODs.");
|
||||
|
||||
#if MC_VER <= MC_1_18_2
|
||||
#if MC_VER <= MC_1_12_2
|
||||
MINECRAFT.gameSettings.clouds = 0;
|
||||
#elif MC_VER <= MC_1_18_2
|
||||
MINECRAFT.options.renderClouds = CloudStatus.OFF;
|
||||
#else
|
||||
MINECRAFT.options.cloudStatus().set(CloudStatus.OFF);
|
||||
@@ -295,7 +317,9 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
{
|
||||
String reasoning = "This is done to fix vanilla chunks (specifically water blocks) not fading into Distant Horizons LODs when DH's 'Vanilla Fade' option is enabled.";
|
||||
|
||||
#if MC_VER <= MC_1_18_2
|
||||
#if MC_VER <= MC_1_12_2
|
||||
// fabulous graphics was added in MC 1.16
|
||||
#elif MC_VER <= MC_1_18_2
|
||||
LOGGER.info("Disabling fabulous graphics... "+reasoning);
|
||||
|
||||
GraphicsStatus oldGraphicsStatus = MINECRAFT.options.graphicsMode;
|
||||
@@ -331,6 +355,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
* no override and not included in {@link IMinecraftClientWrapper}
|
||||
* since this would only be used in common/client, not core.
|
||||
*/
|
||||
#if MC_VER > MC_1_12_2
|
||||
public
|
||||
#if MC_VER < MC_1_21_9 long
|
||||
#else Window
|
||||
@@ -344,12 +369,15 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
return MINECRAFT.getWindow();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@Override
|
||||
public IProfilerWrapper getProfiler()
|
||||
{
|
||||
ProfilerFiller profiler;
|
||||
#if MC_VER < MC_1_21_3
|
||||
#if MC_VER <= MC_1_12_2 Profiler #else ProfilerFiller #endif profiler;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
profiler = MINECRAFT.profiler;
|
||||
#elif MC_VER < MC_1_21_3
|
||||
profiler = MINECRAFT.getProfiler();
|
||||
#else
|
||||
profiler = Profiler.get();
|
||||
@@ -378,7 +406,9 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
executeOnRenderThread(() ->
|
||||
{
|
||||
CrashReport report = new CrashReport(errorMessage, exception);
|
||||
#if MC_VER < MC_1_20_4
|
||||
#if MC_VER <= MC_1_12_2
|
||||
MINECRAFT.crashed(report);
|
||||
#elif MC_VER < MC_1_20_4
|
||||
Minecraft.crash(report);
|
||||
#else
|
||||
MINECRAFT.delayCrash(report);
|
||||
@@ -387,7 +417,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeOnRenderThread(Runnable runnable) { MINECRAFT.execute(runnable); }
|
||||
public void executeOnRenderThread(Runnable runnable) { MINECRAFT.#if MC_VER <= MC_1_12_2 addScheduledTask #else execute #endif(runnable); }
|
||||
|
||||
@Override
|
||||
public void showDialog(String title, String message, String dialogType, String iconType)
|
||||
@@ -403,7 +433,7 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
//region
|
||||
|
||||
@Override
|
||||
public Object getOptionsObject() { return MINECRAFT.options; }
|
||||
public Object getOptionsObject() { return MINECRAFT.#if MC_VER <= MC_1_12_2 gameSettings #else options #endif; }
|
||||
|
||||
//endregion
|
||||
|
||||
@@ -418,19 +448,23 @@ public class MinecraftClientWrapper implements IMinecraftClientWrapper, IMinecra
|
||||
public boolean isDedicatedServer() { return false; }
|
||||
|
||||
@Override
|
||||
public File getInstallationDirectory() { return MINECRAFT.gameDirectory; }
|
||||
public File getInstallationDirectory() { return MINECRAFT.#if MC_VER <= MC_1_12_2 gameDir #else gameDirectory #endif; }
|
||||
|
||||
@Override
|
||||
public int getPlayerCount()
|
||||
{
|
||||
// can be null if the server hasn't finished booting up yet
|
||||
if (MINECRAFT.getSingleplayerServer() == null)
|
||||
if (MINECRAFT.#if MC_VER <= MC_1_12_2 getIntegratedServer() #else getSingleplayerServer() #endif == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
return MINECRAFT.getIntegratedServer().getCurrentPlayerCount();
|
||||
#else
|
||||
return MINECRAFT.getSingleplayerServer().getPlayerCount();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,10 @@ import java.awt.Color;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
import com.mojang.blaze3d.pipeline.RenderTarget;
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
#endif
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiLodShading;
|
||||
import com.seibel.distanthorizons.common.wrappers.McObjectConverter;
|
||||
import com.seibel.distanthorizons.common.wrappers.misc.LightMapWrapper;
|
||||
@@ -60,18 +62,28 @@ import com.seibel.distanthorizons.core.util.math.Vec3f;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IOptifineAccessor;
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
#else
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
#endif
|
||||
import net.minecraft.client.Minecraft;
|
||||
import com.seibel.distanthorizons.core.logging.DhLogger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
#if MC_VER < MC_1_17_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import org.lwjgl.opengl.GL15;
|
||||
#elif MC_VER < MC_1_17_1
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
@@ -102,7 +114,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
private static final IOptifineAccessor OPTIFINE_ACCESSOR = ModAccessorInjector.INSTANCE.get(IOptifineAccessor.class);
|
||||
|
||||
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
|
||||
private static final Minecraft MC = Minecraft.getInstance();
|
||||
private static final Minecraft MC = Minecraft.#if MC_VER <= MC_1_12_2 getMinecraft() #else getInstance() #endif;
|
||||
|
||||
/**
|
||||
* In the case of immersive portals multiple levels may be active at once, causing conflicting lightmaps. <br>
|
||||
@@ -133,7 +145,10 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public Vec3f getLookAtVector()
|
||||
{
|
||||
#if MC_VER <= MC_1_21_10
|
||||
#if MC_VER <= MC_1_12_2
|
||||
net.minecraft.util.math.Vec3d lookVector = (MC.getRenderViewEntity().getLook(MC.getRenderPartialTicks()));
|
||||
return new Vec3f((float) lookVector.x, (float) lookVector.y, (float) lookVector.z);
|
||||
#elif MC_VER <= MC_1_21_10
|
||||
Camera camera = MC.gameRenderer.getMainCamera();
|
||||
return new Vec3f(camera.getLookVector().x(), camera.getLookVector().y(), camera.getLookVector().z());
|
||||
#else
|
||||
@@ -153,37 +168,47 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (MC.player.getActiveEffectsMap() == null)
|
||||
else if (MC.player.#if MC_VER <= MC_1_12_2 getActivePotionMap() #else getActiveEffectsMap() #endif == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
return MC.player.getActivePotionEffect(MobEffects.BLINDNESS) != null;
|
||||
#else
|
||||
return MC.player.getActiveEffectsMap().get(MobEffects.BLINDNESS) != null
|
||||
#if MC_VER >= MC_1_19_2
|
||||
|| MC.player.getActiveEffectsMap().get(MobEffects.DARKNESS) != null // Deep dark effect
|
||||
#endif
|
||||
;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3d getCameraExactPosition()
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
RenderManager rm = MC.getRenderManager();
|
||||
return new Vec3d(rm.viewerPosX, rm.viewerPosY, rm.viewerPosZ);
|
||||
#else
|
||||
Camera camera = MC.gameRenderer.getMainCamera();
|
||||
#if MC_VER <= MC_1_21_10
|
||||
Vec3 projectedView = camera.getPosition();
|
||||
#else
|
||||
Vec3 projectedView = camera.position();
|
||||
#endif
|
||||
|
||||
return new Vec3d(projectedView.x, projectedView.y, projectedView.z);
|
||||
#endif
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPartialTickTime()
|
||||
{
|
||||
#if MC_VER < MC_1_21_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
return MC.getRenderPartialTicks();
|
||||
#elif MC_VER < MC_1_21_1
|
||||
return MC.getFrameTime();
|
||||
#elif MC_VER < MC_1_21_3
|
||||
return MC.getTimer().getRealtimeDeltaTicks();
|
||||
@@ -296,9 +321,17 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public Color getSkyColor()
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
if (MC.world.provider.hasSkyLight())
|
||||
#else
|
||||
if (MC.level.dimensionType().hasSkyLight())
|
||||
#endif
|
||||
{
|
||||
#if MC_VER < MC_1_17_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
float frameTime = this.getPartialTickTime();
|
||||
net.minecraft.util.math.Vec3d colorValues = MC.world.getSkyColor(MC.getRenderViewEntity(), frameTime);
|
||||
return new Color((float) colorValues.x, (float) colorValues.y, (float) colorValues.z);
|
||||
#elif MC_VER < MC_1_17_1
|
||||
float frameTime = this.getPartialTickTime();
|
||||
Vec3 colorValues = MC.level.getSkyColor(MC.gameRenderer.getMainCamera().getBlockPosition(), frameTime);
|
||||
return new Color((float) colorValues.x, (float) colorValues.y, (float) colorValues.z);
|
||||
@@ -325,7 +358,9 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public int getRenderDistance()
|
||||
{
|
||||
#if MC_VER <= MC_1_17_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
return MC.gameSettings.renderDistanceChunks;
|
||||
#elif MC_VER <= MC_1_17_1
|
||||
return MC.options.renderDistance;
|
||||
#else
|
||||
return MC.options.getEffectiveRenderDistance();
|
||||
@@ -335,14 +370,18 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public int getFrameLimit()
|
||||
{
|
||||
#if MC_VER <= MC_1_18_2
|
||||
#if MC_VER <= MC_1_12_2
|
||||
return MC.gameSettings.limitFramerate;
|
||||
#elif MC_VER <= MC_1_18_2
|
||||
return MC.options.framerateLimit;
|
||||
#else
|
||||
return MC.options.framerateLimit().get();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
protected RenderTarget getRenderTarget() { return MC.getMainRenderTarget(); }
|
||||
#endif
|
||||
|
||||
@Override
|
||||
public boolean mcRendersToFrameBuffer()
|
||||
@@ -373,7 +412,9 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
return this.finalLevelFrameBufferId;
|
||||
}
|
||||
|
||||
#if MC_VER < MC_1_21_5
|
||||
#if MC_VER <= MC_1_12_2
|
||||
return MC.getFramebuffer().framebufferObject;
|
||||
#elif MC_VER < MC_1_21_5
|
||||
return this.getRenderTarget().frameBufferId;
|
||||
#else
|
||||
// MC renders to a texture and then directly to the default FBO now
|
||||
@@ -388,7 +429,10 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public int getDepthTextureId()
|
||||
{
|
||||
#if MC_VER < MC_1_21_5
|
||||
#if MC_VER <= MC_1_12_2
|
||||
//1.12.2 is using renderbuffer instead of framebuffer for depth texture
|
||||
return -1;
|
||||
#elif MC_VER < MC_1_21_5
|
||||
return this.getRenderTarget().getDepthTextureId();
|
||||
#else
|
||||
try
|
||||
@@ -418,7 +462,9 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public int getColorTextureId()
|
||||
{
|
||||
#if MC_VER < MC_1_21_5
|
||||
#if MC_VER <= MC_1_12_2
|
||||
return MC.getFramebuffer().framebufferTexture;
|
||||
#elif MC_VER < MC_1_21_5
|
||||
return this.getRenderTarget().getColorTextureId();
|
||||
#else
|
||||
try
|
||||
@@ -448,7 +494,9 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public int getTargetFramebufferViewportWidth()
|
||||
{
|
||||
#if MC_VER < MC_1_21_9
|
||||
#if MC_VER <= MC_1_12_2
|
||||
return MC.getFramebuffer().framebufferWidth;
|
||||
#elif MC_VER < MC_1_21_9
|
||||
return this.getRenderTarget().viewWidth;
|
||||
#else
|
||||
return this.getRenderTarget().width;
|
||||
@@ -458,7 +506,9 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public int getTargetFramebufferViewportHeight()
|
||||
{
|
||||
#if MC_VER < MC_1_21_9
|
||||
#if MC_VER <= MC_1_12_2
|
||||
return MC.getFramebuffer().framebufferHeight;
|
||||
#elif MC_VER < MC_1_21_9
|
||||
return this.getRenderTarget().viewHeight;
|
||||
#else
|
||||
return this.getRenderTarget().height;
|
||||
@@ -471,7 +521,11 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
@Override
|
||||
public boolean isFogStateSpecial()
|
||||
{
|
||||
#if MC_VER < MC_1_17_1
|
||||
#if MC_VER <= MC_1_12_2
|
||||
BlockPos blockPos = new BlockPos(MC.getRenderViewEntity().getPositionEyes(MC.getRenderPartialTicks()));
|
||||
IBlockState fluidState = MC.getRenderViewEntity().world.getBlockState(blockPos);
|
||||
return this.playerHasBlindingEffect() || fluidState.getMaterial().isLiquid() || fluidState.getBlock() instanceof IFluidBlock;
|
||||
#elif MC_VER < MC_1_17_1
|
||||
Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera();
|
||||
FluidState fluidState = camera.getFluidInCamera();
|
||||
Entity entity = camera.getEntity();
|
||||
@@ -489,6 +543,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
* It's better to use {@link MinecraftRenderWrapper#setLightmapId(int, IClientLevelWrapper)} if possible,
|
||||
* however old MC versions don't support it.
|
||||
*/
|
||||
#if MC_VER > MC_1_12_2
|
||||
public void updateLightmap(NativeImage lightPixels, IClientLevelWrapper level)
|
||||
{
|
||||
// Using ClientLevelWrapper as the key would be better, but we don't have a consistent way to create the same
|
||||
@@ -499,6 +554,8 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
LightMapWrapper wrapper = this.lightmapByDimensionType.computeIfAbsent(dimensionType, (dimType) -> new LightMapWrapper());
|
||||
wrapper.uploadLightmap(lightPixels);
|
||||
}
|
||||
#endif
|
||||
|
||||
public void setLightmapId(int tetxureId, IClientLevelWrapper level)
|
||||
{
|
||||
// Using ClientLevelWrapper as the key would be better, but we don't have a consistent way to create the same
|
||||
@@ -532,6 +589,9 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
{
|
||||
default:
|
||||
case AUTO:
|
||||
#if MC_VER <= MC_1_12_2
|
||||
// 1.12.2 has no getShade, fall through to ENABLED
|
||||
#else
|
||||
if (MC.level != null)
|
||||
{
|
||||
Direction mcDir = McObjectConverter.Convert(lodDirection);
|
||||
@@ -545,7 +605,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
#endif
|
||||
case ENABLED:
|
||||
switch (lodDirection)
|
||||
{
|
||||
|
||||
@@ -21,25 +21,29 @@ package com.seibel.distanthorizons.common.wrappers.minecraft;
|
||||
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.profiler.Profiler;
|
||||
#else
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
#endif
|
||||
|
||||
public class ProfilerWrapper implements IProfilerWrapper
|
||||
{
|
||||
public ProfilerFiller profiler;
|
||||
public #if MC_VER <= MC_1_12_2 Profiler #else ProfilerFiller #endif profiler;
|
||||
|
||||
public ProfilerWrapper(ProfilerFiller newProfiler) { this.profiler = newProfiler; }
|
||||
public ProfilerWrapper(#if MC_VER <= MC_1_12_2 Profiler #else ProfilerFiller #endif newProfiler) { this.profiler = newProfiler; }
|
||||
|
||||
@Override
|
||||
public IProfileBlock push(String newSection)
|
||||
{
|
||||
this.profiler.push(newSection);
|
||||
this.profiler.#if MC_VER <= MC_1_12_2 startSection(newSection) #else push(newSection) #endif;
|
||||
return new ProfileBlock(this.profiler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void popPush(String newSection)
|
||||
{
|
||||
this.profiler.popPush(newSection);
|
||||
this.profiler.#if MC_VER <= MC_1_12_2 endStartSection(newSection) #else popPush(newSection) #endif;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,14 +55,14 @@ public class ProfilerWrapper implements IProfilerWrapper
|
||||
|
||||
public static class ProfileBlock implements IProfileBlock
|
||||
{
|
||||
private final ProfilerFiller profiler;
|
||||
public ProfileBlock(ProfilerFiller newProfiler) { this.profiler = newProfiler; }
|
||||
public #if MC_VER <= MC_1_12_2 Profiler #else ProfilerFiller #endif profiler;
|
||||
public ProfileBlock(#if MC_VER <= MC_1_12_2 Profiler #else ProfilerFiller #endif newProfiler) { this.profiler = newProfiler; }
|
||||
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
this.profiler.pop();
|
||||
this.profiler.#if MC_VER <= MC_1_12_2 endSection() #else pop() #endif;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,23 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IC2meAccess
|
||||
import com.seibel.distanthorizons.coreapi.ModInfo;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.gen.ChunkProviderServer;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
#else
|
||||
import net.minecraft.server.level.ChunkHolder;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.TicketType;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
#endif
|
||||
|
||||
#if MC_VER <= MC_1_20_4
|
||||
#if MC_VER <= MC_1_12_2
|
||||
#elif MC_VER <= MC_1_20_4
|
||||
import net.minecraft.world.level.chunk.ChunkStatus;
|
||||
#else
|
||||
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||
@@ -64,7 +73,10 @@ public class InternalServerGenerator
|
||||
*/
|
||||
private static final int MS_TO_IGNORE_CHUNK_AFTER_COMPLETION = 5_000;
|
||||
|
||||
#if MC_VER < MC_1_21_5
|
||||
#if MC_VER <= MC_1_12_2
|
||||
public static Map<World, ForgeChunkManager.Ticket> DH_SERVER_GEN_TICKET_MAP = new HashMap<>();
|
||||
private final ForgeChunkManager.Ticket DH_SERVER_GEN_TICKET;
|
||||
#elif MC_VER < MC_1_21_5
|
||||
private static final TicketType<ChunkPos> DH_SERVER_GEN_TICKET = TicketType.create("dh_server_gen_ticket", Comparator.comparingLong(ChunkPos::toLong));
|
||||
#elif MC_VER < MC_1_21_9
|
||||
private static final TicketType DH_SERVER_GEN_TICKET = new TicketType(/* timeout, 0 = disabled*/0L, /* persist */ false, TicketType.TicketUse.LOADING);
|
||||
@@ -91,6 +103,13 @@ public class InternalServerGenerator
|
||||
{
|
||||
this.params = params;
|
||||
this.dhServerLevel = dhServerLevel;
|
||||
#if MC_VER <= MC_1_12_2
|
||||
this.DH_SERVER_GEN_TICKET = DH_SERVER_GEN_TICKET_MAP.get((WorldServer) this.dhServerLevel.getServerLevelWrapper().getWrappedMcObject());
|
||||
if (this.DH_SERVER_GEN_TICKET == null)
|
||||
{
|
||||
LOGGER.error("DH_SERVER_GEN_TICKET is null for level: " + dhServerLevel.getServerLevelWrapper().getDimensionName());
|
||||
}
|
||||
#endif
|
||||
this.updateManager = WorldChunkUpdateManager.INSTANCE.getByLevelWrapper(this.dhServerLevel.getServerLevelWrapper());
|
||||
}
|
||||
|
||||
@@ -110,14 +129,14 @@ public class InternalServerGenerator
|
||||
// create gen requests //
|
||||
//=====================//
|
||||
|
||||
ArrayList<CompletableFuture<ChunkAccess>> getChunkFutureList = new ArrayList<>();
|
||||
ArrayList<CompletableFuture<#if MC_VER <= MC_1_12_2 Chunk #else ChunkAccess #endif>> getChunkFutureList = new ArrayList<>();
|
||||
{
|
||||
Iterator<ChunkPos> chunkPosIterator = ChunkPosGenStream.getIterator(genEvent.minPos.getX(), genEvent.minPos.getZ(), genEvent.widthInChunks, 0);
|
||||
while (chunkPosIterator.hasNext())
|
||||
{
|
||||
ChunkPos chunkPos = chunkPosIterator.next();
|
||||
|
||||
CompletableFuture<ChunkAccess> requestChunkFuture =
|
||||
CompletableFuture<#if MC_VER <= MC_1_12_2 Chunk #else ChunkAccess #endif> requestChunkFuture =
|
||||
this.requestChunkFromServerAsync(chunkPos)
|
||||
// log errors if necessary
|
||||
.whenCompleteAsync(
|
||||
@@ -160,8 +179,8 @@ public class InternalServerGenerator
|
||||
ArrayList<IChunkWrapper> chunkWrappers = new ArrayList<>();
|
||||
for (int i = 0; i < getChunkFutureList.size(); i++)
|
||||
{
|
||||
CompletableFuture<ChunkAccess> getChunkFuture = getChunkFutureList.get(i);
|
||||
ChunkAccess chunk = getChunkFuture.join();
|
||||
CompletableFuture<#if MC_VER <= MC_1_12_2 Chunk #else ChunkAccess #endif> getChunkFuture = getChunkFutureList.get(i);
|
||||
#if MC_VER <= MC_1_12_2 Chunk #else ChunkAccess #endif chunk = getChunkFuture.join();
|
||||
if (chunk != null)
|
||||
{
|
||||
ChunkWrapper chunkWrapper = new ChunkWrapper(chunk, this.dhServerLevel.getLevelWrapper());
|
||||
@@ -245,8 +264,49 @@ public class InternalServerGenerator
|
||||
LOGGER.warn(c2meWarning);
|
||||
}
|
||||
}
|
||||
private CompletableFuture<ChunkAccess> requestChunkFromServerAsync(ChunkPos chunkPos)
|
||||
private CompletableFuture<#if MC_VER <= MC_1_12_2 Chunk #else ChunkAccess #endif> requestChunkFromServerAsync(ChunkPos chunkPos)
|
||||
{
|
||||
#if MC_VER <= MC_1_12_2
|
||||
WorldServer level = this.params.mcServerLevel;
|
||||
|
||||
if (this.updateManager != null)
|
||||
{
|
||||
this.updateManager.addPosToIgnore(McObjectConverter.Convert(chunkPos));
|
||||
}
|
||||
|
||||
CompletableFuture<Chunk> future = new CompletableFuture<>();
|
||||
level.getMinecraftServer().addScheduledTask(() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
ChunkProviderServer provider = (ChunkProviderServer) level.getChunkProvider();
|
||||
|
||||
// load neighbours first so the target chunk can fully populate
|
||||
for (int i = -1; i <= 1; i++)
|
||||
{
|
||||
for (int j = -1; j <= 1; j++)
|
||||
{
|
||||
if (i != 0 || j != 0)
|
||||
{
|
||||
if (!provider.isChunkGeneratedAt(chunkPos.x + i, chunkPos.z + j))
|
||||
{
|
||||
provider.loadChunk(chunkPos.x + i, chunkPos.z + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ForgeChunkManager.forceChunk(DH_SERVER_GEN_TICKET, chunkPos);
|
||||
Chunk chunk = provider.provideChunk(chunkPos.x, chunkPos.z);
|
||||
future.complete(chunk);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
future.completeExceptionally(e);
|
||||
}
|
||||
});
|
||||
return future;
|
||||
#else
|
||||
return CompletableFuture.supplyAsync(() ->
|
||||
{
|
||||
ServerLevel level = this.params.mcServerLevel;
|
||||
@@ -289,27 +349,35 @@ public class InternalServerGenerator
|
||||
|
||||
}, this.params.mcServerLevel.getChunkSource().chunkMap.mainThreadExecutor)
|
||||
.thenCompose(Function.identity());
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* mitigates out of memory issues in the vanilla chunk system. <br>
|
||||
* See: https://github.com/pop4959/Chunky/pull/383
|
||||
*/
|
||||
private CompletableFuture<Void> releaseChunkFromServerAsync(ServerLevel level, ChunkPos chunkPos)
|
||||
private CompletableFuture<Void> releaseChunkFromServerAsync(#if MC_VER <= MC_1_12_2 WorldServer #else ServerLevel #endif level, ChunkPos chunkPos)
|
||||
{
|
||||
CompletableFuture<Void> removeTicketFuture = new CompletableFuture<>();
|
||||
|
||||
#if MC_VER <= MC_1_12_2
|
||||
level.getMinecraftServer().addScheduledTask(() ->
|
||||
#else
|
||||
level.getChunkSource().chunkMap.mainThreadExecutor.execute(() ->
|
||||
#endif
|
||||
{
|
||||
try
|
||||
{
|
||||
#if MC_VER < MC_1_21_5
|
||||
#if MC_VER <= MC_1_12_2
|
||||
ForgeChunkManager.unforceChunk(DH_SERVER_GEN_TICKET, chunkPos);
|
||||
#elif MC_VER < MC_1_21_5
|
||||
int chunkLevel = 33; // 33 is equivalent to FULL Chunk
|
||||
level.getChunkSource().distanceManager.removeTicket(DH_SERVER_GEN_TICKET, chunkPos, chunkLevel, chunkPos);
|
||||
#else
|
||||
level.getChunkSource().removeTicketWithRadius(DH_SERVER_GEN_TICKET, chunkPos, 0);
|
||||
#endif
|
||||
|
||||
#if MC_VER > MC_1_12_2
|
||||
level.getChunkSource().chunkMap.tick(() -> false);
|
||||
#endif
|
||||
|
||||
#if MC_VER > MC_1_16_5
|
||||
level.entityManager.tick();
|
||||
@@ -340,7 +408,6 @@ public class InternalServerGenerator
|
||||
removeTicketFuture.complete(null);
|
||||
}
|
||||
});
|
||||
|
||||
return removeTicketFuture;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Gradle stuff
|
||||
org.gradle.jvmargs=-Xmx4096M
|
||||
org.gradle.parallel=true
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=false
|
||||
org.gradle.caching=false
|
||||
|
||||
# Mod Info
|
||||
mod_name=DistantHorizons
|
||||
@@ -48,7 +48,7 @@ versionStr=
|
||||
|
||||
# This defines what MC version Intellij will use for the preprocessor
|
||||
# and what version is used automatically by build and run commands
|
||||
mcVer=26.1.2
|
||||
mcVer=1.12.2
|
||||
|
||||
# Defines the maximum amount of memory Minecraft is allowed when run in a development environment
|
||||
minecraftMemoryJavaArg=-Xmx6G
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# 1.12.2 version
|
||||
java_version=21
|
||||
java_version=25
|
||||
minecraft_version=1.12.2
|
||||
parchment_version=
|
||||
compatible_minecraft_versions=["1.12.2"]
|
||||
accessWidenerVersion=
|
||||
accessWidenerVersion=1_12_2
|
||||
builds_for=cleanroom
|
||||
embed_joml=true
|
||||
|
||||
@@ -13,6 +13,9 @@ netty_version=4.2.9.Final
|
||||
# LWJGL
|
||||
lwjgl_version=3.3.6
|
||||
|
||||
# Cleanroom loader
|
||||
cleanroom_loader_version=0.5.6-alpha
|
||||
|
||||
# Fabric loader
|
||||
fabric_loader_version=
|
||||
fabric_api_version=
|
||||
@@ -27,8 +30,7 @@ bclib_version=
|
||||
immersive_portals_version=
|
||||
canvas_version=
|
||||
|
||||
# iris - needs 1.7.4+ to support the DH API
|
||||
fabric_incompatibility_list={ "iris": "*" }
|
||||
fabric_incompatibility_list={}
|
||||
fabric_recommend_list={}
|
||||
|
||||
# Fabric mod run
|
||||
|
||||