mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 11:59:25 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
516b35ce57 | ||
|
|
be60ddbfca | ||
|
|
af6e848227 | ||
|
|
dd139115ed | ||
|
|
145df60bec | ||
|
|
f7cca8fb88 | ||
|
|
1f59b3f9fe | ||
|
|
084effdadf | ||
|
|
40a7998281 | ||
|
|
4786fa6f89 | ||
|
|
9291b865c7 | ||
|
|
52eca96fdc | ||
|
|
4649f7af36 | ||
|
|
3edefbe33e |
No files matched your search
@@ -21,3 +21,6 @@ src/generated/**/*.json text eol=lf
|
|||||||
src/generated_test/**/.cache/cache text eol=lf
|
src/generated_test/**/.cache/cache text eol=lf
|
||||||
src/generated_test/**/*.json text eol=lf
|
src/generated_test/**/*.json text eol=lf
|
||||||
|
|
||||||
|
# We force eclipse to use unix line endings
|
||||||
|
ide/eclipse/template/.settings/*.prefs text eol=lf
|
||||||
|
|
||||||
+3
-1
@@ -13,6 +13,9 @@
|
|||||||
/classes
|
/classes
|
||||||
*.iml
|
*.iml
|
||||||
|
|
||||||
|
# We however WANT the ide folder as it has tempaltes/configs for developing Forge.
|
||||||
|
!ide/**
|
||||||
|
|
||||||
#gradle
|
#gradle
|
||||||
/build
|
/build
|
||||||
/.gradle
|
/.gradle
|
||||||
@@ -23,7 +26,6 @@
|
|||||||
/projects/mcp/
|
/projects/mcp/
|
||||||
/projects/clean/
|
/projects/clean/
|
||||||
/projects/forge/
|
/projects/forge/
|
||||||
/projects/fmlonly/
|
|
||||||
#/patches/*
|
#/patches/*
|
||||||
|
|
||||||
#occupational hazards
|
#occupational hazards
|
||||||
|
|||||||
Vendored
+2
-17
@@ -36,8 +36,8 @@ project {
|
|||||||
buildType(PullRequestCompatibility)
|
buildType(PullRequestCompatibility)
|
||||||
|
|
||||||
params {
|
params {
|
||||||
text("docker_jdk_version", "21", label = "Gradle version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
text("docker_jdk_version", "17", label = "Gradle version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||||
text("docker_gradle_version", "8.8", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
text("docker_gradle_version", "7.5.1", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||||
text("git_main_branch", "1.20.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
text("git_main_branch", "1.20.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||||
text("git_branch_spec", """
|
text("git_branch_spec", """
|
||||||
+:refs/heads/(main*)
|
+:refs/heads/(main*)
|
||||||
@@ -47,8 +47,6 @@ project {
|
|||||||
""".trimIndent(), label = "The branch specification of the repository", description = "By default all main branches are build by the configuration. Modify this value to adapt the branches build.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
|
""".trimIndent(), label = "The branch specification of the repository", description = "By default all main branches are build by the configuration. Modify this value to adapt the branches build.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
|
||||||
text("github_repository_name", "MinecraftForge", label = "The github repository name. Used to connect to it in VCS Roots.", description = "This is the repository slug on github. So for example `MinecraftForge` or `MinecraftForge`. It is interpolated into the global VCS Roots.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
text("github_repository_name", "MinecraftForge", label = "The github repository name. Used to connect to it in VCS Roots.", description = "This is the repository slug on github. So for example `MinecraftForge` or `MinecraftForge`. It is interpolated into the global VCS Roots.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||||
text("env.PUBLISHED_JAVA_ARTIFACT_ID", "forge", label = "Published artifact id", description = "The maven coordinate artifact id that has been published by this build. Can not be empty.", allowEmpty = false)
|
text("env.PUBLISHED_JAVA_ARTIFACT_ID", "forge", label = "Published artifact id", description = "The maven coordinate artifact id that has been published by this build. Can not be empty.", allowEmpty = false)
|
||||||
text("env.PUBLISHED_JAVA_FML_ARTIFACT_ID", "fmlonly", label = "Published fmlonly artifact id", description = "The maven coordinate artifact id for fml only that has been published by this build. Can not be empty.", allowEmpty = false)
|
|
||||||
text("env.PUBLISHED_JAVA_FML_ARTIFACT_VERSION", "0.0.0-SNAPSHOT", label = "Published fmlonly artifact version", description = "The version for fml only that has been published by this build. Can not be empty.", allowEmpty = false)
|
|
||||||
text("env.PUBLISHED_JAVA_GROUP", "net.minecraftforge", label = "Published group", description = "The maven coordinate group that has been published by this build. Can not be empty.", allowEmpty = false)
|
text("env.PUBLISHED_JAVA_GROUP", "net.minecraftforge", label = "Published group", description = "The maven coordinate group that has been published by this build. Can not be empty.", allowEmpty = false)
|
||||||
//These are references and not actually keys
|
//These are references and not actually keys
|
||||||
password("env.CROWDIN_KEY", "credentialsJSON:a3102dbe-805d-4177-9f54-3d2c2eb08fd5", display = ParameterDisplay.HIDDEN)
|
password("env.CROWDIN_KEY", "credentialsJSON:a3102dbe-805d-4177-9f54-3d2c2eb08fd5", display = ParameterDisplay.HIDDEN)
|
||||||
@@ -76,19 +74,6 @@ object Build : BuildType({
|
|||||||
id("MinecraftForge_MinecraftForge__Build")
|
id("MinecraftForge_MinecraftForge__Build")
|
||||||
name = "Build"
|
name = "Build"
|
||||||
description = "Builds and Publishes the main branches of the project."
|
description = "Builds and Publishes the main branches of the project."
|
||||||
|
|
||||||
features {
|
|
||||||
feature {
|
|
||||||
id = "trigger_fml_only_files_generator"
|
|
||||||
type = "triggerBuildFeature"
|
|
||||||
param("triggers", "MinecraftForge_FilesGenerator_GeneratePages")
|
|
||||||
param("parameters", """
|
|
||||||
env.PUBLISHED_JAVA_FML_ARTIFACT_ID~env.PUBLISHED_JAVA_ARTIFACT_ID
|
|
||||||
env.PUBLISHED_JAVA_FML_ARTIFACT_VERSION~env.PUBLISHED_JAVA_ARTIFACT_VERSION
|
|
||||||
env.PUBLISHED_JAVA_GROUP
|
|
||||||
""".trimIndent())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
object BuildSecondaryBranches : BuildType({
|
object BuildSecondaryBranches : BuildType({
|
||||||
|
|||||||
+139
-439
@@ -1,4 +1,3 @@
|
|||||||
import de.undercouch.gradle.tasks.download.Download
|
|
||||||
import groovy.json.JsonBuilder
|
import groovy.json.JsonBuilder
|
||||||
import net.minecraftforge.forge.tasks.checks.CheckATs
|
import net.minecraftforge.forge.tasks.checks.CheckATs
|
||||||
import net.minecraftforge.forge.tasks.checks.CheckExcs
|
import net.minecraftforge.forge.tasks.checks.CheckExcs
|
||||||
@@ -17,6 +16,7 @@ import net.minecraftforge.gradle.common.tasks.CheckJarCompatibility
|
|||||||
import net.minecraftforge.gradle.common.tasks.DownloadMavenArtifact
|
import net.minecraftforge.gradle.common.tasks.DownloadMavenArtifact
|
||||||
import net.minecraftforge.gradle.common.tasks.ExtractInheritance
|
import net.minecraftforge.gradle.common.tasks.ExtractInheritance
|
||||||
import net.minecraftforge.gradle.common.tasks.SignJar
|
import net.minecraftforge.gradle.common.tasks.SignJar
|
||||||
|
import net.minecraftforge.gradle.patcher.tasks.GeneratePatches
|
||||||
import net.minecraftforge.gradle.userdev.tasks.RenameJar
|
import net.minecraftforge.gradle.userdev.tasks.RenameJar
|
||||||
import org.apache.tools.ant.filters.ReplaceTokens
|
import org.apache.tools.ant.filters.ReplaceTokens
|
||||||
import org.gradle.plugins.ide.eclipse.model.SourceFolder
|
import org.gradle.plugins.ide.eclipse.model.SourceFolder
|
||||||
@@ -25,12 +25,11 @@ import org.objectweb.asm.Opcodes
|
|||||||
plugins {
|
plugins {
|
||||||
id 'org.cadixdev.licenser' version '0.6.1'
|
id 'org.cadixdev.licenser' version '0.6.1'
|
||||||
id 'com.github.ben-manes.versions' version '0.46.0'
|
id 'com.github.ben-manes.versions' version '0.46.0'
|
||||||
id 'net.minecraftforge.gradleutils' version '[2.2,2.3)'
|
id 'net.minecraftforge.gradleutils' version '2.+'
|
||||||
id 'eclipse'
|
id 'eclipse'
|
||||||
id 'idea'
|
|
||||||
id 'de.undercouch.download' version '5.4.0'
|
id 'de.undercouch.download' version '5.4.0'
|
||||||
id 'net.minecraftforge.gradle.patcher' version '[6.0.11,6.2)' apply false
|
id 'net.minecraftforge.gradle.patcher' version '[6.0.13,6.2)' apply false
|
||||||
id 'net.minecraftforge.gradle.mcp' version '[6.0.11,6.2)' apply false
|
id 'net.minecraftforge.gradle.mcp' version '[6.0.13,6.2)' apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.init() //Init all our extension methods!
|
Util.init() //Init all our extension methods!
|
||||||
@@ -45,22 +44,22 @@ ext {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
MAPPING_CHANNEL = 'official'
|
MAPPING_CHANNEL = 'official'
|
||||||
MAPPING_VERSION = '1.20.1'
|
MC_VERSION = '1.20.2'
|
||||||
MC_VERSION = '1.20.1'
|
MAPPING_VERSION = MC_VERSION
|
||||||
MC_NEXT_VERSION = '1.21'
|
MC_NEXT_VERSION = '1.21'
|
||||||
MCP_VERSION = '20230612.114412'
|
MCP_VERSION = '20230921.100330'
|
||||||
SNAPSHOT = false
|
SNAPSHOT = false
|
||||||
|
|
||||||
SPI_VERSION = '7.0.1'
|
SPI_VERSION = '7.0.1'
|
||||||
MERGETOOL_VERSION = '1.1.5'
|
MERGETOOL_VERSION = '1.1.5'
|
||||||
ACCESSTRANSFORMERS_VERSION = '8.0.4'
|
ACCESSTRANSFORMERS_VERSION = '8.0.4'
|
||||||
COREMODS_VERSION = '5.2.4'
|
COREMODS_VERSION = '5.0.1'
|
||||||
EVENTBUS_VERSION = '6.0.5'
|
EVENTBUS_VERSION = '6.0.5'
|
||||||
MODLAUNCHER_VERSION = '10.0.9'
|
MODLAUNCHER_VERSION = '10.0.9'
|
||||||
SECUREJARHANDLER_VERSION = '2.1.10'
|
SECUREJARHANDLER_VERSION = '2.1.10'
|
||||||
BOOTSTRAPLAUNCHER_VERSION = '1.1.2'
|
BOOTSTRAPLAUNCHER_VERSION = '1.1.2'
|
||||||
ASM_VERSION = '9.7.1'
|
ASM_VERSION = '9.5'
|
||||||
INSTALLER_VERSION = '2.2.+'
|
INSTALLER_VERSION = '2.1.+'
|
||||||
MIXIN_VERSION = '0.8.5'
|
MIXIN_VERSION = '0.8.5'
|
||||||
TERMINALCONSOLEAPPENDER_VERSION = '1.2.0'
|
TERMINALCONSOLEAPPENDER_VERSION = '1.2.0'
|
||||||
JLINE_VERSION = '3.12.+'
|
JLINE_VERSION = '3.12.+'
|
||||||
@@ -74,11 +73,11 @@ ext {
|
|||||||
// To use a version newer than the version manifest JSON, the dependency must be added to the installer configuration
|
// To use a version newer than the version manifest JSON, the dependency must be added to the installer configuration
|
||||||
MOJANG_LOGGING_VERSION = '1.1.1'
|
MOJANG_LOGGING_VERSION = '1.1.1'
|
||||||
LOG4J_VERSION = '2.19.0'
|
LOG4J_VERSION = '2.19.0'
|
||||||
GUAVA_VERSION = '31.1-jre'
|
GUAVA_VERSION = '32.1.2-jre'
|
||||||
GSON_VERSION = '2.10'
|
GSON_VERSION = '2.10.1'
|
||||||
APACHE_COMMONS_LANG3_VERSION = '3.12.0'
|
APACHE_COMMONS_LANG3_VERSION = '3.12.0'
|
||||||
JOPT_SIMPLE_VERSION = '5.0.4'
|
JOPT_SIMPLE_VERSION = '5.0.4'
|
||||||
COMMONS_IO_VERSION = '2.11.0'
|
COMMONS_IO_VERSION = '2.13.0'
|
||||||
|
|
||||||
GIT_INFO = gradleutils.gitInfo
|
GIT_INFO = gradleutils.gitInfo
|
||||||
VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION)
|
VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION)
|
||||||
@@ -86,10 +85,10 @@ ext {
|
|||||||
FORGE_VERSION = VERSION.substring(MC_VERSION.length() + 1)
|
FORGE_VERSION = VERSION.substring(MC_VERSION.length() + 1)
|
||||||
|
|
||||||
BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.1.1:fatjar'
|
BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.1.1:fatjar'
|
||||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.4.1'
|
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0'
|
||||||
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
|
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
|
||||||
FART = 'net.minecraftforge:ForgeAutoRenamingTool:0.1.22:all'
|
FART = 'net.minecraftforge:ForgeAutoRenamingTool:1.0.5:all'
|
||||||
MIN_TAG_FOR_CHANGELOG = '41.0'
|
MIN_TAG_FOR_CHANGELOG = '47.999'
|
||||||
}
|
}
|
||||||
|
|
||||||
println('Version: ' + VERSION +
|
println('Version: ' + VERSION +
|
||||||
@@ -167,9 +166,9 @@ subprojects {
|
|||||||
|
|
||||||
tasks.withType(Javadoc).configureEach {
|
tasks.withType(Javadoc).configureEach {
|
||||||
options.tags = [
|
options.tags = [
|
||||||
'apiNote:a:<em>API Note:</em>',
|
'apiNote:a:<em>API Note:</em>',
|
||||||
'implSpec:a:<em>Implementation Requirements:</em>',
|
'implSpec:a:<em>Implementation Requirements:</em>',
|
||||||
'implNote:a:<em>Implementation Note:</em>'
|
'implNote:a:<em>Implementation Note:</em>'
|
||||||
]
|
]
|
||||||
options.addStringOption('Xdoclint:all,-missing', '-public')
|
options.addStringOption('Xdoclint:all,-missing', '-public')
|
||||||
}
|
}
|
||||||
@@ -227,50 +226,53 @@ project(':mcp') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!System.env.TEAMCITY_VERSION) {
|
project(':clean') {
|
||||||
project(':clean') {
|
evaluationDependsOn(':mcp')
|
||||||
evaluationDependsOn(':mcp')
|
apply plugin: 'net.minecraftforge.gradle.patcher'
|
||||||
apply plugin: 'net.minecraftforge.gradle.patcher'
|
tasks.withType(AbstractPublishToMaven.class).forEach{tsk -> tsk.enabled = false } // We don't want to publish anything
|
||||||
tasks.withType(AbstractPublishToMaven.class).forEach{tsk -> tsk.enabled = false } // We don't want to publish anything
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'net.minecraftforge:forgespi:' + SPI_VERSION
|
implementation 'net.minecraftforge:forgespi:' + SPI_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
patcher {
|
patcher {
|
||||||
parent = project(':mcp')
|
parent = project(':mcp')
|
||||||
mcVersion = MC_VERSION
|
mcVersion = MC_VERSION
|
||||||
patchedSrc = file('src/main/java')
|
patchedSrc = file('src/main/java')
|
||||||
|
|
||||||
mappings channel: MAPPING_CHANNEL, version: MAPPING_VERSION
|
mappings channel: MAPPING_CHANNEL, version: MAPPING_VERSION
|
||||||
|
|
||||||
runs {
|
runs {
|
||||||
clean_client {
|
clean_client {
|
||||||
client true
|
client true
|
||||||
taskName 'clean_client'
|
taskName 'clean_client'
|
||||||
ideaModule "${rootProject.name}.${project.name}.main"
|
ideaModule "${rootProject.name}.${project.name}.main"
|
||||||
|
|
||||||
main 'net.minecraft.client.main.Main'
|
main 'net.minecraft.client.main.Main'
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run/client')
|
||||||
|
|
||||||
args '--gameDir', '.'
|
args '--gameDir', '.'
|
||||||
args '--version', MC_VERSION
|
args '--version', MC_VERSION
|
||||||
args '--assetsDir', downloadAssets.output
|
args '--assetsDir', downloadAssets.output
|
||||||
args '--assetIndex', '{asset_index}'
|
args '--assetIndex', '{asset_index}'
|
||||||
args '--accessToken', '0'
|
args '--accessToken', '0'
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_server {
|
clean_server {
|
||||||
client false
|
client false
|
||||||
taskName 'clean_server'
|
taskName 'clean_server'
|
||||||
ideaModule "${rootProject.name}.${project.name}.main"
|
ideaModule "${rootProject.name}.${project.name}.main"
|
||||||
|
|
||||||
main 'net.minecraft.server.Main'
|
main 'net.minecraft.server.Main'
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run/server')
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
eclipse.classpath.file.whenMerged {
|
||||||
|
// Disable optional warnings on the minecraft decompiled source code. It just muddies the warning window and hides warnings in our own codebase
|
||||||
|
def src = entries.find { it.path == 'src/main/java' }
|
||||||
|
src.entryAttributes['ignore_optional_problems'] = 'true'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def sharedDeps = {
|
def sharedDeps = {
|
||||||
@@ -305,7 +307,7 @@ def sharedDeps = {
|
|||||||
installer "org.jline:jline-reader:${JLINE_VERSION}" // Dep of TerminalConsoleAppender
|
installer "org.jline:jline-reader:${JLINE_VERSION}" // Dep of TerminalConsoleAppender
|
||||||
installer "org.jline:jline-terminal:${JLINE_VERSION}" // Dep of TerminalConsoleAppender
|
installer "org.jline:jline-terminal:${JLINE_VERSION}" // Dep of TerminalConsoleAppender
|
||||||
installer "org.spongepowered:mixin:${MIXIN_VERSION}"
|
installer "org.spongepowered:mixin:${MIXIN_VERSION}"
|
||||||
installer 'org.openjdk.nashorn:nashorn-core:15.4'
|
installer 'org.openjdk.nashorn:nashorn-core:15.3'
|
||||||
installer "net.minecraftforge:JarJarSelector:${JARJAR_VERSION}"
|
installer "net.minecraftforge:JarJarSelector:${JARJAR_VERSION}"
|
||||||
installer "net.minecraftforge:JarJarMetadata:${JARJAR_VERSION}"
|
installer "net.minecraftforge:JarJarMetadata:${JARJAR_VERSION}"
|
||||||
|
|
||||||
@@ -358,7 +360,7 @@ def sharedFmlonlyForge = { Project prj ->
|
|||||||
}
|
}
|
||||||
|
|
||||||
prj.task([type: DownloadMavenArtifact], 'downloadInstaller') {
|
prj.task([type: DownloadMavenArtifact], 'downloadInstaller') {
|
||||||
artifact = "net.minecraftforge:installer:${INSTALLER_VERSION}:fatjar"
|
artifact = "net.minecraftforge:installer:${INSTALLER_VERSION}:shrunk"
|
||||||
changing = true
|
changing = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,7 +482,6 @@ def sharedFmlonlyForge = { Project prj ->
|
|||||||
}
|
}
|
||||||
for (def run : prj.patcher.runs) {
|
for (def run : prj.patcher.runs) {
|
||||||
if (run.parents) continue // We already added this to the parent run config
|
if (run.parents) continue // We already added this to the parent run config
|
||||||
run.workingDirectory prj.file('run')
|
|
||||||
|
|
||||||
if (run.name.contains('client') || run.name.contains('data')) {
|
if (run.name.contains('client') || run.name.contains('data')) {
|
||||||
// Natives are loaded from the classpath now in all cases
|
// Natives are loaded from the classpath now in all cases
|
||||||
@@ -493,7 +494,7 @@ def sharedFmlonlyForge = { Project prj ->
|
|||||||
run.property 'org.lwjgl.system.SharedLibraryExtractDirectory', 'lwjgl_dll'
|
run.property 'org.lwjgl.system.SharedLibraryExtractDirectory', 'lwjgl_dll'
|
||||||
run.args '--username', 'Dev'
|
run.args '--username', 'Dev'
|
||||||
run.args '--version', prj.name
|
run.args '--version', prj.name
|
||||||
run.args '--uuid', '0'
|
//run.args '--uuid', '0'
|
||||||
run.args '--accessToken', '0'
|
run.args '--accessToken', '0'
|
||||||
run.args '--userType', 'mojang'
|
run.args '--userType', 'mojang'
|
||||||
run.args '--versionType', 'release'
|
run.args '--versionType', 'release'
|
||||||
@@ -566,331 +567,8 @@ def sharedFmlonlyForge = { Project prj ->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def symlink = file("$rootDir/fmlonly/src/fmlcommon")
|
|
||||||
def symlinkValid = symlink.exists() && symlink.directory
|
|
||||||
|
|
||||||
if (symlinkValid)
|
|
||||||
project(':fmlonly') {
|
|
||||||
evaluationDependsOn(':mcp')
|
|
||||||
apply plugin: 'java-library'
|
|
||||||
apply plugin: 'net.minecraftforge.gradle.patcher'
|
|
||||||
|
|
||||||
ext {
|
|
||||||
MCP_ARTIFACT = project(':mcp').mcp.config.get()
|
|
||||||
PACKED_DEPS = [':fmlcore:jar', ':fmlloader:jar', ':fmlearlydisplay:jar', ':javafmllanguage:jar', ':lowcodelanguage:jar', ':mclanguage:jar']
|
|
||||||
MAVEN_PATH = "${group.replace('.', '/')}/${project.name}/${VERSION}"
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
main {
|
|
||||||
java {
|
|
||||||
srcDirs = ["$rootDir/fmlonly/src/fmlcommon/java", "$rootDir/fmlonly/src/main/java"]
|
|
||||||
}
|
|
||||||
resources {
|
|
||||||
srcDirs = ["$rootDir/fmlonly/src/fmlcommon/resources", "$rootDir/fmlonly/src/main/resources"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
moduleonly
|
|
||||||
installer {
|
|
||||||
// Don't pull all libraries, if we're missing something, add it to the installer list so the installer knows to download it.
|
|
||||||
transitive = false
|
|
||||||
}
|
|
||||||
api.extendsFrom(installer)
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Better coordination between project dependencies and the installer.
|
|
||||||
dependencies {
|
|
||||||
implementation project(':fmlcore')
|
|
||||||
implementation project(':fmlloader')
|
|
||||||
implementation project(':fmlearlydisplay')
|
|
||||||
implementation project(':javafmllanguage')
|
|
||||||
implementation project(':lowcodelanguage')
|
|
||||||
implementation project(':mclanguage')
|
|
||||||
runtimeOnly "cpw.mods:bootstraplauncher:${BOOTSTRAPLAUNCHER_VERSION}"
|
|
||||||
}
|
|
||||||
dependencies sharedDeps
|
|
||||||
|
|
||||||
patcher {
|
|
||||||
parent = project(':mcp')
|
|
||||||
mcVersion = MC_VERSION
|
|
||||||
patchedSrc = file('src/main/java')
|
|
||||||
|
|
||||||
mappings channel: MAPPING_CHANNEL, version: MAPPING_VERSION
|
|
||||||
runs {
|
|
||||||
fmlonly_client {
|
|
||||||
args '--launchTarget', 'fmlclientdev'
|
|
||||||
ideaModule "${rootProject.name}.${project.name}.main"
|
|
||||||
|
|
||||||
mods {
|
|
||||||
minecraft { source sourceSets.main }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fmlonly_server {
|
|
||||||
args '--launchTarget', 'fmlserverdev'
|
|
||||||
ideaModule "${rootProject.name}.${project.name}.main"
|
|
||||||
|
|
||||||
mods {
|
|
||||||
minecraft { source sourceSets.main }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sharedFmlonlyForge.call(project)
|
|
||||||
|
|
||||||
task launcherJson(type: LauncherJson) {
|
|
||||||
packedDependencies = [':fmlloader:jar',':fmlearlydisplay:jar']
|
|
||||||
doFirst {
|
|
||||||
def fmlonly_client = project(':fmlonly').patcher.runs.fmlonly_client
|
|
||||||
json = [
|
|
||||||
_comment_: comment,
|
|
||||||
id: id,
|
|
||||||
time: timestamp,
|
|
||||||
releaseTime: timestamp,
|
|
||||||
type: 'release',
|
|
||||||
mainClass: 'cpw.mods.bootstraplauncher.BootstrapLauncher',
|
|
||||||
inheritsFrom: MC_VERSION,
|
|
||||||
logging: {},
|
|
||||||
arguments: [
|
|
||||||
game: ['--launchTarget', 'fmlclient',
|
|
||||||
'--fml.forgeVersion', FORGE_VERSION,
|
|
||||||
'--fml.mcVersion', MC_VERSION,
|
|
||||||
'--fml.forgeGroup', project.group,
|
|
||||||
'--fml.mcpVersion', MCP_VERSION],
|
|
||||||
jvm: ["-DignoreList=${fmlonly_client.properties.ignoreList},\${version_name}.jar",
|
|
||||||
"-DmergeModules=${fmlonly_client.properties.mergeModules}",
|
|
||||||
'-DlibraryDirectory=${library_directory}',
|
|
||||||
'-p', Util.getArtifacts(project, configurations.moduleonly, false).values().collect{"\${library_directory}/${it.downloads.artifact.path}"}.join('${classpath_separator}'),
|
|
||||||
'--add-modules', 'ALL-MODULE-PATH',
|
|
||||||
// Additions to these JVM module args should be mirrored to server_files/args.txt and other similar blocks in the buildscript
|
|
||||||
'--add-opens', 'java.base/java.util.jar=cpw.mods.securejarhandler',
|
|
||||||
'--add-opens', 'java.base/java.lang.invoke=cpw.mods.securejarhandler',
|
|
||||||
'--add-exports', 'java.base/sun.security.util=cpw.mods.securejarhandler',
|
|
||||||
'--add-exports', 'jdk.naming.dns/com.sun.jndi.dns=java.naming'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
libraries: []
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task installerJson(type: InstallerJson, dependsOn: 'signUniversalJar') {
|
|
||||||
icon = rootProject.file('icon.ico')
|
|
||||||
packedDependencies = PACKED_DEPS
|
|
||||||
|
|
||||||
doFirst {
|
|
||||||
def libs = libraries
|
|
||||||
json = [
|
|
||||||
_comment_: launcherJson.comment,
|
|
||||||
spec: 1,
|
|
||||||
profile: project.name,
|
|
||||||
version: launcherJson.id,
|
|
||||||
path: null,
|
|
||||||
minecraft: MC_VERSION,
|
|
||||||
serverJarPath: '{LIBRARY_DIR}/net/minecraft/server/{MINECRAFT_VERSION}/server-{MINECRAFT_VERSION}.jar',
|
|
||||||
welcome: "Welcome to the simple FML installer.",
|
|
||||||
data: [
|
|
||||||
MAPPINGS: [
|
|
||||||
client: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings@txt]",
|
|
||||||
server: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings@txt]"
|
|
||||||
],
|
|
||||||
MOJMAPS: [
|
|
||||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:mappings@txt]",
|
|
||||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:mappings@txt]"
|
|
||||||
],
|
|
||||||
MERGED_MAPPINGS: [
|
|
||||||
client: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings-merged@txt]",
|
|
||||||
server: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings-merged@txt]"
|
|
||||||
],
|
|
||||||
MC_UNPACKED: [
|
|
||||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:unpacked]",
|
|
||||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:unpacked]"
|
|
||||||
],
|
|
||||||
MC_SLIM: [
|
|
||||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:slim]",
|
|
||||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:slim]"
|
|
||||||
],
|
|
||||||
MC_SLIM_SHA: [
|
|
||||||
client: "'${downloadClientSlim.output.get().asFile.sha1()}'",
|
|
||||||
server: "'${downloadServerSlim.output.get().asFile.sha1()}'"
|
|
||||||
],
|
|
||||||
MC_EXTRA: [
|
|
||||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:extra]",
|
|
||||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:extra]"
|
|
||||||
],
|
|
||||||
MC_EXTRA_SHA: [
|
|
||||||
client: "'${downloadClientExtra.output.get().asFile.sha1()}'",
|
|
||||||
server: "'${downloadServerExtra.output.get().asFile.sha1()}'"
|
|
||||||
],
|
|
||||||
MC_SRG: [
|
|
||||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:srg]",
|
|
||||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:srg]"
|
|
||||||
],
|
|
||||||
/*MC_SRG_SHA: [
|
|
||||||
client: "'${createClientSRG.output.sha1()}'",
|
|
||||||
server: "'${createServerSRG.output.sha1()}'"
|
|
||||||
],*/
|
|
||||||
MCP_VERSION: [
|
|
||||||
client: "'${MCP_VERSION}'",
|
|
||||||
server: "'${MCP_VERSION}'"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
processors: [
|
|
||||||
[
|
|
||||||
sides: ['server'],
|
|
||||||
jar: INSTALLER_TOOLS,
|
|
||||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
|
||||||
args: [
|
|
||||||
'--task', 'EXTRACT_FILES',
|
|
||||||
'--archive', '{INSTALLER}',
|
|
||||||
|
|
||||||
'--from', 'data/run.sh',
|
|
||||||
'--to', '{ROOT}/run.sh',
|
|
||||||
'--exec', '{ROOT}/run.sh',
|
|
||||||
//'--from', "data/run_fml_${VERSION.replace('-', '_').sh",
|
|
||||||
//'--to', '{ROOT}/run_fml_${VERSION.replace('-', '_').sh',
|
|
||||||
//'--exec', '{ROOT}/run_fml_${VERSION.replace('-', '_').sh',
|
|
||||||
|
|
||||||
'--from', 'data/run.bat',
|
|
||||||
'--to', '{ROOT}/run.bat',
|
|
||||||
//'--from', 'data/run_fml_${VERSION.replace('-', '_').bat',
|
|
||||||
//'--to', '{ROOT}/run_fml_${VERSION.replace('-', '_').bat',
|
|
||||||
|
|
||||||
'--from', 'data/user_jvm_args.txt',
|
|
||||||
'--to', '{ROOT}/user_jvm_args.txt',
|
|
||||||
'--optional', '{ROOT}/user_jvm_args.txt',
|
|
||||||
|
|
||||||
'--from', 'data/win_args.txt',
|
|
||||||
'--to', "{ROOT}/libraries/${MAVEN_PATH}/win_args.txt",
|
|
||||||
|
|
||||||
'--from', 'data/unix_args.txt',
|
|
||||||
'--to', "{ROOT}/libraries/${MAVEN_PATH}/unix_args.txt"
|
|
||||||
]
|
|
||||||
], [
|
|
||||||
sides: ['server'],
|
|
||||||
jar: INSTALLER_TOOLS,
|
|
||||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
|
||||||
args: [
|
|
||||||
'--task', 'BUNDLER_EXTRACT',
|
|
||||||
'--input', '{MINECRAFT_JAR}',
|
|
||||||
'--output', '{ROOT}/libraries/',
|
|
||||||
'--libraries'
|
|
||||||
]
|
|
||||||
], [
|
|
||||||
sides: ['server'],
|
|
||||||
jar: INSTALLER_TOOLS,
|
|
||||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
|
||||||
args: [
|
|
||||||
'--task', 'BUNDLER_EXTRACT',
|
|
||||||
'--input', '{MINECRAFT_JAR}',
|
|
||||||
'--output', '{MC_UNPACKED}',
|
|
||||||
'--jar-only'
|
|
||||||
]
|
|
||||||
], [
|
|
||||||
jar: INSTALLER_TOOLS,
|
|
||||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
|
||||||
args: [
|
|
||||||
'--task', 'MCP_DATA',
|
|
||||||
'--input', "[${MCP_ARTIFACT.descriptor}]",
|
|
||||||
'--output', '{MAPPINGS}',
|
|
||||||
'--key', 'mappings'
|
|
||||||
]
|
|
||||||
], [
|
|
||||||
jar: INSTALLER_TOOLS,
|
|
||||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
|
||||||
args: [
|
|
||||||
'--task', 'DOWNLOAD_MOJMAPS',
|
|
||||||
'--version', MC_VERSION,
|
|
||||||
'--side', '{SIDE}',
|
|
||||||
'--output', '{MOJMAPS}'
|
|
||||||
]
|
|
||||||
], [
|
|
||||||
jar: INSTALLER_TOOLS,
|
|
||||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
|
||||||
args: [
|
|
||||||
'--task', 'MERGE_MAPPING',
|
|
||||||
'--left', '{MAPPINGS}',
|
|
||||||
'--right', '{MOJMAPS}',
|
|
||||||
'--output', '{MERGED_MAPPINGS}',
|
|
||||||
'--classes', '--reverse-right'
|
|
||||||
]
|
|
||||||
], [
|
|
||||||
sides: ['client'],
|
|
||||||
jar: JAR_SPLITTER,
|
|
||||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
|
||||||
args: [
|
|
||||||
'--input', '{MINECRAFT_JAR}',
|
|
||||||
'--slim', '{MC_SLIM}',
|
|
||||||
'--extra', '{MC_EXTRA}',
|
|
||||||
'--srg', '{MERGED_MAPPINGS}'
|
|
||||||
],
|
|
||||||
outputs: [
|
|
||||||
'{MC_SLIM}': '{MC_SLIM_SHA}',
|
|
||||||
'{MC_EXTRA}': '{MC_EXTRA_SHA}'
|
|
||||||
]
|
|
||||||
], [
|
|
||||||
sides: ['server'],
|
|
||||||
jar: JAR_SPLITTER,
|
|
||||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
|
||||||
args: [
|
|
||||||
'--input', '{MC_UNPACKED}',
|
|
||||||
'--slim', '{MC_SLIM}',
|
|
||||||
'--extra', '{MC_EXTRA}',
|
|
||||||
'--srg', '{MERGED_MAPPINGS}'
|
|
||||||
],
|
|
||||||
outputs: [
|
|
||||||
'{MC_SLIM}': '{MC_SLIM_SHA}',
|
|
||||||
'{MC_EXTRA}': '{MC_EXTRA_SHA}'
|
|
||||||
]
|
|
||||||
], [
|
|
||||||
jar: FART,
|
|
||||||
classpath: getClasspath(project, libs, FART),
|
|
||||||
args: [
|
|
||||||
'--input', '{MC_SLIM}',
|
|
||||||
'--output', '{MC_SRG}',
|
|
||||||
'--names', '{MERGED_MAPPINGS}',
|
|
||||||
'--ann-fix', '--ids-fix', '--src-fix', '--record-fix'
|
|
||||||
]/*,
|
|
||||||
outputs: [
|
|
||||||
'{MC_SRG}': '{MC_SRG_SHA}'
|
|
||||||
]
|
|
||||||
*/
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
getClasspath(project, libs, MCP_ARTIFACT.descriptor) //Tell it to download mcp_config
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task installerJar(type: InstallerJar) {
|
|
||||||
packedDependencies = PACKED_DEPS
|
|
||||||
from(extraTxts)
|
|
||||||
//TODO: make FML installer logo?
|
|
||||||
from(rootProject.file('/forge_installer_logo.png')) {
|
|
||||||
rename { 'big_logo.png' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
artifact universalJar
|
|
||||||
artifact installerJar
|
|
||||||
artifact userdevJar
|
|
||||||
artifact sourcesJar
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Since we need the modules in the bootstrap, we need to make sure they are compiled before we do each run
|
|
||||||
afterEvaluate { prepareRuns.dependsOn(PACKED_DEPS) }
|
|
||||||
}
|
|
||||||
|
|
||||||
project(':forge') {
|
project(':forge') {
|
||||||
evaluationDependsOn(System.env.TEAMCITY_VERSION ? ':mcp' : ':clean')
|
evaluationDependsOn(':clean')
|
||||||
apply plugin: 'java-library'
|
apply plugin: 'java-library'
|
||||||
apply plugin: 'net.minecraftforge.gradle.patcher'
|
apply plugin: 'net.minecraftforge.gradle.patcher'
|
||||||
apply plugin: 'org.cadixdev.licenser'
|
apply plugin: 'org.cadixdev.licenser'
|
||||||
@@ -930,8 +608,12 @@ project(':forge') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Eclipse adds the sourcesets twice, once where we tell it to, once in the projects folder. No idea why. So delete them
|
|
||||||
eclipse.classpath.file.whenMerged { cls -> cls.entries.removeIf { e -> e instanceof SourceFolder && e.path.startsWith('src/') && !e.path.startsWith('src/main/') } }
|
eclipse.classpath.file.whenMerged {
|
||||||
|
// Disable optional warnings on the minecraft decompiled source code. It just muddies the warning window and hides warnings in our own codebase
|
||||||
|
def src = entries.find { it.path == 'src/main/java' }
|
||||||
|
src.entryAttributes['ignore_optional_problems'] = 'true'
|
||||||
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
SPEC_VERSION = gradleutils.gitInfo.tag
|
SPEC_VERSION = gradleutils.gitInfo.tag
|
||||||
@@ -970,21 +652,16 @@ project(':forge') {
|
|||||||
|
|
||||||
patcher {
|
patcher {
|
||||||
excs.from file("$rootDir/src/main/resources/forge.exc")
|
excs.from file("$rootDir/src/main/resources/forge.exc")
|
||||||
parent = project(System.env.TEAMCITY_VERSION ? ':mcp' : ':clean')
|
parent = project(':clean')
|
||||||
patches = file("$rootDir/patches/minecraft")
|
patches = file("$rootDir/patches/minecraft")
|
||||||
patchedSrc = file('src/main/java')
|
patchedSrc = file('src/main/java')
|
||||||
srgPatches = true
|
srgPatches = false
|
||||||
accessTransformers.from file("$rootDir/src/main/resources/META-INF/accesstransformer.cfg")
|
accessTransformers.from file("$rootDir/src/main/resources/META-INF/accesstransformer.cfg")
|
||||||
sideAnnotationStrippers.from file("$rootDir/src/main/resources/forge.sas")
|
sideAnnotationStrippers.from file("$rootDir/src/main/resources/forge.sas")
|
||||||
|
|
||||||
// the clean project provides these. if we're not using it, we need to provide them ourselves
|
|
||||||
if (System.env.TEAMCITY_VERSION) {
|
|
||||||
mappings channel: MAPPING_CHANNEL, version: MAPPING_VERSION
|
|
||||||
mcVersion = MC_VERSION
|
|
||||||
}
|
|
||||||
|
|
||||||
runs {
|
runs {
|
||||||
forge_client {
|
forge_client {
|
||||||
|
workingDirectory file('run/client')
|
||||||
property 'eventbus.checkTypesOnDispatch', 'true'
|
property 'eventbus.checkTypesOnDispatch', 'true'
|
||||||
args '--launchTarget', 'forgeclientdev'
|
args '--launchTarget', 'forgeclientdev'
|
||||||
ideaModule "${rootProject.name}.${project.name}.main"
|
ideaModule "${rootProject.name}.${project.name}.main"
|
||||||
@@ -994,6 +671,7 @@ project(':forge') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
forge_test_client {
|
forge_test_client {
|
||||||
|
workingDirectory file('run/client_test')
|
||||||
parent runs.forge_client
|
parent runs.forge_client
|
||||||
taskName 'forge_test_client'
|
taskName 'forge_test_client'
|
||||||
|
|
||||||
@@ -1008,6 +686,7 @@ project(':forge') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
forge_server {
|
forge_server {
|
||||||
|
workingDirectory file('run/server')
|
||||||
args '--launchTarget', 'forgeserverdev'
|
args '--launchTarget', 'forgeserverdev'
|
||||||
ideaModule "${rootProject.name}.${project.name}.main"
|
ideaModule "${rootProject.name}.${project.name}.main"
|
||||||
|
|
||||||
@@ -1017,6 +696,7 @@ project(':forge') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
forge_test_server {
|
forge_test_server {
|
||||||
|
workingDirectory file('run/server_test')
|
||||||
parent runs.forge_server
|
parent runs.forge_server
|
||||||
taskName 'forge_test_server'
|
taskName 'forge_test_server'
|
||||||
|
|
||||||
@@ -1089,19 +769,20 @@ project(':forge') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
args '--flat', '--all', '--validate',
|
args '--flat', '--all', '--validate',
|
||||||
'--mod', 'data_gen_test',
|
'--mod', 'empty',
|
||||||
'--mod', 'piston_event_test',
|
//'--mod', 'data_gen_test',
|
||||||
|
//'--mod', 'piston_event_test',
|
||||||
'--mod', 'global_loot_test',
|
'--mod', 'global_loot_test',
|
||||||
'--mod', 'scaffolding_test',
|
//'--mod', 'scaffolding_test',
|
||||||
'--mod', 'custom_tag_types_test',
|
//'--mod', 'custom_tag_types_test',
|
||||||
'--mod', 'new_model_loader_test',
|
//'--mod', 'new_model_loader_test',
|
||||||
'--mod', 'remove_tag_datagen_test',
|
//'--mod', 'remove_tag_datagen_test',
|
||||||
'--mod', 'tag_based_tool_types',
|
//'--mod', 'tag_based_tool_types',
|
||||||
'--mod', 'custom_transformtype_test',
|
//'--mod', 'custom_transformtype_test',
|
||||||
'--mod', 'data_pack_registries_test',
|
//'--mod', 'data_pack_registries_test',
|
||||||
'--mod', 'biome_modifiers_test',
|
//'--mod', 'biome_modifiers_test',
|
||||||
'--mod', 'structure_modifiers_test',
|
//'--mod', 'structure_modifiers_test',
|
||||||
'--mod', 'custom_preset_editor_test',
|
//'--mod', 'custom_preset_editor_test',
|
||||||
'--output', rootProject.file('src/generated_test/resources/'),
|
'--output', rootProject.file('src/generated_test/resources/'),
|
||||||
'--existing', sourceSets.main.resources.srcDirs[0],
|
'--existing', sourceSets.main.resources.srcDirs[0],
|
||||||
'--existing', sourceSets.test.resources.srcDirs[0]
|
'--existing', sourceSets.test.resources.srcDirs[0]
|
||||||
@@ -1135,6 +816,33 @@ project(':forge') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
if (!patcher.srgPatches) {
|
||||||
|
srg2mcpClean {
|
||||||
|
dependsOn = []
|
||||||
|
input = project(':mcp').setupMCP.output
|
||||||
|
}
|
||||||
|
userdevJar {
|
||||||
|
onlyIf = { t -> true }
|
||||||
|
}
|
||||||
|
def patches = project.file('build/genPatchesForUserdev/output/')
|
||||||
|
patches.mkdirs()
|
||||||
|
def genPatchesForUserdev = tasks.register('genPatchesForUserdev', GeneratePatches){
|
||||||
|
base = project(':mcp').setupMCP.output
|
||||||
|
modified = applyRangeMapBase.output
|
||||||
|
originalPrefix = genPatches.originalPrefix
|
||||||
|
modifiedPrefix = genPatches.modifiedPrefix
|
||||||
|
output = patches
|
||||||
|
autoHeader true
|
||||||
|
lineEnding = '\n'
|
||||||
|
}
|
||||||
|
bakePatches {
|
||||||
|
dependsOn = []
|
||||||
|
input = genPatchesForUserdev.get().output
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
MANIFESTS = [
|
MANIFESTS = [
|
||||||
@@ -1187,12 +895,9 @@ project(':forge') {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register('downloadCrowdin', Download) {
|
task crowdin(type: Crowdin) {
|
||||||
src 'https://files.minecraftforge.net/crowdin.zip'
|
key = project.hasProperty('crowdinKey') ? project.crowdinKey : null
|
||||||
dest file('build/crowdin.zip')
|
//TODO: Merge our english.json?
|
||||||
useETag 'all'
|
|
||||||
onlyIfModified true
|
|
||||||
quiet true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sharedFmlonlyForge.call(project)
|
sharedFmlonlyForge.call(project)
|
||||||
@@ -1394,6 +1099,8 @@ project(':forge') {
|
|||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
def libs = libraries
|
def libs = libraries
|
||||||
|
def INSTALLER_TOOLS_CLASSPATH = getClasspath(project, libs, INSTALLER_TOOLS)
|
||||||
|
def JAR_SPLITTER_CLASSPATH = getClasspath(project, libs, JAR_SPLITTER)
|
||||||
json = [
|
json = [
|
||||||
_comment_: launcherJson.comment,
|
_comment_: launcherJson.comment,
|
||||||
spec: 1,
|
spec: 1,
|
||||||
@@ -1464,7 +1171,7 @@ project(':forge') {
|
|||||||
[
|
[
|
||||||
sides: ['server'],
|
sides: ['server'],
|
||||||
jar: INSTALLER_TOOLS,
|
jar: INSTALLER_TOOLS,
|
||||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||||
args: [
|
args: [
|
||||||
'--task', 'EXTRACT_FILES',
|
'--task', 'EXTRACT_FILES',
|
||||||
'--archive', '{INSTALLER}',
|
'--archive', '{INSTALLER}',
|
||||||
@@ -1494,7 +1201,7 @@ project(':forge') {
|
|||||||
], [
|
], [
|
||||||
sides: ['server'],
|
sides: ['server'],
|
||||||
jar: INSTALLER_TOOLS,
|
jar: INSTALLER_TOOLS,
|
||||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||||
args: [
|
args: [
|
||||||
'--task', 'BUNDLER_EXTRACT',
|
'--task', 'BUNDLER_EXTRACT',
|
||||||
'--input', '{MINECRAFT_JAR}',
|
'--input', '{MINECRAFT_JAR}',
|
||||||
@@ -1504,7 +1211,7 @@ project(':forge') {
|
|||||||
], [
|
], [
|
||||||
sides: ['server'],
|
sides: ['server'],
|
||||||
jar: INSTALLER_TOOLS,
|
jar: INSTALLER_TOOLS,
|
||||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||||
args: [
|
args: [
|
||||||
'--task', 'BUNDLER_EXTRACT',
|
'--task', 'BUNDLER_EXTRACT',
|
||||||
'--input', '{MINECRAFT_JAR}',
|
'--input', '{MINECRAFT_JAR}',
|
||||||
@@ -1513,7 +1220,7 @@ project(':forge') {
|
|||||||
]
|
]
|
||||||
], [
|
], [
|
||||||
jar: INSTALLER_TOOLS,
|
jar: INSTALLER_TOOLS,
|
||||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||||
args: [
|
args: [
|
||||||
'--task', 'MCP_DATA',
|
'--task', 'MCP_DATA',
|
||||||
'--input', "[${MCP_ARTIFACT.descriptor}]",
|
'--input', "[${MCP_ARTIFACT.descriptor}]",
|
||||||
@@ -1522,7 +1229,7 @@ project(':forge') {
|
|||||||
]
|
]
|
||||||
], [
|
], [
|
||||||
jar: INSTALLER_TOOLS,
|
jar: INSTALLER_TOOLS,
|
||||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||||
args: [
|
args: [
|
||||||
'--task', 'DOWNLOAD_MOJMAPS',
|
'--task', 'DOWNLOAD_MOJMAPS',
|
||||||
'--version', MC_VERSION,
|
'--version', MC_VERSION,
|
||||||
@@ -1531,7 +1238,7 @@ project(':forge') {
|
|||||||
]
|
]
|
||||||
], [
|
], [
|
||||||
jar: INSTALLER_TOOLS,
|
jar: INSTALLER_TOOLS,
|
||||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||||
args: [
|
args: [
|
||||||
'--task', 'MERGE_MAPPING',
|
'--task', 'MERGE_MAPPING',
|
||||||
'--left', '{MAPPINGS}',
|
'--left', '{MAPPINGS}',
|
||||||
@@ -1542,7 +1249,7 @@ project(':forge') {
|
|||||||
], [
|
], [
|
||||||
sides: ['client'],
|
sides: ['client'],
|
||||||
jar: JAR_SPLITTER,
|
jar: JAR_SPLITTER,
|
||||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
classpath: JAR_SPLITTER_CLASSPATH,
|
||||||
args: [
|
args: [
|
||||||
'--input', '{MINECRAFT_JAR}',
|
'--input', '{MINECRAFT_JAR}',
|
||||||
'--slim', '{MC_SLIM}',
|
'--slim', '{MC_SLIM}',
|
||||||
@@ -1556,7 +1263,7 @@ project(':forge') {
|
|||||||
], [
|
], [
|
||||||
sides: ['server'],
|
sides: ['server'],
|
||||||
jar: JAR_SPLITTER,
|
jar: JAR_SPLITTER,
|
||||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
classpath: JAR_SPLITTER_CLASSPATH,
|
||||||
args: [
|
args: [
|
||||||
'--input', '{MC_UNPACKED}',
|
'--input', '{MC_UNPACKED}',
|
||||||
'--slim', '{MC_SLIM}',
|
'--slim', '{MC_SLIM}',
|
||||||
@@ -1603,12 +1310,9 @@ project(':forge') {
|
|||||||
from extraTxts
|
from extraTxts
|
||||||
|
|
||||||
// add crowdin locales
|
// add crowdin locales
|
||||||
from zipTree(downloadCrowdin.dest).matching {
|
from { crowdin.output.present && crowdin.output.get().asFile.exists() ? zipTree(crowdin.output) : null}
|
||||||
include 'assets/forge/lang/*.json'
|
dependsOn crowdin
|
||||||
}
|
duplicatesStrategy = 'exclude'
|
||||||
|
|
||||||
dependsOn downloadCrowdin
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
MANIFESTS.each{ pkg, values ->
|
MANIFESTS.each{ pkg, values ->
|
||||||
@@ -1803,10 +1507,7 @@ project(':forge') {
|
|||||||
|
|
||||||
//evaluationDependsOnChildren()
|
//evaluationDependsOnChildren()
|
||||||
task setup() { //These must be strings so that we can do lazy resolution. Else we need evaluationDependsOnChildren above
|
task setup() { //These must be strings so that we can do lazy resolution. Else we need evaluationDependsOnChildren above
|
||||||
if (!System.env.TEAMCITY_VERSION)
|
dependsOn ':clean:extractMapped'
|
||||||
dependsOn ':clean:extractMapped'
|
|
||||||
if (symlinkValid)
|
|
||||||
dependsOn ':fmlonly:extractMapped'
|
|
||||||
dependsOn ':forge:extractMapped'
|
dependsOn ':forge:extractMapped'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1815,28 +1516,27 @@ task doChecks {
|
|||||||
dependsOn ':forge:publish'
|
dependsOn ':forge:publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symlinkValid)
|
project.gradle.startParameter.excludedTaskNames.add(':clean:genPatches')
|
||||||
project.gradle.startParameter.excludedTaskNames.add(':fmlonly:genPatches')
|
|
||||||
|
|
||||||
if (!System.env.TEAMCITY_VERSION)
|
|
||||||
project.gradle.startParameter.excludedTaskNames.add(':clean:genPatches')
|
|
||||||
|
|
||||||
//Also output FMLOnly when building a version.
|
|
||||||
if (System.env.TEAMCITY_VERSION) {
|
if (System.env.TEAMCITY_VERSION) {
|
||||||
//Only setup the CI environment if and only if the environment variables are set.
|
//Only setup the CI environment if and only if the environment variables are set.
|
||||||
tasks.configureTeamCity {
|
tasks.configureTeamCity {
|
||||||
doLast {
|
doLast {
|
||||||
println "##teamcity[buildNumber '${project(':forge').version}']"
|
println "##teamcity[buildNumber '${project(':forge').version}']"
|
||||||
println "##teamcity[setParameter name='env.PUBLISHED_JAVA_ARTIFACT_VERSION' value='${project(':forge').version}']"
|
println "##teamcity[setParameter name='env.PUBLISHED_JAVA_ARTIFACT_VERSION' value='${project(':forge').version}']"
|
||||||
println "##teamcity[setParameter name='env.PUBLISHED_JAVA_FML_ARTIFACT_VERSION' value='${project(':fmlonly').version}']"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
idea {
|
allprojects { prj ->
|
||||||
module {
|
prj.tasks.eclipse.doFirst {
|
||||||
// IntelliJ IDEA does not do this by itself anymore...
|
rootProject.fileTree('ide/eclipse/template/.settings/').matching { include '**/*.prefs' }.each { file ->
|
||||||
downloadJavadoc = true
|
def target = project.file('.settings/' + file.name)
|
||||||
downloadSources = true
|
def temp = new CleanProperties().load(file)
|
||||||
|
def exst = new CleanProperties().load(target)
|
||||||
|
exst.put('eclipse.preferences.version', '1')
|
||||||
|
temp.forEach(exst::put)
|
||||||
|
exst.store(target)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -27,6 +27,6 @@ abstract class BytecodePredicateFinder extends BytecodeFinder {
|
|||||||
@Internal
|
@Internal
|
||||||
@Override
|
@Override
|
||||||
protected Object getData() {
|
protected Object getData() {
|
||||||
return matches.stream().sorted().toList() ?: {throw new RuntimeException('Failed to find any targets, please ensure that method names and descriptors are correct.')}()
|
return matches.toSorted(Comparator.naturalOrder()) ?: {throw new RuntimeException('Failed to find any targets, please ensure that method names and descriptors are correct.')}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package net.minecraftforge.forge.tasks;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Eclipse config files are literally just java properties, with the header cleaned up.
|
||||||
|
* https://github.com/eclipse/buildship/blob/5b2c7fca7fa86cd74d71b3c099c7b1559eba038e/org.eclipse.buildship.core/src/main/java/org/eclipse/buildship/core/internal/configuration/PreferenceStore.java#L238
|
||||||
|
*
|
||||||
|
* This does the same thing, as well as sorting alphabetically.
|
||||||
|
* It also ignores all comments. We can add them latter if someone cares.
|
||||||
|
*/
|
||||||
|
public class CleanProperties extends Properties {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static final String LINE_SEP = System.getProperty("line.separator");
|
||||||
|
private static final String UNIX_LINE_SEP = "\n";
|
||||||
|
private static final Charset ENCODING = StandardCharsets.UTF_8;
|
||||||
|
|
||||||
|
public CleanProperties load(File input) throws IOException {
|
||||||
|
if (input.exists()) {
|
||||||
|
try (Reader is = new InputStreamReader(new FileInputStream(input), ENCODING)) {
|
||||||
|
super.load(is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void store(File out) throws IOException {
|
||||||
|
if (!out.getParentFile().exists())
|
||||||
|
out.getParentFile().mkdirs();
|
||||||
|
|
||||||
|
try (OutputStream os = new FileOutputStream(out)) {
|
||||||
|
store(os, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized Enumeration<Object> keys() {
|
||||||
|
Set<Object> ret = new TreeSet<>();
|
||||||
|
for (Enumeration<?> e = super.keys(); e.hasMoreElements();)
|
||||||
|
ret.add(e.nextElement());
|
||||||
|
return Collections.enumeration(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Map.Entry<Object, Object>> entrySet() {
|
||||||
|
Set<Map.Entry<Object, Object>> ret = new TreeSet<>((l, r) -> ((String)l.getKey()).compareTo((String)r.getKey()));
|
||||||
|
ret.addAll(super.entrySet());
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void store(OutputStream out, String comments) throws IOException {
|
||||||
|
out.write(clean().getBytes(ENCODING));
|
||||||
|
out.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void store(Writer out, String comments) throws IOException {
|
||||||
|
out.write(clean());
|
||||||
|
out.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String clean() throws IOException {
|
||||||
|
ByteArrayOutputStream tmp = new ByteArrayOutputStream();
|
||||||
|
try {
|
||||||
|
super.store(tmp, null);
|
||||||
|
} finally {
|
||||||
|
tmp.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
String ret = tmp.toString(ENCODING).replace(LINE_SEP, UNIX_LINE_SEP);
|
||||||
|
ret = ret.substring(ret.indexOf(UNIX_LINE_SEP) + 1);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
-30
@@ -2,15 +2,16 @@
|
|||||||
|
|
||||||
MinecraftForge
|
MinecraftForge
|
||||||
=============
|
=============
|
||||||
[][Download]
|
[][Download]
|
||||||
[][Download] [][Discord] [][Patreon]
|
)][Download] [][Discord] [][Patreon]
|
||||||
|
|
||||||
Forge is a free, open-source modding API all of your favourite mods use!
|
Forge is a free, open-source modding API all of your favourite mods use!
|
||||||
|
|
||||||
| Version | Support |
|
| Version | Support |
|
||||||
|--------------|-----------------------------|
|
|---------| ------------- |
|
||||||
| All versions | [Supported][Support-Policy] |
|
| 1.20.x | Active |
|
||||||
|
| 1.19.x | Legacy |
|
||||||
|
|
||||||
* [Download]
|
* [Download]
|
||||||
* [Forum]
|
* [Forum]
|
||||||
@@ -26,23 +27,10 @@ You can download the installer for the *Recommended Build* or the
|
|||||||
*Latest build* there. Latest builds may have newer features but may be
|
*Latest build* there. Latest builds may have newer features but may be
|
||||||
more unstable as a result. The installer will attempt to install Forge
|
more unstable as a result. The installer will attempt to install Forge
|
||||||
into your vanilla launcher environment, where you can then create a new
|
into your vanilla launcher environment, where you can then create a new
|
||||||
profile using that version and play the game!
|
profile using that version and play the game!
|
||||||
|
|
||||||
For support and questions, visit [the Support Forum][Support-Forum] or [the Forge Discord server][Discord].
|
For support and questions, visit [the Support Forum][Support-Forum] or [the Forge Discord server][Discord].
|
||||||
|
|
||||||
## Required Java Versions
|
|
||||||
|
|
||||||
We require the version of Java that Minecraft requires, which is currently:
|
|
||||||
|
|
||||||
| Minecraft | Java |
|
|
||||||
|---------------|-------------------|
|
|
||||||
| 1.20.6+ | [21][Adoptium-21] |
|
|
||||||
| 1.18 - 1.20.4 | [17][Adoptium-17] |
|
|
||||||
| 1.17.1 | [16][Adoptium-16] |
|
|
||||||
| 1.16.5- | [8][Adoptium-8] |
|
|
||||||
|
|
||||||
**If you are on Windows and have difficulty using Java to launch JAR files, consider using [Jarfix by Johann Löfflmann][Jarfix].**
|
|
||||||
|
|
||||||
# Creating Mods
|
# Creating Mods
|
||||||
|
|
||||||
[See the "Getting Started" section in the Forge Documentation][Getting-Started].
|
[See the "Getting Started" section in the Forge Documentation][Getting-Started].
|
||||||
@@ -75,21 +63,14 @@ Please ensure you have a valid email address associated with your GitHub account
|
|||||||
|
|
||||||
[Download]: https://files.minecraftforge.net/
|
[Download]: https://files.minecraftforge.net/
|
||||||
|
|
||||||
[Adoptium-21]: https://adoptium.net/temurin/releases/?version=21
|
|
||||||
[Adoptium-17]: https://adoptium.net/temurin/releases/?version=17
|
|
||||||
[Adoptium-16]: https://adoptium.net/temurin/releases/?version=16
|
|
||||||
[Adoptium-8]: https://adoptium.net/temurin/releases/?version=8
|
|
||||||
[Jarfix]: https://johann.loefflmann.net/en/software/jarfix/index.html
|
|
||||||
|
|
||||||
[Forum]: https://forums.minecraftforge.net/
|
[Forum]: https://forums.minecraftforge.net/
|
||||||
[Support-Forum]: https://forums.minecraftforge.net/forum/18-support-bug-reports/
|
[Support-Forum]: https://forums.minecraftforge.net/forum/18-support-bug-reports/
|
||||||
[Support-Policy]: https://forums.minecraftforge.net/topic/144690-new-tiered-support-policy
|
|
||||||
|
|
||||||
[Discord]: https://discord.minecraftforge.net/
|
[Discord]: https://discord.minecraftforge.net/
|
||||||
|
|
||||||
[Documentation]: https://docs.minecraftforge.net/en/1.20.1/
|
[Documentation]: https://docs.minecraftforge.net/
|
||||||
[Getting-Started]: https://docs.minecraftforge.net/en/1.20.1/gettingstarted/
|
[Getting-Started]: https://docs.minecraftforge.net/en/latest/gettingstarted/
|
||||||
[ForgeDev]: https://docs.minecraftforge.net/en/1.20.1/forgedev/
|
[ForgeDev]: https://docs.minecraftforge.net/en/latest/forgedev/
|
||||||
[Pull-Requests]: https://docs.minecraftforge.net/en/1.20.1/forgedev/#making-changes-and-pull-requests
|
[Pull-Requests]: https://docs.minecraftforge.net/en/latest/forgedev/#making-changes-and-pull-requests
|
||||||
|
|
||||||
[Patreon]: https://www.patreon.com/LexManos
|
[Patreon]: https://www.patreon.com/MinecraftForge
|
||||||
@@ -2,10 +2,9 @@ plugins {
|
|||||||
id 'com.github.ben-manes.versions'
|
id 'com.github.ben-manes.versions'
|
||||||
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
||||||
id 'org.cadixdev.licenser'
|
id 'org.cadixdev.licenser'
|
||||||
|
id 'java-library'
|
||||||
|
id 'jacoco'
|
||||||
}
|
}
|
||||||
apply plugin: 'java-library'
|
|
||||||
apply plugin: 'jacoco'
|
|
||||||
apply plugin: 'org.javamodularity.moduleplugin'
|
|
||||||
|
|
||||||
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
||||||
|
|
||||||
|
|||||||
@@ -5,39 +5,36 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml;
|
package net.minecraftforge.fml;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.util.ServiceLoaderUtils;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.fml.config.IConfigEvent;
|
import net.minecraftforge.fml.config.IConfigEvent;
|
||||||
import net.minecraftforge.fml.loading.FMLLoader;
|
import net.minecraftforge.fml.loading.FMLLoader;
|
||||||
|
|
||||||
import java.util.ServiceConfigurationError;
|
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to allow access to certain things from the game layer
|
|
||||||
*/
|
|
||||||
public class Bindings {
|
public class Bindings {
|
||||||
private Bindings() {}
|
private static final Bindings INSTANCE = new Bindings();
|
||||||
|
|
||||||
/**
|
private final IBindingsProvider provider;
|
||||||
* The provider of the bindings
|
|
||||||
* @implNote May also throw a {@link ServiceConfigurationError}
|
private Bindings() {
|
||||||
*/
|
final var providers = ServiceLoaderUtils.streamServiceLoader(()->ServiceLoader.load(FMLLoader.getGameLayer(), IBindingsProvider.class), sce->{}).toList();
|
||||||
private static final IBindingsProvider PROVIDER = ServiceLoader.load(FMLLoader.getGameLayer(), IBindingsProvider.class)
|
if (providers.size() != 1) {
|
||||||
.findFirst().orElseThrow(() -> new IllegalStateException("Could not find bindings provider"));
|
throw new IllegalStateException("Could not find bindings provider");
|
||||||
|
}
|
||||||
|
this.provider = providers.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return A supplier of net.minecraftforge.common.MinecraftForge#EVENT_BUS
|
|
||||||
*/
|
|
||||||
public static Supplier<IEventBus> getForgeBus() {
|
public static Supplier<IEventBus> getForgeBus() {
|
||||||
return PROVIDER.getForgeBusSupplier();
|
return INSTANCE.provider.getForgeBusSupplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Supplier<I18NParser> getMessageParser() {
|
public static Supplier<I18NParser> getMessageParser() {
|
||||||
return PROVIDER.getMessageParser();
|
return INSTANCE.provider.getMessageParser();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Supplier<IConfigEvent.ConfigConfig> getConfigConfiguration() {
|
public static Supplier<IConfigEvent.ConfigConfig> getConfigConfiguration() {
|
||||||
return PROVIDER.getConfigConfiguration();
|
return INSTANCE.provider.getConfigConfiguration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@ import java.util.function.Supplier;
|
|||||||
* @param <T> the type of the record which is held by the extension point
|
* @param <T> the type of the record which is held by the extension point
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused") // Type parameter T
|
@SuppressWarnings("unused") // Type parameter T
|
||||||
|
// TODO: Complete re-write, this hasnt actually be used in a generic way by mods and we could make it a lot simpler.
|
||||||
public interface IExtensionPoint<T extends Record>
|
public interface IExtensionPoint<T extends Record>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +41,7 @@ public interface IExtensionPoint<T extends Record>
|
|||||||
* where {@code true} means it is from the server and {@code false} means it is from the world save. The return
|
* where {@code true} means it is from the server and {@code false} means it is from the world save. The return
|
||||||
* value of the predicate determines whether the remote version is "compatible" for the purposes of the display test.</p>
|
* value of the predicate determines whether the remote version is "compatible" for the purposes of the display test.</p>
|
||||||
*
|
*
|
||||||
* <p>The local compatibility version may be of the value {@link net.minecraftforge.network.NetworkConstants#IGNORESERVERONLY},
|
* <p>The local compatibility version may be of the value {@link DisplayTest#IGNORESERVERONLY},
|
||||||
* in which case clients will ignore the mod's presence if it is present on the server but not on the client.
|
* in which case clients will ignore the mod's presence if it is present on the server but not on the client.
|
||||||
* However, the remote version test predicate must still accept this value as a remote version in order to display
|
* However, the remote version test predicate must still accept this value as a remote version in order to display
|
||||||
* as compatible if the mod is present on the client.</p>
|
* as compatible if the mod is present on the client.</p>
|
||||||
@@ -94,25 +95,6 @@ public interface IExtensionPoint<T extends Record>
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("JavadocReference") // reference to NetworkConstants, ForgeHooksClient
|
@SuppressWarnings("JavadocReference") // reference to NetworkConstants, ForgeHooksClient
|
||||||
record DisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) implements IExtensionPoint<DisplayTest> {
|
record DisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) implements IExtensionPoint<DisplayTest> {
|
||||||
public static final String IGNORESERVERONLY = "OHNOES\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31";
|
public static final String IGNORESERVERONLY = "SERVER_ONLY";
|
||||||
|
|
||||||
/**
|
|
||||||
* Ignores any version information coming from the server - use for server only mods
|
|
||||||
*/
|
|
||||||
public static final Supplier<DisplayTest> IGNORE_SERVER_VERSION = () -> new DisplayTest(IGNORESERVERONLY, (remoteVersion, isFromServer) -> true);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ignores all information and provides no information
|
|
||||||
*/
|
|
||||||
public static final Supplier<DisplayTest> IGNORE_ALL_VERSION = () -> new DisplayTest("", (remoteVersion, isFromServer) -> true);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An optional alternative to {@link #DisplayTest(Supplier, BiPredicate)} which accepts a constant version string
|
|
||||||
* instead of a {@link Supplier}.
|
|
||||||
* <p>Internally, the provided version string is wrapped in a Supplier for you.</p>
|
|
||||||
*/
|
|
||||||
public DisplayTest(String version, BiPredicate<String, Boolean> remoteVersionTest) {
|
|
||||||
this(() -> version, remoteVersionTest);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,6 @@ import net.minecraftforge.eventbus.api.Event;
|
|||||||
import net.minecraftforge.fml.config.IConfigEvent;
|
import net.minecraftforge.fml.config.IConfigEvent;
|
||||||
import net.minecraftforge.fml.config.ModConfig;
|
import net.minecraftforge.fml.config.ModConfig;
|
||||||
import net.minecraftforge.fml.event.IModBusEvent;
|
import net.minecraftforge.fml.event.IModBusEvent;
|
||||||
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
|
||||||
import net.minecraftforge.fml.loading.progress.ProgressMeter;
|
import net.minecraftforge.fml.loading.progress.ProgressMeter;
|
||||||
import net.minecraftforge.forgespi.language.IModInfo;
|
import net.minecraftforge.forgespi.language.IModInfo;
|
||||||
|
|
||||||
@@ -22,7 +21,6 @@ import java.util.Optional;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.BiPredicate;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@@ -60,16 +58,15 @@ public abstract class ModContainer
|
|||||||
this.modInfo = info;
|
this.modInfo = info;
|
||||||
this.modLoadingStage = ModLoadingStage.CONSTRUCT;
|
this.modLoadingStage = ModLoadingStage.CONSTRUCT;
|
||||||
|
|
||||||
final String displayTestString = info.getConfig().<String>getConfigElement("displayTest")
|
final String displayTestString = info.getConfig().<String>getConfigElement("displayTest").orElse("MATCH_VERSION"); // missing defaults to DEFAULT type
|
||||||
.orElseGet(() -> (Boolean) info.getOwningFile().getFileProperties().getOrDefault(ModFileInfo.CLIENT_SIDE_ONLY_PROP, Boolean.FALSE) ? "IGNORE_ALL_VERSION" : "MATCH_VERSION");
|
|
||||||
Supplier<IExtensionPoint.DisplayTest> displayTestSupplier = switch (displayTestString) {
|
Supplier<IExtensionPoint.DisplayTest> displayTestSupplier = switch (displayTestString) {
|
||||||
case "MATCH_VERSION" -> // default displaytest checks for version string match
|
case "MATCH_VERSION" -> // default displaytest checks for version string match
|
||||||
() -> new IExtensionPoint.DisplayTest(() -> this.modInfo.getVersion().toString(),
|
() -> new IExtensionPoint.DisplayTest(() -> this.modInfo.getVersion().toString(),
|
||||||
(incoming, isNetwork) -> Objects.equals(incoming, this.modInfo.getVersion().toString()));
|
(incoming, isNetwork) -> Objects.equals(incoming, this.modInfo.getVersion().toString()));
|
||||||
case "IGNORE_SERVER_VERSION" -> // Ignores any version information coming from the server - use for server only mods
|
case "IGNORE_SERVER_VERSION" -> // Ignores any version information coming from the server - use for server only mods
|
||||||
IExtensionPoint.DisplayTest.IGNORE_SERVER_VERSION;
|
() -> new IExtensionPoint.DisplayTest(() -> IExtensionPoint.DisplayTest.IGNORESERVERONLY, (incoming, isNetwork) -> true);
|
||||||
case "IGNORE_ALL_VERSION" -> // Ignores all information and provides no information
|
case "IGNORE_ALL_VERSION" -> // Ignores all information and provides no information
|
||||||
IExtensionPoint.DisplayTest.IGNORE_ALL_VERSION;
|
() -> new IExtensionPoint.DisplayTest(() -> "", (incoming, isNetwork) -> true);
|
||||||
case "NONE" -> null; // NO display test at all - use this if you're going to do your own display test
|
case "NONE" -> null; // NO display test at all - use this if you're going to do your own display test
|
||||||
default -> // any other value throws an exception
|
default -> // any other value throws an exception
|
||||||
throw new IllegalArgumentException("Invalid displayTest value supplied in mods.toml");
|
throw new IllegalArgumentException("Invalid displayTest value supplied in mods.toml");
|
||||||
@@ -148,22 +145,6 @@ public abstract class ModContainer
|
|||||||
extensionPoints.put(point, extension);
|
extensionPoints.put(point, extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerDisplayTest(IExtensionPoint.DisplayTest displayTest) {
|
|
||||||
registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> displayTest);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerDisplayTest(Supplier<IExtensionPoint.DisplayTest> displayTest) {
|
|
||||||
registerExtensionPoint(IExtensionPoint.DisplayTest.class, displayTest);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerDisplayTest(String version, BiPredicate<String, Boolean> remoteVersionTest) {
|
|
||||||
registerDisplayTest(new IExtensionPoint.DisplayTest(version, remoteVersionTest));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerDisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) {
|
|
||||||
registerDisplayTest(new IExtensionPoint.DisplayTest(suppliedVersion, remoteVersionTest));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addConfig(final ModConfig modConfig) {
|
public void addConfig(final ModConfig modConfig) {
|
||||||
configs.put(modConfig.getType(), modConfig);
|
configs.put(modConfig.getType(), modConfig);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,54 +8,38 @@ package net.minecraftforge.fml;
|
|||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
import net.minecraftforge.fml.config.IConfigSpec;
|
import net.minecraftforge.fml.config.IConfigSpec;
|
||||||
import net.minecraftforge.fml.config.ModConfig;
|
import net.minecraftforge.fml.config.ModConfig;
|
||||||
|
import net.minecraftforge.fml.loading.FMLLoader;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.function.BiPredicate;
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class ModLoadingContext
|
public class ModLoadingContext
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
private static final ThreadLocal<ModLoadingContext> context = ThreadLocal.withInitial(ModLoadingContext::new);
|
private static final ThreadLocal<ModLoadingContext> context = ThreadLocal.withInitial(ModLoadingContext::new);
|
||||||
private ModContainer activeContainer;
|
|
||||||
private Object languageExtension;
|
private Object languageExtension;
|
||||||
private ModLoadingStage stage;
|
private ModLoadingStage stage;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use the context provided by your language loader in your mod's constructor.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "1.21.1")
|
|
||||||
public static ModLoadingContext get() {
|
public static ModLoadingContext get() {
|
||||||
return context.get();
|
return context.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private ModContainer activeContainer;
|
||||||
* @deprecated Going to be moved to ForgeHooks for internal use.
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "1.21.1")
|
|
||||||
public void setActiveContainer(final ModContainer container) {
|
public void setActiveContainer(final ModContainer container) {
|
||||||
this.activeContainer = container;
|
this.activeContainer = container;
|
||||||
this.languageExtension = container == null ? null : container.contextExtension.get();
|
this.languageExtension = container == null ? null : container.contextExtension.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Going to be moved to ForgeHooks for internal use.
|
|
||||||
* @deprecated Override/Use {@link ModLoadingContext#getContainer()}
|
|
||||||
*/
|
|
||||||
@Deprecated(forRemoval = true, since = "1.21.1")
|
|
||||||
public ModContainer getActiveContainer() {
|
public ModContainer getActiveContainer() {
|
||||||
return activeContainer == null ? ModList.get().getModContainerById("minecraft").orElseThrow(()->new RuntimeException("Where is minecraft???!")) : activeContainer;
|
return activeContainer == null ? ModList.get().getModContainerById("minecraft").orElseThrow(()->new RuntimeException("Where is minecraft???!")) : activeContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(forRemoval = true, since = "1.21.1")
|
|
||||||
public String getActiveNamespace() {
|
public String getActiveNamespace() {
|
||||||
return activeContainer == null ? "minecraft" : activeContainer.getNamespace();
|
return activeContainer == null ? "minecraft" : activeContainer.getNamespace();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModContainer getContainer() {
|
|
||||||
return getActiveContainer();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register an {@link IExtensionPoint} with the mod container.
|
* Register an {@link IExtensionPoint} with the mod container.
|
||||||
* @param point The extension point to register
|
* @param point The extension point to register
|
||||||
@@ -63,67 +47,29 @@ public class ModLoadingContext
|
|||||||
* @param <T> The type signature of the extension operator
|
* @param <T> The type signature of the extension operator
|
||||||
*/
|
*/
|
||||||
public <T extends Record & IExtensionPoint<T>> void registerExtensionPoint(Class<? extends IExtensionPoint<T>> point, Supplier<T> extension) {
|
public <T extends Record & IExtensionPoint<T>> void registerExtensionPoint(Class<? extends IExtensionPoint<T>> point, Supplier<T> extension) {
|
||||||
getContainer().registerExtensionPoint(point, extension);
|
getActiveContainer().registerExtensionPoint(point, extension);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a {@link IExtensionPoint.DisplayTest} with the mod container.
|
|
||||||
* <p>A shorthand for registering a DisplayTest with {@link #registerExtensionPoint(Class, Supplier)}.</p>
|
|
||||||
* @param displayTest The {@link IExtensionPoint.DisplayTest} to register
|
|
||||||
*/
|
|
||||||
public void registerDisplayTest(IExtensionPoint.DisplayTest displayTest) {
|
|
||||||
getContainer().registerDisplayTest(() -> displayTest);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a {@link IExtensionPoint.DisplayTest} with the mod container.
|
|
||||||
* <p>A shorthand for registering a DisplayTest supplier with {@link #registerExtensionPoint(Class, Supplier)}.</p>
|
|
||||||
* @param displayTest The {@link Supplier<IExtensionPoint.DisplayTest>} to register
|
|
||||||
*/
|
|
||||||
public void registerDisplayTest(Supplier<IExtensionPoint.DisplayTest> displayTest) {
|
|
||||||
getContainer().registerDisplayTest(displayTest);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a {@link IExtensionPoint.DisplayTest} with the mod container.
|
|
||||||
* <p>A shorthand for registering a DisplayTest with {@link #registerExtensionPoint(Class, Supplier)} that also
|
|
||||||
* creates the DisplayTest instance for you using the provided parameters.</p>
|
|
||||||
* @see IExtensionPoint.DisplayTest#DisplayTest(String, BiPredicate)
|
|
||||||
*/
|
|
||||||
public void registerDisplayTest(String version, BiPredicate<String, Boolean> remoteVersionTest) {
|
|
||||||
getContainer().registerDisplayTest(new IExtensionPoint.DisplayTest(version, remoteVersionTest));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a {@link IExtensionPoint.DisplayTest} with the mod container.
|
|
||||||
* <p>A shorthand for registering a DisplayTest with {@link #registerExtensionPoint(Class, Supplier)} that also
|
|
||||||
* creates the DisplayTest instance for you using the provided parameters.</p>
|
|
||||||
* @see IExtensionPoint.DisplayTest#DisplayTest(Supplier, BiPredicate)
|
|
||||||
*/
|
|
||||||
public void registerDisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) {
|
|
||||||
getContainer().registerDisplayTest(new IExtensionPoint.DisplayTest(suppliedVersion, remoteVersionTest));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec) {
|
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec) {
|
||||||
if (spec.isEmpty())
|
if (spec.isEmpty())
|
||||||
{
|
{
|
||||||
// This handles the case where a mod tries to register a config, without any options configured inside it.
|
// This handles the case where a mod tries to register a config, without any options configured inside it.
|
||||||
LOGGER.debug("Attempted to register an empty config for type {} on mod {}", type, getContainer().getModId());
|
LOGGER.debug("Attempted to register an empty config for type {} on mod {}", type, getActiveContainer().getModId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getContainer().addConfig(new ModConfig(type, spec, getContainer()));
|
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec, String fileName) {
|
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec, String fileName) {
|
||||||
if (spec.isEmpty())
|
if (spec.isEmpty())
|
||||||
{
|
{
|
||||||
// This handles the case where a mod tries to register a config, without any options configured inside it.
|
// This handles the case where a mod tries to register a config, without any options configured inside it.
|
||||||
LOGGER.debug("Attempted to register an empty config for type {} on mod {} using file name {}", type, getContainer().getModId(), fileName);
|
LOGGER.debug("Attempted to register an empty config for type {} on mod {} using file name {}", type, getActiveContainer().getModId(), fileName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getContainer().addConfig(new ModConfig(type, spec, getContainer(), fileName));
|
getActiveContainer().addConfig(new ModConfig(type, spec, getActiveContainer(), fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ public class VersionChecker
|
|||||||
BETA(),
|
BETA(),
|
||||||
BETA_OUTDATED(6, true);
|
BETA_OUTDATED(6, true);
|
||||||
|
|
||||||
private final int sheetOffset;
|
final int sheetOffset;
|
||||||
private final boolean draw, animated;
|
final boolean draw, animated;
|
||||||
|
|
||||||
Status()
|
Status()
|
||||||
{
|
{
|
||||||
@@ -91,9 +91,6 @@ public class VersionChecker
|
|||||||
return animated;
|
return animated;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOutdated() {
|
|
||||||
return this == OUTDATED || this == BETA_OUTDATED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public record CheckResult(VersionChecker.Status status, ComparableVersion target, Map<ComparableVersion, String> changes, String url) {}
|
public record CheckResult(VersionChecker.Status status, ComparableVersion target, Map<ComparableVersion, String> changes, String url) {}
|
||||||
@@ -260,7 +257,7 @@ public class VersionChecker
|
|||||||
LOGGER.warn("Failed to process update information", e);
|
LOGGER.warn("Failed to process update information", e);
|
||||||
status = FAILED;
|
status = FAILED;
|
||||||
}
|
}
|
||||||
RESULTS.put(mod, new CheckResult(status, target, changes, display_url));
|
results.put(mod, new CheckResult(status, target, changes, display_url));
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
@@ -276,12 +273,12 @@ public class VersionChecker
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<IModInfo, CheckResult> RESULTS = new ConcurrentHashMap<>();
|
private static Map<IModInfo, CheckResult> results = new ConcurrentHashMap<>();
|
||||||
private static final CheckResult PENDING_CHECK = new CheckResult(PENDING, null, null, null);
|
private static final CheckResult PENDING_CHECK = new CheckResult(PENDING, null, null, null);
|
||||||
|
|
||||||
public static CheckResult getResult(IModInfo mod)
|
public static CheckResult getResult(IModInfo mod)
|
||||||
{
|
{
|
||||||
return RESULTS.getOrDefault(mod, PENDING_CHECK);
|
return results.getOrDefault(mod, PENDING_CHECK);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,10 +2,9 @@ plugins {
|
|||||||
id 'com.github.ben-manes.versions'
|
id 'com.github.ben-manes.versions'
|
||||||
id 'org.javamodularity.moduleplugin' version '1.8.7' apply false
|
id 'org.javamodularity.moduleplugin' version '1.8.7' apply false
|
||||||
id 'org.cadixdev.licenser'
|
id 'org.cadixdev.licenser'
|
||||||
|
id 'java-library'
|
||||||
|
id 'jacoco'
|
||||||
}
|
}
|
||||||
apply plugin: 'java-library'
|
|
||||||
apply plugin: 'jacoco'
|
|
||||||
apply plugin: 'org.javamodularity.moduleplugin'
|
|
||||||
|
|
||||||
import org.gradle.internal.os.OperatingSystem
|
import org.gradle.internal.os.OperatingSystem
|
||||||
|
|
||||||
|
|||||||
+41
-69
@@ -14,7 +14,9 @@ import net.minecraftforge.fml.loading.ImmediateWindowProvider;
|
|||||||
import net.minecraftforge.fml.loading.progress.StartupNotificationManager;
|
import net.minecraftforge.fml.loading.progress.StartupNotificationManager;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.lwjgl.PointerBuffer;
|
import org.lwjgl.PointerBuffer;
|
||||||
|
import org.lwjgl.glfw.GLFWImage;
|
||||||
import org.lwjgl.glfw.GLFWVidMode;
|
import org.lwjgl.glfw.GLFWVidMode;
|
||||||
|
import org.lwjgl.stb.STBImage;
|
||||||
import org.lwjgl.system.MemoryStack;
|
import org.lwjgl.system.MemoryStack;
|
||||||
import org.lwjgl.system.MemoryUtil;
|
import org.lwjgl.system.MemoryUtil;
|
||||||
import org.lwjgl.util.tinyfd.TinyFileDialogs;
|
import org.lwjgl.util.tinyfd.TinyFileDialogs;
|
||||||
@@ -28,8 +30,9 @@ import java.io.InputStreamReader;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@@ -37,16 +40,15 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.Semaphore;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.TimeoutException;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.function.IntConsumer;
|
import java.util.function.IntConsumer;
|
||||||
import java.util.function.IntSupplier;
|
import java.util.function.IntSupplier;
|
||||||
import java.util.function.LongSupplier;
|
import java.util.function.LongSupplier;
|
||||||
@@ -76,7 +78,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
private static final Logger LOGGER = LoggerFactory.getLogger("EARLYDISPLAY");
|
private static final Logger LOGGER = LoggerFactory.getLogger("EARLYDISPLAY");
|
||||||
private final AtomicBoolean animationTimerTrigger = new AtomicBoolean(true);
|
private final AtomicBoolean animationTimerTrigger = new AtomicBoolean(true);
|
||||||
|
|
||||||
private ColourScheme colourScheme = ColourScheme.RED;
|
private ColourScheme colourScheme;
|
||||||
private ElementShader elementShader;
|
private ElementShader elementShader;
|
||||||
|
|
||||||
private RenderElement.DisplayContext context;
|
private RenderElement.DisplayContext context;
|
||||||
@@ -84,7 +86,6 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
private int framecount;
|
private int framecount;
|
||||||
private EarlyFramebuffer framebuffer;
|
private EarlyFramebuffer framebuffer;
|
||||||
private ScheduledFuture<?> windowTick;
|
private ScheduledFuture<?> windowTick;
|
||||||
private ScheduledFuture<?> initializationFuture;
|
|
||||||
|
|
||||||
private PerformanceInfo performanceInfo;
|
private PerformanceInfo performanceInfo;
|
||||||
private ScheduledFuture<?> performanceTick;
|
private ScheduledFuture<?> performanceTick;
|
||||||
@@ -133,17 +134,13 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
this.colourScheme = ColourScheme.BLACK;
|
this.colourScheme = ColourScheme.BLACK;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
// check the options file for the colour scheme
|
var optionLines = Files.readAllLines(FMLPaths.GAMEDIR.get().resolve(Paths.get("options.txt")));
|
||||||
var optionLines = Files.readAllLines(FMLPaths.GAMEDIR.get().resolve(Path.of("options.txt")));
|
var options = optionLines.stream().map(l -> l.split(":")).filter(a -> a.length == 2).collect(Collectors.toMap(a -> a[0], a -> a[1]));
|
||||||
var keyName = "darkMojangStudiosBackground:";
|
var colourScheme = Boolean.parseBoolean(options.getOrDefault("darkMojangStudiosBackground", "false"));
|
||||||
for (String line : optionLines) {
|
this.colourScheme = colourScheme ? ColourScheme.BLACK : ColourScheme.RED;
|
||||||
if (line.startsWith(keyName)) {
|
} catch (IOException ioe) {
|
||||||
this.colourScheme = line.startsWith("true", keyName.length()) ? ColourScheme.BLACK : ColourScheme.RED;
|
// No options
|
||||||
break;
|
this.colourScheme = ColourScheme.RED; // default to red colourscheme
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
this.colourScheme = ColourScheme.RED; // fallback to red colourScheme
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.maximized = parsed.has(maximizedopt) || FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_MAXIMIZED);
|
this.maximized = parsed.has(maximizedopt) || FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_MAXIMIZED);
|
||||||
@@ -228,7 +225,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
LOGGER.error("Crash during font initialization", t);
|
LOGGER.error("Crash during font initialization", t);
|
||||||
crashElegantly("An error occurred initializing a font for rendering. "+t.getMessage());
|
crashElegantly("An error occurred initializing a font for rendering. "+t.getMessage());
|
||||||
}
|
}
|
||||||
this.elements = new ArrayList<>(List.of(
|
this.elements = new ArrayList<>(Arrays.asList(
|
||||||
RenderElement.anvil(font),
|
RenderElement.anvil(font),
|
||||||
RenderElement.logMessageOverlay(font),
|
RenderElement.logMessageOverlay(font),
|
||||||
RenderElement.forgeVersionOverlay(font, mcVersion+"-"+forgeVersion.split("-")[0]),
|
RenderElement.forgeVersionOverlay(font, mcVersion+"-"+forgeVersion.split("-")[0]),
|
||||||
@@ -267,6 +264,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
public void render(int alpha) {
|
public void render(int alpha) {
|
||||||
var currentVAO = glGetInteger(GL_VERTEX_ARRAY_BINDING);
|
var currentVAO = glGetInteger(GL_VERTEX_ARRAY_BINDING);
|
||||||
var currentFB = glGetInteger(GL_READ_FRAMEBUFFER_BINDING);
|
var currentFB = glGetInteger(GL_READ_FRAMEBUFFER_BINDING);
|
||||||
|
glfwSwapInterval(0);
|
||||||
glViewport(0, 0, this.context.scaledWidth(), this.context.scaledHeight());
|
glViewport(0, 0, this.context.scaledWidth(), this.context.scaledHeight());
|
||||||
RenderElement.globalAlpha = alpha;
|
RenderElement.globalAlpha = alpha;
|
||||||
framebuffer.activate();
|
framebuffer.activate();
|
||||||
@@ -289,7 +287,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
return thread;
|
return thread;
|
||||||
});
|
});
|
||||||
initWindow(mcVersion);
|
initWindow(mcVersion);
|
||||||
this.initializationFuture = renderScheduler.schedule(() -> initRender(mcVersion, forgeVersion), 1, TimeUnit.MILLISECONDS);
|
renderScheduler.schedule(() -> initRender(mcVersion, forgeVersion), 1, TimeUnit.MILLISECONDS);
|
||||||
return this::periodicTick;
|
return this::periodicTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,15 +360,14 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API);
|
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API);
|
||||||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||||
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
|
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
|
||||||
|
if (mcVersion != null) {
|
||||||
String vanillaWindowTitle = "Minecraft* ";
|
// this emulates what we would get without early progress window
|
||||||
if (mcVersion != null) vanillaWindowTitle += mcVersion;
|
// as vanilla never sets these, so GLFW uses the first window title
|
||||||
|
// set them explicitly to avoid it using "FML early loading progress" as the class
|
||||||
// this emulates what we would get without early progress window
|
String vanillaWindowTitle = "Minecraft* " + mcVersion;
|
||||||
// as vanilla never sets these, so GLFW uses the first window title
|
glfwWindowHintString(GLFW_X11_CLASS_NAME, vanillaWindowTitle);
|
||||||
// set them explicitly to avoid it using "FML early loading progress" as the class
|
glfwWindowHintString(GLFW_X11_INSTANCE_NAME, vanillaWindowTitle);
|
||||||
glfwWindowHintString(GLFW_X11_CLASS_NAME, vanillaWindowTitle);
|
}
|
||||||
glfwWindowHintString(GLFW_X11_INSTANCE_NAME, vanillaWindowTitle);
|
|
||||||
|
|
||||||
long primaryMonitor = glfwGetPrimaryMonitor();
|
long primaryMonitor = glfwGetPrimaryMonitor();
|
||||||
if (primaryMonitor == 0) {
|
if (primaryMonitor == 0) {
|
||||||
@@ -392,8 +389,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
}, 10, TimeUnit.SECONDS);
|
}, 10, TimeUnit.SECONDS);
|
||||||
int versidx = 0;
|
int versidx = 0;
|
||||||
var skipVersions = FMLConfig.<String>getListConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_SKIP_GL_VERSIONS);
|
var skipVersions = FMLConfig.<String>getListConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_SKIP_GL_VERSIONS);
|
||||||
boolean showHelpLog = FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_LOG_HELP_MSG);
|
final String[] lastGLError=new String[GL_VERSIONS.length];
|
||||||
final String[] lastGLError = new String[GL_VERSIONS.length];
|
|
||||||
do {
|
do {
|
||||||
final var glVersionToTry = GL_VERSIONS[versidx][0] + "." + GL_VERSIONS[versidx][1];
|
final var glVersionToTry = GL_VERSIONS[versidx][0] + "." + GL_VERSIONS[versidx][1];
|
||||||
if (skipVersions.contains(glVersionToTry)) {
|
if (skipVersions.contains(glVersionToTry)) {
|
||||||
@@ -402,23 +398,11 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LOGGER.info("Trying GL version " + glVersionToTry);
|
LOGGER.info("Trying GL version " + glVersionToTry);
|
||||||
if (showHelpLog && versidx == 0) {
|
|
||||||
LOGGER.info("""
|
|
||||||
If this message is the only thing at the bottom of your log before a crash, you probably have a driver issue.
|
|
||||||
|
|
||||||
Possible solutions:
|
|
||||||
A) Make sure Minecraft is set to prefer high performance graphics in the OS and/or driver control panel
|
|
||||||
B) Check for driver updates on the graphics brand's website
|
|
||||||
C) Try reinstalling your graphics drivers
|
|
||||||
D) If still not working after trying all of the above, ask for further help on the Forge forums or Discord
|
|
||||||
|
|
||||||
You can safely ignore this message if the game starts up successfully.""");
|
|
||||||
}
|
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, GL_VERSIONS[versidx][0]); // we try our versions one at a time
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, GL_VERSIONS[versidx][0]); // we try our versions one at a time
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, GL_VERSIONS[versidx][1]);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, GL_VERSIONS[versidx][1]);
|
||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||||
window = glfwCreateWindow(winWidth, winHeight, vanillaWindowTitle, 0L, 0L);
|
window = glfwCreateWindow(winWidth, winHeight, "Minecraft: Forge Loading...", 0L, 0L);
|
||||||
var erridx = versidx;
|
var erridx = versidx;
|
||||||
handleLastGLFWError((error, description) -> lastGLError[erridx] = String.format("Trying %d.%d: GLFW error: [0x%X]%s", GL_VERSIONS[erridx][0], GL_VERSIONS[erridx][1], error, description));
|
handleLastGLFWError((error, description) -> lastGLError[erridx] = String.format("Trying %d.%d: GLFW error: [0x%X]%s", GL_VERSIONS[erridx][0], GL_VERSIONS[erridx][1], error, description));
|
||||||
if (lastGLError[versidx] != null) {
|
if (lastGLError[versidx] != null) {
|
||||||
@@ -446,9 +430,6 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
this.glVersion = gotVersion;
|
this.glVersion = gotVersion;
|
||||||
this.window = window;
|
this.window = window;
|
||||||
|
|
||||||
if (showHelpLog)
|
|
||||||
FMLConfig.updateConfig(FMLConfig.ConfigValue.EARLY_WINDOW_LOG_HELP_MSG, false);
|
|
||||||
|
|
||||||
int[] x = new int[1];
|
int[] x = new int[1];
|
||||||
int[] y = new int[1];
|
int[] y = new int[1];
|
||||||
glfwGetMonitorPos(primaryMonitor, x, y);
|
glfwGetMonitorPos(primaryMonitor, x, y);
|
||||||
@@ -466,19 +447,19 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
glfwSetWindowPos(window, (vidmode.width() - this.winWidth) / 2 + monitorX, (vidmode.height() - this.winHeight) / 2 + monitorY);
|
glfwSetWindowPos(window, (vidmode.width() - this.winWidth) / 2 + monitorX, (vidmode.height() - this.winHeight) / 2 + monitorY);
|
||||||
|
|
||||||
// Attempt setting the icon
|
// Attempt setting the icon
|
||||||
// int[] channels = new int[1];
|
int[] channels = new int[1];
|
||||||
// try (var glfwImgBuffer = GLFWImage.create(MemoryUtil.getAllocator().malloc(GLFWImage.SIZEOF), 1)) {
|
try (var glfwImgBuffer = GLFWImage.create(MemoryUtil.getAllocator().malloc(GLFWImage.SIZEOF), 1)) {
|
||||||
// final ByteBuffer imgBuffer;
|
final ByteBuffer imgBuffer;
|
||||||
// try (GLFWImage glfwImages = GLFWImage.malloc()) {
|
try (GLFWImage glfwImages = GLFWImage.malloc()) {
|
||||||
// imgBuffer = STBHelper.loadImageFromClasspath("forge_logo.png", 20000, x, y, channels);
|
imgBuffer = STBHelper.loadImageFromClasspath("forge_logo.png", 20000, x, y, channels);
|
||||||
// glfwImgBuffer.put(glfwImages.set(x[0], y[0], imgBuffer));
|
glfwImgBuffer.put(glfwImages.set(x[0], y[0], imgBuffer));
|
||||||
// glfwSetWindowIcon(window, glfwImgBuffer);
|
glfwSetWindowIcon(window, glfwImgBuffer);
|
||||||
// STBImage.stbi_image_free(imgBuffer);
|
STBImage.stbi_image_free(imgBuffer);
|
||||||
// }
|
}
|
||||||
// } catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
// System.err.println("Failed to load forge logo");
|
System.err.println("Failed to load forge logo");
|
||||||
// }
|
}
|
||||||
// handleLastGLFWError((error, description) -> LOGGER.debug(String.format("Suppressing GLFW icon error: [0x%X]%s", error, description)));
|
handleLastGLFWError((error, description) -> LOGGER.debug(String.format("Suppressing GLFW icon error: [0x%X]%s", error, description)));
|
||||||
|
|
||||||
glfwSetFramebufferSizeCallback(window, this::fbResize);
|
glfwSetFramebufferSizeCallback(window, this::fbResize);
|
||||||
glfwSetWindowPosCallback(window, this::winMove);
|
glfwSetWindowPosCallback(window, this::winMove);
|
||||||
@@ -537,16 +518,6 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
* @return the Window we own.
|
* @return the Window we own.
|
||||||
*/
|
*/
|
||||||
public long setupMinecraftWindow(final IntSupplier width, final IntSupplier height, final Supplier<String> title, final LongSupplier monitorSupplier) {
|
public long setupMinecraftWindow(final IntSupplier width, final IntSupplier height, final Supplier<String> title, final LongSupplier monitorSupplier) {
|
||||||
// wait for the window to actually be initialized
|
|
||||||
try {
|
|
||||||
this.initializationFuture.get(30, TimeUnit.SECONDS);
|
|
||||||
} catch (InterruptedException | ExecutionException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (TimeoutException e) {
|
|
||||||
Thread.dumpStack();
|
|
||||||
crashElegantly("We seem to be having trouble initializing the window, waited for 30 seconds");
|
|
||||||
}
|
|
||||||
|
|
||||||
// we have to spin wait for the window ticker
|
// we have to spin wait for the window ticker
|
||||||
ImmediateWindowHandler.updateProgress("Initializing Game Graphics");
|
ImmediateWindowHandler.updateProgress("Initializing Game Graphics");
|
||||||
while (!this.windowTick.isDone()) {
|
while (!this.windowTick.isDone()) {
|
||||||
@@ -613,7 +584,8 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
|||||||
var fm = layer.findModule("forge").orElseThrow();
|
var fm = layer.findModule("forge").orElseThrow();
|
||||||
getClass().getModule().addReads(fm);
|
getClass().getModule().addReads(fm);
|
||||||
var clz = FMLLoader.getGameLayer().findModule("forge").map(l->Class.forName(l, "net.minecraftforge.client.loading.ForgeLoadingOverlay")).orElseThrow();
|
var clz = FMLLoader.getGameLayer().findModule("forge").map(l->Class.forName(l, "net.minecraftforge.client.loading.ForgeLoadingOverlay")).orElseThrow();
|
||||||
loadingOverlay = Arrays.stream(clz.getMethods()).filter(m-> Modifier.isStatic(m.getModifiers()) && m.getName().equals("newInstance")).findFirst().orElseThrow();
|
var methods = Arrays.stream(clz.getMethods()).filter(m-> Modifier.isStatic(m.getModifiers())).collect(Collectors.toMap(Method::getName, Function.identity()));
|
||||||
|
loadingOverlay = methods.get("newInstance");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFramebufferTextureId() {
|
public int getFramebufferTextureId() {
|
||||||
|
|||||||
+7
-16
@@ -6,44 +6,35 @@
|
|||||||
package net.minecraftforge.fml.earlydisplay;
|
package net.minecraftforge.fml.earlydisplay;
|
||||||
|
|
||||||
import com.sun.management.OperatingSystemMXBean;
|
import com.sun.management.OperatingSystemMXBean;
|
||||||
import net.minecraftforge.fml.loading.FMLConfig;
|
|
||||||
|
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.lang.management.MemoryMXBean;
|
import java.lang.management.MemoryMXBean;
|
||||||
import java.lang.management.MemoryUsage;
|
import java.lang.management.MemoryUsage;
|
||||||
|
|
||||||
public class PerformanceInfo {
|
public class PerformanceInfo {
|
||||||
private static final MemoryMXBean MEMORY_BEAN = ManagementFactory.getMemoryMXBean();
|
|
||||||
|
|
||||||
private final boolean showCPUUsage;
|
|
||||||
private final OperatingSystemMXBean osBean;
|
private final OperatingSystemMXBean osBean;
|
||||||
|
private final MemoryMXBean memoryBean;
|
||||||
float memory;
|
float memory;
|
||||||
private String text;
|
private String text;
|
||||||
|
|
||||||
PerformanceInfo() {
|
PerformanceInfo() {
|
||||||
showCPUUsage = FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_SHOW_CPU);
|
osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
|
||||||
osBean = showCPUUsage ? ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class) : null;
|
memoryBean = ManagementFactory.getMemoryMXBean();
|
||||||
}
|
}
|
||||||
|
|
||||||
void update() {
|
void update() {
|
||||||
final MemoryUsage heapusage = MEMORY_BEAN.getHeapMemoryUsage();
|
final MemoryUsage heapusage = memoryBean.getHeapMemoryUsage();
|
||||||
memory = (float) heapusage.getUsed() / heapusage.getMax();
|
memory = (float) heapusage.getUsed() / heapusage.getMax();
|
||||||
|
|
||||||
if (!showCPUUsage) {
|
|
||||||
text = "Memory: %d/%dMB (%.1f%%)".formatted(heapusage.getUsed() >>> 20, heapusage.getMax() >>> 20, memory * 100f);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var cpuLoad = osBean.getProcessCpuLoad();
|
var cpuLoad = osBean.getProcessCpuLoad();
|
||||||
String cpuText;
|
String cpuText;
|
||||||
if (cpuLoad == -1) {
|
if (cpuLoad == -1) {
|
||||||
cpuText = "*CPU: %.1f%%".formatted(osBean.getCpuLoad() * 100f);
|
cpuText = String.format("*CPU: %.1f%%", osBean.getCpuLoad() * 100f);
|
||||||
} else {
|
} else {
|
||||||
cpuText = "CPU: %.1f%%".formatted(cpuLoad * 100f);
|
cpuText = String.format("CPU: %.1f%%", cpuLoad * 100f);
|
||||||
}
|
}
|
||||||
|
|
||||||
text = "Memory: %d/%dMB (%.1f%%) %s".formatted(heapusage.getUsed() >>> 20, heapusage.getMax() >>> 20, memory * 100f, cpuText);
|
text = String.format("Heap: %d/%d MB (%.1f%%) OffHeap: %d MB %s", heapusage.getUsed() >> 20, heapusage.getMax() >> 20, memory * 100.0, memoryBean.getNonHeapMemoryUsage().getUsed() >> 20, cpuText);
|
||||||
}
|
}
|
||||||
|
|
||||||
String text() {
|
String text() {
|
||||||
|
|||||||
+2
-8
@@ -34,14 +34,11 @@ public class RenderElement {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@FunctionalInterface
|
|
||||||
interface TextureRenderer {
|
interface TextureRenderer {
|
||||||
void accept(SimpleBufferBuilder bb, DisplayContext context, int[] size, int frame);
|
void accept(SimpleBufferBuilder bb, DisplayContext context, int[] size, int frame);
|
||||||
}
|
}
|
||||||
@FunctionalInterface
|
|
||||||
interface Initializer extends Supplier<Renderer> {}
|
interface Initializer extends Supplier<Renderer> {}
|
||||||
|
|
||||||
@FunctionalInterface
|
|
||||||
interface TextGenerator {
|
interface TextGenerator {
|
||||||
void accept(SimpleBufferBuilder bb, SimpleFont fh, DisplayContext ctx);
|
void accept(SimpleBufferBuilder bb, SimpleFont fh, DisplayContext ctx);
|
||||||
}
|
}
|
||||||
@@ -204,17 +201,14 @@ public class RenderElement {
|
|||||||
bar.then(label).accept(buffer, context, frameNumber);
|
bar.then(label).accept(buffer, context, frameNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
|
||||||
interface ColourFunction {
|
interface ColourFunction {
|
||||||
int colour(int frame);
|
int colour(int frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
|
||||||
interface ProgressDisplay {
|
interface ProgressDisplay {
|
||||||
float[] progress(int frame);
|
float[] progress(int frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
|
||||||
interface BarPosition {
|
interface BarPosition {
|
||||||
int[] location(DisplayContext context);
|
int[] location(DisplayContext context);
|
||||||
}
|
}
|
||||||
@@ -286,7 +280,7 @@ public class RenderElement {
|
|||||||
if (num < min) {
|
if (num < min) {
|
||||||
return min;
|
return min;
|
||||||
} else {
|
} else {
|
||||||
return Math.min(num, max);
|
return num > max ? max : num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,7 +288,7 @@ public class RenderElement {
|
|||||||
if (num < min) {
|
if (num < min) {
|
||||||
return min;
|
return min;
|
||||||
} else {
|
} else {
|
||||||
return Math.min(num, max);
|
return num > max ? max : num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ plugins {
|
|||||||
id 'com.github.ben-manes.versions'
|
id 'com.github.ben-manes.versions'
|
||||||
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
||||||
id 'org.cadixdev.licenser'
|
id 'org.cadixdev.licenser'
|
||||||
|
id 'java-library'
|
||||||
|
id 'jacoco'
|
||||||
}
|
}
|
||||||
apply plugin: 'java-library'
|
|
||||||
apply plugin: 'jacoco'
|
|
||||||
apply plugin: 'org.javamodularity.moduleplugin'
|
|
||||||
|
|
||||||
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
||||||
configurations.forEach{ it.transitive = false }
|
configurations.forEach{ it.transitive = false }
|
||||||
@@ -77,7 +76,7 @@ jar.doFirst {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
options.compilerArgs << '-Xlint:-unchecked'
|
options.compilerArgs << '-Xlint:unchecked'
|
||||||
}
|
}
|
||||||
|
|
||||||
license {
|
license {
|
||||||
|
|||||||
+6
-13
@@ -36,9 +36,9 @@ import cpw.mods.modlauncher.serviceapi.ILaunchPluginService;
|
|||||||
*/
|
*/
|
||||||
public class CapabilityTokenSubclass implements ILaunchPluginService {
|
public class CapabilityTokenSubclass implements ILaunchPluginService {
|
||||||
|
|
||||||
private static final String FUNC_NAME = "getType";
|
private final String FUNC_NAME = "getType";
|
||||||
private static final String FUNC_DESC = "()Ljava/lang/String;";
|
private final String FUNC_DESC = "()Ljava/lang/String;";
|
||||||
private static final String CAP_INJECT = "net/minecraftforge/common/capabilities/CapabilityToken"; //Don't directly reference this to prevent class loading.
|
private final String CAP_INJECT = "net/minecraftforge/common/capabilities/CapabilityToken"; //Don't directly reference this to prevent class loading.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
@@ -51,14 +51,7 @@ public class CapabilityTokenSubclass implements ILaunchPluginService {
|
|||||||
@Override
|
@Override
|
||||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
|
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
|
||||||
{
|
{
|
||||||
if (isEmpty)
|
return isEmpty ? NAY : YAY;
|
||||||
return NAY;
|
|
||||||
|
|
||||||
String internalName = classType.getInternalName();
|
|
||||||
if (internalName.startsWith("net/minecraft/") || internalName.startsWith("com/mojang/"))
|
|
||||||
return NAY;
|
|
||||||
|
|
||||||
return YAY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -82,7 +75,7 @@ public class CapabilityTokenSubclass implements ILaunchPluginService {
|
|||||||
SignatureReader reader = new SignatureReader(classNode.signature); // Having a node version of this would probably be useful.
|
SignatureReader reader = new SignatureReader(classNode.signature); // Having a node version of this would probably be useful.
|
||||||
reader.accept(new SignatureVisitor(Opcodes.ASM9)
|
reader.accept(new SignatureVisitor(Opcodes.ASM9)
|
||||||
{
|
{
|
||||||
final Deque<String> stack = new ArrayDeque<>();
|
Deque<String> stack = new ArrayDeque<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitClassType(final String name)
|
public void visitClassType(final String name)
|
||||||
@@ -120,7 +113,7 @@ public class CapabilityTokenSubclass implements ILaunchPluginService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class Holder {
|
private static class Holder {
|
||||||
String value;
|
String value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-30
@@ -8,7 +8,6 @@ package net.minecraftforge.fml.common.asm;
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -36,11 +35,7 @@ public class ObjectHolderDefinalize implements ILaunchPluginService {
|
|||||||
new VanillaObjectHolderData("net.minecraft.core.particles.ParticleTypes", "particle_type", "net.minecraft.core.particles.ParticleType"),
|
new VanillaObjectHolderData("net.minecraft.core.particles.ParticleTypes", "particle_type", "net.minecraft.core.particles.ParticleType"),
|
||||||
new VanillaObjectHolderData("net.minecraft.sounds.SoundEvents", "sound_event", "net.minecraft.sounds.SoundEvent")
|
new VanillaObjectHolderData("net.minecraft.sounds.SoundEvents", "sound_event", "net.minecraft.sounds.SoundEvent")
|
||||||
).collect(Collectors.toMap(VanillaObjectHolderData::holderClass, Function.identity()));
|
).collect(Collectors.toMap(VanillaObjectHolderData::holderClass, Function.identity()));
|
||||||
private static final Set<String> VANILLA_OBJECT_HOLDER_CLASSES = VANILLA_OBJECT_HOLDERS.keySet().stream()
|
private final String OBJECT_HOLDER = "Lnet/minecraftforge/registries/ObjectHolder;"; //Don't directly reference this to prevent class loading.
|
||||||
.map(it -> it.replace('.', '/'))
|
|
||||||
.collect(Collectors.toUnmodifiableSet());
|
|
||||||
private static final String OBJECT_HOLDER = "Lnet/minecraftforge/registries/ObjectHolder;"; //Don't directly reference this to prevent class loading.
|
|
||||||
private static final int PUBLIC_STATIC_FINAL_FLAGS = Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
@@ -51,30 +46,13 @@ public class ObjectHolderDefinalize implements ILaunchPluginService {
|
|||||||
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
|
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty) {
|
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
|
||||||
if (isEmpty)
|
{
|
||||||
return NAY;
|
return isEmpty ? NAY : YAY;
|
||||||
|
|
||||||
// Let's skip processing classes that definitely don't have object holders
|
|
||||||
String internalName = classType.getInternalName();
|
|
||||||
|
|
||||||
// Forge classes that aren't in the debug package (that package is used for tests)
|
|
||||||
if (internalName.startsWith("net/minecraftforge/") && !internalName.substring(18).contains("debug")
|
|
||||||
&& !internalName.equals("net/minecraftforge/common/crafting/ConditionalRecipe"))
|
|
||||||
return NAY;
|
|
||||||
|
|
||||||
// Vanilla classes that don't have object holders
|
|
||||||
if (internalName.startsWith("com/mojang/"))
|
|
||||||
return NAY;
|
|
||||||
|
|
||||||
// ...except specific ones we added to the VANILLA_OBJECT_HOLDERS map
|
|
||||||
if (internalName.startsWith("net/minecraft/") && !VANILLA_OBJECT_HOLDER_CLASSES.contains(internalName))
|
|
||||||
return NAY;
|
|
||||||
|
|
||||||
return YAY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasHolder(List<AnnotationNode> lst) {
|
private boolean hasHolder(List<AnnotationNode> lst)
|
||||||
|
{
|
||||||
return lst != null && lst.stream().anyMatch(n -> n.desc.equals(OBJECT_HOLDER));
|
return lst != null && lst.stream().anyMatch(n -> n.desc.equals(OBJECT_HOLDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,9 +75,10 @@ public class ObjectHolderDefinalize implements ILaunchPluginService {
|
|||||||
{
|
{
|
||||||
final AtomicBoolean changes = new AtomicBoolean();
|
final AtomicBoolean changes = new AtomicBoolean();
|
||||||
//Must be public static finals, and non-array objects
|
//Must be public static finals, and non-array objects
|
||||||
|
final int flags = Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL;
|
||||||
|
|
||||||
//Fix Annotated Fields before injecting from class level
|
//Fix Annotated Fields before injecting from class level
|
||||||
classNode.fields.stream().filter(f -> ((f.access & PUBLIC_STATIC_FINAL_FLAGS) == PUBLIC_STATIC_FINAL_FLAGS) && f.desc.startsWith("L") && hasHolder(f.visibleAnnotations)).forEach(f ->
|
classNode.fields.stream().filter(f -> ((f.access & flags) == flags) && f.desc.startsWith("L") && hasHolder(f.visibleAnnotations)).forEach(f ->
|
||||||
{
|
{
|
||||||
int prev = f.access;
|
int prev = f.access;
|
||||||
f.access &= ~Opcodes.ACC_FINAL; //Strip final
|
f.access &= ~Opcodes.ACC_FINAL; //Strip final
|
||||||
@@ -109,7 +88,7 @@ public class ObjectHolderDefinalize implements ILaunchPluginService {
|
|||||||
|
|
||||||
if (VANILLA_OBJECT_HOLDERS.containsKey(classType.getClassName())) //Class level, de-finalize all fields and add @ObjectHolder to them!
|
if (VANILLA_OBJECT_HOLDERS.containsKey(classType.getClassName())) //Class level, de-finalize all fields and add @ObjectHolder to them!
|
||||||
{
|
{
|
||||||
classNode.fields.stream().filter(f -> ((f.access & PUBLIC_STATIC_FINAL_FLAGS) == PUBLIC_STATIC_FINAL_FLAGS) && f.desc.startsWith("L")).forEach(f ->
|
classNode.fields.stream().filter(f -> ((f.access & flags) == flags) && f.desc.startsWith("L")).forEach(f ->
|
||||||
{
|
{
|
||||||
int prev = f.access;
|
int prev = f.access;
|
||||||
f.access &= ~Opcodes.ACC_FINAL;
|
f.access &= ~Opcodes.ACC_FINAL;
|
||||||
|
|||||||
+23
-28
@@ -30,16 +30,15 @@ import org.slf4j.MarkerFactory;
|
|||||||
public class RuntimeEnumExtender implements ILaunchPluginService {
|
public class RuntimeEnumExtender implements ILaunchPluginService {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
private static final Type STRING = Type.getType(String.class);
|
private final Type STRING = Type.getType(String.class);
|
||||||
private static final Type ENUM = Type.getType(Enum.class);
|
private final Type ENUM = Type.getType(Enum.class);
|
||||||
private static final Type MARKER_IFACE = Type.getType("Lnet/minecraftforge/common/IExtensibleEnum;");
|
private final Type MARKER_IFACE = Type.getType("Lnet/minecraftforge/common/IExtensibleEnum;");
|
||||||
private static final Type ARRAY_UTILS = Type.getType("Lorg/apache/commons/lang3/ArrayUtils;"); //Don't directly reference this to prevent class loading.
|
private final Type ARRAY_UTILS = Type.getType("Lorg/apache/commons/lang3/ArrayUtils;"); //Don't directly reference this to prevent class loading.
|
||||||
private static final String ADD_DESC = Type.getMethodDescriptor(Type.getType(Object[].class), Type.getType(Object[].class), Type.getType(Object.class));
|
private final String ADD_DESC = Type.getMethodDescriptor(Type.getType(Object[].class), Type.getType(Object[].class), Type.getType(Object.class));
|
||||||
private static final Type UNSAFE_HACKS = Type.getType("Lnet/minecraftforge/fml/unsafe/UnsafeHacks;"); //Again, not direct reference to prevent class loading.
|
private final Type UNSAFE_HACKS = Type.getType("Lnet/minecraftforge/fml/unsafe/UnsafeHacks;"); //Again, not direct reference to prevent class loading.
|
||||||
private static final String CLEAN_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(Class.class));
|
private final String CLEAN_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, Type.getType(Class.class));
|
||||||
private static final String NAME_DESC = Type.getMethodDescriptor(STRING);
|
private final String NAME_DESC = Type.getMethodDescriptor(STRING);
|
||||||
private static final String EQUALS_DESC = Type.getMethodDescriptor(Type.BOOLEAN_TYPE, STRING);
|
private final String EQUALS_DESC = Type.getMethodDescriptor(Type.BOOLEAN_TYPE, STRING);
|
||||||
private static final int FLAGS = Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_SYNTHETIC;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
@@ -50,15 +49,9 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
|
|||||||
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
|
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty) {
|
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
|
||||||
if (isEmpty)
|
{
|
||||||
return NAY;
|
return isEmpty ? NAY : YAY;
|
||||||
|
|
||||||
String internalName = classType.getInternalName();
|
|
||||||
if (internalName.startsWith("net/minecraftforge/") || internalName.startsWith("com/mojang/"))
|
|
||||||
return NAY;
|
|
||||||
|
|
||||||
return YAY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,24 +60,25 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
|
|||||||
if ((classNode.access & Opcodes.ACC_ENUM) == 0)
|
if ((classNode.access & Opcodes.ACC_ENUM) == 0)
|
||||||
return ComputeFlags.NO_REWRITE;
|
return ComputeFlags.NO_REWRITE;
|
||||||
|
|
||||||
if (!classNode.interfaces.contains(MARKER_IFACE.getInternalName()))
|
|
||||||
return ComputeFlags.NO_REWRITE;
|
|
||||||
|
|
||||||
Type array = Type.getType("[" + classType.getDescriptor());
|
Type array = Type.getType("[" + classType.getDescriptor());
|
||||||
String arrayDesc = array.getDescriptor();
|
final int flags = Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL | Opcodes.ACC_SYNTHETIC;
|
||||||
|
|
||||||
FieldNode values = classNode.fields.stream().filter(f -> f.desc.equals(arrayDesc) && ((f.access & FLAGS) == FLAGS)).findFirst().orElse(null);
|
FieldNode values = classNode.fields.stream().filter(f -> f.desc.contentEquals(array.getDescriptor()) && ((f.access & flags) == flags)).findFirst().orElse(null);
|
||||||
|
|
||||||
|
if (!classNode.interfaces.contains(MARKER_IFACE.getInternalName())) {
|
||||||
|
return ComputeFlags.NO_REWRITE;
|
||||||
|
}
|
||||||
|
|
||||||
//Static methods named "create" with first argument as a string
|
//Static methods named "create" with first argument as a string
|
||||||
List<MethodNode> candidates = classNode.methods.stream()
|
List<MethodNode> candidates = classNode.methods.stream()
|
||||||
.filter(m -> ((m.access & Opcodes.ACC_STATIC) != 0) && m.name.equals("create"))
|
.filter(m -> ((m.access & Opcodes.ACC_STATIC) != 0) && m.name.equals("create"))
|
||||||
.toList();
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (candidates.isEmpty()) {
|
if (candidates.isEmpty()) {
|
||||||
throw new IllegalStateException("IExtensibleEnum has no candidate factory methods: " + classType.getClassName());
|
throw new IllegalStateException("IExtensibleEnum has no candidate factory methods: " + classType.getClassName());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var mtd : candidates)
|
candidates.forEach(mtd ->
|
||||||
{
|
{
|
||||||
Type[] args = Type.getArgumentTypes(mtd.desc);
|
Type[] args = Type.getArgumentTypes(mtd.desc);
|
||||||
if (args.length == 0 || !args[0].equals(STRING)) {
|
if (args.length == 0 || !args[0].equals(STRING)) {
|
||||||
@@ -116,7 +110,8 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
|
|||||||
Type[] ctrArgs = new Type[args.length + 1];
|
Type[] ctrArgs = new Type[args.length + 1];
|
||||||
ctrArgs[0] = STRING;
|
ctrArgs[0] = STRING;
|
||||||
ctrArgs[1] = Type.INT_TYPE;
|
ctrArgs[1] = Type.INT_TYPE;
|
||||||
System.arraycopy(args, 1, ctrArgs, 2, args.length - 1);
|
for (int x = 1; x < args.length; x++)
|
||||||
|
ctrArgs[1 + x] = args[x];
|
||||||
|
|
||||||
String desc = Type.getMethodDescriptor(Type.VOID_TYPE, ctrArgs);
|
String desc = Type.getMethodDescriptor(Type.VOID_TYPE, ctrArgs);
|
||||||
|
|
||||||
@@ -238,7 +233,7 @@ public class RuntimeEnumExtender implements ILaunchPluginService {
|
|||||||
ins.load(vars, classType);
|
ins.load(vars, classType);
|
||||||
ins.areturn(classType);
|
ins.areturn(classType);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
return ComputeFlags.COMPUTE_FRAMES;
|
return ComputeFlags.COMPUTE_FRAMES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,9 +36,7 @@ public class FMLConfig
|
|||||||
EARLY_WINDOW_FBSCALE("earlyWindowFBScale", 1, "Early window framebuffer scale"),
|
EARLY_WINDOW_FBSCALE("earlyWindowFBScale", 1, "Early window framebuffer scale"),
|
||||||
EARLY_WINDOW_MAXIMIZED("earlyWindowMaximized", Boolean.FALSE, "Early window starts maximized"),
|
EARLY_WINDOW_MAXIMIZED("earlyWindowMaximized", Boolean.FALSE, "Early window starts maximized"),
|
||||||
EARLY_WINDOW_SKIP_GL_VERSIONS("earlyWindowSkipGLVersions", List.of(), "Skip specific GL versions, may help with buggy graphics card drivers"),
|
EARLY_WINDOW_SKIP_GL_VERSIONS("earlyWindowSkipGLVersions", List.of(), "Skip specific GL versions, may help with buggy graphics card drivers"),
|
||||||
EARLY_WINDOW_SQUIR("earlyWindowSquir", Boolean.FALSE, "Squir?"),
|
EARLY_WINDOW_SQUIR("earlyWindowSquir", Boolean.FALSE, "Squir?")
|
||||||
EARLY_WINDOW_SHOW_CPU("earlyWindowShowCPU", Boolean.FALSE, "Whether to show CPU usage stats in early window"),
|
|
||||||
EARLY_WINDOW_LOG_HELP_MSG("earlyWindowLogHelpMessage", Boolean.TRUE, "Whether to log a help message on first attempt, to aid troubleshooting. This setting should automatically disable itself after a successful launch"),
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String entry;
|
private final String entry;
|
||||||
|
|||||||
@@ -65,9 +65,6 @@ public class FMLLoader
|
|||||||
throw new IncompatibleEnvironmentException("Incompatible modlauncher found "+modLauncherPackage.getSpecificationVersion());
|
throw new IncompatibleEnvironmentException("Incompatible modlauncher found "+modLauncherPackage.getSpecificationVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allows us to communicate properties with other services through ModLauncher
|
|
||||||
setupBlackboardKeys();
|
|
||||||
|
|
||||||
accessTransformer = (AccessTransformerService) environment.findLaunchPlugin("accesstransformer").orElseThrow(()-> {
|
accessTransformer = (AccessTransformerService) environment.findLaunchPlugin("accesstransformer").orElseThrow(()-> {
|
||||||
LOGGER.error(CORE, "Access Transformer library is missing, we need this to run");
|
LOGGER.error(CORE, "Access Transformer library is missing, we need this to run");
|
||||||
return new IncompatibleEnvironmentException("Missing AccessTransformer, cannot run");
|
return new IncompatibleEnvironmentException("Missing AccessTransformer, cannot run");
|
||||||
@@ -129,12 +126,6 @@ public class FMLLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setupBlackboardKeys() {
|
|
||||||
LOGGER.debug(CORE, "Requesting CoreMods to not apply the fix for ASMAPI.findFirstInstructionBefore by default");
|
|
||||||
var blackboardKey = TypesafeMap.Key.getOrCreate(Launcher.INSTANCE.blackboard(), "coremods.use_old_findFirstInstructionBefore", Boolean.class);
|
|
||||||
Launcher.INSTANCE.blackboard().<Boolean>computeIfAbsent(blackboardKey, k -> true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setupLaunchHandler(final IEnvironment environment, final Map<String, Object> arguments)
|
static void setupLaunchHandler(final IEnvironment environment, final Map<String, Object> arguments)
|
||||||
{
|
{
|
||||||
final String launchTarget = environment.getProperty(IEnvironment.Keys.LAUNCHTARGET.get()).orElse("MISSING");
|
final String launchTarget = environment.getProperty(IEnvironment.Keys.LAUNCHTARGET.get()).orElse("MISSING");
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public class RuntimeDistCleaner implements ILaunchPluginService
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean remove(final List<AnnotationNode> anns, final String side)
|
private boolean remove(final List<AnnotationNode> anns, final String side)
|
||||||
{
|
{
|
||||||
return unpack(anns).stream().
|
return unpack(anns).stream().
|
||||||
filter(ann->Objects.equals(ann.desc, ONLYIN)).
|
filter(ann->Objects.equals(ann.desc, ONLYIN)).
|
||||||
@@ -169,15 +169,9 @@ public class RuntimeDistCleaner implements ILaunchPluginService
|
|||||||
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
|
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty) {
|
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
|
||||||
if (isEmpty)
|
{
|
||||||
return NAY;
|
return isEmpty ? NAY : YAY;
|
||||||
|
|
||||||
String internalName = classType.getInternalName();
|
|
||||||
if (internalName.startsWith("net/minecraftforge/"))
|
|
||||||
return NAY;
|
|
||||||
|
|
||||||
return YAY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class LambdaGatherer extends MethodVisitor {
|
private static class LambdaGatherer extends MethodVisitor {
|
||||||
|
|||||||
@@ -18,15 +18,12 @@ import java.util.function.BiPredicate;
|
|||||||
public class VersionSupportMatrix {
|
public class VersionSupportMatrix {
|
||||||
private static final HashMap<String, List<ArtifactVersion>> overrideVersions = new HashMap<>();
|
private static final HashMap<String, List<ArtifactVersion>> overrideVersions = new HashMap<>();
|
||||||
static {
|
static {
|
||||||
// final ArtifactVersion version = new DefaultArtifactVersion(FMLLoader.versionInfo().mcVersion());
|
final ArtifactVersion version = new DefaultArtifactVersion(FMLLoader.versionInfo().mcVersion());
|
||||||
// if (MavenVersionAdapter.createFromVersionSpec("[1.19.2]").containsVersion(version)) {
|
if (MavenVersionAdapter.createFromVersionSpec("[1.19.2]").containsVersion(version)) {
|
||||||
// // 1.19.2 is Compatible with 1.19.1
|
// 1.19.2 is Compatible with 1.19.1
|
||||||
// add("languageloader.javafml", "42");
|
add("languageloader.javafml", "42");
|
||||||
// add("mod.minecraft", "1.19.1");
|
add("mod.minecraft", "1.19.1");
|
||||||
// add("mod.forge", "42.0.9");
|
add("mod.forge", "42.0.9");
|
||||||
// }
|
|
||||||
if (FMLLoader.versionInfo().mcVersion().equals("1.20.1")) {
|
|
||||||
add("mod.forge", "47.1.79");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static void add(String key, String value) {
|
private static void add(String key, String value) {
|
||||||
|
|||||||
+1
-6
@@ -34,11 +34,6 @@ public abstract class AbstractModProvider implements IModProvider
|
|||||||
protected static final String MANIFEST = "META-INF/MANIFEST.MF";
|
protected static final String MANIFEST = "META-INF/MANIFEST.MF";
|
||||||
|
|
||||||
protected IModLocator.ModFileOrException createMod(Path... path) {
|
protected IModLocator.ModFileOrException createMod(Path... path) {
|
||||||
return this.createMod(getDefaultJarModType(), path);
|
|
||||||
}
|
|
||||||
|
|
||||||
// FORGE: Backporting artifact, the defaultType must be the first parameter since path is varargs
|
|
||||||
protected IModLocator.ModFileOrException createMod(String defaultType, Path... path) {
|
|
||||||
var mjm = new ModJarMetadata();
|
var mjm = new ModJarMetadata();
|
||||||
var sj = SecureJar.from(
|
var sj = SecureJar.from(
|
||||||
Manifest::new,
|
Manifest::new,
|
||||||
@@ -50,7 +45,7 @@ public abstract class AbstractModProvider implements IModProvider
|
|||||||
IModFile mod;
|
IModFile mod;
|
||||||
var type = sj.moduleDataProvider().getManifest().getMainAttributes().getValue(ModFile.TYPE);
|
var type = sj.moduleDataProvider().getManifest().getMainAttributes().getValue(ModFile.TYPE);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
type = defaultType;
|
type = getDefaultJarModType();
|
||||||
}
|
}
|
||||||
if (sj.moduleDataProvider().findFile(MODS_TOML).isPresent()) {
|
if (sj.moduleDataProvider().findFile(MODS_TOML).isPresent()) {
|
||||||
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MODS_TOML, type, path);
|
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MODS_TOML, type, path);
|
||||||
|
|||||||
+1
-8
@@ -81,14 +81,7 @@ public class JarInJarDependencyLocator extends AbstractJarFileDependencyLocator
|
|||||||
final Map<String, ?> outerFsArgs = ImmutableMap.of("packagePath", pathInModFile);
|
final Map<String, ?> outerFsArgs = ImmutableMap.of("packagePath", pathInModFile);
|
||||||
final FileSystem zipFS = FileSystems.newFileSystem(filePathUri, outerFsArgs);
|
final FileSystem zipFS = FileSystems.newFileSystem(filePathUri, outerFsArgs);
|
||||||
final Path pathInFS = zipFS.getPath("/");
|
final Path pathInFS = zipFS.getPath("/");
|
||||||
final IModFile.Type parentType = file.getType();
|
return Optional.of(createMod(pathInFS).file());
|
||||||
final String modType;
|
|
||||||
if (parentType == IModFile.Type.LIBRARY || parentType == IModFile.Type.LANGPROVIDER) {
|
|
||||||
modType = IModFile.Type.LIBRARY.name();
|
|
||||||
} else {
|
|
||||||
modType = IModFile.Type.GAMELIBRARY.name();
|
|
||||||
}
|
|
||||||
return Optional.of(createMod(modType, pathInFS).file());
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-20
@@ -12,7 +12,6 @@ import cpw.mods.modlauncher.Launcher;
|
|||||||
import cpw.mods.modlauncher.api.IModuleLayerManager;
|
import cpw.mods.modlauncher.api.IModuleLayerManager;
|
||||||
import cpw.mods.modlauncher.util.ServiceLoaderUtils;
|
import cpw.mods.modlauncher.util.ServiceLoaderUtils;
|
||||||
import net.minecraftforge.fml.loading.EarlyLoadingException;
|
import net.minecraftforge.fml.loading.EarlyLoadingException;
|
||||||
import net.minecraftforge.fml.loading.FMLLoader;
|
|
||||||
import net.minecraftforge.fml.loading.ImmediateWindowHandler;
|
import net.minecraftforge.fml.loading.ImmediateWindowHandler;
|
||||||
import net.minecraftforge.fml.loading.LogMarkers;
|
import net.minecraftforge.fml.loading.LogMarkers;
|
||||||
import net.minecraftforge.fml.loading.UniqueModListBuilder;
|
import net.minecraftforge.fml.loading.UniqueModListBuilder;
|
||||||
@@ -22,7 +21,6 @@ import net.minecraftforge.forgespi.language.IModFileInfo;
|
|||||||
import net.minecraftforge.forgespi.locating.IDependencyLocator;
|
import net.minecraftforge.forgespi.locating.IDependencyLocator;
|
||||||
import net.minecraftforge.forgespi.locating.IModFile;
|
import net.minecraftforge.forgespi.locating.IModFile;
|
||||||
import net.minecraftforge.forgespi.locating.IModLocator;
|
import net.minecraftforge.forgespi.locating.IModLocator;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -69,7 +67,6 @@ public class ModDiscoverer {
|
|||||||
List<EarlyLoadingException.ExceptionData> discoveryErrorData = new ArrayList<>();
|
List<EarlyLoadingException.ExceptionData> discoveryErrorData = new ArrayList<>();
|
||||||
boolean successfullyLoadedMods = true;
|
boolean successfullyLoadedMods = true;
|
||||||
List<IModFileInfo> brokenFiles = new ArrayList<>();
|
List<IModFileInfo> brokenFiles = new ArrayList<>();
|
||||||
boolean distIsDedicatedServer = FMLLoader.getDist().isDedicatedServer();
|
|
||||||
ImmediateWindowHandler.updateProgress("Discovering mod files");
|
ImmediateWindowHandler.updateProgress("Discovering mod files");
|
||||||
//Loop all mod locators to get the prime mods to load from.
|
//Loop all mod locators to get the prime mods to load from.
|
||||||
for (IModLocator locator : modLocatorList) {
|
for (IModLocator locator : modLocatorList) {
|
||||||
@@ -88,24 +85,8 @@ public class ModDiscoverer {
|
|||||||
if (!badModFiles.isEmpty()) {
|
if (!badModFiles.isEmpty()) {
|
||||||
LOGGER.error(LogMarkers.SCAN, "Locator {} returned {} files which is are not ModFile instances! They will be skipped!", locator, badModFiles.size());
|
LOGGER.error(LogMarkers.SCAN, "Locator {} returned {} files which is are not ModFile instances! They will be skipped!", locator, badModFiles.size());
|
||||||
brokenFiles.addAll(badModFiles.stream().map(IModFile::getModFileInfo).toList());
|
brokenFiles.addAll(badModFiles.stream().map(IModFile::getModFileInfo).toList());
|
||||||
locatedFiles.removeAll(badModFiles);
|
|
||||||
}
|
}
|
||||||
|
locatedFiles.removeAll(badModFiles);
|
||||||
if (distIsDedicatedServer) {
|
|
||||||
var clientOnlyModFiles = locatedFiles.stream()
|
|
||||||
.filter(file -> {
|
|
||||||
// some mod files can have null infos, like javafml, mclanguage, lowcode, and fmlcore
|
|
||||||
@Nullable var info = file.getModFileInfo();
|
|
||||||
|
|
||||||
return info != null && (Boolean) info.getFileProperties().getOrDefault(ModFileInfo.CLIENT_SIDE_ONLY_PROP, Boolean.FALSE);
|
|
||||||
})
|
|
||||||
.toList();
|
|
||||||
if (!clientOnlyModFiles.isEmpty()) {
|
|
||||||
LOGGER.warn(LogMarkers.SCAN, "Locator {} returned {} files which are client-side-only mods, but we're on a dedicated server. They will be skipped!", locator, clientOnlyModFiles.size());
|
|
||||||
locatedFiles.removeAll(clientOnlyModFiles);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOGGER.debug(LogMarkers.SCAN, "Locator {} found {} valid mod files", locator, locatedFiles.size());
|
LOGGER.debug(LogMarkers.SCAN, "Locator {} found {} valid mod files", locator, locatedFiles.size());
|
||||||
handleLocatedFiles(loadedFiles, locatedFiles);
|
handleLocatedFiles(loadedFiles, locatedFiles);
|
||||||
} catch (InvalidModFileException imfe) {
|
} catch (InvalidModFileException imfe) {
|
||||||
|
|||||||
+2
-20
@@ -29,7 +29,6 @@ import java.security.cert.X509Certificate;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -51,10 +50,6 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
|||||||
private final String license;
|
private final String license;
|
||||||
private final List<String> usesServices;
|
private final List<String> usesServices;
|
||||||
|
|
||||||
public static final String CLIENT_SIDE_ONLY_PROP = "__FORGE_clientSideOnly";
|
|
||||||
|
|
||||||
private static final Map<String, Object> CLIENT_SIDE_ONLY_MAP = Map.of(CLIENT_SIDE_ONLY_PROP, Boolean.TRUE);
|
|
||||||
|
|
||||||
ModFileInfo(final ModFile modFile, final IConfigurable config, Consumer<IModFileInfo> configFileConsumer)
|
ModFileInfo(final ModFile modFile, final IConfigurable config, Consumer<IModFileInfo> configFileConsumer)
|
||||||
{
|
{
|
||||||
this.modFile = modFile;
|
this.modFile = modFile;
|
||||||
@@ -73,23 +68,10 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
|||||||
.orElse("");
|
.orElse("");
|
||||||
this.showAsResourcePack = config.<Boolean>getConfigElement("showAsResourcePack")
|
this.showAsResourcePack = config.<Boolean>getConfigElement("showAsResourcePack")
|
||||||
.orElse(false);
|
.orElse(false);
|
||||||
boolean clientSideOnly = config.<Boolean>getConfigElement("clientSideOnly")
|
|
||||||
.orElse(false);
|
|
||||||
this.usesServices = config.<List<String>>getConfigElement("services")
|
this.usesServices = config.<List<String>>getConfigElement("services")
|
||||||
.orElse(List.of());
|
.orElse(List.of());
|
||||||
|
this.properties = config.<Map<String, Object>>getConfigElement("properties")
|
||||||
var maybeProps = config.<Map<String, Object>>getConfigElement("properties");
|
.orElse(Collections.emptyMap());
|
||||||
if (clientSideOnly) {
|
|
||||||
if (maybeProps.isPresent()) {
|
|
||||||
this.properties = new HashMap<>(maybeProps.get());
|
|
||||||
this.properties.put(CLIENT_SIDE_ONLY_PROP, Boolean.TRUE);
|
|
||||||
} else {
|
|
||||||
this.properties = CLIENT_SIDE_ONLY_MAP;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.properties = maybeProps.orElse(Collections.emptyMap());
|
|
||||||
}
|
|
||||||
|
|
||||||
this.modFile.setFileProperties(this.properties);
|
this.modFile.setFileProperties(this.properties);
|
||||||
this.issueURL = config.<String>getConfigElement("issueTrackerURL")
|
this.issueURL = config.<String>getConfigElement("issueTrackerURL")
|
||||||
.map(StringUtils::toURL)
|
.map(StringUtils::toURL)
|
||||||
|
|||||||
@@ -80,8 +80,7 @@ public class ModInfo implements IModInfo, IConfigurable
|
|||||||
this.displayName = config.<String>getConfigElement("displayName")
|
this.displayName = config.<String>getConfigElement("displayName")
|
||||||
.orElse(this.modId);
|
.orElse(this.modId);
|
||||||
this.description = config.<String>getConfigElement("description")
|
this.description = config.<String>getConfigElement("description")
|
||||||
.orElse("MISSING DESCRIPTION")
|
.orElse("MISSING DESCRIPTION");
|
||||||
.replace("\r\n", "\n").stripIndent();
|
|
||||||
this.logoFile = Optional.ofNullable(config.<String>getConfigElement("logoFile")
|
this.logoFile = Optional.ofNullable(config.<String>getConfigElement("logoFile")
|
||||||
.orElseGet(() -> ownFile.flatMap(mf -> mf.<String>getConfigElement("logoFile"))
|
.orElseGet(() -> ownFile.flatMap(mf -> mf.<String>getConfigElement("logoFile"))
|
||||||
.orElse(null)));
|
.orElse(null)));
|
||||||
@@ -206,7 +205,7 @@ public class ModInfo implements IModInfo, IConfigurable
|
|||||||
private final boolean mandatory;
|
private final boolean mandatory;
|
||||||
private final Ordering ordering;
|
private final Ordering ordering;
|
||||||
private final DependencySide side;
|
private final DependencySide side;
|
||||||
private final Optional<URL> referralUrl;
|
private Optional<URL> referralUrl;
|
||||||
|
|
||||||
public ModVersion(final IModInfo owner, final IConfigurable config) {
|
public ModVersion(final IModInfo owner, final IConfigurable config) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
|
|||||||
+4
-26
@@ -6,7 +6,6 @@
|
|||||||
package net.minecraftforge.fml.loading.moddiscovery;
|
package net.minecraftforge.fml.loading.moddiscovery;
|
||||||
|
|
||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
import cpw.mods.jarhandling.SecureJar;
|
|
||||||
import cpw.mods.modlauncher.api.IModuleLayerManager;
|
import cpw.mods.modlauncher.api.IModuleLayerManager;
|
||||||
import cpw.mods.modlauncher.api.ITransformationService;
|
import cpw.mods.modlauncher.api.ITransformationService;
|
||||||
import net.minecraftforge.fml.loading.*;
|
import net.minecraftforge.fml.loading.*;
|
||||||
@@ -27,17 +26,14 @@ public class ModValidator {
|
|||||||
private final Map<IModFile.Type, List<ModFile>> modFiles;
|
private final Map<IModFile.Type, List<ModFile>> modFiles;
|
||||||
private final List<ModFile> candidatePlugins;
|
private final List<ModFile> candidatePlugins;
|
||||||
private final List<ModFile> candidateMods;
|
private final List<ModFile> candidateMods;
|
||||||
private final List<ModFile> gameLibraries;
|
|
||||||
private LoadingModList loadingModList;
|
private LoadingModList loadingModList;
|
||||||
private final List<IModFile> brokenFiles;
|
private List<IModFile> brokenFiles;
|
||||||
private final List<EarlyLoadingException.ExceptionData> discoveryErrorData;
|
private final List<EarlyLoadingException.ExceptionData> discoveryErrorData;
|
||||||
|
|
||||||
public ModValidator(final Map<IModFile.Type, List<ModFile>> modFiles, final List<IModFileInfo> brokenFiles, final List<EarlyLoadingException.ExceptionData> discoveryErrorData) {
|
public ModValidator(final Map<IModFile.Type, List<ModFile>> modFiles, final List<IModFileInfo> brokenFiles, final List<EarlyLoadingException.ExceptionData> discoveryErrorData) {
|
||||||
this.modFiles = modFiles;
|
this.modFiles = modFiles;
|
||||||
this.candidateMods = lst(modFiles.get(IModFile.Type.MOD));
|
this.candidateMods = lst(modFiles.get(IModFile.Type.MOD));
|
||||||
this.candidateMods.addAll(lst(modFiles.get(IModFile.Type.GAMELIBRARY)));
|
this.candidateMods.addAll(lst(modFiles.get(IModFile.Type.GAMELIBRARY)));
|
||||||
this.gameLibraries = lst(modFiles.get(IModFile.Type.GAMELIBRARY));
|
|
||||||
this.candidateMods.addAll(this.gameLibraries);
|
|
||||||
this.candidatePlugins = lst(modFiles.get(IModFile.Type.LANGPROVIDER));
|
this.candidatePlugins = lst(modFiles.get(IModFile.Type.LANGPROVIDER));
|
||||||
this.candidatePlugins.addAll(lst(modFiles.get(IModFile.Type.LIBRARY)));
|
this.candidatePlugins.addAll(lst(modFiles.get(IModFile.Type.LIBRARY)));
|
||||||
this.discoveryErrorData = discoveryErrorData;
|
this.discoveryErrorData = discoveryErrorData;
|
||||||
@@ -59,7 +55,8 @@ public class ModValidator {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private List<ModFile> validateFiles(final List<ModFile> mods) {
|
private List<ModFile> validateFiles(final List<ModFile> mods) {
|
||||||
final List<ModFile> brokenFiles = new ArrayList<>();
|
final List<ModFile> brokenFiles = new ArrayList<>();
|
||||||
for (Iterator<ModFile> iterator = mods.iterator(); iterator.hasNext();) {
|
for (Iterator<ModFile> iterator = mods.iterator(); iterator.hasNext(); )
|
||||||
|
{
|
||||||
ModFile modFile = iterator.next();
|
ModFile modFile = iterator.next();
|
||||||
if (!modFile.getProvider().isValid(modFile) || !modFile.identifyMods()) {
|
if (!modFile.getProvider().isValid(modFile) || !modFile.identifyMods()) {
|
||||||
LOGGER.warn(LogMarkers.SCAN, "File {} has been ignored - it is invalid", modFile.getFilePath());
|
LOGGER.warn(LogMarkers.SCAN, "File {} has been ignored - it is invalid", modFile.getFilePath());
|
||||||
@@ -75,26 +72,7 @@ public class ModValidator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ITransformationService.Resource getModResources() {
|
public ITransformationService.Resource getModResources() {
|
||||||
var mods = new ArrayList<SecureJar>();
|
return new ITransformationService.Resource(IModuleLayerManager.Layer.GAME, this.candidateMods.stream().map(IModFile::getSecureJar).toList());
|
||||||
// Add only the valid mods that we will be attempting to load.
|
|
||||||
// If any detectable error happens during the sorting process {missing deps, duplicates,
|
|
||||||
// This helps prevent coremods/mixins from screwing up us displaying the error screens that the sorting/validation is trying to display.
|
|
||||||
// This won't fix them all as they are still loaded and will still apply but it might help
|
|
||||||
for (var info : this.loadingModList.getModFiles())
|
|
||||||
mods.add(info.getFile().getSecureJar());
|
|
||||||
|
|
||||||
// Add any game libraries, this *may* be duplicates, depending on the state of the sorting. But until I get around to re-writing
|
|
||||||
// that clusterfuck of a system, have this simple de-duplication. Order of resource is important, but i'm unsure if duplication is
|
|
||||||
// so might as well waste a few cycles on checking. Still faster then converting from a set to a list.
|
|
||||||
// Ideally we would explicitly list out which mods to load {forge and MC being the only ones} but some coremods could require extra things.
|
|
||||||
// So try game libraries as well
|
|
||||||
for (var lib : this.gameLibraries) {
|
|
||||||
var jar = lib.getSecureJar();
|
|
||||||
if (!mods.contains(jar))
|
|
||||||
mods.add(jar);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ITransformationService.Resource(IModuleLayerManager.Layer.GAME, mods);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<EarlyLoadingException.ExceptionData> validateLanguages() {
|
private List<EarlyLoadingException.ExceptionData> validateLanguages() {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class Scanner {
|
|||||||
try (InputStream in = Files.newInputStream(path)){
|
try (InputStream in = Files.newInputStream(path)){
|
||||||
ModClassVisitor mcv = new ModClassVisitor();
|
ModClassVisitor mcv = new ModClassVisitor();
|
||||||
ClassReader cr = new ClassReader(in);
|
ClassReader cr = new ClassReader(in);
|
||||||
cr.accept(mcv, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
|
cr.accept(mcv, 0);
|
||||||
mcv.buildData(result.getClasses(), result.getAnnotations());
|
mcv.buildData(result.getClasses(), result.getAnnotations());
|
||||||
} catch (IOException | IllegalArgumentException e) {
|
} catch (IOException | IllegalArgumentException e) {
|
||||||
// mark path bad
|
// mark path bad
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
public final class ProgressMeter {
|
public final class ProgressMeter {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int steps;
|
private final int steps;
|
||||||
private final AtomicInteger current;
|
private AtomicInteger current;
|
||||||
private Message label;
|
private Message label;
|
||||||
|
|
||||||
public ProgressMeter(String name, int steps, int current, Message label) {
|
public ProgressMeter(String name, int steps, int current, Message label) {
|
||||||
|
|||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Forge Development LLC and contributors
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
|
||||||
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
|
||||||
|
|
||||||
public class FMLClientDevLaunchHandler extends CommonDevLaunchHandler {
|
|
||||||
@Override public String name() { return "fmlclientdev"; }
|
|
||||||
@Override public Dist getDist() { return Dist.CLIENT; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void devService(String[] arguments, ModuleLayer layer) throws Throwable {
|
|
||||||
clientService(arguments, layer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-23
@@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Forge Development LLC and contributors
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
import net.minecraftforge.fml.loading.LibraryFinder;
|
|
||||||
import net.minecraftforge.fml.loading.VersionInfo;
|
|
||||||
|
|
||||||
public class FMLClientLaunchHandler extends CommonClientLaunchHandler {
|
|
||||||
@Override public String name() { return "fmlclient"; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void processMCStream(VersionInfo versionInfo, Stream.Builder<Path> mc, Stream.Builder<List<Path>> mods) {
|
|
||||||
var fmlonly = LibraryFinder.findPathForMaven(versionInfo.forgeGroup(), "fmlonly", "", "universal", versionInfo.mcAndForgeVersion());
|
|
||||||
mods.add(List.of(fmlonly));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Forge Development LLC and contributors
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
|
||||||
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
|
||||||
|
|
||||||
public class FMLClientUserdevLaunchHandler extends FMLUserdevLaunchHandler {
|
|
||||||
@Override
|
|
||||||
public String name() { return "fmlclientuserdev"; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dist getDist() { return Dist.CLIENT; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void devService(String[] arguments, ModuleLayer layer) throws Throwable {
|
|
||||||
clientService(arguments, layer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Forge Development LLC and contributors
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
|
||||||
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
|
||||||
|
|
||||||
public class FMLDataUserdevLaunchHandler extends FMLUserdevLaunchHandler {
|
|
||||||
@Override
|
|
||||||
public String name() { return "fmldatauserdev"; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Dist getDist() { return Dist.CLIENT; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isData() { return true; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void devService(String[] arguments, ModuleLayer layer) throws Throwable {
|
|
||||||
dataService(arguments, layer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Forge Development LLC and contributors
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
|
||||||
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
|
||||||
|
|
||||||
public class FMLServerDevLaunchHandler extends CommonDevLaunchHandler {
|
|
||||||
@Override public String name() { return "fmlserverdev"; }
|
|
||||||
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void devService(String[] arguments, ModuleLayer layer) throws Throwable {
|
|
||||||
serverService(arguments, layer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-26
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Forge Development LLC and contributors
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
|
||||||
|
|
||||||
import cpw.mods.modlauncher.api.ILaunchHandlerService;
|
|
||||||
import net.minecraftforge.fml.loading.LibraryFinder;
|
|
||||||
import net.minecraftforge.fml.loading.VersionInfo;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.BiPredicate;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
public class FMLServerLaunchHandler extends CommonServerLaunchHandler implements ILaunchHandlerService {
|
|
||||||
@Override public String name() { return "fmlserver"; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BiPredicate<String, String> processMCStream(VersionInfo versionInfo, Stream.Builder<Path> mc, BiPredicate<String, String> filter, Stream.Builder<List<Path>> mods) {
|
|
||||||
var fmlonly = LibraryFinder.findPathForMaven(versionInfo.forgeGroup(), "fmlonly", "", "universal", versionInfo.mcAndForgeVersion());
|
|
||||||
mods.add(List.of(fmlonly));
|
|
||||||
return filter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Forge Development LLC and contributors
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
|
||||||
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
|
||||||
|
|
||||||
public class FMLServerUserdevLaunchHandler extends FMLUserdevLaunchHandler {
|
|
||||||
@Override public String name() { return "fmlserveruserdev"; }
|
|
||||||
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void devService(String[] arguments, ModuleLayer layer) throws Throwable {
|
|
||||||
serverService(arguments, layer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-20
@@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Forge Development LLC and contributors
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
|
||||||
|
|
||||||
import net.minecraftforge.fml.loading.VersionInfo;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
public abstract class FMLUserdevLaunchHandler extends CommonUserdevLaunchHandler {
|
|
||||||
@Override
|
|
||||||
protected void processStreams(String[] classpath, VersionInfo versionInfo, Stream.Builder<Path> mc, Stream.Builder<List<Path>> mods) {
|
|
||||||
var fmlonly = findJarOnClasspath(classpath, "fmlonly-" + versionInfo.mcAndForgeVersion());
|
|
||||||
mc.add(fmlonly);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-8
@@ -1,11 +1,3 @@
|
|||||||
net.minecraftforge.fml.loading.targets.FMLClientLaunchHandler
|
|
||||||
net.minecraftforge.fml.loading.targets.FMLClientDevLaunchHandler
|
|
||||||
net.minecraftforge.fml.loading.targets.FMLClientUserdevLaunchHandler
|
|
||||||
net.minecraftforge.fml.loading.targets.FMLServerLaunchHandler
|
|
||||||
net.minecraftforge.fml.loading.targets.FMLServerDevLaunchHandler
|
|
||||||
net.minecraftforge.fml.loading.targets.FMLServerUserdevLaunchHandler
|
|
||||||
net.minecraftforge.fml.loading.targets.FMLDataUserdevLaunchHandler
|
|
||||||
|
|
||||||
net.minecraftforge.fml.loading.targets.ForgeClientLaunchHandler
|
net.minecraftforge.fml.loading.targets.ForgeClientLaunchHandler
|
||||||
net.minecraftforge.fml.loading.targets.ForgeClientDevLaunchHandler
|
net.minecraftforge.fml.loading.targets.ForgeClientDevLaunchHandler
|
||||||
net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler
|
net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
../../src/fmlcommon/
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* Minecraft Forge - Forge Development LLC
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraftforge.fmlonly;
|
|
||||||
|
|
||||||
import net.minecraftforge.eventbus.api.BusBuilder;
|
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
|
||||||
import net.minecraftforge.fml.I18NParser;
|
|
||||||
import net.minecraftforge.fml.IBindingsProvider;
|
|
||||||
import net.minecraftforge.fml.config.IConfigEvent;
|
|
||||||
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class FMLOnlyBindings implements IBindingsProvider {
|
|
||||||
private static final IEventBus DUMMYFORGEBUS = BusBuilder.builder().build();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Supplier<IEventBus> getForgeBusSupplier() {
|
|
||||||
return ()->DUMMYFORGEBUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Supplier<I18NParser> getMessageParser() {
|
|
||||||
return ()->new I18NParser() {
|
|
||||||
@Override
|
|
||||||
public String parseMessage(final String i18nMessage, final Object... args) {
|
|
||||||
return i18nMessage + Arrays.stream(args).map(Objects::toString).collect(Collectors.joining(",", "[", "]"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String stripControlCodes(final String toStrip) {
|
|
||||||
return toStrip;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Supplier<IConfigEvent.ConfigConfig> getConfigConfiguration() {
|
|
||||||
return ()->new IConfigEvent.ConfigConfig(ModConfigEvent.Loading::new, ModConfigEvent.Reloading::new, ModConfigEvent.Unloading::new);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/*
|
|
||||||
* Minecraft Forge - Forge Development LLC
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraftforge.fmlonly;
|
|
||||||
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
|
||||||
|
|
||||||
@Mod("fmlonly")
|
|
||||||
public class FMLOnlyMod {}
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* Minecraft Forge - Forge Development LLC
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraftforge.fmlonlyclient;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.resources.ClientPackSource;
|
|
||||||
import net.minecraft.server.packs.repository.PackRepository;
|
|
||||||
import net.minecraft.server.packs.resources.PreparableReloadListener;
|
|
||||||
import net.minecraft.server.packs.resources.ReloadableResourceManager;
|
|
||||||
import net.minecraft.server.packs.resources.ResourceManager;
|
|
||||||
import net.minecraft.util.profiling.ProfilerFiller;
|
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
||||||
import net.minecraftforge.fml.LoadingFailedException;
|
|
||||||
import net.minecraftforge.fml.ModLoader;
|
|
||||||
import net.minecraftforge.fml.ModWorkManager;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.Executor;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
|
||||||
public class ClientModLoader
|
|
||||||
{
|
|
||||||
private static boolean loading;
|
|
||||||
private static Minecraft mc;
|
|
||||||
private static boolean loadingComplete;
|
|
||||||
private static LoadingFailedException error;
|
|
||||||
|
|
||||||
public static void begin(final Minecraft minecraft, final PackRepository defaultResourcePacks, final ReloadableResourceManager mcResourceManager)
|
|
||||||
{
|
|
||||||
// force log4j to shutdown logging in a shutdown hook. This is because we disable default shutdown hook so the server properly logs it's shutdown
|
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(LogManager::shutdown));
|
|
||||||
loading = true;
|
|
||||||
ClientModLoader.mc = minecraft;
|
|
||||||
createRunnableWithCatch(()->ModLoader.get().gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), ()->{})).run();
|
|
||||||
mcResourceManager.registerReloadListener(ClientModLoader::onResourceReload);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static CompletableFuture<Void> onResourceReload(final PreparableReloadListener.PreparationBarrier stage, final ResourceManager resourceManager, final ProfilerFiller prepareProfiler, final ProfilerFiller executeProfiler, final Executor asyncExecutor, final Executor syncExecutor) {
|
|
||||||
return CompletableFuture.runAsync(createRunnableWithCatch(() -> startModLoading(ModWorkManager.wrappedExecutor(syncExecutor), asyncExecutor)), ModWorkManager.parallelExecutor())
|
|
||||||
.thenCompose(stage::wait)
|
|
||||||
.thenRunAsync(() -> finishModLoading(ModWorkManager.wrappedExecutor(syncExecutor), asyncExecutor), ModWorkManager.parallelExecutor());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Runnable createRunnableWithCatch(Runnable r) {
|
|
||||||
return ()-> {
|
|
||||||
if (loadingComplete) return;
|
|
||||||
try {
|
|
||||||
r.run();
|
|
||||||
} catch (LoadingFailedException e) {
|
|
||||||
if (error == null) error = e;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void startModLoading(ModWorkManager.DrivenExecutor syncExecutor, Executor parallelExecutor) {
|
|
||||||
if (error!=null) throw error;
|
|
||||||
createRunnableWithCatch(() -> ModLoader.get().loadMods(syncExecutor, parallelExecutor, ()->{})).run();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void finishModLoading(ModWorkManager.DrivenExecutor syncExecutor, Executor parallelExecutor)
|
|
||||||
{
|
|
||||||
if (error!=null) throw error;
|
|
||||||
createRunnableWithCatch(() -> ModLoader.get().finishMods(syncExecutor, parallelExecutor, ()->{})).run();
|
|
||||||
loading = false;
|
|
||||||
loadingComplete = true;
|
|
||||||
// reload game settings on main thread
|
|
||||||
syncExecutor.execute(()->mc.options.load());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isLoading()
|
|
||||||
{
|
|
||||||
return loading;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
* Minecraft Forge - Forge Development LLC
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraftforge.fmlonlyserver;
|
|
||||||
|
|
||||||
import joptsimple.OptionParser;
|
|
||||||
import net.minecraftforge.fml.LoadingFailedException;
|
|
||||||
import net.minecraftforge.fml.ModLoader;
|
|
||||||
import net.minecraftforge.fml.ModLoadingWarning;
|
|
||||||
import net.minecraftforge.fml.ModWorkManager;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static net.minecraftforge.fml.Logging.LOADING;
|
|
||||||
|
|
||||||
public class ServerModLoader
|
|
||||||
{
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger();
|
|
||||||
private static boolean hasErrors = false;
|
|
||||||
|
|
||||||
public static void addOptions(OptionParser parser)
|
|
||||||
{
|
|
||||||
// We consume this argument as we use it in the launcher and the client side.
|
|
||||||
parser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File("."));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void load()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ModLoader.get().gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), () -> {});
|
|
||||||
ModLoader.get().loadMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), () -> {});
|
|
||||||
ModLoader.get().finishMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), () -> {});
|
|
||||||
} catch (LoadingFailedException error)
|
|
||||||
{
|
|
||||||
ServerModLoader.hasErrors = true;
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
List<ModLoadingWarning> warnings = ModLoader.get().getWarnings();
|
|
||||||
if (!warnings.isEmpty())
|
|
||||||
{
|
|
||||||
LOGGER.warn(LOADING, "Mods loaded with {} warnings", warnings.size());
|
|
||||||
warnings.forEach(warning -> LOGGER.warn(LOADING, warning.formatToString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hasErrors()
|
|
||||||
{
|
|
||||||
return ServerModLoader.hasErrors;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"load_fml_client": "coremods/load_fml_client.js",
|
|
||||||
"load_fml_server": "coremods/load_fml_server.js"
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
modLoader="javafml"
|
|
||||||
loaderVersion="[24,]"
|
|
||||||
issueTrackerURL="https://www.minecraftforge.net/"
|
|
||||||
license="LGPL v2.1"
|
|
||||||
|
|
||||||
[[mods]]
|
|
||||||
modId="fmlonly"
|
|
||||||
# We use the global forge version
|
|
||||||
version="${global.forgeVersion}"
|
|
||||||
updateJSONURL="https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json"
|
|
||||||
displayName="Forge"
|
|
||||||
credits="Anyone who has contributed on Github and supports our development"
|
|
||||||
authors="LexManos,cpw"
|
|
||||||
description='''
|
|
||||||
Forge, a broad compatibility API.
|
|
||||||
'''
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
net.minecraftforge.fmlonly.FMLOnlyBindings
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
net.minecraftforge.fml.core.ModStateProvider
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
var ASMAPI = Java.type('net.minecraftforge.coremod.api.ASMAPI')
|
|
||||||
var Opcodes = Java.type('org.objectweb.asm.Opcodes')
|
|
||||||
|
|
||||||
function initializeCoreMod() {
|
|
||||||
return {
|
|
||||||
'minecraft': {
|
|
||||||
'target': {
|
|
||||||
'type': 'METHOD',
|
|
||||||
'class': 'net.minecraft.client.Minecraft',
|
|
||||||
'methodName': '<init>',
|
|
||||||
'methodDesc': '(Lnet/minecraft/client/main/GameConfig;)V'
|
|
||||||
},
|
|
||||||
'transformer': function(methodNode) {
|
|
||||||
//print(ASMAPI.methodNodeToString(methodNode))
|
|
||||||
var meth = ASMAPI.getMethodNode();
|
|
||||||
var resourcePackRepository = ASMAPI.mapField("f_91038_")
|
|
||||||
var resourceManager = ASMAPI.mapField("f_91036_")
|
|
||||||
|
|
||||||
meth.visitVarInsn(Opcodes.ALOAD, 0);
|
|
||||||
meth.visitVarInsn(Opcodes.ALOAD, 0);
|
|
||||||
meth.visitFieldInsn(Opcodes.GETFIELD, "net/minecraft/client/Minecraft", resourcePackRepository, "Lnet/minecraft/server/packs/repository/PackRepository;");
|
|
||||||
meth.visitVarInsn(Opcodes.ALOAD, 0);
|
|
||||||
meth.visitFieldInsn(Opcodes.GETFIELD, "net/minecraft/client/Minecraft", resourceManager, "Lnet/minecraft/server/packs/resources/ReloadableResourceManager;");
|
|
||||||
meth.visitMethodInsn(Opcodes.INVOKESTATIC, "net/minecraftforge/fmlonlyclient/ClientModLoader", "begin", "(Lnet/minecraft/client/Minecraft;Lnet/minecraft/server/packs/repository/PackRepository;Lnet/minecraft/server/packs/resources/ReloadableResourceManager;)V", false)
|
|
||||||
for (var i=0; i<methodNode.instructions.size(); i++) {
|
|
||||||
var ain = methodNode.instructions.get(i);
|
|
||||||
if (ain.getOpcode() == Opcodes.PUTFIELD && ain.name.equals(resourceManager)) {
|
|
||||||
methodNode.instructions.insert(ain, meth.instructions);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return methodNode;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
var ASMAPI = Java.type('net.minecraftforge.coremod.api.ASMAPI')
|
|
||||||
var Opcodes = Java.type('org.objectweb.asm.Opcodes')
|
|
||||||
|
|
||||||
function initializeCoreMod() {
|
|
||||||
return {
|
|
||||||
'minecraft': {
|
|
||||||
'target': {
|
|
||||||
'type': 'METHOD',
|
|
||||||
'class': 'net.minecraft.server.Main',
|
|
||||||
'methodName': 'main',
|
|
||||||
'methodDesc': '([Ljava/lang/String;)V'
|
|
||||||
},
|
|
||||||
'transformer': function(methodNode) {
|
|
||||||
var meth = ASMAPI.getMethodNode();
|
|
||||||
meth.visitMethodInsn(Opcodes.INVOKESTATIC, 'net/minecraftforge/fmlonlyserver/ServerModLoader', 'load', '()V', false)
|
|
||||||
|
|
||||||
var methOptions = ASMAPI.getMethodNode();
|
|
||||||
methOptions.visitIntInsn(Opcodes.ALOAD, 1);
|
|
||||||
methOptions.visitMethodInsn(Opcodes.INVOKESTATIC, 'net/minecraftforge/fmlonlyserver/ServerModLoader', 'addOptions', '(Ljoptsimple/OptionParser;)V', false)
|
|
||||||
|
|
||||||
for (var i=0; i<methodNode.instructions.size(); i++) {
|
|
||||||
var ain = methodNode.instructions.get(i);
|
|
||||||
if (ain.getOpcode() == Opcodes.INVOKESPECIAL && ain.owner == 'joptsimple/OptionParser' && ain.name == '<init>' && ain.desc == '()V') {
|
|
||||||
// Inject after the STORE
|
|
||||||
methodNode.instructions.insert(methodNode.instructions.get(i + 1), methOptions.instructions);
|
|
||||||
} else if (ain.getOpcode() == Opcodes.INVOKESTATIC && ain.owner == 'net/minecraft/Util' && ain.name == ASMAPI.mapMethod('m_137584_') /* startTimerHackThread */ && ain.desc == '()V') {
|
|
||||||
methodNode.instructions.insert(ain, meth.instructions);
|
|
||||||
break; // By this point we've already reached the first injection point so break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return methodNode;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -85,6 +85,9 @@ done
|
|||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
|
||||||
@@ -141,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC3045
|
# shellcheck disable=SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
@@ -149,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC3045
|
# shellcheck disable=SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
@@ -194,10 +197,6 @@ if "$cygwin" || "$msys" ; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
# Collect all arguments for the java command;
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
activeContentFilterList=*.makefile,makefile,*.Makefile,Makefile,Makefile.*,*.mk,MANIFEST.MF,.project,*.yml
|
||||||
|
addNewLine=true
|
||||||
|
convertActionOnSaave=AnyEdit.CnvrtTabToSpaces
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
||||||
|
fixLineDelimiters=false
|
||||||
|
ignoreBlankLinesWhenTrimming=false
|
||||||
|
inActiveContentFilterList=
|
||||||
|
javaTabWidthForJava=true
|
||||||
|
org.eclipse.jdt.ui.editor.tab.width=2
|
||||||
|
projectPropsEnabled=true
|
||||||
|
removeTrailingSpaces=true
|
||||||
|
replaceAllSpaces=false
|
||||||
|
replaceAllTabs=false
|
||||||
|
saveAndAddLine=false
|
||||||
|
saveAndConvert=true
|
||||||
|
saveAndFixLineDelimiters=false
|
||||||
|
saveAndTrim=true
|
||||||
|
useModulo4Tabs=false
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
line.separator=\n
|
||||||
@@ -2,10 +2,9 @@ plugins {
|
|||||||
id 'com.github.ben-manes.versions'
|
id 'com.github.ben-manes.versions'
|
||||||
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
||||||
id 'org.cadixdev.licenser'
|
id 'org.cadixdev.licenser'
|
||||||
|
id 'java-library'
|
||||||
|
id 'jacoco'
|
||||||
}
|
}
|
||||||
apply plugin: 'java-library'
|
|
||||||
apply plugin: 'jacoco'
|
|
||||||
apply plugin: 'org.javamodularity.moduleplugin'
|
|
||||||
|
|
||||||
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
||||||
|
|
||||||
|
|||||||
+1
-8
@@ -8,7 +8,7 @@ package net.minecraftforge.fml.javafmlmod;
|
|||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.fml.ModLoadingContext;
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
|
|
||||||
public class FMLJavaModLoadingContext extends ModLoadingContext
|
public class FMLJavaModLoadingContext
|
||||||
{
|
{
|
||||||
private final FMLModContainer container;
|
private final FMLModContainer container;
|
||||||
|
|
||||||
@@ -24,18 +24,11 @@ public class FMLJavaModLoadingContext extends ModLoadingContext
|
|||||||
return container.getEventBus();
|
return container.getEventBus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public FMLModContainer getContainer() {
|
|
||||||
return container;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper to get the right instance from the {@link ModLoadingContext} correctly.
|
* Helper to get the right instance from the {@link ModLoadingContext} correctly.
|
||||||
* @return The FMLJavaMod language specific extension from the ModLoadingContext
|
* @return The FMLJavaMod language specific extension from the ModLoadingContext
|
||||||
*
|
|
||||||
* @deprecated use {@link FMLJavaModLoadingContext} in your mod constructor
|
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "1.21.1")
|
|
||||||
public static FMLJavaModLoadingContext get() {
|
public static FMLJavaModLoadingContext get() {
|
||||||
return ModLoadingContext.get().extension();
|
return ModLoadingContext.get().extension();
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-17
@@ -21,9 +21,6 @@ import org.apache.logging.log4j.Logger;
|
|||||||
import org.apache.logging.log4j.Marker;
|
import org.apache.logging.log4j.Marker;
|
||||||
import org.apache.logging.log4j.MarkerManager;
|
import org.apache.logging.log4j.MarkerManager;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class FMLModContainer extends ModContainer
|
public class FMLModContainer extends ModContainer
|
||||||
@@ -34,7 +31,6 @@ public class FMLModContainer extends ModContainer
|
|||||||
private final IEventBus eventBus;
|
private final IEventBus eventBus;
|
||||||
private Object modInstance;
|
private Object modInstance;
|
||||||
private final Class<?> modClass;
|
private final Class<?> modClass;
|
||||||
private final FMLJavaModLoadingContext context = new FMLJavaModLoadingContext(this);
|
|
||||||
|
|
||||||
public FMLModContainer(IModInfo info, String className, ModFileScanData modFileScanResults, ModuleLayer gameLayer)
|
public FMLModContainer(IModInfo info, String className, ModFileScanData modFileScanResults, ModuleLayer gameLayer)
|
||||||
{
|
{
|
||||||
@@ -44,7 +40,8 @@ public class FMLModContainer extends ModContainer
|
|||||||
activityMap.put(ModLoadingStage.CONSTRUCT, this::constructMod);
|
activityMap.put(ModLoadingStage.CONSTRUCT, this::constructMod);
|
||||||
this.eventBus = BusBuilder.builder().setExceptionHandler(this::onEventFailed).setTrackPhases(false).markerType(IModBusEvent.class).useModLauncher().build();
|
this.eventBus = BusBuilder.builder().setExceptionHandler(this::onEventFailed).setTrackPhases(false).markerType(IModBusEvent.class).useModLauncher().build();
|
||||||
this.configHandler = Optional.of(ce->this.eventBus.post(ce.self()));
|
this.configHandler = Optional.of(ce->this.eventBus.post(ce.self()));
|
||||||
this.contextExtension = () -> context;
|
final FMLJavaModLoadingContext contextExtension = new FMLJavaModLoadingContext(this);
|
||||||
|
this.contextExtension = () -> contextExtension;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var layer = gameLayer.findModule(info.getOwningFile().moduleName()).orElseThrow();
|
var layer = gameLayer.findModule(info.getOwningFile().moduleName()).orElseThrow();
|
||||||
@@ -68,22 +65,11 @@ public class FMLModContainer extends ModContainer
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
LOGGER.trace(LOADING, "Loading mod instance {} of type {}", getModId(), modClass.getName());
|
LOGGER.trace(LOADING, "Loading mod instance {} of type {}", getModId(), modClass.getName());
|
||||||
Constructor<?> constructor;
|
this.modInstance = modClass.getDeclaredConstructor().newInstance();
|
||||||
try {
|
|
||||||
constructor = modClass.getDeclaredConstructor(context.getClass());
|
|
||||||
} catch (NoSuchMethodException | SecurityException exception) {
|
|
||||||
constructor = modClass.getDeclaredConstructor();
|
|
||||||
}
|
|
||||||
this.modInstance = constructor.getParameterCount() == 0 ? constructor.newInstance() : constructor.newInstance(context);
|
|
||||||
LOGGER.trace(LOADING, "Loaded mod instance {} of type {}", getModId(), modClass.getName());
|
LOGGER.trace(LOADING, "Loaded mod instance {} of type {}", getModId(), modClass.getName());
|
||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
// When a mod constructor throws an exception, it's wrapped in an InvocationTargetException which hides the
|
|
||||||
// actual exception from the mod loading error screen.
|
|
||||||
if (e instanceof InvocationTargetException wrapped)
|
|
||||||
e = Objects.requireNonNullElse(wrapped.getCause(), e); // unwrap the exception
|
|
||||||
|
|
||||||
LOGGER.error(LOADING,"Failed to create mod instance. ModID: {}, class {}", getModId(), modClass.getName(), e);
|
LOGGER.error(LOADING,"Failed to create mod instance. ModID: {}, class {}", getModId(), modClass.getName(), e);
|
||||||
throw new ModLoadingException(modInfo, ModLoadingStage.CONSTRUCT, "fml.modloading.failedtoloadmod", e, modClass);
|
throw new ModLoadingException(modInfo, ModLoadingStage.CONSTRUCT, "fml.modloading.failedtoloadmod", e, modClass);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ plugins {
|
|||||||
id 'com.github.ben-manes.versions'
|
id 'com.github.ben-manes.versions'
|
||||||
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
||||||
id 'org.cadixdev.licenser'
|
id 'org.cadixdev.licenser'
|
||||||
|
id 'java-library'
|
||||||
|
id 'jacoco'
|
||||||
}
|
}
|
||||||
apply plugin: 'java-library'
|
|
||||||
apply plugin: 'jacoco'
|
|
||||||
apply plugin: 'org.javamodularity.moduleplugin'
|
|
||||||
|
|
||||||
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ plugins {
|
|||||||
id 'com.github.ben-manes.versions'
|
id 'com.github.ben-manes.versions'
|
||||||
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
||||||
id 'org.cadixdev.licenser'
|
id 'org.cadixdev.licenser'
|
||||||
|
id 'java-library'
|
||||||
|
id 'jacoco'
|
||||||
}
|
}
|
||||||
apply plugin: 'java-library'
|
|
||||||
apply plugin: 'jacoco'
|
|
||||||
apply plugin: 'org.javamodularity.moduleplugin'
|
|
||||||
|
|
||||||
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -16,19 +16,19 @@ Step 1: Open your command-line and browse to the folder where you extracted the
|
|||||||
|
|
||||||
Step 2: You're left with a choice.
|
Step 2: You're left with a choice.
|
||||||
If you prefer to use Eclipse:
|
If you prefer to use Eclipse:
|
||||||
1. Run the following command: `./gradlew genEclipseRuns`
|
1. Run the following command: `gradlew genEclipseRuns` (`./gradlew genEclipseRuns` if you are on Mac/Linux)
|
||||||
2. Open Eclipse, Import > Existing Gradle Project > Select Folder
|
2. Open Eclipse, Import > Existing Gradle Project > Select Folder
|
||||||
or run `gradlew eclipse` to generate the project.
|
or run `gradlew eclipse` to generate the project.
|
||||||
|
|
||||||
If you prefer to use IntelliJ:
|
If you prefer to use IntelliJ:
|
||||||
1. Open IDEA, and import project.
|
1. Open IDEA, and import project.
|
||||||
2. Select your build.gradle file and have it import.
|
2. Select your build.gradle file and have it import.
|
||||||
3. Run the following command: `./gradlew genIntellijRuns`
|
3. Run the following command: `gradlew genIntellijRuns` (`./gradlew genIntellijRuns` if you are on Mac/Linux)
|
||||||
4. Refresh the Gradle Project in IDEA if required.
|
4. Refresh the Gradle Project in IDEA if required.
|
||||||
|
|
||||||
If at any point you are missing libraries in your IDE, or you've run into problems you can
|
If at any point you are missing libraries in your IDE, or you've run into problems you can
|
||||||
run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything
|
run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything
|
||||||
(this does not affect your code) and then start the process again.
|
{this does not affect your code} and then start the process again.
|
||||||
|
|
||||||
Mapping Names:
|
Mapping Names:
|
||||||
=============================
|
=============================
|
||||||
@@ -40,7 +40,7 @@ https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
|||||||
|
|
||||||
Additional Resources:
|
Additional Resources:
|
||||||
=========================
|
=========================
|
||||||
Community Documentation: https://docs.minecraftforge.net/en/1.20.1/gettingstarted/
|
Community Documentation: https://mcforge.readthedocs.io/en/latest/gettingstarted/
|
||||||
LexManos' Install Video: https://youtu.be/8VEdtQLuLO0
|
LexManos' Install Video: https://www.youtube.com/watch?v=8VEdtQLuLO0
|
||||||
Forge Forums: https://forums.minecraftforge.net/
|
Forge Forum: https://forums.minecraftforge.net/
|
||||||
Forge Discord: https://discord.minecraftforge.net/
|
Forge Discord: https://discord.gg/UvedJ9m
|
||||||
+1
-1
@@ -9,5 +9,5 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@ import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
|
|||||||
import net.minecraftforge.event.server.ServerStartingEvent;
|
import net.minecraftforge.event.server.ServerStartingEvent;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.config.ModConfig;
|
import net.minecraftforge.fml.config.ModConfig;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
@@ -60,9 +61,9 @@ public class ExampleMod
|
|||||||
output.accept(EXAMPLE_ITEM.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event
|
output.accept(EXAMPLE_ITEM.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event
|
||||||
}).build());
|
}).build());
|
||||||
|
|
||||||
public ExampleMod(FMLJavaModLoadingContext context)
|
public ExampleMod()
|
||||||
{
|
{
|
||||||
IEventBus modEventBus = context.getModEventBus();
|
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||||
|
|
||||||
// Register the commonSetup method for modloading
|
// Register the commonSetup method for modloading
|
||||||
modEventBus.addListener(this::commonSetup);
|
modEventBus.addListener(this::commonSetup);
|
||||||
@@ -81,7 +82,7 @@ public class ExampleMod
|
|||||||
modEventBus.addListener(this::addCreative);
|
modEventBus.addListener(this::addCreative);
|
||||||
|
|
||||||
// Register our mod's ForgeConfigSpec so that Forge can create and load the config file for us
|
// Register our mod's ForgeConfigSpec so that Forge can create and load the config file for us
|
||||||
context.registerConfig(ModConfig.Type.COMMON, Config.SPEC);
|
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void commonSetup(final FMLCommonSetupEvent event)
|
private void commonSetup(final FMLCommonSetupEvent event)
|
||||||
|
|||||||
@@ -12,9 +12,6 @@ loaderVersion="${loader_version_range}" #mandatory This is typically bumped ever
|
|||||||
license="${mod_license}"
|
license="${mod_license}"
|
||||||
# A URL to refer people to when problems occur with this mod
|
# A URL to refer people to when problems occur with this mod
|
||||||
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
|
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
|
||||||
# If your mod is purely client-side and has no multiplayer functionality (be it dedicated servers or Open to LAN),
|
|
||||||
# set this to true, and Forge will set the correct displayTest for you and skip loading your mod on dedicated servers.
|
|
||||||
#clientSideOnly=true #optional - defaults to false if absent
|
|
||||||
# A list of mods - how many allowed here is determined by the individual mod loader
|
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||||
[[mods]] #mandatory
|
[[mods]] #mandatory
|
||||||
# The modid of the mod
|
# The modid of the mod
|
||||||
@@ -39,7 +36,7 @@ authors="${mod_authors}" #optional
|
|||||||
# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component.
|
# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component.
|
||||||
# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value.
|
# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value.
|
||||||
# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself.
|
# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself.
|
||||||
#displayTest="MATCH_VERSION" # if nothing is specified, MATCH_VERSION is the default when clientSideOnly=false, otherwise IGNORE_ALL_VERSION when clientSideOnly=true (#optional)
|
#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional)
|
||||||
|
|
||||||
# The description text for the mod (multi line!) (#mandatory)
|
# The description text for the mod (multi line!) (#mandatory)
|
||||||
description='''${mod_description}'''
|
description='''${mod_description}'''
|
||||||
@@ -70,4 +67,4 @@ description='''${mod_description}'''
|
|||||||
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
|
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
|
||||||
# stop your mod loading on the server for example.
|
# stop your mod loading on the server for example.
|
||||||
#[features.${mod_id}]
|
#[features.${mod_id}]
|
||||||
#openGLVersion="[3.2,)"
|
#openGLVersion="[3.2,)"
|
||||||
@@ -5,30 +5,30 @@
|
|||||||
GlStateManager._texParameter(3553, 10242, 33071);
|
GlStateManager._texParameter(3553, 10242, 33071);
|
||||||
GlStateManager._texParameter(3553, 10243, 33071);
|
GlStateManager._texParameter(3553, 10243, 33071);
|
||||||
+ if (!stencilEnabled)
|
+ if (!stencilEnabled)
|
||||||
GlStateManager._texImage2D(3553, 0, 6402, this.f_83915_, this.f_83916_, 0, 6402, 5126, (IntBuffer)null);
|
GlStateManager._texImage2D(3553, 0, 6402, this.width, this.height, 0, 6402, 5126, (IntBuffer)null);
|
||||||
+ else
|
+ else
|
||||||
+ GlStateManager._texImage2D(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.f_83915_, this.f_83916_, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null);
|
+ GlStateManager._texImage2D(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.width, this.height, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.m_83936_(9728);
|
this.setFilterMode(9728);
|
||||||
@@ -124,7 +_,14 @@
|
@@ -124,7 +_,14 @@
|
||||||
GlStateManager._glBindFramebuffer(36160, this.f_83920_);
|
GlStateManager._glBindFramebuffer(36160, this.frameBufferId);
|
||||||
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.f_83923_, 0);
|
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.colorTextureId, 0);
|
||||||
if (this.f_83919_) {
|
if (this.useDepth) {
|
||||||
+ if(!stencilEnabled)
|
+ if(!stencilEnabled)
|
||||||
GlStateManager._glFramebufferTexture2D(36160, 36096, 3553, this.f_83924_, 0);
|
GlStateManager._glFramebufferTexture2D(36160, 36096, 3553, this.depthBufferId, 0);
|
||||||
+ else if(net.minecraftforge.common.ForgeConfig.CLIENT.useCombinedDepthStencilAttachment.get()) {
|
+ else if(net.minecraftforge.common.ForgeConfig.CLIENT.useCombinedDepthStencilAttachment.get()) {
|
||||||
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL_ATTACHMENT, 3553, this.f_83924_, 0);
|
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL_ATTACHMENT, 3553, this.depthBufferId, 0);
|
||||||
+ } else {
|
+ } else {
|
||||||
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_ATTACHMENT, 3553, this.f_83924_, 0);
|
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_ATTACHMENT, 3553, this.depthBufferId, 0);
|
||||||
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, 3553, this.f_83924_, 0);
|
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, 3553, this.depthBufferId, 0);
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
|
|
||||||
this.m_83949_();
|
this.checkStatus();
|
||||||
@@ -292,4 +_,27 @@
|
@@ -292,4 +_,27 @@
|
||||||
public int m_83980_() {
|
public int getDepthTextureId() {
|
||||||
return this.f_83924_;
|
return this.depthBufferId;
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ /*================================ FORGE START ================================================*/
|
+ /*================================ FORGE START ================================================*/
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
+ public void enableStencil() {
|
+ public void enableStencil() {
|
||||||
+ if(stencilEnabled) return;
|
+ if(stencilEnabled) return;
|
||||||
+ stencilEnabled = true;
|
+ stencilEnabled = true;
|
||||||
+ this.m_83941_(f_83917_, f_83918_, net.minecraft.client.Minecraft.f_91002_);
|
+ this.resize(viewWidth, viewHeight, net.minecraft.client.Minecraft.ON_OSX);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
--- a/com/mojang/blaze3d/platform/Window.java
|
--- a/com/mojang/blaze3d/platform/Window.java
|
||||||
+++ b/com/mojang/blaze3d/platform/Window.java
|
+++ b/com/mojang/blaze3d/platform/Window.java
|
||||||
@@ -83,7 +_,8 @@
|
@@ -81,7 +_,8 @@
|
||||||
GLFW.glfwWindowHint(139267, 2);
|
GLFW.glfwWindowHint(139267, 2);
|
||||||
GLFW.glfwWindowHint(139272, 204801);
|
GLFW.glfwWindowHint(139272, 204801);
|
||||||
GLFW.glfwWindowHint(139270, 1);
|
GLFW.glfwWindowHint(139270, 1);
|
||||||
- this.f_85349_ = GLFW.glfwCreateWindow(this.f_85359_, this.f_85360_, p_85376_, this.f_85355_ && monitor != null ? monitor.m_84954_() : 0L, 0L);
|
- this.window = GLFW.glfwCreateWindow(this.width, this.height, p_85376_, this.fullscreen && monitor != null ? monitor.getMonitor() : 0L, 0L);
|
||||||
+ this.f_85349_ = net.minecraftforge.fml.loading.ImmediateWindowHandler.setupMinecraftWindow(()->this.f_85359_, ()->this.f_85360_, ()->p_85376_, ()->this.f_85355_ && monitor != null ? monitor.m_84954_() : 0L);
|
+ this.window = net.minecraftforge.fml.loading.ImmediateWindowHandler.setupMinecraftWindow(()->this.width, ()->this.height, ()->p_85376_, ()->this.fullscreen && monitor != null ? monitor.getMonitor() : 0L);
|
||||||
+ if (!net.minecraftforge.fml.loading.ImmediateWindowHandler.positionWindow(Optional.ofNullable(monitor), w->this.f_85359_ = this.f_85352_ = w, h->this.f_85360_ = this.f_85353_ = h, x->this.f_85357_ = this.f_85350_ = x, y->this.f_85358_ = this.f_85351_ = y)) {
|
+ if (!net.minecraftforge.fml.loading.ImmediateWindowHandler.positionWindow(Optional.ofNullable(monitor), w->this.width = this.windowedWidth = w, h->this.height = this.windowedHeight = h, x->this.x = this.windowedX = x, y->this.y = this.windowedY = y)) {
|
||||||
if (monitor != null) {
|
if (monitor != null) {
|
||||||
VideoMode videomode = monitor.m_84948_(this.f_85355_ ? this.f_85354_ : Optional.empty());
|
VideoMode videomode = monitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty());
|
||||||
this.f_85350_ = this.f_85357_ = monitor.m_84951_() + videomode.m_85332_() / 2 - this.f_85359_ / 2;
|
this.windowedX = this.x = monitor.getX() + videomode.getWidth() / 2 - this.width / 2;
|
||||||
@@ -95,6 +_,7 @@
|
@@ -93,6 +_,7 @@
|
||||||
this.f_85350_ = this.f_85357_ = aint1[0];
|
this.windowedX = this.x = aint1[0];
|
||||||
this.f_85351_ = this.f_85358_ = aint[0];
|
this.windowedY = this.y = aint[0];
|
||||||
}
|
}
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
GLFW.glfwMakeContextCurrent(this.f_85349_);
|
GLFW.glfwMakeContextCurrent(this.window);
|
||||||
Locale locale = Locale.getDefault(Category.FORMAT);
|
GL.createCapabilities();
|
||||||
@@ -238,6 +_,7 @@
|
@@ -242,6 +_,7 @@
|
||||||
GLFW.glfwGetFramebufferSize(this.f_85349_, aint, aint1);
|
GLFW.glfwGetFramebufferSize(this.window, aint, aint1);
|
||||||
this.f_85361_ = aint[0] > 0 ? aint[0] : 1;
|
this.framebufferWidth = aint[0] > 0 ? aint[0] : 1;
|
||||||
this.f_85362_ = aint1[0] > 0 ? aint1[0] : 1;
|
this.framebufferHeight = aint1[0] > 0 ? aint1[0] : 1;
|
||||||
+ if (this.f_85362_ == 0 || this.f_85361_==0) net.minecraftforge.fml.loading.ImmediateWindowHandler.updateFBSize(w->this.f_85361_=w, h->this.f_85362_=h);
|
+ if (this.framebufferHeight == 0 || this.framebufferWidth==0) net.minecraftforge.fml.loading.ImmediateWindowHandler.updateFBSize(w->this.framebufferWidth=w, h->this.framebufferHeight=h);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void m_85427_(long p_85428_, int p_85429_, int p_85430_) {
|
private void onResize(long p_85428_, int p_85429_, int p_85430_) {
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
--- a/com/mojang/blaze3d/vertex/BufferBuilder.java
|
--- a/com/mojang/blaze3d/vertex/BufferBuilder.java
|
||||||
+++ b/com/mojang/blaze3d/vertex/BufferBuilder.java
|
+++ b/com/mojang/blaze3d/vertex/BufferBuilder.java
|
||||||
@@ -459,4 +_,14 @@
|
@@ -459,4 +_,14 @@
|
||||||
this.f_276566_ = p_277855_;
|
this.sorting = p_277855_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Forge start
|
+ // Forge start
|
||||||
+ public void putBulkData(ByteBuffer buffer) {
|
+ public void putBulkData(ByteBuffer buffer) {
|
||||||
+ m_85722_(buffer.limit() + this.f_85658_.m_86020_());
|
+ ensureCapacity(buffer.limit() + this.format.getVertexSize());
|
||||||
+ this.f_85648_.position(this.f_85652_);
|
+ this.buffer.position(this.nextElementByte);
|
||||||
+ this.f_85648_.put(buffer);
|
+ this.buffer.put(buffer);
|
||||||
+ this.f_85648_.position(0);
|
+ this.buffer.position(0);
|
||||||
+ this.f_85654_ += buffer.limit() / this.f_85658_.m_86020_();
|
+ this.vertices += buffer.limit() / this.format.getVertexSize();
|
||||||
+ this.f_85652_ += buffer.limit();
|
+ this.nextElementByte += buffer.limit();
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,6 @@
|
|||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
-public class PoseStack {
|
-public class PoseStack {
|
||||||
+public class PoseStack implements net.minecraftforge.client.extensions.IForgePoseStack {
|
+public class PoseStack implements net.minecraftforge.client.extensions.IForgePoseStack {
|
||||||
private final Deque<PoseStack.Pose> f_85834_ = Util.m_137469_(Queues.newArrayDeque(), (p_85848_) -> {
|
private final Deque<PoseStack.Pose> poseStack = Util.make(Queues.newArrayDeque(), (p_85848_) -> {
|
||||||
Matrix4f matrix4f = new Matrix4f();
|
Matrix4f matrix4f = new Matrix4f();
|
||||||
Matrix3f matrix3f = new Matrix3f();
|
Matrix3f matrix3f = new Matrix3f();
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
+++ b/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java
|
+++ b/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java
|
||||||
@@ -46,7 +_,7 @@
|
@@ -46,7 +_,7 @@
|
||||||
|
|
||||||
public void m_5752_() {
|
public void endVertex() {
|
||||||
Vector3f vector3f = this.f_85869_.transform(new Vector3f(this.f_85876_, this.f_85877_, this.f_85878_));
|
Vector3f vector3f = this.normalInversePose.transform(new Vector3f(this.nx, this.ny, this.nz));
|
||||||
- Direction direction = Direction.m_122372_(vector3f.x(), vector3f.y(), vector3f.z());
|
- Direction direction = Direction.getNearest(vector3f.x(), vector3f.y(), vector3f.z());
|
||||||
+ Direction direction = net.minecraftforge.client.ForgeHooksClient.getNearestStable(vector3f.x(), vector3f.y(), vector3f.z());
|
+ Direction direction = net.minecraftforge.client.ForgeHooksClient.getNearestStable(vector3f.x(), vector3f.y(), vector3f.z());
|
||||||
Vector4f vector4f = this.f_85868_.transform(new Vector4f(this.f_85870_, this.f_85871_, this.f_85872_, 1.0F));
|
Vector4f vector4f = this.cameraInversePose.transform(new Vector4f(this.x, this.y, this.z, 1.0F));
|
||||||
vector4f.rotateY((float)Math.PI);
|
vector4f.rotateY((float)Math.PI);
|
||||||
vector4f.rotateX((-(float)Math.PI / 2F));
|
vector4f.rotateX((-(float)Math.PI / 2F));
|
||||||
@@ -6,20 +6,20 @@
|
|||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
-public interface VertexConsumer {
|
-public interface VertexConsumer {
|
||||||
+public interface VertexConsumer extends net.minecraftforge.client.extensions.IForgeVertexConsumer {
|
+public interface VertexConsumer extends net.minecraftforge.client.extensions.IForgeVertexConsumer {
|
||||||
VertexConsumer m_5483_(double p_85945_, double p_85946_, double p_85947_);
|
VertexConsumer vertex(double p_85945_, double p_85946_, double p_85947_);
|
||||||
|
|
||||||
VertexConsumer m_6122_(int p_85973_, int p_85974_, int p_85975_, int p_85976_);
|
VertexConsumer color(int p_85973_, int p_85974_, int p_85975_, int p_85976_);
|
||||||
@@ -64,6 +_,10 @@
|
@@ -64,6 +_,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
default void m_85995_(PoseStack.Pose p_85996_, BakedQuad p_85997_, float[] p_85998_, float p_85999_, float p_86000_, float p_86001_, int[] p_86002_, int p_86003_, boolean p_86004_) {
|
default void putBulkData(PoseStack.Pose p_85996_, BakedQuad p_85997_, float[] p_85998_, float p_85999_, float p_86000_, float p_86001_, int[] p_86002_, int p_86003_, boolean p_86004_) {
|
||||||
+ putBulkData(p_85996_, p_85997_, p_85998_, p_85999_, p_86000_, p_86001_, 1, p_86002_, p_86003_, p_86004_);
|
+ putBulkData(p_85996_, p_85997_, p_85998_, p_85999_, p_86000_, p_86001_, 1, p_86002_, p_86003_, p_86004_);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ default void putBulkData(PoseStack.Pose p_85996_, BakedQuad p_85997_, float[] p_85998_, float p_85999_, float p_86000_, float p_86001_, float alpha, int[] p_86002_, int p_86003_, boolean p_86004_) {
|
+ default void putBulkData(PoseStack.Pose p_85996_, BakedQuad p_85997_, float[] p_85998_, float p_85999_, float p_86000_, float p_86001_, float alpha, int[] p_86002_, int p_86003_, boolean p_86004_) {
|
||||||
float[] afloat = new float[]{p_85998_[0], p_85998_[1], p_85998_[2], p_85998_[3]};
|
float[] afloat = new float[]{p_85998_[0], p_85998_[1], p_85998_[2], p_85998_[3]};
|
||||||
int[] aint = new int[]{p_86002_[0], p_86002_[1], p_86002_[2], p_86002_[3]};
|
int[] aint = new int[]{p_86002_[0], p_86002_[1], p_86002_[2], p_86002_[3]};
|
||||||
int[] aint1 = p_85997_.m_111303_();
|
int[] aint1 = p_85997_.getVertices();
|
||||||
@@ -99,11 +_,13 @@
|
@@ -99,11 +_,13 @@
|
||||||
f5 = afloat[k] * p_86001_;
|
f5 = afloat[k] * p_86001_;
|
||||||
}
|
}
|
||||||
@@ -29,10 +29,10 @@
|
|||||||
float f9 = bytebuffer.getFloat(16);
|
float f9 = bytebuffer.getFloat(16);
|
||||||
float f10 = bytebuffer.getFloat(20);
|
float f10 = bytebuffer.getFloat(20);
|
||||||
Vector4f vector4f = matrix4f.transform(new Vector4f(f, f1, f2, 1.0F));
|
Vector4f vector4f = matrix4f.transform(new Vector4f(f, f1, f2, 1.0F));
|
||||||
- this.m_5954_(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
|
- this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
|
||||||
+ applyBakedNormals(vector3f, bytebuffer, p_85996_.m_252943_());
|
+ applyBakedNormals(vector3f, bytebuffer, p_85996_.normal());
|
||||||
+ float vertexAlpha = p_86004_ ? alpha * (float) (bytebuffer.get(15) & 255) / 255.0F : alpha;
|
+ float vertexAlpha = p_86004_ ? alpha * (float) (bytebuffer.get(15) & 255) / 255.0F : alpha;
|
||||||
+ this.m_5954_(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
|
+ this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5,10 +5,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ public ImmutableMap<String, VertexFormatElement> getElementMapping() { return f_166905_; }
|
+ public ImmutableMap<String, VertexFormatElement> getElementMapping() { return elementMapping; }
|
||||||
+ public int getOffset(int index) { return f_86013_.getInt(index); }
|
+ public int getOffset(int index) { return offsets.getInt(index); }
|
||||||
+ public boolean hasPosition() { return f_86012_.stream().anyMatch(e -> e.m_86048_() == VertexFormatElement.Usage.POSITION); }
|
+ public boolean hasPosition() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.POSITION); }
|
||||||
+ public boolean hasNormal() { return f_86012_.stream().anyMatch(e -> e.m_86048_() == VertexFormatElement.Usage.NORMAL); }
|
+ public boolean hasNormal() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.NORMAL); }
|
||||||
+ public boolean hasColor() { return f_86012_.stream().anyMatch(e -> e.m_86048_() == VertexFormatElement.Usage.COLOR); }
|
+ public boolean hasColor() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.COLOR); }
|
||||||
+ public boolean hasUV(int which) { return f_86012_.stream().anyMatch(e -> e.m_86048_() == VertexFormatElement.Usage.UV && e.m_86049_() == which); }
|
+ public boolean hasUV(int which) { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.UV && e.getIndex() == which); }
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
--- a/com/mojang/blaze3d/vertex/VertexFormatElement.java
|
--- a/com/mojang/blaze3d/vertex/VertexFormatElement.java
|
||||||
+++ b/com/mojang/blaze3d/vertex/VertexFormatElement.java
|
+++ b/com/mojang/blaze3d/vertex/VertexFormatElement.java
|
||||||
@@ -90,6 +_,10 @@
|
@@ -90,6 +_,10 @@
|
||||||
this.f_86031_.m_166978_(this.f_86032_, p_166964_);
|
this.usage.clearBufferState(this.index, p_166964_);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ public int getElementCount() {
|
+ public int getElementCount() {
|
||||||
+ return f_86033_;
|
+ return count;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
--- a/com/mojang/math/Transformation.java
|
--- a/com/mojang/math/Transformation.java
|
||||||
+++ b/com/mojang/math/Transformation.java
|
+++ b/com/mojang/math/Transformation.java
|
||||||
@@ -14,7 +_,7 @@
|
@@ -13,7 +_,7 @@
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
import org.joml.Vector3fc;
|
import org.joml.Vector3fc;
|
||||||
|
|
||||||
-public final class Transformation {
|
-public final class Transformation {
|
||||||
+public final class Transformation implements net.minecraftforge.common.extensions.IForgeTransformation {
|
+public final class Transformation implements net.minecraftforge.common.extensions.IForgeTransformation {
|
||||||
private final Matrix4f f_121078_;
|
private final Matrix4f matrix;
|
||||||
public static final Codec<Transformation> f_268453_ = RecordCodecBuilder.create((p_269604_) -> {
|
public static final Codec<Transformation> CODEC = RecordCodecBuilder.create((p_269604_) -> {
|
||||||
return p_269604_.group(ExtraCodecs.f_252432_.fieldOf("translation").forGetter((p_269599_) -> {
|
return p_269604_.group(ExtraCodecs.VECTOR3F.fieldOf("translation").forGetter((p_269599_) -> {
|
||||||
@@ -163,6 +_,19 @@
|
@@ -156,6 +_,19 @@
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(this.f_121078_);
|
return Objects.hash(this.matrix);
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ private Matrix3f normalTransform = null;
|
+ private Matrix3f normalTransform = null;
|
||||||
@@ -21,11 +21,11 @@
|
|||||||
+ }
|
+ }
|
||||||
+ private void checkNormalTransform() {
|
+ private void checkNormalTransform() {
|
||||||
+ if (normalTransform == null) {
|
+ if (normalTransform == null) {
|
||||||
+ normalTransform = new Matrix3f(f_121078_);
|
+ normalTransform = new Matrix3f(matrix);
|
||||||
+ normalTransform.invert();
|
+ normalTransform.invert();
|
||||||
+ normalTransform.transpose();
|
+ normalTransform.transpose();
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
public Transformation m_175937_(Transformation p_175938_, float p_175939_) {
|
public Transformation slerp(Transformation p_175938_, float p_175939_) {
|
||||||
Vector3f vector3f = this.m_252829_();
|
Vector3f vector3f = this.getTranslation();
|
||||||
+8
-8
@@ -1,18 +1,18 @@
|
|||||||
--- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
--- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
||||||
+++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
+++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
||||||
@@ -68,6 +_,15 @@
|
@@ -61,6 +_,15 @@
|
||||||
return Component.m_237119_().m_7220_(this.f_200947_.f_287789_).m_130946_(": ").m_7220_(this.f_200947_.f_287787_);
|
return Component.empty().append(this.lines.title).append(": ").append(this.lines.detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public boolean m_7933_(int key, int scanCode, int modifiers) {
|
+ public boolean keyPressed(int key, int scanCode, int modifiers) {
|
||||||
+ if (key == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) {
|
+ if (key == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) {
|
||||||
+ f_96541_.m_91152_(this.f_88665_);
|
+ minecraft.setScreen(this.nextScreen);
|
||||||
+ return true;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+ return super.m_7933_(key, scanCode, modifiers);
|
+ return super.keyPressed(key, scanCode, modifiers);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
public void m_88315_(GuiGraphics p_283497_, int p_88680_, int p_88681_, float p_88682_) {
|
public void render(GuiGraphics p_283497_, int p_88680_, int p_88681_, float p_88682_) {
|
||||||
this.m_280273_(p_283497_);
|
super.render(p_283497_, p_88680_, p_88681_, p_88682_);
|
||||||
p_283497_.m_280653_(this.f_96547_, this.f_200947_.f_287789_, this.f_96543_ / 2, 80, 16777215);
|
p_283497_.drawCenteredString(this.font, this.lines.title, this.width / 2, 80, -1);
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
--- a/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java
|
|
||||||
+++ b/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java
|
|
||||||
@@ -45,9 +_,9 @@
|
|
||||||
}
|
|
||||||
};
|
|
||||||
private final RealmsNotificationsScreen.DataFetcherConfiguration f_273849_ = new RealmsNotificationsScreen.DataFetcherConfiguration() {
|
|
||||||
- public DataFetcher.Subscription m_274316_(RealmsDataFetcher p_275731_) {
|
|
||||||
- DataFetcher.Subscription datafetcher$subscription = p_275731_.f_238549_.m_239139_();
|
|
||||||
- RealmsNotificationsScreen.this.m_274585_(p_275731_, datafetcher$subscription);
|
|
||||||
+ public DataFetcher.Subscription m_274316_(RealmsDataFetcher p_275318_) {
|
|
||||||
+ DataFetcher.Subscription datafetcher$subscription = p_275318_.f_238549_.m_239139_();
|
|
||||||
+ RealmsNotificationsScreen.this.m_274585_(p_275318_, datafetcher$subscription);
|
|
||||||
return datafetcher$subscription;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,33 +1,32 @@
|
|||||||
--- a/net/minecraft/CrashReport.java
|
--- a/net/minecraft/CrashReport.java
|
||||||
+++ b/net/minecraft/CrashReport.java
|
+++ b/net/minecraft/CrashReport.java
|
||||||
@@ -57,14 +_,9 @@
|
@@ -57,14 +_,8 @@
|
||||||
if (this.f_127506_ != null && this.f_127506_.length > 0) {
|
if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) {
|
||||||
p_127520_.append("-- Head --\n");
|
p_127520_.append("-- Head --\n");
|
||||||
p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
|
p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
|
||||||
- p_127520_.append("Stacktrace:\n");
|
- p_127520_.append("Stacktrace:\n");
|
||||||
-
|
-
|
||||||
- for(StackTraceElement stacktraceelement : this.f_127506_) {
|
- for(StackTraceElement stacktraceelement : this.uncategorizedStackTrace) {
|
||||||
- p_127520_.append("\t").append("at ").append((Object)stacktraceelement);
|
- p_127520_.append("\t").append("at ").append((Object)stacktraceelement);
|
||||||
- p_127520_.append("\n");
|
- p_127520_.append("\n");
|
||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
- p_127520_.append("\n");
|
- p_127520_.append("\n");
|
||||||
+ p_127520_.append(net.minecraftforge.logging.CrashReportAnalyser.appendSuspectedMods(this.f_127501_, this.f_127506_));
|
|
||||||
+ p_127520_.append("Stacktrace:");
|
+ p_127520_.append("Stacktrace:");
|
||||||
+ p_127520_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.f_127506_));
|
+ p_127520_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.uncategorizedStackTrace));
|
||||||
}
|
}
|
||||||
|
|
||||||
for(CrashReportCategory crashreportcategory : this.f_127503_) {
|
for(CrashReportCategory crashreportcategory : this.details) {
|
||||||
@@ -72,6 +_,7 @@
|
@@ -72,6 +_,7 @@
|
||||||
p_127520_.append("\n\n");
|
p_127520_.append("\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
+ net.minecraftforge.logging.CrashReportExtender.extendSystemReport(f_178624_);
|
+ net.minecraftforge.logging.CrashReportExtender.extendSystemReport(systemReport);
|
||||||
this.f_178624_.m_143525_(p_127520_);
|
this.systemReport.appendToCrashReportString(p_127520_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,23 +_,13 @@
|
@@ -91,23 +_,13 @@
|
||||||
throwable.setStackTrace(this.f_127501_.getStackTrace());
|
throwable.setStackTrace(this.exception.getStackTrace());
|
||||||
}
|
}
|
||||||
|
|
||||||
- String s;
|
- String s;
|
||||||
@@ -45,10 +44,10 @@
|
|||||||
+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(throwable);
|
+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String m_127526_() {
|
public String getFriendlyReport() {
|
||||||
StringBuilder stringbuilder = new StringBuilder();
|
StringBuilder stringbuilder = new StringBuilder();
|
||||||
stringbuilder.append("---- Minecraft Crash Report ----\n");
|
stringbuilder.append("---- Minecraft Crash Report ----\n");
|
||||||
+ net.minecraftforge.logging.CrashReportExtender.addCrashReportHeader(stringbuilder, this);
|
+ net.minecraftforge.logging.CrashReportExtender.addCrashReportHeader(stringbuilder, this);
|
||||||
stringbuilder.append("// ");
|
stringbuilder.append("// ");
|
||||||
stringbuilder.append(m_127531_());
|
stringbuilder.append(getErrorComment());
|
||||||
stringbuilder.append("\n\n");
|
stringbuilder.append("\n\n");
|
||||||
@@ -4,35 +4,35 @@
|
|||||||
if (astacktraceelement.length <= 0) {
|
if (astacktraceelement.length <= 0) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
- this.f_128139_ = new StackTraceElement[astacktraceelement.length - 3 - p_128149_];
|
- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - p_128149_];
|
||||||
- System.arraycopy(astacktraceelement, 3 + p_128149_, this.f_128139_, 0, this.f_128139_.length);
|
- System.arraycopy(astacktraceelement, 3 + p_128149_, this.stackTrace, 0, this.stackTrace.length);
|
||||||
+ int len = astacktraceelement.length - 3 - p_128149_;
|
+ int len = astacktraceelement.length - 3 - p_128149_;
|
||||||
+ if (len <= 0) len = astacktraceelement.length;
|
+ if (len <= 0) len = astacktraceelement.length;
|
||||||
+ this.f_128139_ = new StackTraceElement[len];
|
+ this.stackTrace = new StackTraceElement[len];
|
||||||
+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.f_128139_, 0, this.f_128139_.length);
|
+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length);
|
||||||
return this.f_128139_.length;
|
return this.stackTrace.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,17 +_,17 @@
|
@@ -147,17 +_,17 @@
|
||||||
|
|
||||||
if (this.f_128139_ != null && this.f_128139_.length > 0) {
|
if (this.stackTrace != null && this.stackTrace.length > 0) {
|
||||||
p_128169_.append("\nStacktrace:");
|
p_128169_.append("\nStacktrace:");
|
||||||
-
|
-
|
||||||
- for(StackTraceElement stacktraceelement : this.f_128139_) {
|
- for(StackTraceElement stacktraceelement : this.stackTrace) {
|
||||||
- p_128169_.append("\n\tat ");
|
- p_128169_.append("\n\tat ");
|
||||||
- p_128169_.append((Object)stacktraceelement);
|
- p_128169_.append((Object)stacktraceelement);
|
||||||
- }
|
- }
|
||||||
+ p_128169_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.f_128139_));
|
+ p_128169_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.stackTrace));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public StackTraceElement[] m_128143_() {
|
public StackTraceElement[] getStacktrace() {
|
||||||
return this.f_128139_;
|
return this.stackTrace;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void applyStackTrace(Throwable t) {
|
+ public void applyStackTrace(Throwable t) {
|
||||||
+ this.f_128139_ = t.getStackTrace();
|
+ this.stackTrace = t.getStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void m_178950_(CrashReportCategory p_178951_, LevelHeightAccessor p_178952_, BlockPos p_178953_, @Nullable BlockState p_178954_) {
|
public static void populateBlockDetails(CrashReportCategory p_178951_, LevelHeightAccessor p_178952_, BlockPos p_178953_, @Nullable BlockState p_178954_) {
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
--- a/net/minecraft/SharedConstants.java
|
--- a/net/minecraft/SharedConstants.java
|
||||||
+++ b/net/minecraft/SharedConstants.java
|
+++ b/net/minecraft/SharedConstants.java
|
||||||
@@ -210,6 +_,7 @@
|
@@ -212,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
+ if (System.getProperty("io.netty.leakDetection.level") == null) // Forge: allow level to be manually specified
|
+ if (System.getProperty("io.netty.leakDetection.level") == null) // Forge: allow level to be manually specified
|
||||||
ResourceLeakDetector.setLevel(f_136180_);
|
ResourceLeakDetector.setLevel(NETTY_LEAK_DETECTION);
|
||||||
CommandSyntaxException.ENABLE_COMMAND_STACK_TRACES = false;
|
CommandSyntaxException.ENABLE_COMMAND_STACK_TRACES = false;
|
||||||
CommandSyntaxException.BUILT_IN_EXCEPTIONS = new BrigadierExceptions();
|
CommandSyntaxException.BUILT_IN_EXCEPTIONS = new BrigadierExceptions();
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/Util.java
|
--- a/net/minecraft/Util.java
|
||||||
+++ b/net/minecraft/Util.java
|
+++ b/net/minecraft/Util.java
|
||||||
@@ -171,6 +_,11 @@
|
@@ -172,6 +_,11 @@
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9,15 +9,15 @@
|
|||||||
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT1 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
|
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT1 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
|
||||||
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT2 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
|
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT2 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
|
||||||
+
|
+
|
||||||
public static ExecutorService m_183991_() {
|
public static ExecutorService backgroundExecutor() {
|
||||||
return f_137444_;
|
return BACKGROUND_EXECUTOR;
|
||||||
}
|
}
|
||||||
@@ -239,7 +_,7 @@
|
@@ -240,7 +_,7 @@
|
||||||
try {
|
try {
|
||||||
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().m_183476_().m_193006_())).getChoiceType(p_137552_, p_137553_);
|
type = DataFixers.getDataFixer().getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().getDataVersion().getVersion())).getChoiceType(p_137552_, p_137553_);
|
||||||
} catch (IllegalArgumentException illegalargumentexception) {
|
} catch (IllegalArgumentException illegalargumentexception) {
|
||||||
- f_137446_.error("No data fixer registered for {}", (Object)p_137553_);
|
- LOGGER.error("No data fixer registered for {}", (Object)p_137553_);
|
||||||
+ f_137446_.debug("No data fixer registered for {}", (Object)p_137553_);
|
+ LOGGER.debug("No data fixer registered for {}", (Object)p_137553_);
|
||||||
if (SharedConstants.f_136183_) {
|
if (SharedConstants.IS_RUNNING_IN_IDE) {
|
||||||
throw illegalargumentexception;
|
throw illegalargumentexception;
|
||||||
}
|
}
|
||||||
@@ -1,26 +1,30 @@
|
|||||||
--- a/net/minecraft/advancements/Advancement.java
|
--- a/net/minecraft/advancements/Advancement.java
|
||||||
+++ b/net/minecraft/advancements/Advancement.java
|
+++ b/net/minecraft/advancements/Advancement.java
|
||||||
@@ -150,7 +_,7 @@
|
@@ -62,7 +_,14 @@
|
||||||
return this.f_138305_;
|
return jsonobject;
|
||||||
}
|
}
|
||||||
|
|
||||||
- public static class Builder {
|
+ /** @deprecated Forge: use {@linkplain #fromJson(JsonObject, DeserializationContext, net.minecraftforge.common.crafting.conditions.ICondition.IContext) overload with context}. */
|
||||||
+ public static class Builder implements net.minecraftforge.common.extensions.IForgeAdvancementBuilder {
|
+ @Deprecated
|
||||||
@Nullable
|
public static Advancement fromJson(JsonObject p_300691_, DeserializationContext p_300053_) {
|
||||||
private ResourceLocation f_138332_;
|
+ return fromJson(p_300691_, p_300053_, net.minecraftforge.common.crafting.conditions.ICondition.IContext.EMPTY);
|
||||||
@Nullable
|
+ }
|
||||||
@@ -340,7 +_,14 @@
|
+
|
||||||
return "Task Advancement{parentId=" + this.f_138332_ + ", display=" + this.f_138334_ + ", rewards=" + this.f_138335_ + ", criteria=" + this.f_138336_ + ", requirements=" + Arrays.deepToString(this.f_138337_) + ", sends_telemetry_event=" + this.f_285655_ + "}";
|
+ public static Advancement fromJson(JsonObject p_300691_, DeserializationContext p_300053_, net.minecraftforge.common.crafting.conditions.ICondition.IContext context) {
|
||||||
|
+ //if ((p_300691_ = net.minecraftforge.common.crafting.ConditionalAdvancement.processConditional(p_300691_, context)) == null) return null;
|
||||||
|
Optional<ResourceLocation> optional = p_300691_.has("parent") ? Optional.of(new ResourceLocation(GsonHelper.getAsString(p_300691_, "parent"))) : Optional.empty();
|
||||||
|
Optional<DisplayInfo> optional1 = p_300691_.has("display") ? Optional.of(DisplayInfo.fromJson(GsonHelper.getAsJsonObject(p_300691_, "display"))) : Optional.empty();
|
||||||
|
AdvancementRewards advancementrewards = p_300691_.has("rewards") ? AdvancementRewards.deserialize(GsonHelper.getAsJsonObject(p_300691_, "rewards")) : AdvancementRewards.EMPTY;
|
||||||
|
@@ -182,7 +_,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
+ /** @deprecated Forge: use {@linkplain #fromJson(JsonObject, DeserializationContext, net.minecraftforge.common.crafting.conditions.ICondition.IContext) overload with context}. */
|
public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, String p_138391_) {
|
||||||
+ @Deprecated
|
- AdvancementHolder advancementholder = this.build(new ResourceLocation(p_138391_));
|
||||||
public static Advancement.Builder m_138380_(JsonObject p_138381_, DeserializationContext p_138382_) {
|
+ return save(p_138390_, new ResourceLocation(p_138391_));
|
||||||
+ return fromJson(p_138381_, p_138382_, net.minecraftforge.common.crafting.conditions.ICondition.IContext.EMPTY);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static Advancement.Builder fromJson(JsonObject p_138381_, DeserializationContext p_138382_, net.minecraftforge.common.crafting.conditions.ICondition.IContext context) {
|
+ public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, ResourceLocation id) {
|
||||||
+ if ((p_138381_ = net.minecraftforge.common.crafting.ConditionalAdvancement.processConditional(p_138381_, context)) == null) return null;
|
+ AdvancementHolder advancementholder = this.build(id);
|
||||||
ResourceLocation resourcelocation = p_138381_.has("parent") ? new ResourceLocation(GsonHelper.m_13906_(p_138381_, "parent")) : null;
|
p_138390_.accept(advancementholder);
|
||||||
DisplayInfo displayinfo = p_138381_.has("display") ? DisplayInfo.m_14981_(GsonHelper.m_13930_(p_138381_, "display")) : null;
|
return advancementholder;
|
||||||
AdvancementRewards advancementrewards = p_138381_.has("rewards") ? AdvancementRewards.m_9991_(GsonHelper.m_13930_(p_138381_, "rewards")) : AdvancementRewards.f_9978_;
|
}
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
+++ b/net/minecraft/advancements/AdvancementRewards.java
|
+++ b/net/minecraft/advancements/AdvancementRewards.java
|
||||||
@@ -43,7 +_,7 @@
|
@@ -43,7 +_,7 @@
|
||||||
|
|
||||||
public void m_9989_(ServerPlayer p_9990_) {
|
public void grant(ServerPlayer p_9990_) {
|
||||||
p_9990_.m_6756_(this.f_9979_);
|
p_9990_.giveExperiencePoints(this.experience);
|
||||||
- LootParams lootparams = (new LootParams.Builder(p_9990_.m_284548_())).m_287286_(LootContextParams.f_81455_, p_9990_).m_287286_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_287235_(LootContextParamSets.f_81418_);
|
- LootParams lootparams = (new LootParams.Builder(p_9990_.serverLevel())).withParameter(LootContextParams.THIS_ENTITY, p_9990_).withParameter(LootContextParams.ORIGIN, p_9990_.position()).create(LootContextParamSets.ADVANCEMENT_REWARD);
|
||||||
+ LootParams lootparams = (new LootParams.Builder(p_9990_.m_284548_())).m_287286_(LootContextParams.f_81455_, p_9990_).m_287286_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_287239_(p_9990_.m_36336_()).m_287235_(LootContextParamSets.f_81418_); // Forge: Add luck to LootContext
|
+ LootParams lootparams = (new LootParams.Builder(p_9990_.serverLevel())).withParameter(LootContextParams.THIS_ENTITY, p_9990_).withParameter(LootContextParams.ORIGIN, p_9990_.position()).withLuck(p_9990_.getLuck()).create(LootContextParamSets.ADVANCEMENT_REWARD); // Forge: Add luck to LootContext
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
|
|
||||||
for(ResourceLocation resourcelocation : this.f_9980_) {
|
for(ResourceLocation resourcelocation : this.loot) {
|
||||||
@@ -1,47 +1,11 @@
|
|||||||
--- a/net/minecraft/advancements/critereon/ItemPredicate.java
|
--- a/net/minecraft/advancements/critereon/ItemPredicate.java
|
||||||
+++ b/net/minecraft/advancements/critereon/ItemPredicate.java
|
+++ b/net/minecraft/advancements/critereon/ItemPredicate.java
|
||||||
@@ -29,6 +_,8 @@
|
@@ -50,7 +_,7 @@
|
||||||
import net.minecraft.world.level.ItemLike;
|
|
||||||
|
|
||||||
public class ItemPredicate {
|
|
||||||
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> custom_predicates = new java.util.HashMap<>();
|
|
||||||
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> unmod_predicates = java.util.Collections.unmodifiableMap(custom_predicates);
|
|
||||||
public static final ItemPredicate f_45028_ = new ItemPredicate();
|
|
||||||
@Nullable
|
|
||||||
private final TagKey<Item> f_45029_;
|
|
||||||
@@ -81,7 +_,7 @@
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (this.f_45033_.length > 0) {
|
if (!this.enchantments.isEmpty()) {
|
||||||
- Map<Enchantment, Integer> map = EnchantmentHelper.m_44882_(p_45050_.m_41785_());
|
- Map<Enchantment, Integer> map = EnchantmentHelper.deserializeEnchantments(p_45050_.getEnchantmentTags());
|
||||||
+ Map<Enchantment, Integer> map = p_45050_.getAllEnchantments();
|
+ Map<Enchantment, Integer> map = p_45050_.getAllEnchantments();
|
||||||
|
|
||||||
for(EnchantmentPredicate enchantmentpredicate : this.f_45033_) {
|
for(EnchantmentPredicate enchantmentpredicate : this.enchantments) {
|
||||||
if (!enchantmentpredicate.m_30476_(map)) {
|
if (!enchantmentpredicate.containedIn(map)) {
|
||||||
@@ -108,6 +_,11 @@
|
|
||||||
public static ItemPredicate m_45051_(@Nullable JsonElement p_45052_) {
|
|
||||||
if (p_45052_ != null && !p_45052_.isJsonNull()) {
|
|
||||||
JsonObject jsonobject = GsonHelper.m_13918_(p_45052_, "item");
|
|
||||||
+ if (jsonobject.has("type")) {
|
|
||||||
+ final ResourceLocation rl = new ResourceLocation(GsonHelper.m_13906_(jsonobject, "type"));
|
|
||||||
+ if (custom_predicates.containsKey(rl)) return custom_predicates.get(rl).apply(jsonobject);
|
|
||||||
+ else throw new JsonSyntaxException("There is no ItemPredicate of type "+rl);
|
|
||||||
+ }
|
|
||||||
MinMaxBounds.Ints minmaxbounds$ints = MinMaxBounds.Ints.m_55373_(jsonobject.get("count"));
|
|
||||||
MinMaxBounds.Ints minmaxbounds$ints1 = MinMaxBounds.Ints.m_55373_(jsonobject.get("durability"));
|
|
||||||
if (jsonobject.has("data")) {
|
|
||||||
@@ -215,6 +_,14 @@
|
|
||||||
} else {
|
|
||||||
return new ItemPredicate[0];
|
|
||||||
}
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static void register(ResourceLocation name, java.util.function.Function<JsonObject, ItemPredicate> deserializer) {
|
|
||||||
+ custom_predicates.put(name, deserializer);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> getPredicates() {
|
|
||||||
+ return unmod_predicates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder {
|
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
--- a/net/minecraft/client/Camera.java
|
--- a/net/minecraft/client/Camera.java
|
||||||
+++ b/net/minecraft/client/Camera.java
|
+++ b/net/minecraft/client/Camera.java
|
||||||
@@ -206,6 +_,18 @@
|
@@ -206,6 +_,18 @@
|
||||||
this.f_90549_ = false;
|
this.initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ public void setAnglesInternal(float yaw, float pitch) {
|
+ public void setAnglesInternal(float yaw, float pitch) {
|
||||||
+ this.f_90558_ = yaw;
|
+ this.yRot = yaw;
|
||||||
+ this.f_90557_ = pitch;
|
+ this.xRot = pitch;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public net.minecraft.world.level.block.state.BlockState getBlockAtCamera() {
|
+ public net.minecraft.world.level.block.state.BlockState getBlockAtCamera() {
|
||||||
+ if (!this.f_90549_)
|
+ if (!this.initialized)
|
||||||
+ return net.minecraft.world.level.block.Blocks.f_50016_.m_49966_();
|
+ return net.minecraft.world.level.block.Blocks.AIR.defaultBlockState();
|
||||||
+ else
|
+ else
|
||||||
+ return this.f_90550_.m_8055_(this.f_90553_).getStateAtViewpoint(this.f_90550_, this.f_90553_, this.f_90552_);
|
+ return this.level.getBlockState(this.blockPosition).getStateAtViewpoint(this.level, this.blockPosition, this.position);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static class NearPlane {
|
public static class NearPlane {
|
||||||
final Vec3 f_167687_;
|
final Vec3 forward;
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
--- a/net/minecraft/client/ClientRecipeBook.java
|
--- a/net/minecraft/client/ClientRecipeBook.java
|
||||||
+++ b/net/minecraft/client/ClientRecipeBook.java
|
+++ b/net/minecraft/client/ClientRecipeBook.java
|
||||||
@@ -54,7 +_,7 @@
|
@@ -56,7 +_,7 @@
|
||||||
for(Recipe<?> recipe : p_90643_) {
|
Recipe<?> recipe = recipeholder.value();
|
||||||
if (!recipe.m_5598_() && !recipe.m_142505_()) {
|
if (!recipe.isSpecial() && !recipe.isIncomplete()) {
|
||||||
RecipeBookCategories recipebookcategories = m_90646_(recipe);
|
RecipeBookCategories recipebookcategories = getCategory(recipeholder);
|
||||||
- String s = recipe.m_6076_();
|
- String s = recipe.getGroup();
|
||||||
+ String s = recipe.m_6076_().isEmpty() ? recipe.m_6423_().toString() : recipe.m_6076_(); // FORGE: Group value defaults to the recipe's ID if the recipe's explicit group is empty.
|
+ String s = recipe.getGroup().isEmpty() ? recipeholder.id().toString() : recipe.getGroup(); // FORGE: Group value defaults to the recipe's ID if the recipe's explicit group is empty.
|
||||||
if (s.isEmpty()) {
|
if (s.isEmpty()) {
|
||||||
map.computeIfAbsent(recipebookcategories, (p_90645_) -> {
|
map.computeIfAbsent(recipebookcategories, (p_90645_) -> {
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
@@ -141,6 +_,8 @@
|
@@ -144,6 +_,8 @@
|
||||||
} else if (recipetype == RecipeType.f_44113_) {
|
} else if (recipetype == RecipeType.SMITHING) {
|
||||||
return RecipeBookCategories.SMITHING;
|
return RecipeBookCategories.SMITHING;
|
||||||
} else {
|
} else {
|
||||||
+ RecipeBookCategories categories = net.minecraftforge.client.RecipeBookManager.findCategories((RecipeType) recipetype, p_90647_);
|
+ RecipeBookCategories categories = net.minecraftforge.client.RecipeBookManager.findCategories((RecipeType) recipetype, p_299041_);
|
||||||
+ if (categories != null) return categories;
|
+ if (categories != null) return categories;
|
||||||
f_90618_.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> {
|
LOGGER.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> {
|
||||||
return BuiltInRegistries.f_256990_.m_7981_(p_90647_.m_6671_());
|
return BuiltInRegistries.RECIPE_TYPE.getKey(recipe.getType());
|
||||||
}), LogUtils.defer(p_90647_::m_6423_));
|
}), LogUtils.defer(p_299041_::id));
|
||||||
@@ -6,58 +6,58 @@
|
|||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
-public class KeyMapping implements Comparable<KeyMapping> {
|
-public class KeyMapping implements Comparable<KeyMapping> {
|
||||||
+public class KeyMapping implements Comparable<KeyMapping>, net.minecraftforge.client.extensions.IForgeKeyMapping {
|
+public class KeyMapping implements Comparable<KeyMapping>, net.minecraftforge.client.extensions.IForgeKeyMapping {
|
||||||
private static final Map<String, KeyMapping> f_90809_ = Maps.newHashMap();
|
private static final Map<String, KeyMapping> ALL = Maps.newHashMap();
|
||||||
- private static final Map<InputConstants.Key, KeyMapping> f_90810_ = Maps.newHashMap();
|
- private static final Map<InputConstants.Key, KeyMapping> MAP = Maps.newHashMap();
|
||||||
+ private static final net.minecraftforge.client.settings.KeyMappingLookup f_90810_ = new net.minecraftforge.client.settings.KeyMappingLookup();
|
+ private static final net.minecraftforge.client.settings.KeyMappingLookup MAP = new net.minecraftforge.client.settings.KeyMappingLookup();
|
||||||
private static final Set<String> f_90811_ = Sets.newHashSet();
|
private static final Set<String> CATEGORIES = Sets.newHashSet();
|
||||||
public static final String f_167805_ = "key.categories.movement";
|
public static final String CATEGORY_MOVEMENT = "key.categories.movement";
|
||||||
public static final String f_167806_ = "key.categories.misc";
|
public static final String CATEGORY_MISC = "key.categories.misc";
|
||||||
@@ -41,7 +_,7 @@
|
@@ -41,7 +_,7 @@
|
||||||
private int f_90818_;
|
private int clickCount;
|
||||||
|
|
||||||
public static void m_90835_(InputConstants.Key p_90836_) {
|
public static void click(InputConstants.Key p_90836_) {
|
||||||
- KeyMapping keymapping = f_90810_.get(p_90836_);
|
- KeyMapping keymapping = MAP.get(p_90836_);
|
||||||
+ for (KeyMapping keymapping : f_90810_.getAll(p_90836_))
|
+ for (KeyMapping keymapping : MAP.getAll(p_90836_))
|
||||||
if (keymapping != null) {
|
if (keymapping != null) {
|
||||||
++keymapping.f_90818_;
|
++keymapping.clickCount;
|
||||||
}
|
}
|
||||||
@@ -49,7 +_,7 @@
|
@@ -49,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void m_90837_(InputConstants.Key p_90838_, boolean p_90839_) {
|
public static void set(InputConstants.Key p_90838_, boolean p_90839_) {
|
||||||
- KeyMapping keymapping = f_90810_.get(p_90838_);
|
- KeyMapping keymapping = MAP.get(p_90838_);
|
||||||
+ for (KeyMapping keymapping : f_90810_.getAll(p_90838_))
|
+ for (KeyMapping keymapping : MAP.getAll(p_90838_))
|
||||||
if (keymapping != null) {
|
if (keymapping != null) {
|
||||||
keymapping.m_7249_(p_90839_);
|
keymapping.setDown(p_90839_);
|
||||||
}
|
}
|
||||||
@@ -105,7 +_,7 @@
|
@@ -105,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean m_90857_() {
|
public boolean isDown() {
|
||||||
- return this.f_90817_;
|
- return this.isDown;
|
||||||
+ return this.f_90817_ && isConflictContextAndModifierActive();
|
+ return this.isDown && isConflictContextAndModifierActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String m_90858_() {
|
public String getCategory() {
|
||||||
@@ -139,7 +_,13 @@
|
@@ -139,7 +_,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo(KeyMapping p_90841_) {
|
public int compareTo(KeyMapping p_90841_) {
|
||||||
- return this.f_90815_.equals(p_90841_.f_90815_) ? I18n.m_118938_(this.f_90813_).compareTo(I18n.m_118938_(p_90841_.f_90813_)) : f_90812_.get(this.f_90815_).compareTo(f_90812_.get(p_90841_.f_90815_));
|
- return this.category.equals(p_90841_.category) ? I18n.get(this.name).compareTo(I18n.get(p_90841_.name)) : CATEGORY_SORT_ORDER.get(this.category).compareTo(CATEGORY_SORT_ORDER.get(p_90841_.category));
|
||||||
+ if (this.f_90815_.equals(p_90841_.f_90815_)) return I18n.m_118938_(this.f_90813_).compareTo(I18n.m_118938_(p_90841_.f_90813_));
|
+ if (this.category.equals(p_90841_.category)) return I18n.get(this.name).compareTo(I18n.get(p_90841_.name));
|
||||||
+ Integer tCat = f_90812_.get(this.f_90815_);
|
+ Integer tCat = CATEGORY_SORT_ORDER.get(this.category);
|
||||||
+ Integer oCat = f_90812_.get(p_90841_.f_90815_);
|
+ Integer oCat = CATEGORY_SORT_ORDER.get(p_90841_.category);
|
||||||
+ if (tCat == null && oCat != null) return 1;
|
+ if (tCat == null && oCat != null) return 1;
|
||||||
+ if (tCat != null && oCat == null) return -1;
|
+ if (tCat != null && oCat == null) return -1;
|
||||||
+ if (tCat == null && oCat == null) return I18n.m_118938_(this.f_90815_).compareTo(I18n.m_118938_(p_90841_.f_90815_));
|
+ if (tCat == null && oCat == null) return I18n.get(this.category).compareTo(I18n.get(p_90841_.category));
|
||||||
+ return tCat.compareTo(oCat);
|
+ return tCat.compareTo(oCat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Supplier<Component> m_90842_(String p_90843_) {
|
public static Supplier<Component> createNameSupplier(String p_90843_) {
|
||||||
@@ -150,6 +_,20 @@
|
@@ -150,6 +_,20 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean m_90850_(KeyMapping p_90851_) {
|
public boolean same(KeyMapping p_90851_) {
|
||||||
+ if (getKeyConflictContext().conflicts(p_90851_.getKeyConflictContext()) || p_90851_.getKeyConflictContext().conflicts(getKeyConflictContext())) {
|
+ if (getKeyConflictContext().conflicts(p_90851_.getKeyConflictContext()) || p_90851_.getKeyConflictContext().conflicts(getKeyConflictContext())) {
|
||||||
+ net.minecraftforge.client.settings.KeyModifier keyModifier = getKeyModifier();
|
+ net.minecraftforge.client.settings.KeyModifier keyModifier = getKeyModifier();
|
||||||
+ net.minecraftforge.client.settings.KeyModifier otherKeyModifier = p_90851_.getKeyModifier();
|
+ net.minecraftforge.client.settings.KeyModifier otherKeyModifier = p_90851_.getKeyModifier();
|
||||||
@@ -72,30 +72,30 @@
|
|||||||
+ (keyModifier == net.minecraftforge.client.settings.KeyModifier.NONE || otherKeyModifier == net.minecraftforge.client.settings.KeyModifier.NONE));
|
+ (keyModifier == net.minecraftforge.client.settings.KeyModifier.NONE || otherKeyModifier == net.minecraftforge.client.settings.KeyModifier.NONE));
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
return this.f_90816_.equals(p_90851_.f_90816_);
|
return this.key.equals(p_90851_.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,11 +_,13 @@
|
@@ -170,11 +_,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public Component m_90863_() {
|
public Component getTranslatedKeyMessage() {
|
||||||
+ return getKeyModifier().getCombinedName(f_90816_, () -> {
|
+ return getKeyModifier().getCombinedName(key, () -> {
|
||||||
return this.f_90816_.m_84875_();
|
return this.key.getDisplayName();
|
||||||
+ });
|
+ });
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean m_90864_() {
|
public boolean isDefault() {
|
||||||
- return this.f_90816_.equals(this.f_90814_);
|
- return this.key.equals(this.defaultKey);
|
||||||
+ return this.f_90816_.equals(this.f_90814_) && getKeyModifier() == getDefaultKeyModifier();
|
+ return this.key.equals(this.defaultKey) && getKeyModifier() == getDefaultKeyModifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String m_90865_() {
|
public String saveString() {
|
||||||
@@ -183,5 +_,88 @@
|
@@ -184,4 +_,84 @@
|
||||||
|
public void setDown(boolean p_90846_) {
|
||||||
public void m_7249_(boolean p_90846_) {
|
this.isDown = p_90846_;
|
||||||
this.f_90817_ = p_90846_;
|
}
|
||||||
+ }
|
|
||||||
+
|
+
|
||||||
|
+ /****************** Forge Start *****************************/
|
||||||
+ private net.minecraftforge.client.settings.KeyModifier keyModifierDefault = net.minecraftforge.client.settings.KeyModifier.NONE;
|
+ private net.minecraftforge.client.settings.KeyModifier keyModifierDefault = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||||
+ private net.minecraftforge.client.settings.KeyModifier keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
+ private net.minecraftforge.client.settings.KeyModifier keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||||
+ private net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext = net.minecraftforge.client.settings.KeyConflictContext.UNIVERSAL;
|
+ private net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext = net.minecraftforge.client.settings.KeyConflictContext.UNIVERSAL;
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
|
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
|
||||||
+ */
|
+ */
|
||||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputConstants.Type inputType, final int keyCode, String category) {
|
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputConstants.Type inputType, final int keyCode, String category) {
|
||||||
+ this(description, keyConflictContext, inputType.m_84895_(keyCode), category);
|
+ this(description, keyConflictContext, inputType.getOrCreate(keyCode), category);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
@@ -118,30 +118,30 @@
|
|||||||
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
|
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
|
||||||
+ */
|
+ */
|
||||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, final InputConstants.Type inputType, final int keyCode, String category) {
|
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, final InputConstants.Type inputType, final int keyCode, String category) {
|
||||||
+ this(description, keyConflictContext, keyModifier, inputType.m_84895_(keyCode), category);
|
+ this(description, keyConflictContext, keyModifier, inputType.getOrCreate(keyCode), category);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
|
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
|
||||||
+ */
|
+ */
|
||||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode, String category) {
|
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode, String category) {
|
||||||
+ this.f_90813_ = description;
|
+ this.name = description;
|
||||||
+ this.f_90816_ = keyCode;
|
+ this.key = keyCode;
|
||||||
+ this.f_90814_ = keyCode;
|
+ this.defaultKey = keyCode;
|
||||||
+ this.f_90815_ = category;
|
+ this.category = category;
|
||||||
+ this.keyConflictContext = keyConflictContext;
|
+ this.keyConflictContext = keyConflictContext;
|
||||||
+ this.keyModifier = keyModifier;
|
+ this.keyModifier = keyModifier;
|
||||||
+ this.keyModifierDefault = keyModifier;
|
+ this.keyModifierDefault = keyModifier;
|
||||||
+ if (this.keyModifier.matches(keyCode))
|
+ if (this.keyModifier.matches(keyCode))
|
||||||
+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||||
+ f_90809_.put(description, this);
|
+ ALL.put(description, this);
|
||||||
+ f_90810_.put(keyCode, this);
|
+ MAP.put(keyCode, this);
|
||||||
+ f_90811_.add(category);
|
+ CATEGORIES.add(category);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public InputConstants.Key getKey() {
|
+ public InputConstants.Key getKey() {
|
||||||
+ return this.f_90816_;
|
+ return this.key;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
@@ -165,17 +165,13 @@
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void setKeyModifierAndCode(@org.jetbrains.annotations.Nullable net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode) {
|
+ public void setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode) {
|
||||||
+ f_90810_.remove(this);
|
+ this.key = keyCode;
|
||||||
+
|
+ if (keyModifier.matches(keyCode))
|
||||||
+ if (keyModifier == null)
|
|
||||||
+ keyModifier = net.minecraftforge.client.settings.KeyModifier.getModifier(this.f_90816_);
|
|
||||||
+ if (keyModifier == null || keyCode == InputConstants.f_84822_ || net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(keyCode))
|
|
||||||
+ keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
+ keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||||
+
|
+ MAP.remove(this);
|
||||||
+ this.f_90816_ = keyCode;
|
|
||||||
+ this.keyModifier = keyModifier;
|
+ this.keyModifier = keyModifier;
|
||||||
+
|
+ MAP.put(keyCode, this);
|
||||||
+ f_90810_.put(keyCode, this);
|
+ }
|
||||||
}
|
+ /****************** Forge End *****************************/
|
||||||
}
|
}
|
||||||
@@ -1,25 +1,45 @@
|
|||||||
--- a/net/minecraft/client/KeyboardHandler.java
|
--- a/net/minecraft/client/KeyboardHandler.java
|
||||||
+++ b/net/minecraft/client/KeyboardHandler.java
|
+++ b/net/minecraft/client/KeyboardHandler.java
|
||||||
@@ -369,11 +_,15 @@
|
@@ -340,7 +_,9 @@
|
||||||
Screen.m_96579_(() -> {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (p_90897_ == 1 && (!(this.minecraft.screen instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).lastKeySelection <= Util.getMillis() - 20L)) {
|
||||||
|
+
|
||||||
|
+ if ((!(this.minecraft.screen instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).lastKeySelection <= Util.getMillis() - 20L)) {
|
||||||
|
+ if (p_90897_ == 1) {
|
||||||
|
if (this.minecraft.options.keyFullscreen.matches(p_90895_, p_90896_)) {
|
||||||
|
this.minecraft.getWindow().toggleFullScreen();
|
||||||
|
this.minecraft.options.fullscreen().set(this.minecraft.getWindow().isFullscreen());
|
||||||
|
@@ -358,6 +_,8 @@
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
+ } else if (p_90897_ == 0 /*GLFW_RELEASE*/ && this.minecraft.screen instanceof KeyBindsScreen)
|
||||||
|
+ ((KeyBindsScreen)this.minecraft.screen).selectedKey = null; //Forge: Unset pure modifiers.
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.minecraft.getNarrator().isActive() && this.minecraft.options.narratorHotkey().get()) {
|
||||||
|
@@ -380,11 +_,15 @@
|
||||||
|
Screen.wrapScreenError(() -> {
|
||||||
if (p_90897_ != 1 && p_90897_ != 2) {
|
if (p_90897_ != 1 && p_90897_ != 2) {
|
||||||
if (p_90897_ == 0) {
|
if (p_90897_ == 0) {
|
||||||
- aboolean[0] = screen.m_7920_(p_90895_, p_90896_, p_90898_);
|
- aboolean[0] = screen.keyReleased(p_90895_, p_90896_, p_90898_);
|
||||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPre(screen, p_90895_, p_90896_, p_90898_);
|
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPre(screen, p_90895_, p_90896_, p_90898_);
|
||||||
+ if (!aboolean[0]) aboolean[0] = screen.m_7920_(p_90895_, p_90896_, p_90898_);
|
+ if (!aboolean[0]) aboolean[0] = screen.keyReleased(p_90895_, p_90896_, p_90898_);
|
||||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPost(screen, p_90895_, p_90896_, p_90898_);
|
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPost(screen, p_90895_, p_90896_, p_90898_);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
screen.m_169416_();
|
screen.afterKeyboardAction();
|
||||||
- aboolean[0] = screen.m_7933_(p_90895_, p_90896_, p_90898_);
|
- aboolean[0] = screen.keyPressed(p_90895_, p_90896_, p_90898_);
|
||||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPre(screen, p_90895_, p_90896_, p_90898_);
|
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPre(screen, p_90895_, p_90896_, p_90898_);
|
||||||
+ if (!aboolean[0]) aboolean[0] = screen.m_7933_(p_90895_, p_90896_, p_90898_);
|
+ if (!aboolean[0]) aboolean[0] = screen.keyPressed(p_90895_, p_90896_, p_90898_);
|
||||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPost(screen, p_90895_, p_90896_, p_90898_);
|
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPost(screen, p_90895_, p_90896_, p_90898_);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, "keyPressed event handler", screen.getClass().getCanonicalName());
|
}, "keyPressed event handler", screen.getClass().getCanonicalName());
|
||||||
@@ -424,22 +_,26 @@
|
@@ -443,22 +_,26 @@
|
||||||
}
|
this.minecraft.debugFpsMeterKeyPress(p_90895_ - 48);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
-
|
-
|
||||||
@@ -27,24 +47,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void m_90889_(long p_90890_, int p_90891_, int p_90892_) {
|
private void charTyped(long p_90890_, int p_90891_, int p_90892_) {
|
||||||
if (p_90890_ == this.f_90867_.m_91268_().m_85439_()) {
|
if (p_90890_ == this.minecraft.getWindow().getWindow()) {
|
||||||
- GuiEventListener guieventlistener = this.f_90867_.f_91080_;
|
- GuiEventListener guieventlistener = this.minecraft.screen;
|
||||||
+ Screen guieventlistener = this.f_90867_.f_91080_;
|
+ Screen guieventlistener = this.minecraft.screen;
|
||||||
if (guieventlistener != null && this.f_90867_.m_91265_() == null) {
|
if (guieventlistener != null && this.minecraft.getOverlay() == null) {
|
||||||
if (Character.charCount(p_90891_) == 1) {
|
if (Character.charCount(p_90891_) == 1) {
|
||||||
Screen.m_96579_(() -> {
|
Screen.wrapScreenError(() -> {
|
||||||
- guieventlistener.m_5534_((char)p_90891_, p_90892_);
|
- guieventlistener.charTyped((char)p_90891_, p_90892_);
|
||||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, (char)p_90891_, p_90892_)) return;
|
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, (char)p_90891_, p_90892_)) return;
|
||||||
+ if (guieventlistener.m_5534_((char)p_90891_, p_90892_)) return;
|
+ if (guieventlistener.charTyped((char)p_90891_, p_90892_)) return;
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, (char)p_90891_, p_90892_);
|
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, (char)p_90891_, p_90892_);
|
||||||
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
|
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
|
||||||
} else {
|
} else {
|
||||||
for(char c0 : Character.toChars(p_90891_)) {
|
for(char c0 : Character.toChars(p_90891_)) {
|
||||||
Screen.m_96579_(() -> {
|
Screen.wrapScreenError(() -> {
|
||||||
- guieventlistener.m_5534_(c0, p_90892_);
|
- guieventlistener.charTyped(c0, p_90892_);
|
||||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, c0, p_90892_)) return;
|
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, c0, p_90892_)) return;
|
||||||
+ if (guieventlistener.m_5534_(c0, p_90892_)) return;
|
+ if (guieventlistener.charTyped(c0, p_90892_)) return;
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, c0, p_90892_);
|
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, c0, p_90892_);
|
||||||
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
|
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,462 +1,421 @@
|
|||||||
--- a/net/minecraft/client/Minecraft.java
|
--- a/net/minecraft/client/Minecraft.java
|
||||||
+++ b/net/minecraft/client/Minecraft.java
|
+++ b/net/minecraft/client/Minecraft.java
|
||||||
@@ -249,7 +_,7 @@
|
@@ -252,7 +_,7 @@
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
-public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler {
|
-public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler {
|
||||||
+public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler, net.minecraftforge.client.extensions.IForgeMinecraft {
|
+public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler, net.minecraftforge.client.extensions.IForgeMinecraft {
|
||||||
static Minecraft f_90981_;
|
static Minecraft instance;
|
||||||
private static final Logger f_90982_ = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
|
public static final boolean ON_OSX = Util.getPlatform() == Util.OS.OSX;
|
||||||
@@ -413,7 +_,6 @@
|
@@ -422,7 +_,6 @@
|
||||||
this.f_193584_ = this.m_193585_(this.f_231338_, p_91084_);
|
}, Util.ioPool());
|
||||||
this.f_90998_ = p_91084_.f_101905_.f_101942_;
|
this.userApiService = this.createUserApiService(this.authenticationService, p_91084_);
|
||||||
f_90982_.info("Setting user: {}", (Object)this.f_90998_.m_92546_());
|
LOGGER.info("Setting user: {}", (Object)this.user.getName());
|
||||||
- f_90982_.debug("(Session ID is {})", (Object)this.f_90998_.m_92544_());
|
- LOGGER.debug("(Session ID is {})", (Object)this.user.getSessionId());
|
||||||
this.f_91033_ = p_91084_.f_101908_.f_101926_;
|
this.demo = p_91084_.game.demo;
|
||||||
this.f_91034_ = !p_91084_.f_101908_.f_101929_;
|
this.allowsMultiplayer = !p_91084_.game.disableMultiplayer;
|
||||||
this.f_91035_ = !p_91084_.f_101908_.f_101930_;
|
this.allowsChat = !p_91084_.game.disableChat;
|
||||||
@@ -449,15 +_,15 @@
|
@@ -458,15 +_,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_());
|
this.window.setFramerateLimit(this.options.framerateLimit().get());
|
||||||
+ // FORGE: Move mouse and keyboard handler setup further below
|
+ // FORGE: Move mouse and keyboard handler setup further below
|
||||||
this.f_91067_ = new MouseHandler(this);
|
this.mouseHandler = new MouseHandler(this);
|
||||||
- this.f_91067_.m_91524_(this.f_90990_.m_85439_());
|
- this.mouseHandler.setup(this.window.getWindow());
|
||||||
this.f_91068_ = new KeyboardHandler(this);
|
this.keyboardHandler = new KeyboardHandler(this);
|
||||||
- this.f_91068_.m_90887_(this.f_90990_.m_85439_());
|
- this.keyboardHandler.setup(this.window.getWindow());
|
||||||
RenderSystem.initRenderer(this.f_91066_.f_92035_, false);
|
RenderSystem.initRenderer(this.options.glDebugVerbosity, false);
|
||||||
this.f_91042_ = new MainTarget(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
|
this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight());
|
||||||
this.f_91042_.m_83931_(0.0F, 0.0F, 0.0F, 0.0F);
|
this.mainRenderTarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F);
|
||||||
this.f_91042_.m_83954_(f_91002_);
|
this.mainRenderTarget.clear(ON_OSX);
|
||||||
this.f_91036_ = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
||||||
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.f_91038_, this.f_91036_);
|
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager);
|
||||||
this.f_91038_.m_10506_();
|
this.resourcePackRepository.reload();
|
||||||
this.f_91066_.m_92145_(this.f_91038_);
|
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
|
||||||
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_);
|
this.languageManager = new LanguageManager(this.options.languageCode);
|
||||||
@@ -504,10 +_,13 @@
|
@@ -512,10 +_,13 @@
|
||||||
this.f_91063_ = new GameRenderer(this, this.f_90994_.m_234586_(), this.f_91036_, this.f_90993_);
|
this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.resourceManager, this.renderBuffers);
|
||||||
this.f_91036_.m_7217_(this.f_91063_.m_247116_());
|
this.resourceManager.registerReloadListener(this.gameRenderer.createReloadListener());
|
||||||
this.f_91060_ = new LevelRenderer(this, this.f_90994_, this.f_167845_, this.f_90993_);
|
this.levelRenderer = new LevelRenderer(this, this.entityRenderDispatcher, this.blockEntityRenderDispatcher, this.renderBuffers);
|
||||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RenderLevelStageEvent.RegisterStageEvent());
|
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RenderLevelStageEvent.RegisterStageEvent());
|
||||||
this.f_91036_.m_7217_(this.f_91060_);
|
this.resourceManager.registerReloadListener(this.levelRenderer);
|
||||||
- this.m_91271_();
|
- this.createSearchTrees();
|
||||||
+ // Forge: We delay this to allow registration of modded creative mode tabs
|
+ // Forge: We delay this to allow registration of modded creative mode tabs
|
||||||
+ // this.createSearchTrees();
|
+ // this.createSearchTrees();
|
||||||
this.f_91036_.m_7217_(this.f_90997_);
|
this.resourceManager.registerReloadListener(this.searchRegistry);
|
||||||
this.f_91061_ = new ParticleEngine(this.f_91073_, this.f_90987_);
|
this.particleEngine = new ParticleEngine(this.level, this.textureManager);
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(this.f_91061_);
|
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(this.particleEngine);
|
||||||
this.f_91036_.m_7217_(this.f_91061_);
|
this.resourceManager.registerReloadListener(this.particleEngine);
|
||||||
this.f_91053_ = new PaintingTextureManager(this.f_90987_);
|
this.paintingTextures = new PaintingTextureManager(this.textureManager);
|
||||||
this.f_91036_.m_7217_(this.f_91053_);
|
this.resourceManager.registerReloadListener(this.paintingTextures);
|
||||||
@@ -516,7 +_,10 @@
|
@@ -526,7 +_,10 @@
|
||||||
this.f_91047_ = new GpuWarnlistManager();
|
this.gpuWarnlistManager = new GpuWarnlistManager();
|
||||||
this.f_91036_.m_7217_(this.f_91047_);
|
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
|
||||||
this.f_91036_.m_7217_(this.f_205120_);
|
this.resourceManager.registerReloadListener(this.regionalCompliancies);
|
||||||
- this.f_91065_ = new Gui(this, this.f_90995_);
|
- this.gui = new Gui(this, this.itemRenderer);
|
||||||
+ this.f_91065_ = new net.minecraftforge.client.gui.overlay.ForgeGui(this);
|
+ this.gui = new net.minecraftforge.client.gui.overlay.ForgeGui(this);
|
||||||
+ // FORGE: Moved keyboard and mouse handler setup below ingame gui creation to prevent NPEs in them.
|
+ // FORGE: Moved keyboard and mouse handler setup below ingame gui creation to prevent NPEs in them.
|
||||||
+ this.f_91067_.m_91524_(this.f_90990_.m_85439_());
|
+ this.mouseHandler.setup(this.window.getWindow());
|
||||||
+ this.f_91068_.m_90887_(this.f_90990_.m_85439_());
|
+ this.keyboardHandler.setup(this.window.getWindow());
|
||||||
this.f_91064_ = new DebugRenderer(this);
|
this.debugRenderer = new DebugRenderer(this);
|
||||||
RealmsClient realmsclient = RealmsClient.m_239151_(this);
|
RealmsClient realmsclient = RealmsClient.create(this);
|
||||||
this.f_238717_ = new RealmsDataFetcher(realmsclient);
|
this.realmsDataFetcher = new RealmsDataFetcher(realmsclient);
|
||||||
@@ -536,6 +_,7 @@
|
@@ -546,6 +_,7 @@
|
||||||
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
|
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.f_91036_);
|
+ net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.resourceManager);
|
||||||
this.f_90990_.m_85409_(this.f_91066_.m_231817_().m_231551_());
|
this.window.updateVsync(this.options.enableVsync().get());
|
||||||
this.f_90990_.m_85424_(this.f_91066_.m_232123_().m_231551_());
|
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
|
||||||
this.f_90990_.m_85426_();
|
this.window.setDefaultErrorCallback();
|
||||||
@@ -554,7 +_,7 @@
|
@@ -565,7 +_,7 @@
|
||||||
this.f_167847_.m_168557_(ResourceLoadStateTracker.ReloadReason.INITIAL, list);
|
ReloadInstance reloadinstance = this.resourceManager.createReload(Util.backgroundExecutor(), this, RESOURCE_RELOAD_INITIAL_TASK, list);
|
||||||
ReloadInstance reloadinstance = this.f_91036_.m_142463_(Util.m_183991_(), this, f_90983_, list);
|
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
|
||||||
GameLoadTimesEvent.f_285635_.m_285833_(TelemetryProperty.f_285629_);
|
Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay);
|
||||||
- this.m_91150_(new LoadingOverlay(this, reloadinstance, (p_210745_) -> {
|
- this.setOverlay(new LoadingOverlay(this, reloadinstance, (p_296164_) -> {
|
||||||
+ this.m_91150_(net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(()->this, ()->reloadinstance, (p_210745_) -> {
|
+ this.setOverlay(net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(() -> this, () -> reloadinstance, (p_296164_) -> {
|
||||||
Util.m_137521_(p_210745_, this::m_91239_, () -> {
|
Util.ifElse(p_296164_, (p_296162_) -> {
|
||||||
if (SharedConstants.f_136183_) {
|
this.rollbackResourcePacks(p_296162_, minecraft$gameloadcookie);
|
||||||
this.m_91273_();
|
}, () -> {
|
||||||
@@ -562,20 +_,23 @@
|
@@ -575,8 +_,10 @@
|
||||||
|
|
||||||
this.f_167847_.m_168556_();
|
this.reloadStateTracker.finishReload();
|
||||||
this.m_286052_();
|
this.onResourceLoadFinished(minecraft$gameloadcookie);
|
||||||
+ if (net.minecraftforge.client.loading.ClientModLoader.completeModLoading())
|
+ if (net.minecraftforge.client.loading.ClientModLoader.completeModLoading())
|
||||||
+ return; // Do not overwrite the error screen if there are errors
|
+ return; // Do not overwrite the error screen if there are errors
|
||||||
+ // FORGE: Move opening initial screen to after startup and events are enabled
|
|
||||||
+ if (this.m_239929_()) {
|
|
||||||
+ this.m_91152_(BanNoticeScreen.m_239967_((p_278873_) -> {
|
|
||||||
+ if (p_278873_) {
|
|
||||||
+ Util.m_137581_().m_137646_("https://aka.ms/mcjavamoderation");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
|
|
||||||
+ }, this.m_239210_()));
|
|
||||||
+ } else {
|
|
||||||
+ this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
|
|
||||||
+ }
|
|
||||||
});
|
});
|
||||||
- }, false));
|
- }, false));
|
||||||
+ }, false).get());
|
+ }, false).get());
|
||||||
this.f_278504_ = QuickPlayLog.m_278648_(p_91084_.f_278410_.f_278493_());
|
this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.path());
|
||||||
- if (this.m_239929_()) {
|
|
||||||
- this.m_91152_(BanNoticeScreen.m_239967_((p_278873_) -> {
|
|
||||||
- if (p_278873_) {
|
|
||||||
- Util.m_137581_().m_137646_("https://aka.ms/mcjavamoderation");
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
|
|
||||||
- }, this.m_239210_()));
|
|
||||||
- } else {
|
|
||||||
- this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
|
|
||||||
- }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,7 +_,7 @@
|
@@ -674,7 +_,7 @@
|
||||||
private String m_91270_() {
|
private String createTitle() {
|
||||||
StringBuilder stringbuilder = new StringBuilder("Minecraft");
|
StringBuilder stringbuilder = new StringBuilder("Minecraft");
|
||||||
if (m_193589_().m_184597_()) {
|
if (checkModStatus().shouldReportAsModified()) {
|
||||||
- stringbuilder.append("*");
|
- stringbuilder.append("*");
|
||||||
+ stringbuilder.append("* ").append(net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.BRANDING_NAME);
|
+ stringbuilder.append(' ').append(net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.BRANDING_NAME).append('*');
|
||||||
}
|
}
|
||||||
|
|
||||||
stringbuilder.append(" ");
|
stringbuilder.append(" ");
|
||||||
@@ -635,6 +_,8 @@
|
@@ -699,6 +_,8 @@
|
||||||
|
|
||||||
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
||||||
try {
|
try {
|
||||||
+ if ("0".equals(p_193587_.f_101905_.f_101942_.m_92547_())) // Forge: We use "0" in dev. Short circuit to stop exception spam.
|
+ if ("0".equals(p_193587_.user.user.getAccessToken())) // Forge: We use "0" in dev. Short circuit to stop exception spam.
|
||||||
+ return UserApiService.OFFLINE;
|
+ return UserApiService.OFFLINE;
|
||||||
return p_193586_.createUserApiService(p_193587_.f_101905_.f_101942_.m_92547_());
|
return p_193586_.createUserApiService(p_193587_.user.user.getAccessToken());
|
||||||
} catch (AuthenticationException authenticationexception) {
|
} catch (AuthenticationException authenticationexception) {
|
||||||
f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception);
|
LOGGER.error("Failed to verify authentication", (Throwable)authenticationexception);
|
||||||
@@ -647,7 +_,7 @@
|
@@ -711,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void m_91239_(Throwable p_91240_) {
|
private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_) {
|
||||||
- if (this.f_91038_.m_10523_().size() > 1) {
|
- if (this.resourcePackRepository.getSelectedIds().size() > 1) {
|
||||||
+ if (this.f_91038_.m_10524_().stream().anyMatch(e -> !e.m_10449_())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any.
|
+ if (this.resourcePackRepository.getSelectedPacks().stream().anyMatch(e -> !e.isRequired())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any.
|
||||||
this.m_91241_(p_91240_, (Component)null);
|
this.clearResourcePacksOnError(p_91240_, (Component)null, p_299515_);
|
||||||
} else {
|
} else {
|
||||||
Util.m_137559_(p_91240_);
|
Util.throwAsRuntime(p_91240_);
|
||||||
@@ -739,7 +_,10 @@
|
@@ -803,7 +_,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_91271_() {
|
public void createSearchTrees() {
|
||||||
- this.f_90997_.m_235232_(SearchRegistry.f_119941_, (p_231389_) -> {
|
- this.searchRegistry.register(SearchRegistry.CREATIVE_NAMES, (p_231451_) -> {
|
||||||
+ var nameSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys();
|
+ var nameSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys();
|
||||||
+ var tagSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys();
|
+ var tagSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys();
|
||||||
+ for (var nameSearchKey : nameSearchKeys.values())
|
+ for (var nameSearchKey : nameSearchKeys.values())
|
||||||
+ this.f_90997_.m_235232_(nameSearchKey, (p_231389_) -> {
|
+ this.searchRegistry.register(nameSearchKey, (p_231451_) -> {
|
||||||
return new FullTextSearchTree<>((p_210797_) -> {
|
return new FullTextSearchTree<>((p_210797_) -> {
|
||||||
return p_210797_.m_41651_((Player)null, TooltipFlag.Default.f_256752_.m_257777_()).stream().map((p_210807_) -> {
|
return p_210797_.getTooltipLines((Player)null, TooltipFlag.Default.NORMAL.asCreative()).stream().map((p_231455_) -> {
|
||||||
return ChatFormatting.m_126649_(p_210807_.getString()).trim();
|
return ChatFormatting.stripFormatting(p_231455_.getString()).trim();
|
||||||
@@ -750,7 +_,8 @@
|
@@ -814,7 +_,8 @@
|
||||||
return Stream.of(BuiltInRegistries.f_257033_.m_7981_(p_91317_.m_41720_()));
|
return Stream.of(BuiltInRegistries.ITEM.getKey(p_91317_.getItem()));
|
||||||
}, p_231389_);
|
|
||||||
});
|
|
||||||
- this.f_90997_.m_235232_(SearchRegistry.f_119942_, (p_231430_) -> {
|
|
||||||
+ for (var tagSearchKey : tagSearchKeys.values())
|
|
||||||
+ this.f_90997_.m_235232_(tagSearchKey, (p_231430_) -> {
|
|
||||||
return new IdSearchTree<>((p_231353_) -> {
|
|
||||||
return p_231353_.m_204131_().map(TagKey::f_203868_);
|
|
||||||
}, p_231430_);
|
|
||||||
@@ -770,9 +_,12 @@
|
|
||||||
});
|
|
||||||
}, p_231451_);
|
}, p_231451_);
|
||||||
});
|
});
|
||||||
- CreativeModeTabs.m_258007_().m_257882_((p_255439_) -> {
|
- this.searchRegistry.register(SearchRegistry.CREATIVE_TAGS, (p_231430_) -> {
|
||||||
- this.m_231374_(SearchRegistry.f_119941_, p_255439_);
|
+ for (var tagSearchKey : tagSearchKeys.values())
|
||||||
- this.m_231374_(SearchRegistry.f_119942_, p_255439_);
|
+ this.searchRegistry.register(tagSearchKey, (p_231430_) -> {
|
||||||
|
return new IdSearchTree<>((p_231353_) -> {
|
||||||
|
return p_231353_.getTags().map(TagKey::location);
|
||||||
|
}, p_231430_);
|
||||||
|
@@ -834,9 +_,12 @@
|
||||||
|
});
|
||||||
|
}, p_301514_);
|
||||||
|
});
|
||||||
|
- CreativeModeTabs.searchTab().setSearchTreeBuilder((p_255439_) -> {
|
||||||
|
- this.populateSearchTree(SearchRegistry.CREATIVE_NAMES, p_255439_);
|
||||||
|
- this.populateSearchTree(SearchRegistry.CREATIVE_TAGS, p_255439_);
|
||||||
+ nameSearchKeys.forEach((tab, nameSearchKey) -> {
|
+ nameSearchKeys.forEach((tab, nameSearchKey) -> {
|
||||||
+ var tagSearchKey = tagSearchKeys.get(tab);
|
+ var tagSearchKey = tagSearchKeys.get(tab);
|
||||||
+ tab.m_257882_(contents -> {
|
+ tab.setSearchTreeBuilder(contents -> {
|
||||||
+ this.m_231374_(nameSearchKey, contents);
|
+ this.populateSearchTree(nameSearchKey, contents);
|
||||||
+ this.m_231374_(tagSearchKey, contents);
|
+ this.populateSearchTree(tagSearchKey, contents);
|
||||||
+ });
|
+ });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -824,13 +_,13 @@
|
@@ -1019,10 +_,6 @@
|
||||||
Bootstrap.m_135875_(p_91333_.m_127526_());
|
LOGGER.error("setScreen called from non-game thread");
|
||||||
if (p_91333_.m_127527_() != null) {
|
|
||||||
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + p_91333_.m_127527_());
|
|
||||||
- System.exit(-1);
|
|
||||||
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-1);
|
|
||||||
} else if (p_91333_.m_127512_(file2)) {
|
|
||||||
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
|
|
||||||
- System.exit(-1);
|
|
||||||
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-1);
|
|
||||||
} else {
|
|
||||||
Bootstrap.m_135875_("#@?@# Game crashed! Crash report could not be saved. #@?@#");
|
|
||||||
- System.exit(-2);
|
|
||||||
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
- if (this.screen != null) {
|
||||||
@@ -954,10 +_,6 @@
|
- this.screen.removed();
|
||||||
f_90982_.error("setScreen called from non-game thread");
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (this.f_91080_ != null) {
|
|
||||||
- this.f_91080_.m_7861_();
|
|
||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
if (p_91153_ == null && this.f_91073_ == null) {
|
if (p_91153_ == null && this.level == null) {
|
||||||
p_91153_ = new TitleScreen();
|
p_91153_ = new TitleScreen();
|
||||||
} else if (p_91153_ == null && this.f_91074_.m_21224_()) {
|
} else if (p_91153_ == null && this.player.isDeadOrDying()) {
|
||||||
@@ -968,6 +_,19 @@
|
@@ -1033,6 +_,19 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
|
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
|
||||||
+ Screen old = this.f_91080_;
|
+ Screen old = this.screen;
|
||||||
+ if (p_91153_ != null) {
|
+ if (p_91153_ != null) {
|
||||||
+ var event = new net.minecraftforge.client.event.ScreenEvent.Opening(old, p_91153_);
|
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenOpening(old, p_91153_);
|
||||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
|
+ if (event == null) return;
|
||||||
+ p_91153_ = event.getNewScreen();
|
+ p_91153_ = event;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (old != null && p_91153_ != old) {
|
+ if (old != null && p_91153_ != old) {
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Closing(old));
|
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenClose(old);
|
||||||
+ old.m_7861_();
|
+ old.removed();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
this.f_91080_ = p_91153_;
|
this.screen = p_91153_;
|
||||||
if (this.f_91080_ != null) {
|
if (this.screen != null) {
|
||||||
this.f_91080_.m_274333_();
|
this.screen.added();
|
||||||
@@ -1113,9 +_,12 @@
|
@@ -1179,9 +_,12 @@
|
||||||
RenderSystem.enableCull();
|
RenderSystem.enableCull();
|
||||||
this.f_91026_.m_7238_();
|
this.profiler.pop();
|
||||||
if (!this.f_91079_) {
|
if (!this.noRender) {
|
||||||
+ this.realPartialTick = this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_; // Cache this since pause is volatile
|
+ this.realPartialTick = this.pause ? this.pausePartialTick : this.timer.partialTick; // Cache this since pause is volatile
|
||||||
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.realPartialTick);
|
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.realPartialTick);
|
||||||
this.f_91026_.m_6182_("gameRenderer");
|
this.profiler.popPush("gameRenderer");
|
||||||
this.f_91063_.m_109093_(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_, i, p_91384_);
|
this.gameRenderer.render(this.pause ? this.pausePartialTick : this.timer.partialTick, i, p_91384_);
|
||||||
this.f_91026_.m_7238_();
|
this.profiler.pop();
|
||||||
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.realPartialTick);
|
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.realPartialTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.f_91056_ != null) {
|
if (this.fpsPieResults != null) {
|
||||||
@@ -1240,10 +_,12 @@
|
@@ -1302,10 +_,12 @@
|
||||||
this.f_90990_.m_85378_((double)i);
|
this.window.setGuiScale((double)i);
|
||||||
if (this.f_91080_ != null) {
|
if (this.screen != null) {
|
||||||
this.f_91080_.m_6574_(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_());
|
this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_());
|
+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTarget rendertarget = this.m_91385_();
|
RenderTarget rendertarget = this.getMainRenderTarget();
|
||||||
rendertarget.m_83941_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_(), f_91002_);
|
rendertarget.resize(this.window.getWidth(), this.window.getHeight(), ON_OSX);
|
||||||
+ if (this.f_91063_ != null)
|
+ if (this.gameRenderer != null)
|
||||||
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
|
this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight());
|
||||||
this.f_91067_.m_91599_();
|
this.mouseHandler.setIgnoreFirstMove();
|
||||||
}
|
}
|
||||||
@@ -1517,6 +_,7 @@
|
@@ -1579,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_91395_() {
|
public void stop() {
|
||||||
+ if (this.m_91396_()) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.GameShuttingDownEvent());
|
+ if (this.isRunning()) net.minecraftforge.event.ForgeEventFactory.onGameShuttingDown();
|
||||||
this.f_91019_ = false;
|
this.running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1546,10 +_,18 @@
|
@@ -1608,10 +_,18 @@
|
||||||
if (p_91387_ && this.f_91077_ != null && this.f_91077_.m_6662_() == HitResult.Type.BLOCK) {
|
if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
|
||||||
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||||
BlockPos blockpos = blockhitresult.m_82425_();
|
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||||
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
- if (!this.level.getBlockState(blockpos).isAir()) {
|
||||||
+ if (!this.f_91073_.m_46859_(blockpos)) {
|
+ if (!this.level.isEmptyBlock(blockpos)) {
|
||||||
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
|
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
|
||||||
+ if (inputEvent.isCanceled()) {
|
+ if (inputEvent.isCanceled()) {
|
||||||
+ if (inputEvent.shouldSwingHand()) {
|
+ if (inputEvent.shouldSwingHand()) {
|
||||||
+ this.f_91061_.addBlockHitEffects(blockpos, blockhitresult);
|
+ this.particleEngine.addBlockHitEffects(blockpos, blockhitresult);
|
||||||
+ this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
+ this.player.swing(InteractionHand.MAIN_HAND);
|
||||||
+ }
|
+ }
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
Direction direction = blockhitresult.m_82434_();
|
Direction direction = blockhitresult.getDirection();
|
||||||
- if (this.f_91072_.m_105283_(blockpos, direction)) {
|
- if (this.gameMode.continueDestroyBlock(blockpos, direction)) {
|
||||||
- this.f_91061_.m_107367_(blockpos, direction);
|
- this.particleEngine.crack(blockpos, direction);
|
||||||
+ if (this.f_91072_.m_105283_(blockpos, direction) && inputEvent.shouldSwingHand()) {
|
+ if (this.gameMode.continueDestroyBlock(blockpos, direction) && inputEvent.shouldSwingHand()) {
|
||||||
+ this.f_91061_.addBlockHitEffects(blockpos, blockhitresult);
|
+ this.particleEngine.addBlockHitEffects(blockpos, blockhitresult);
|
||||||
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
this.player.swing(InteractionHand.MAIN_HAND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1578,6 +_,8 @@
|
@@ -1640,6 +_,8 @@
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
|
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
|
||||||
+ if (!inputEvent.isCanceled())
|
+ if (!inputEvent.isCanceled())
|
||||||
switch (this.f_91077_.m_6662_()) {
|
switch (this.hitResult.getType()) {
|
||||||
case ENTITY:
|
case ENTITY:
|
||||||
this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_());
|
this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity());
|
||||||
@@ -1585,7 +_,7 @@
|
@@ -1647,7 +_,7 @@
|
||||||
case BLOCK:
|
case BLOCK:
|
||||||
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||||
BlockPos blockpos = blockhitresult.m_82425_();
|
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||||
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
- if (!this.level.getBlockState(blockpos).isAir()) {
|
||||||
+ if (!this.f_91073_.m_46859_(blockpos)) {
|
+ if (!this.level.isEmptyBlock(blockpos)) {
|
||||||
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_());
|
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
|
||||||
if (this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
if (this.level.getBlockState(blockpos).isAir()) {
|
||||||
flag = true;
|
flag = true;
|
||||||
@@ -1598,8 +_,10 @@
|
@@ -1660,8 +_,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.f_91074_.m_36334_();
|
this.player.resetAttackStrengthTicker();
|
||||||
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_);
|
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if (inputEvent.shouldSwingHand())
|
+ if (inputEvent.shouldSwingHand())
|
||||||
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
this.player.swing(InteractionHand.MAIN_HAND);
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
@@ -1615,6 +_,11 @@
|
@@ -1677,6 +_,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
for(InteractionHand interactionhand : InteractionHand.values()) {
|
for(InteractionHand interactionhand : InteractionHand.values()) {
|
||||||
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.f_91066_.f_92095_, interactionhand);
|
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.options.keyUse, interactionhand);
|
||||||
+ if (inputEvent.isCanceled()) {
|
+ if (inputEvent.isCanceled()) {
|
||||||
+ if (inputEvent.shouldSwingHand()) this.f_91074_.m_6674_(interactionhand);
|
+ if (inputEvent.shouldSwingHand()) this.player.swing(interactionhand);
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
|
ItemStack itemstack = this.player.getItemInHand(interactionhand);
|
||||||
if (!itemstack.m_246617_(this.f_91073_.m_246046_())) {
|
if (!itemstack.isItemEnabled(this.level.enabledFeatures())) {
|
||||||
return;
|
return;
|
||||||
@@ -1635,7 +_,7 @@
|
@@ -1697,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interactionresult.m_19077_()) {
|
if (interactionresult.consumesAction()) {
|
||||||
- if (interactionresult.m_19080_()) {
|
- if (interactionresult.shouldSwing()) {
|
||||||
+ if (interactionresult.m_19080_() && inputEvent.shouldSwingHand()) {
|
+ if (interactionresult.shouldSwing() && inputEvent.shouldSwingHand()) {
|
||||||
this.f_91074_.m_6674_(interactionhand);
|
this.player.swing(interactionhand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1647,7 +_,7 @@
|
@@ -1709,7 +_,7 @@
|
||||||
int i = itemstack.m_41613_();
|
int i = itemstack.getCount();
|
||||||
InteractionResult interactionresult1 = this.f_91072_.m_233732_(this.f_91074_, interactionhand, blockhitresult);
|
InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult);
|
||||||
if (interactionresult1.m_19077_()) {
|
if (interactionresult1.consumesAction()) {
|
||||||
- if (interactionresult1.m_19080_()) {
|
- if (interactionresult1.shouldSwing()) {
|
||||||
+ if (interactionresult1.m_19080_() && inputEvent.shouldSwingHand()) {
|
+ if (interactionresult1.shouldSwing() && inputEvent.shouldSwingHand()) {
|
||||||
this.f_91074_.m_6674_(interactionhand);
|
this.player.swing(interactionhand);
|
||||||
if (!itemstack.m_41619_() && (itemstack.m_41613_() != i || this.f_91072_.m_105290_())) {
|
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.gameMode.hasInfiniteItems())) {
|
||||||
this.f_91063_.f_109055_.m_109320_(interactionhand);
|
this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand);
|
||||||
@@ -1663,6 +_,9 @@
|
@@ -1725,6 +_,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if (itemstack.m_41619_() && (this.f_91077_ == null || this.f_91077_.m_6662_() == HitResult.Type.MISS))
|
+ if (itemstack.isEmpty() && (this.hitResult == null || this.hitResult.getType() == HitResult.Type.MISS))
|
||||||
+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.f_91074_, interactionhand);
|
+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.player, interactionhand);
|
||||||
+
|
+
|
||||||
if (!itemstack.m_41619_()) {
|
if (!itemstack.isEmpty()) {
|
||||||
InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand);
|
InteractionResult interactionresult2 = this.gameMode.useItem(this.player, interactionhand);
|
||||||
if (interactionresult2.m_19077_()) {
|
if (interactionresult2.consumesAction()) {
|
||||||
@@ -1689,6 +_,8 @@
|
@@ -1751,6 +_,8 @@
|
||||||
--this.f_91011_;
|
--this.rightClickDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
|
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
|
||||||
+
|
+
|
||||||
this.f_91026_.m_6180_("gui");
|
this.profiler.push("gui");
|
||||||
this.f_240378_.m_240688_();
|
this.chatListener.tick();
|
||||||
this.f_91065_.m_193832_(this.f_91012_);
|
this.gui.tick(this.pause);
|
||||||
@@ -1780,6 +_,7 @@
|
@@ -1839,6 +_,7 @@
|
||||||
|
|
||||||
this.f_91005_.m_120596_();
|
this.tutorial.tick();
|
||||||
|
|
||||||
+ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.f_91073_, () -> true);
|
+ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.level, () -> true);
|
||||||
try {
|
try {
|
||||||
this.f_91073_.m_104726_(() -> {
|
this.level.tick(() -> {
|
||||||
return true;
|
return true;
|
||||||
@@ -1795,6 +_,7 @@
|
@@ -1854,6 +_,7 @@
|
||||||
|
|
||||||
throw new ReportedException(crashreport);
|
throw new ReportedException(crashreport);
|
||||||
}
|
}
|
||||||
+ net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(this.f_91073_, () -> true);
|
+ net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(this.level, () -> true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.f_91026_.m_6182_("animateTick");
|
this.profiler.popPush("animateTick");
|
||||||
@@ -1814,6 +_,8 @@
|
@@ -1873,6 +_,8 @@
|
||||||
this.f_91026_.m_6182_("keyboard");
|
this.profiler.popPush("keyboard");
|
||||||
this.f_91068_.m_90931_();
|
this.keyboardHandler.tick();
|
||||||
this.f_91026_.m_7238_();
|
this.profiler.pop();
|
||||||
+
|
+
|
||||||
+ net.minecraftforge.event.ForgeEventFactory.onPostClientTick();
|
+ net.minecraftforge.event.ForgeEventFactory.onPostClientTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean m_91278_() {
|
private boolean isMultiplayerServer() {
|
||||||
@@ -2011,6 +_,7 @@
|
@@ -2069,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_91156_(ClientLevel p_91157_) {
|
public void setLevel(ClientLevel p_91157_) {
|
||||||
+ if (this.f_91073_ != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.f_91073_));
|
+ if (this.level != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.level));
|
||||||
ProgressScreen progressscreen = new ProgressScreen(true);
|
ProgressScreen progressscreen = new ProgressScreen(true);
|
||||||
progressscreen.m_6309_(Component.m_237115_("connect.joining"));
|
progressscreen.progressStartNoAbort(Component.translatable("connect.joining"));
|
||||||
this.m_91362_(progressscreen);
|
this.updateScreenAndTick(progressscreen);
|
||||||
@@ -2044,10 +_,12 @@
|
@@ -2102,10 +_,12 @@
|
||||||
IntegratedServer integratedserver = this.f_91007_;
|
IntegratedServer integratedserver = this.singleplayerServer;
|
||||||
this.f_91007_ = null;
|
this.singleplayerServer = null;
|
||||||
this.f_91063_.m_109150_();
|
this.gameRenderer.resetData();
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.firePlayerLogout(this.f_91072_, this.f_91074_);
|
+ net.minecraftforge.client.ForgeHooksClient.firePlayerLogout(this.gameMode, this.player);
|
||||||
this.f_91072_ = null;
|
this.gameMode = null;
|
||||||
this.f_240365_.m_93328_();
|
this.narrator.clear();
|
||||||
this.m_91362_(p_91321_);
|
this.updateScreenAndTick(p_91321_);
|
||||||
if (this.f_91073_ != null) {
|
if (this.level != null) {
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.f_91073_));
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.level));
|
||||||
if (integratedserver != null) {
|
if (integratedserver != null) {
|
||||||
this.f_91026_.m_6180_("waitForServer");
|
this.profiler.push("waitForServer");
|
||||||
|
|
||||||
@@ -2061,6 +_,7 @@
|
@@ -2119,6 +_,7 @@
|
||||||
this.f_243981_.m_246151_();
|
this.downloadedPackSource.clearServerPack();
|
||||||
this.f_91065_.m_93089_();
|
this.gui.onDisconnected();
|
||||||
this.f_91010_ = false;
|
this.isLocalServer = false;
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(this.f_91073_);
|
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(this.level);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.f_91073_ = null;
|
this.level = null;
|
||||||
@@ -2167,6 +_,7 @@
|
@@ -2243,6 +_,7 @@
|
||||||
|
|
||||||
private void m_91280_() {
|
private void pickBlock() {
|
||||||
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
|
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
|
||||||
+ if (net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.f_91066_.f_92097_, InteractionHand.MAIN_HAND).isCanceled()) return;
|
+ if (net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.options.keyPickItem, InteractionHand.MAIN_HAND).isCanceled()) return;
|
||||||
boolean flag = this.f_91074_.m_150110_().f_35937_;
|
boolean flag = this.player.getAbilities().instabuild;
|
||||||
BlockEntity blockentity = null;
|
BlockEntity blockentity = null;
|
||||||
HitResult.Type hitresult$type = this.f_91077_.m_6662_();
|
HitResult.Type hitresult$type = this.hitResult.getType();
|
||||||
@@ -2179,10 +_,7 @@
|
@@ -2255,10 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block = blockstate.m_60734_();
|
Block block = blockstate.getBlock();
|
||||||
- itemstack = block.m_7397_(this.f_91073_, blockpos, blockstate);
|
- itemstack = block.getCloneItemStack(this.level, blockpos, blockstate);
|
||||||
- if (itemstack.m_41619_()) {
|
- if (itemstack.isEmpty()) {
|
||||||
- return;
|
- return;
|
||||||
- }
|
- }
|
||||||
+ itemstack = blockstate.getCloneItemStack(this.f_91077_, this.f_91073_, blockpos, this.f_91074_);
|
+ itemstack = blockstate.getCloneItemStack(this.hitResult, this.level, blockpos, this.player);
|
||||||
|
|
||||||
if (flag && Screen.m_96637_() && blockstate.m_155947_()) {
|
if (flag && Screen.hasControlDown() && blockstate.hasBlockEntity()) {
|
||||||
blockentity = this.f_91073_.m_7702_(blockpos);
|
blockentity = this.level.getBlockEntity(blockpos);
|
||||||
@@ -2193,7 +_,7 @@
|
@@ -2269,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity entity = ((EntityHitResult)this.f_91077_).m_82443_();
|
Entity entity = ((EntityHitResult)this.hitResult).getEntity();
|
||||||
- itemstack = entity.m_142340_();
|
- itemstack = entity.getPickResult();
|
||||||
+ itemstack = entity.getPickedResult(this.f_91077_);
|
+ itemstack = entity.getPickedResult(this.hitResult);
|
||||||
if (itemstack == null) {
|
if (itemstack == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2732,6 +_,19 @@
|
@@ -2808,6 +_,19 @@
|
||||||
|
|
||||||
public void m_91312_(int p_91313_) {
|
public void updateMaxMipLevel(int p_91313_) {
|
||||||
this.f_91051_.m_119410_(p_91313_);
|
this.modelManager.updateMaxMipLevel(p_91313_);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public ItemColors getItemColors() {
|
+ public ItemColors getItemColors() {
|
||||||
+ return this.f_91041_;
|
+ return this.itemColors;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public SearchRegistry getSearchTreeManager() {
|
+ public SearchRegistry getSearchTreeManager() {
|
||||||
+ return this.f_90997_;
|
+ return this.searchRegistry;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private float realPartialTick;
|
+ private float realPartialTick;
|
||||||
@@ -464,4 +423,4 @@
|
|||||||
+ return this.realPartialTick;
|
+ return this.realPartialTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityModelSet m_167973_() {
|
public EntityModelSet getEntityModels() {
|
||||||
@@ -1,96 +1,86 @@
|
|||||||
--- a/net/minecraft/client/MouseHandler.java
|
--- a/net/minecraft/client/MouseHandler.java
|
||||||
+++ b/net/minecraft/client/MouseHandler.java
|
+++ b/net/minecraft/client/MouseHandler.java
|
||||||
@@ -73,6 +_,7 @@
|
@@ -74,6 +_,7 @@
|
||||||
this.f_91510_ = -1;
|
this.activeButton = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if (net.minecraftforge.client.ForgeHooksClient.onMouseButtonPre(p_91532_, p_91533_, p_91534_)) return;
|
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPre(p_91532_, p_91533_, p_91534_)) return;
|
||||||
boolean[] aboolean = new boolean[]{false};
|
boolean[] aboolean = new boolean[]{false};
|
||||||
if (this.f_91503_.m_91265_() == null) {
|
if (this.minecraft.getOverlay() == null) {
|
||||||
if (this.f_91503_.f_91080_ == null) {
|
if (this.minecraft.screen == null) {
|
||||||
@@ -86,11 +_,19 @@
|
@@ -87,11 +_,19 @@
|
||||||
if (flag) {
|
if (flag) {
|
||||||
screen.m_169415_();
|
screen.afterMouseAction();
|
||||||
Screen.m_96579_(() -> {
|
Screen.wrapScreenError(() -> {
|
||||||
- aboolean[0] = screen.m_6375_(d0, d1, i);
|
- aboolean[0] = screen.mouseClicked(d0, d1, i);
|
||||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseClickedPre(screen, d0, d1, i);
|
+ aboolean[0] = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClickedPre(screen, d0, d1, i);
|
||||||
+ if (!aboolean[0]) {
|
+ if (!aboolean[0]) {
|
||||||
+ aboolean[0] = this.f_91503_.f_91080_.m_6375_(d0, d1, i);
|
+ aboolean[0] = this.minecraft.screen.mouseClicked(d0, d1, i);
|
||||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseClickedPost(screen, d0, d1, i, aboolean[0]);
|
+ aboolean[0] = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClickedPost(screen, d0, d1, i, aboolean[0]);
|
||||||
+ }
|
+ }
|
||||||
}, "mouseClicked event handler", screen.getClass().getCanonicalName());
|
}, "mouseClicked event handler", screen.getClass().getCanonicalName());
|
||||||
} else {
|
} else {
|
||||||
Screen.m_96579_(() -> {
|
Screen.wrapScreenError(() -> {
|
||||||
- aboolean[0] = screen.m_6348_(d0, d1, i);
|
- aboolean[0] = screen.mouseReleased(d0, d1, i);
|
||||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseReleasedPre(screen, d0, d1, i);
|
+ aboolean[0] = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleasedPre(screen, d0, d1, i);
|
||||||
+ if (!aboolean[0]) {
|
+ if (!aboolean[0]) {
|
||||||
+ aboolean[0] = this.f_91503_.f_91080_.m_6348_(d0, d1, i);
|
+ aboolean[0] = this.minecraft.screen.mouseReleased(d0, d1, i);
|
||||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseReleasedPost(screen, d0, d1, i, aboolean[0]);
|
+ aboolean[0] = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleasedPost(screen, d0, d1, i, aboolean[0]);
|
||||||
+ }
|
+ }
|
||||||
}, "mouseReleased event handler", screen.getClass().getCanonicalName());
|
}, "mouseReleased event handler", screen.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,19 +_,26 @@
|
@@ -116,6 +_,7 @@
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
-
|
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.onMouseButtonPost(p_91532_, p_91533_, p_91534_);
|
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPost(p_91532_, p_91533_, p_91534_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void m_91526_(long p_91527_, double p_91528_, double p_91529_) {
|
@@ -129,8 +_,10 @@
|
||||||
if (p_91527_ == Minecraft.m_91087_().m_91268_().m_85439_()) {
|
if (this.minecraft.screen != null) {
|
||||||
- double d0 = (this.f_91503_.f_91066_.m_231821_().m_231551_() ? Math.signum(p_91529_) : p_91529_) * this.f_91503_.f_91066_.m_232122_().m_231551_();
|
double d3 = this.xpos * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
|
||||||
+ // FORGE: Allows for Horizontal Scroll to be recognized as Vertical Scroll - Fixes MC-121772
|
double d4 = this.ypos * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
|
||||||
+ double offset = p_91529_;
|
- this.minecraft.screen.mouseScrolled(d3, d4, d1, d2);
|
||||||
+ if (Minecraft.f_91002_ && p_91529_ == 0) {
|
this.minecraft.screen.afterMouseAction();
|
||||||
+ offset = p_91528_;
|
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPre(this.minecraft.screen, d3, d4, d1, d2)) return;
|
||||||
+ }
|
+ if (this.minecraft.screen.mouseScrolled(d3, d4, d1, d2)) return;
|
||||||
+ double d0 = (this.f_91503_.f_91066_.m_231821_().m_231551_() ? Math.signum(offset) : offset) * this.f_91503_.f_91066_.m_232122_().m_231551_();
|
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPost(this.minecraft.screen, d3, d4, d1, d2);
|
||||||
if (this.f_91503_.m_91265_() == null) {
|
} else if (this.minecraft.player != null) {
|
||||||
if (this.f_91503_.f_91080_ != null) {
|
if (this.accumulatedScrollX != 0.0D && Math.signum(d1) != Math.signum(this.accumulatedScrollX)) {
|
||||||
double d1 = this.f_91507_ * (double)this.f_91503_.m_91268_().m_85445_() / (double)this.f_91503_.m_91268_().m_85443_();
|
this.accumulatedScrollX = 0.0D;
|
||||||
double d2 = this.f_91508_ * (double)this.f_91503_.m_91268_().m_85446_() / (double)this.f_91503_.m_91268_().m_85444_();
|
@@ -151,6 +_,7 @@
|
||||||
- this.f_91503_.f_91080_.m_6050_(d1, d2, d0);
|
this.accumulatedScrollX -= (double)j;
|
||||||
this.f_91503_.f_91080_.m_169415_();
|
this.accumulatedScrollY -= (double)i;
|
||||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenMouseScrollPre(this, this.f_91503_.f_91080_, d0)) return;
|
int k = i == 0 ? -j : i;
|
||||||
+ if (this.f_91503_.f_91080_.m_6050_(d1, d2, d0)) return;
|
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseScroll(this, d1, d2)) return;
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseScrollPost(this, this.f_91503_.f_91080_, d0);
|
if (this.minecraft.player.isSpectator()) {
|
||||||
} else if (this.f_91503_.f_91074_ != null) {
|
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
|
||||||
if (this.f_91518_ != 0.0D && Math.signum(d0) != Math.signum(this.f_91518_)) {
|
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-k);
|
||||||
this.f_91518_ = 0.0D;
|
@@ -219,7 +_,9 @@
|
||||||
@@ -139,6 +_,7 @@
|
double d2 = (p_91563_ - this.xpos) * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
|
||||||
}
|
double d3 = (p_91564_ - this.ypos) * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
|
||||||
|
Screen.wrapScreenError(() -> {
|
||||||
this.f_91518_ -= (double)i;
|
- screen.mouseDragged(d0, d1, this.activeButton, d2, d3);
|
||||||
+ if (net.minecraftforge.client.ForgeHooksClient.onMouseScroll(this, d0)) return;
|
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseDragPre(screen, d0, d1, this.activeButton, d2, d3)) return;
|
||||||
if (this.f_91503_.f_91074_.m_5833_()) {
|
+ if (screen.mouseDragged(d0, d1, this.activeButton, d2, d3)) return;
|
||||||
if (this.f_91503_.f_91065_.m_93085_().m_94768_()) {
|
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseDragPost(screen, d0, d1, this.activeButton, d2, d3);
|
||||||
this.f_91503_.f_91065_.m_93085_().m_205380_(-i);
|
|
||||||
@@ -207,7 +_,9 @@
|
|
||||||
double d2 = (p_91563_ - this.f_91507_) * (double)this.f_91503_.m_91268_().m_85445_() / (double)this.f_91503_.m_91268_().m_85443_();
|
|
||||||
double d3 = (p_91564_ - this.f_91508_) * (double)this.f_91503_.m_91268_().m_85446_() / (double)this.f_91503_.m_91268_().m_85444_();
|
|
||||||
Screen.m_96579_(() -> {
|
|
||||||
- screen.m_7979_(d0, d1, this.f_91510_, d2, d3);
|
|
||||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenMouseDragPre(screen, d0, d1, this.f_91510_, d2, d3)) return;
|
|
||||||
+ if (screen.m_7979_(d0, d1, this.f_91510_, d2, d3)) return;
|
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseDragPost(screen, d0, d1, this.f_91510_, d2, d3);
|
|
||||||
}, "mouseDragged event handler", screen.getClass().getCanonicalName());
|
}, "mouseDragged event handler", screen.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,6 +_,14 @@
|
@@ -302,6 +_,14 @@
|
||||||
|
|
||||||
public double m_91594_() {
|
public double ypos() {
|
||||||
return this.f_91508_;
|
return this.ypos;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public double getXVelocity() {
|
+ public double getXVelocity() {
|
||||||
+ return this.f_91516_;
|
+ return this.accumulatedDX;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public double getYVelocity() {
|
+ public double getYVelocity() {
|
||||||
+ return this.f_91517_;
|
+ return this.accumulatedDY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_91599_() {
|
public void setIgnoreFirstMove() {
|
||||||
@@ -1,26 +1,26 @@
|
|||||||
--- a/net/minecraft/client/Options.java
|
--- a/net/minecraft/client/Options.java
|
||||||
+++ b/net/minecraft/client/Options.java
|
+++ b/net/minecraft/client/Options.java
|
||||||
@@ -545,7 +_,8 @@
|
@@ -507,7 +_,8 @@
|
||||||
}, new OptionInstance.LazyEnum<>(() -> {
|
}, new OptionInstance.LazyEnum<>(() -> {
|
||||||
return Stream.concat(Stream.of(""), Minecraft.m_91087_().m_91106_().m_194525_().stream()).toList();
|
return Stream.concat(Stream.of(""), Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().stream()).toList();
|
||||||
}, (p_232011_) -> {
|
}, (p_232011_) -> {
|
||||||
- return Minecraft.m_91087_().m_91396_() && p_232011_ != "" && !Minecraft.m_91087_().m_91106_().m_194525_().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_);
|
- return Minecraft.getInstance().isRunning() && p_232011_ != "" && !Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_);
|
||||||
+ // FORGE: fix incorrect string comparison - PR #8767
|
+ // FORGE: fix incorrect string comparison - PR #8767
|
||||||
+ return Minecraft.m_91087_().m_91396_() && (p_232011_ == null || !p_232011_.isEmpty()) && !Minecraft.m_91087_().m_91106_().m_194525_().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_);
|
+ return Minecraft.getInstance().isRunning() && (p_232011_ == null || !p_232011_.isEmpty()) && !Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_);
|
||||||
}, Codec.STRING), "", (p_275584_) -> {
|
}, Codec.STRING), "", (p_299350_) -> {
|
||||||
SoundManager soundmanager = Minecraft.m_91087_().m_91106_();
|
SoundManager soundmanager = Minecraft.getInstance().getSoundManager();
|
||||||
soundmanager.m_194526_();
|
soundmanager.reload();
|
||||||
@@ -869,6 +_,7 @@
|
@@ -835,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public Options(Minecraft p_92138_, File p_92139_) {
|
public Options(Minecraft p_92138_, File p_92139_) {
|
||||||
+ setForgeKeybindProperties();
|
+ setForgeKeybindProperties();
|
||||||
this.f_92060_ = p_92138_;
|
this.minecraft = p_92138_;
|
||||||
this.f_92110_ = new File(p_92139_, "options.txt");
|
this.optionsFile = new File(p_92139_, "options.txt");
|
||||||
boolean flag = p_92138_.m_91103_();
|
boolean flag = p_92138_.is64Bit();
|
||||||
@@ -990,11 +_,21 @@
|
@@ -957,11 +_,21 @@
|
||||||
p_168428_.m_213982_("telemetryOptInExtra", this.f_260461_);
|
p_168428_.process("telemetryOptInExtra", this.telemetryOptInExtra);
|
||||||
this.f_263744_ = p_168428_.m_142682_("onboardAccessibility", this.f_263744_);
|
this.onboardAccessibility = p_168428_.process("onboardAccessibility", this.onboardAccessibility);
|
||||||
|
|
||||||
+ net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.processOptions(p_168428_);
|
+ net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.processOptions(p_168428_);
|
||||||
+ processOptionsForge(p_168428_);
|
+ processOptionsForge(p_168428_);
|
||||||
@@ -28,69 +28,69 @@
|
|||||||
+ // FORGE: split off to allow reloading options after mod loading is done
|
+ // FORGE: split off to allow reloading options after mod loading is done
|
||||||
+ private void processOptionsForge(Options.FieldAccess p_168428_)
|
+ private void processOptionsForge(Options.FieldAccess p_168428_)
|
||||||
+ {
|
+ {
|
||||||
for(KeyMapping keymapping : this.f_92059_) {
|
for(KeyMapping keymapping : this.keyMappings) {
|
||||||
- String s = keymapping.m_90865_();
|
- String s = keymapping.saveString();
|
||||||
+ String s = keymapping.m_90865_() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : "");
|
+ String s = keymapping.saveString() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : "");
|
||||||
String s1 = p_168428_.m_141943_("key_" + keymapping.m_90860_(), s);
|
String s1 = p_168428_.process("key_" + keymapping.getName(), s);
|
||||||
if (!s.equals(s1)) {
|
if (!s.equals(s1)) {
|
||||||
- keymapping.m_90848_(InputConstants.m_84851_(s1));
|
- keymapping.setKey(InputConstants.getKey(s1));
|
||||||
+ if (s1.indexOf(':') != -1) {
|
+ if (s1.indexOf(':') != -1) {
|
||||||
+ String[] pts = s1.split(":");
|
+ String[] pts = s1.split(":");
|
||||||
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputConstants.m_84851_(pts[0]));
|
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputConstants.getKey(pts[0]));
|
||||||
+ } else
|
+ } else
|
||||||
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputConstants.m_84851_(s1));
|
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputConstants.getKey(s1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1013,6 +_,9 @@
|
@@ -980,6 +_,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_92140_() {
|
public void load() {
|
||||||
+ this.load(false);
|
+ this.load(false);
|
||||||
+ }
|
+ }
|
||||||
+ public void load(boolean limited) {
|
+ public void load(boolean limited) {
|
||||||
try {
|
try {
|
||||||
if (!this.f_92110_.exists()) {
|
if (!this.optionsFile.exists()) {
|
||||||
return;
|
return;
|
||||||
@@ -1041,7 +_,8 @@
|
@@ -1008,7 +_,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- this.m_168427_(new Options.FieldAccess() {
|
- this.processOptions(new Options.FieldAccess() {
|
||||||
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsForge : this::m_168427_;
|
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsForge : this::processOptions;
|
||||||
+ processor.accept(new Options.FieldAccess() {
|
+ processor.accept(new Options.FieldAccess() {
|
||||||
@Nullable
|
@Nullable
|
||||||
private String m_168458_(String p_168459_) {
|
private String getValueOrNull(String p_168459_) {
|
||||||
return compoundtag1.m_128441_(p_168459_) ? compoundtag1.m_128461_(p_168459_) : null;
|
return compoundtag1.contains(p_168459_) ? compoundtag1.getString(p_168459_) : null;
|
||||||
@@ -1204,6 +_,7 @@
|
@@ -1181,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_92172_() {
|
public void broadcastOptions() {
|
||||||
+ if (net.minecraftforge.client.loading.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
|
+ if (net.minecraftforge.client.loading.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
|
||||||
if (this.f_92060_.f_91074_ != null) {
|
if (this.minecraft.player != null) {
|
||||||
int i = 0;
|
this.minecraft.player.connection.send(new ServerboundClientInformationPacket(this.buildPlayerInformation()));
|
||||||
|
}
|
||||||
@@ -1268,6 +_,23 @@
|
@@ -1239,6 +_,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
p_92146_.m_10509_(set);
|
p_92146_.setSelected(set);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private void setForgeKeybindProperties() {
|
+ private void setForgeKeybindProperties() {
|
||||||
+ net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME;
|
+ net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME;
|
||||||
+ f_92085_.setKeyConflictContext(inGame);
|
+ keyUp.setKeyConflictContext(inGame);
|
||||||
+ f_92086_.setKeyConflictContext(inGame);
|
+ keyLeft.setKeyConflictContext(inGame);
|
||||||
+ f_92087_.setKeyConflictContext(inGame);
|
+ keyDown.setKeyConflictContext(inGame);
|
||||||
+ f_92088_.setKeyConflictContext(inGame);
|
+ keyRight.setKeyConflictContext(inGame);
|
||||||
+ f_92089_.setKeyConflictContext(inGame);
|
+ keyJump.setKeyConflictContext(inGame);
|
||||||
+ f_92090_.setKeyConflictContext(inGame);
|
+ keyShift.setKeyConflictContext(inGame);
|
||||||
+ f_92091_.setKeyConflictContext(inGame);
|
+ keySprint.setKeyConflictContext(inGame);
|
||||||
+ f_92096_.setKeyConflictContext(inGame);
|
+ keyAttack.setKeyConflictContext(inGame);
|
||||||
+ f_92098_.setKeyConflictContext(inGame);
|
+ keyChat.setKeyConflictContext(inGame);
|
||||||
+ f_92099_.setKeyConflictContext(inGame);
|
+ keyPlayerList.setKeyConflictContext(inGame);
|
||||||
+ f_92100_.setKeyConflictContext(inGame);
|
+ keyCommand.setKeyConflictContext(inGame);
|
||||||
+ f_92103_.setKeyConflictContext(inGame);
|
+ keyTogglePerspective.setKeyConflictContext(inGame);
|
||||||
+ f_92104_.setKeyConflictContext(inGame);
|
+ keySmoothCamera.setKeyConflictContext(inGame);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CameraType m_92176_() {
|
public CameraType getCameraType() {
|
||||||
@@ -6,20 +6,20 @@
|
|||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
-public enum RecipeBookCategories {
|
-public enum RecipeBookCategories {
|
||||||
+public enum RecipeBookCategories implements net.minecraftforge.common.IExtensibleEnum {
|
+public enum RecipeBookCategories implements net.minecraftforge.common.IExtensibleEnum {
|
||||||
CRAFTING_SEARCH(new ItemStack(Items.f_42522_)),
|
CRAFTING_SEARCH(new ItemStack(Items.COMPASS)),
|
||||||
CRAFTING_BUILDING_BLOCKS(new ItemStack(Blocks.f_50076_)),
|
CRAFTING_BUILDING_BLOCKS(new ItemStack(Blocks.BRICKS)),
|
||||||
CRAFTING_REDSTONE(new ItemStack(Items.f_42451_)),
|
CRAFTING_REDSTONE(new ItemStack(Items.REDSTONE)),
|
||||||
@@ -36,7 +_,7 @@
|
@@ -36,7 +_,7 @@
|
||||||
public static final List<RecipeBookCategories> f_92257_ = ImmutableList.of(BLAST_FURNACE_SEARCH, BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC);
|
public static final List<RecipeBookCategories> BLAST_FURNACE_CATEGORIES = ImmutableList.of(BLAST_FURNACE_SEARCH, BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC);
|
||||||
public static final List<RecipeBookCategories> f_92258_ = ImmutableList.of(FURNACE_SEARCH, FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC);
|
public static final List<RecipeBookCategories> FURNACE_CATEGORIES = ImmutableList.of(FURNACE_SEARCH, FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC);
|
||||||
public static final List<RecipeBookCategories> f_92259_ = ImmutableList.of(CRAFTING_SEARCH, CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE);
|
public static final List<RecipeBookCategories> CRAFTING_CATEGORIES = ImmutableList.of(CRAFTING_SEARCH, CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE);
|
||||||
- public static final Map<RecipeBookCategories, List<RecipeBookCategories>> f_92260_ = ImmutableMap.of(CRAFTING_SEARCH, ImmutableList.of(CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE), FURNACE_SEARCH, ImmutableList.of(FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC), BLAST_FURNACE_SEARCH, ImmutableList.of(BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC), SMOKER_SEARCH, ImmutableList.of(SMOKER_FOOD));
|
- public static final Map<RecipeBookCategories, List<RecipeBookCategories>> AGGREGATE_CATEGORIES = ImmutableMap.of(CRAFTING_SEARCH, ImmutableList.of(CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE), FURNACE_SEARCH, ImmutableList.of(FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC), BLAST_FURNACE_SEARCH, ImmutableList.of(BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC), SMOKER_SEARCH, ImmutableList.of(SMOKER_FOOD));
|
||||||
+ public static final Map<RecipeBookCategories, List<RecipeBookCategories>> f_92260_ = net.minecraftforge.client.RecipeBookManager.getAggregateCategories();
|
+ public static final Map<RecipeBookCategories, List<RecipeBookCategories>> AGGREGATE_CATEGORIES = net.minecraftforge.client.RecipeBookManager.getAggregateCategories();
|
||||||
private final List<ItemStack> f_92261_;
|
private final List<ItemStack> itemIcons;
|
||||||
|
|
||||||
private RecipeBookCategories(ItemStack... p_92267_) {
|
private RecipeBookCategories(ItemStack... p_92267_) {
|
||||||
@@ -59,7 +_,7 @@
|
@@ -59,7 +_,7 @@
|
||||||
list = f_92256_;
|
list = SMOKER_CATEGORIES;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
- throw new IncompatibleClassChangeError();
|
- throw new IncompatibleClassChangeError();
|
||||||
@@ -29,8 +29,8 @@
|
|||||||
return list;
|
return list;
|
||||||
@@ -67,5 +_,9 @@
|
@@ -67,5 +_,9 @@
|
||||||
|
|
||||||
public List<ItemStack> m_92268_() {
|
public List<ItemStack> getIconItems() {
|
||||||
return this.f_92261_;
|
return this.itemIcons;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static RecipeBookCategories create(String name, ItemStack... icons) {
|
+ public static RecipeBookCategories create(String name, ItemStack... icons) {
|
||||||
|
|||||||
@@ -11,19 +11,19 @@
|
|||||||
+ }
|
+ }
|
||||||
+ final File target = event.getScreenshotFile();
|
+ final File target = event.getScreenshotFile();
|
||||||
+
|
+
|
||||||
Util.m_183992_().execute(() -> {
|
Util.ioPool().execute(() -> {
|
||||||
try {
|
try {
|
||||||
- nativeimage.m_85056_(file2);
|
- nativeimage.writeToFile(file2);
|
||||||
+ nativeimage.m_85056_(target);
|
+ nativeimage.writeToFile(target);
|
||||||
Component component = Component.m_237113_(file2.getName()).m_130940_(ChatFormatting.UNDERLINE).m_130938_((p_168608_) -> {
|
Component component = Component.literal(file2.getName()).withStyle(ChatFormatting.UNDERLINE).withStyle((p_168608_) -> {
|
||||||
- return p_168608_.m_131142_(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath()));
|
- return p_168608_.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath()));
|
||||||
+ return p_168608_.m_131142_(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath()));
|
+ return p_168608_.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath()));
|
||||||
});
|
});
|
||||||
- p_92311_.accept(Component.m_237110_("screenshot.success", component));
|
- p_92311_.accept(Component.translatable("screenshot.success", component));
|
||||||
+ if (event.getResultMessage() != null)
|
+ if (event.getResultMessage() != null)
|
||||||
+ p_92311_.accept(event.getResultMessage());
|
+ p_92311_.accept(event.getResultMessage());
|
||||||
+ else
|
+ else
|
||||||
+ p_92311_.accept(Component.m_237110_("screenshot.success", component));
|
+ p_92311_.accept(Component.translatable("screenshot.success", component));
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
f_92276_.warn("Couldn't save screenshot", (Throwable)exception);
|
LOGGER.warn("Couldn't save screenshot", (Throwable)exception);
|
||||||
p_92311_.accept(Component.m_237110_("screenshot.failure", exception.getMessage()));
|
p_92311_.accept(Component.translatable("screenshot.failure", exception.getMessage()));
|
||||||
@@ -2,18 +2,18 @@
|
|||||||
+++ b/net/minecraft/client/ToggleKeyMapping.java
|
+++ b/net/minecraft/client/ToggleKeyMapping.java
|
||||||
@@ -16,7 +_,7 @@
|
@@ -16,7 +_,7 @@
|
||||||
|
|
||||||
public void m_7249_(boolean p_92534_) {
|
public void setDown(boolean p_92534_) {
|
||||||
if (this.f_92527_.getAsBoolean()) {
|
if (this.needsToggle.getAsBoolean()) {
|
||||||
- if (p_92534_) {
|
- if (p_92534_) {
|
||||||
+ if (p_92534_ && isConflictContextAndModifierActive()) {
|
+ if (p_92534_ && isConflictContextAndModifierActive()) {
|
||||||
super.m_7249_(!this.m_90857_());
|
super.setDown(!this.isDown());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -24,6 +_,7 @@
|
@@ -24,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+ @Override public boolean m_90857_() { return this.f_90817_ && (isConflictContextAndModifierActive() || f_92527_.getAsBoolean()); }
|
+ @Override public boolean isDown() { return this.isDown && (isConflictContextAndModifierActive() || needsToggle.getAsBoolean()); }
|
||||||
|
|
||||||
protected void m_289748_() {
|
protected void reset() {
|
||||||
super.m_7249_(false);
|
super.setDown(false);
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
--- a/net/minecraft/client/User.java
|
|
||||||
+++ b/net/minecraft/client/User.java
|
|
||||||
@@ -21,8 +_,22 @@
|
|
||||||
private final Optional<String> f_193796_;
|
|
||||||
private final Optional<String> f_193797_;
|
|
||||||
private final User.Type f_92538_;
|
|
||||||
+ /** Forge: Cache of the local session's GameProfile properties. */
|
|
||||||
+ private com.mojang.authlib.properties.PropertyMap properties;
|
|
||||||
|
|
||||||
public User(String p_193799_, String p_193800_, String p_193801_, Optional<String> p_193802_, Optional<String> p_193803_, User.Type p_193804_) {
|
|
||||||
+ if (p_193799_ == null || p_193799_.isEmpty()) {
|
|
||||||
+ p_193799_ = "MissingName";
|
|
||||||
+ p_193800_ = p_193801_ = "NotValid";
|
|
||||||
+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger(getClass().getName());
|
|
||||||
+ logger.warn("=========================================================");
|
|
||||||
+ logger.warn("WARNING!! the username was not set for this session, typically");
|
|
||||||
+ logger.warn("this means you installed Forge incorrectly. We have set your");
|
|
||||||
+ logger.warn("name to \"MissingName\" and your session to nothing. Please");
|
|
||||||
+ logger.warn("check your installation and post a console log from the launcher");
|
|
||||||
+ logger.warn("when asking for help!");
|
|
||||||
+ logger.warn("=========================================================");
|
|
||||||
+ }
|
|
||||||
this.f_92535_ = p_193799_;
|
|
||||||
this.f_92536_ = p_193800_;
|
|
||||||
this.f_92537_ = p_193801_;
|
|
||||||
@@ -64,8 +_,22 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ //For internal use only. Modders should never need to use this.
|
|
||||||
+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) {
|
|
||||||
+ if (this.properties == null)
|
|
||||||
+ this.properties = properties;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public boolean hasCachedProperties() {
|
|
||||||
+ return properties != null;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
public GameProfile m_92548_() {
|
|
||||||
- return new GameProfile(this.m_240411_(), this.m_92546_());
|
|
||||||
+ // FORGE: Add cached GameProfile properties to returned GameProfile. This helps to cut down on calls to the session service.
|
|
||||||
+ GameProfile ret = new GameProfile(this.m_240411_(), this.m_92546_());
|
|
||||||
+ if (this.properties != null)
|
|
||||||
+ ret.getProperties().putAll(this.properties);
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User.Type m_168638_() {
|
|
||||||
@@ -3,42 +3,42 @@
|
|||||||
@@ -28,7 +_,8 @@
|
@@ -28,7 +_,8 @@
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class BlockColors {
|
public class BlockColors {
|
||||||
private static final int f_168640_ = -1;
|
private static final int DEFAULT = -1;
|
||||||
- private final IdMapper<BlockColor> f_92571_ = new IdMapper<>(32);
|
- private final IdMapper<BlockColor> blockColors = new IdMapper<>(32);
|
||||||
+ // FORGE: Use registry delegate as non-Vanilla block ids are not constant
|
+ // FORGE: Use registry delegate as non-Vanilla block ids are not constant
|
||||||
+ private final java.util.Map<net.minecraft.core.Holder.Reference<Block>, BlockColor> f_92571_ = new java.util.HashMap<>();
|
+ private final java.util.Map<net.minecraft.core.Holder.Reference<Block>, BlockColor> blockColors = new java.util.HashMap<>();
|
||||||
private final Map<Block, Set<Property<?>>> f_92572_ = Maps.newHashMap();
|
private final Map<Block, Set<Property<?>>> coloringStates = Maps.newHashMap();
|
||||||
|
|
||||||
public static BlockColors m_92574_() {
|
public static BlockColors createDefault() {
|
||||||
@@ -80,11 +_,12 @@
|
@@ -80,11 +_,12 @@
|
||||||
blockcolors.m_92589_((p_92596_, p_92597_, p_92598_, p_92599_) -> {
|
blockcolors.register((p_92596_, p_92597_, p_92598_, p_92599_) -> {
|
||||||
return p_92597_ != null && p_92598_ != null ? 2129968 : 7455580;
|
return p_92597_ != null && p_92598_ != null ? 2129968 : 7455580;
|
||||||
}, Blocks.f_50196_);
|
}, Blocks.LILY_PAD);
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(blockcolors);
|
+ net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(blockcolors);
|
||||||
return blockcolors;
|
return blockcolors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int m_92582_(BlockState p_92583_, Level p_92584_, BlockPos p_92585_) {
|
public int getColor(BlockState p_92583_, Level p_92584_, BlockPos p_92585_) {
|
||||||
- BlockColor blockcolor = this.f_92571_.m_7942_(BuiltInRegistries.f_256975_.m_7447_(p_92583_.m_60734_()));
|
- BlockColor blockcolor = this.blockColors.byId(BuiltInRegistries.BLOCK.getId(p_92583_.getBlock()));
|
||||||
+ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92583_.m_60734_()));
|
+ BlockColor blockcolor = this.blockColors.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92583_.getBlock()));
|
||||||
if (blockcolor != null) {
|
if (blockcolor != null) {
|
||||||
return blockcolor.m_92566_(p_92583_, (BlockAndTintGetter)null, (BlockPos)null, 0);
|
return blockcolor.getColor(p_92583_, (BlockAndTintGetter)null, (BlockPos)null, 0);
|
||||||
} else {
|
} else {
|
||||||
@@ -94,13 +_,15 @@
|
@@ -94,13 +_,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public int m_92577_(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) {
|
public int getColor(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) {
|
||||||
- BlockColor blockcolor = this.f_92571_.m_7942_(BuiltInRegistries.f_256975_.m_7447_(p_92578_.m_60734_()));
|
- BlockColor blockcolor = this.blockColors.byId(BuiltInRegistries.BLOCK.getId(p_92578_.getBlock()));
|
||||||
+ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92578_.m_60734_()));
|
+ BlockColor blockcolor = this.blockColors.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92578_.getBlock()));
|
||||||
return blockcolor == null ? -1 : blockcolor.m_92566_(p_92578_, p_92579_, p_92580_, p_92581_);
|
return blockcolor == null ? -1 : blockcolor.getColor(p_92578_, p_92579_, p_92580_, p_92581_);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Block} */
|
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Block} */
|
||||||
+ @Deprecated
|
+ @Deprecated
|
||||||
public void m_92589_(BlockColor p_92590_, Block... p_92591_) {
|
public void register(BlockColor p_92590_, Block... p_92591_) {
|
||||||
for(Block block : p_92591_) {
|
for(Block block : p_92591_) {
|
||||||
- this.f_92571_.m_122664_(p_92590_, BuiltInRegistries.f_256975_.m_7447_(block));
|
- this.blockColors.addMapping(p_92590_, BuiltInRegistries.BLOCK.getId(block));
|
||||||
+ this.f_92571_.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), p_92590_);
|
+ this.blockColors.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), p_92590_);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,33 +3,33 @@
|
|||||||
@@ -25,7 +_,8 @@
|
@@ -25,7 +_,8 @@
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class ItemColors {
|
public class ItemColors {
|
||||||
private static final int f_168642_ = -1;
|
private static final int DEFAULT = -1;
|
||||||
- private final IdMapper<ItemColor> f_92674_ = new IdMapper<>(32);
|
- private final IdMapper<ItemColor> itemColors = new IdMapper<>(32);
|
||||||
+ // FORGE: Use registry delegate as non-Vanilla item ids are not constant
|
+ // FORGE: Use registry delegate as non-Vanilla item ids are not constant
|
||||||
+ private final java.util.Map<net.minecraft.core.Holder.Reference<Item>, ItemColor> f_92674_ = new java.util.HashMap<>();
|
+ private final java.util.Map<net.minecraft.core.Holder.Reference<Item>, ItemColor> itemColors = new java.util.HashMap<>();
|
||||||
|
|
||||||
public static ItemColors m_92683_(BlockColors p_92684_) {
|
public static ItemColors createDefault(BlockColors p_92684_) {
|
||||||
ItemColors itemcolors = new ItemColors();
|
ItemColors itemcolors = new ItemColors();
|
||||||
@@ -88,17 +_,20 @@
|
@@ -88,17 +_,20 @@
|
||||||
itemcolors.m_92689_((p_232352_, p_232353_) -> {
|
itemcolors.register((p_232352_, p_232353_) -> {
|
||||||
return p_232353_ == 0 ? -1 : MapItem.m_42918_(p_232352_);
|
return p_232353_ == 0 ? -1 : MapItem.getColor(p_232352_);
|
||||||
}, Items.f_42573_);
|
}, Items.FILLED_MAP);
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.onItemColorsInit(itemcolors, p_92684_);
|
+ net.minecraftforge.client.ForgeHooksClient.onItemColorsInit(itemcolors, p_92684_);
|
||||||
return itemcolors;
|
return itemcolors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int m_92676_(ItemStack p_92677_, int p_92678_) {
|
public int getColor(ItemStack p_92677_, int p_92678_) {
|
||||||
- ItemColor itemcolor = this.f_92674_.m_7942_(BuiltInRegistries.f_257033_.m_7447_(p_92677_.m_41720_()));
|
- ItemColor itemcolor = this.itemColors.byId(BuiltInRegistries.ITEM.getId(p_92677_.getItem()));
|
||||||
+ ItemColor itemcolor = this.f_92674_.get(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(p_92677_.m_41720_()));
|
+ ItemColor itemcolor = this.itemColors.get(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(p_92677_.getItem()));
|
||||||
return itemcolor == null ? -1 : itemcolor.m_92671_(p_92677_, p_92678_);
|
return itemcolor == null ? -1 : itemcolor.getColor(p_92677_, p_92678_);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Item} */
|
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Item} */
|
||||||
+ @Deprecated
|
+ @Deprecated
|
||||||
public void m_92689_(ItemColor p_92690_, ItemLike... p_92691_) {
|
public void register(ItemColor p_92690_, ItemLike... p_92691_) {
|
||||||
for(ItemLike itemlike : p_92691_) {
|
for(ItemLike itemlike : p_92691_) {
|
||||||
- this.f_92674_.m_122664_(p_92690_, Item.m_41393_(itemlike.m_5456_()));
|
- this.itemColors.addMapping(p_92690_, Item.getId(itemlike.asItem()));
|
||||||
+ this.f_92674_.put(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(itemlike.m_5456_()), p_92690_);
|
+ this.itemColors.put(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(itemlike.asItem()), p_92690_);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6,12 +6,12 @@
|
|||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
-public class Font {
|
-public class Font {
|
||||||
+public class Font implements net.minecraftforge.client.extensions.IForgeFont {
|
+public class Font implements net.minecraftforge.client.extensions.IForgeFont {
|
||||||
private static final float f_168643_ = 0.01F;
|
private static final float EFFECT_DEPTH = 0.01F;
|
||||||
private static final Vector3f f_92712_ = new Vector3f(0.0F, 0.0F, 0.03F);
|
private static final Vector3f SHADOW_OFFSET = new Vector3f(0.0F, 0.0F, 0.03F);
|
||||||
public static final int f_193827_ = 8;
|
public static final int ALPHA_CUTOFF = 8;
|
||||||
@@ -202,6 +_,8 @@
|
@@ -202,6 +_,8 @@
|
||||||
public StringSplitter m_92865_() {
|
public StringSplitter getSplitter() {
|
||||||
return this.f_92714_;
|
return this.splitter;
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ @Override public Font self() { return this; }
|
+ @Override public Font self() { return this; }
|
||||||
|
|||||||
Loaded 100 of 1597 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user