mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 17:14:44 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2106a3ced9 | ||
|
|
50b5414033 |
No files matched your search
+2
-3
@@ -24,7 +24,7 @@
|
||||
/projects/clean/
|
||||
/projects/forge/
|
||||
/projects/fmlonly/
|
||||
#/patches/*
|
||||
#/patches/
|
||||
|
||||
#occupational hazards
|
||||
/projects/**/build/
|
||||
@@ -36,7 +36,7 @@ src/generated/resources/.cache/
|
||||
|
||||
#Patch rejects
|
||||
/patches-/
|
||||
*.patch.rej
|
||||
#*.patch.rej
|
||||
/projects/*/rejects/
|
||||
|
||||
# FML changelog
|
||||
@@ -44,4 +44,3 @@ changelog.txt
|
||||
*.py
|
||||
*.7z
|
||||
/logs/
|
||||
|
||||
Vendored
+185
@@ -0,0 +1,185 @@
|
||||
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
||||
import jetbrains.buildServer.configs.kotlin.v2019_2.projectFeatures.githubIssues
|
||||
import jetbrains.buildServer.configs.kotlin.*
|
||||
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
|
||||
|
||||
/*
|
||||
The settings script is an entry point for defining a TeamCity
|
||||
project hierarchy. The script should contain a single call to the
|
||||
project() function with a Project instance or an init function as
|
||||
an argument.
|
||||
|
||||
VcsRoots, BuildTypes, Templates, and subprojects can be
|
||||
registered inside the project using the vcsRoot(), buildType(),
|
||||
template(), and subProject() methods respectively.
|
||||
|
||||
To debug settings scripts in command-line, run the
|
||||
|
||||
mvnDebug org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate
|
||||
|
||||
command and attach your debugger to the port 8000.
|
||||
|
||||
To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View
|
||||
-> Tool Windows -> Maven Projects), find the generate task node
|
||||
(Plugins -> teamcity-configs -> teamcity-configs:generate), the
|
||||
'Debug' option is available in the context menu for the task.
|
||||
*/
|
||||
|
||||
version = "2021.2"
|
||||
|
||||
project {
|
||||
|
||||
buildType(Build)
|
||||
buildType(BuildSecondaryBranches)
|
||||
buildType(PullRequests)
|
||||
buildType(PullRequestChecks)
|
||||
buildType(PullRequestCompatibility)
|
||||
|
||||
params {
|
||||
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", "7.3.3", 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_branch_spec", """
|
||||
+:refs/heads/(main*)
|
||||
+:refs/heads/(master*)
|
||||
+:refs/heads/(develop|release|staging|main|master)
|
||||
+:refs/heads/(1.*)
|
||||
""".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("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_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
|
||||
password("env.CROWDIN_KEY", "credentialsJSON:a3102dbe-805d-4177-9f54-3d2c2eb08fd5", display = ParameterDisplay.HIDDEN)
|
||||
password("env.LEGACY_KEYSTORE_URL", "credentialsJSON:a2d2efc7-4492-47b6-9826-d14b2c1243a0", display = ParameterDisplay.HIDDEN)
|
||||
password("env.LEGACY_KEYSTORE_PASSWORD", "credentialsJSON:9f9a1a9e-f91b-40d5-b888-8ebc79a99ded", display = ParameterDisplay.HIDDEN)
|
||||
text("additional_publishing_gradle_parameters", "-PcrowdinKey=%env.CROWDIN_KEY% -PkeystoreKeyPass=%env.LEGACY_KEYSTORE_PASSWORD% -PkeystoreStorePass=%env.LEGACY_KEYSTORE_PASSWORD% -Pkeystore=%env.LEGACY_KEYSTORE_URL%", label = "Additional gradle parameters for publish", description = "Contains the additional gradle parameters used during publishing.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
|
||||
|
||||
checkbox("should_execute_build", "false", label = "Should build", description = "Indicates if the build task should be executed.", display = ParameterDisplay.HIDDEN,
|
||||
checked = "true", unchecked = "false")
|
||||
checkbox("should_execute_test", "false", label = "Should build", description = "Indicates if the build task should be executed.", display = ParameterDisplay.HIDDEN,
|
||||
checked = "true", unchecked = "false")
|
||||
}
|
||||
|
||||
features {
|
||||
githubIssues {
|
||||
id = "MinecraftForge_MinecraftForge__IssueTracker"
|
||||
displayName = "MinecraftForge/MinecraftForge"
|
||||
repositoryURL = "https://github.com/MinecraftForge/MinecraftForge"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object Build : BuildType({
|
||||
templates(AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_BuildMainBranches"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"), AbsoluteId("MinecraftForge_BuildUsingGradle"), AbsoluteId("MinecraftForge_PublishProjectUsingGradle"), AbsoluteId("MinecraftForge_TriggersStaticFilesWebpageGenerator"))
|
||||
id("MinecraftForge_MinecraftForge__Build")
|
||||
name = "Build"
|
||||
description = "Builds and Publishes the main branches of the project."
|
||||
})
|
||||
|
||||
object BuildSecondaryBranches : BuildType({
|
||||
templates(AbsoluteId("MinecraftForge_ExcludesBuildingDefaultBranch"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_BuildMainBranches"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"), AbsoluteId("MinecraftForge_BuildUsingGradle"))
|
||||
id("MinecraftForge_MinecraftForge__BuildSecondaryBranches")
|
||||
name = "Build - Secondary Branches"
|
||||
description = "Builds and Publishes the secondary branches of the project."
|
||||
params {
|
||||
text("git_branch_spec", """
|
||||
+:refs/heads/(*)
|
||||
-:refs/heads/noci*
|
||||
""".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)
|
||||
}
|
||||
vcs {
|
||||
branchFilter = """
|
||||
+:*
|
||||
-:1.*
|
||||
-:<default>
|
||||
""".trimIndent()
|
||||
}
|
||||
})
|
||||
|
||||
object PullRequests : BuildType({
|
||||
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"), AbsoluteId("MinecraftForge_BuildUsingGradle"))
|
||||
id("MinecraftForge_MinecraftForge__PullRequests")
|
||||
name = "Pull Requests"
|
||||
description = "Builds pull requests for the project"
|
||||
|
||||
params {
|
||||
checkbox("should_execute_build", "true", label = "Should build", description = "Indicates if the build task should be executed.", display = ParameterDisplay.HIDDEN,
|
||||
checked = "true", unchecked = "false")
|
||||
text(
|
||||
"gradle_build_task",
|
||||
"assemble",
|
||||
label = "Gradle build task to execute during build",
|
||||
description = "Determines the build task that is executed to build the project.",
|
||||
display = ParameterDisplay.HIDDEN,
|
||||
allowEmpty = false
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
object PullRequestChecks : BuildType({
|
||||
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"))
|
||||
id("MinecraftForge_MinecraftForge__PullRequestChecks")
|
||||
name = "Pull Requests (Checks)"
|
||||
description = "Checks pull requests for the project"
|
||||
|
||||
steps {
|
||||
gradle {
|
||||
name = "Check"
|
||||
id = "RUNNER_10_Check"
|
||||
|
||||
tasks = "checkAll"
|
||||
gradleParams = "--continue %gradle_custom_args%"
|
||||
enableStacktrace = true
|
||||
dockerImage = "%docker_gradle_image%"
|
||||
dockerRunParameters = """
|
||||
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
|
||||
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
|
||||
--network=host
|
||||
-u 1000:1000
|
||||
%docker_additional_args%
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
|
||||
vcs {
|
||||
branchFilter = """
|
||||
+:*
|
||||
-:1.*
|
||||
-:<default>
|
||||
""".trimIndent()
|
||||
}
|
||||
})
|
||||
|
||||
object PullRequestCompatibility : BuildType({
|
||||
templates(AbsoluteId("MinecraftForge_BuildPullRequests"), AbsoluteId("MinecraftForge_SetupGradleUtilsCiEnvironmen"), AbsoluteId("MinecraftForge_BuildWithDiscordNotifications"), AbsoluteId("MinecraftForge_SetupProjectUsingGradle"))
|
||||
id("MinecraftForge_MinecraftForge__PullRequestCompatibility")
|
||||
name = "Pull Requests (Compatibility)"
|
||||
description = "Validates binary compatibility for pull requests made to the project"
|
||||
|
||||
steps {
|
||||
gradle {
|
||||
name = "Validate"
|
||||
id = "RUNNER_10_Compatibility"
|
||||
|
||||
tasks = "checkJarCompatibility"
|
||||
gradleParams = "--continue %gradle_custom_args%"
|
||||
enableStacktrace = true
|
||||
dockerImage = "%docker_gradle_image%"
|
||||
dockerRunParameters = """
|
||||
-v "/opt/cache/agent/gradle:/home/gradle/.gradle"
|
||||
-v "/opt/cache/shared/gradle:/home/gradle/rocache:ro"
|
||||
--network=host
|
||||
-u 1000:1000
|
||||
%docker_additional_args%
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
|
||||
vcs {
|
||||
branchFilter = """
|
||||
+:*
|
||||
-:1.*
|
||||
-:<default>
|
||||
""".trimIndent()
|
||||
}
|
||||
})
|
||||
+2
-16
@@ -1,16 +1,2 @@
|
||||
Minecraft Forge
|
||||
Copyright (c) 2016-${year}.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation version 2.1
|
||||
of the License.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Copyright (c) Forge Development LLC and contributors
|
||||
SPDX-License-Identifier: LGPL-2.1-only
|
||||
+172
-199
@@ -5,11 +5,18 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:[5.1.26,)'
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:[5.1.39,5.2.0)'
|
||||
}
|
||||
}
|
||||
|
||||
import groovy.json.JsonBuilder
|
||||
import de.undercouch.gradle.tasks.download.Download
|
||||
import net.minecraftforge.forge.tasks.checks.CheckATs
|
||||
import net.minecraftforge.forge.tasks.checks.CheckExcs
|
||||
import net.minecraftforge.forge.tasks.checks.CheckPatches
|
||||
import net.minecraftforge.forge.tasks.checks.CheckSAS
|
||||
import net.minecraftforge.forge.tasks.checks.CheckTask
|
||||
import net.minecraftforge.forge.tasks.checks.CheckMode
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.util.Date
|
||||
@@ -17,6 +24,8 @@ import java.util.LinkedHashMap
|
||||
import net.minecraftforge.forge.tasks.*
|
||||
import static net.minecraftforge.forge.tasks.Util.*
|
||||
import net.minecraftforge.gradle.common.tasks.ApplyBinPatches
|
||||
import net.minecraftforge.gradle.common.tasks.CheckJarCompatibility
|
||||
import net.minecraftforge.gradle.common.tasks.ApplyBinPatches
|
||||
import net.minecraftforge.gradle.common.tasks.DownloadMavenArtifact
|
||||
import net.minecraftforge.gradle.common.tasks.ExtractInheritance
|
||||
import net.minecraftforge.gradle.common.tasks.SignJar
|
||||
@@ -27,9 +36,9 @@ import org.gradle.plugins.ide.eclipse.model.SourceFolder
|
||||
plugins {
|
||||
id 'org.cadixdev.licenser' version '0.6.1'
|
||||
id 'com.github.ben-manes.versions' version '0.36.0'
|
||||
id 'net.minecraftforge.gradleutils' version '1.+'
|
||||
id 'net.minecraftforge.gradleutils' version '[2.2,2.3)'
|
||||
id 'eclipse'
|
||||
id 'de.undercouch.download' version '4.1.2'
|
||||
id 'de.undercouch.download' version '5.1.3'
|
||||
}
|
||||
|
||||
Util.init() //Init all our extension methods!
|
||||
@@ -44,30 +53,32 @@ ext {
|
||||
]
|
||||
}
|
||||
MAPPING_CHANNEL = 'official'
|
||||
MAPPING_VERSION = '1.18.1'
|
||||
MC_VERSION = '1.18.1'
|
||||
MCP_VERSION = '20211210.034407'
|
||||
MAPPING_VERSION = '1.17.1'
|
||||
MC_VERSION = '1.17.1'
|
||||
MCP_VERSION = '20210706.113038'
|
||||
SPI_VERSION = '4.0.10'
|
||||
ACCESSTRANSFORMERS_VERSION = '8.0.4'
|
||||
COREMODS_VERSION = '5.0.1'
|
||||
EVENTBUS_VERSION = '5.0.3'
|
||||
COREMODS_VERSION = '5.0.3'
|
||||
EVENTBUS_VERSION = '5.0.7'
|
||||
MODLAUNCHER_VERSION = '9.0.7'
|
||||
SECUREJARHANDLER_VERSION = '0.9.54'
|
||||
BOOTSTRAPLAUNCHER_VERSION = '0.1.17'
|
||||
ASM_VERSION = '9.1'
|
||||
INSTALLER_VERSION = '2.1.+'
|
||||
ASM_VERSION = '9.6'
|
||||
INSTALLER_VERSION = '2.2.+'
|
||||
MIXIN_VERSION = '0.8.5'
|
||||
|
||||
GIT_INFO = gradleutils.gitInfo
|
||||
VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION)
|
||||
GIT_INFO = gradleutils.gitInfo
|
||||
LAST_RB = GIT_INFO.tag.rsplit('.', 1)[1] as int >= 1 ? GIT_INFO.tag + '.0' : null
|
||||
// FML_VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, 'FML', MC_VERSION)
|
||||
FORGE_VERSION = VERSION.substring(MC_VERSION.length() + 1)
|
||||
MIN_TAG_FOR_CHANGELOG = "37.0"
|
||||
|
||||
SPECIAL_SOURCE = 'net.md-5:SpecialSource:1.10.0'
|
||||
VIGNETTE = 'net.minecraftforge.lex:vignette:0.2.0.16'
|
||||
BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.0.12:fatjar'
|
||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.2.10'
|
||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.4.1'
|
||||
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
|
||||
FART = 'net.minecraftforge:ForgeAutoRenamingTool:0.1.17:all'
|
||||
}
|
||||
|
||||
println('Version: ' + VERSION +
|
||||
@@ -75,6 +86,10 @@ println('Version: ' + VERSION +
|
||||
' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ')' +
|
||||
' Arch: ' + System.getProperty('os.arch'))
|
||||
|
||||
changelog {
|
||||
fromTag MIN_TAG_FOR_CHANGELOG
|
||||
}
|
||||
|
||||
def extraTxts = [
|
||||
rootProject.file('CREDITS.txt'),
|
||||
rootProject.file('LICENSE.txt')
|
||||
@@ -84,32 +99,6 @@ def changelog = rootProject.file('build/changelog.txt')
|
||||
if (changelog.exists())
|
||||
extraTxts += changelog
|
||||
|
||||
task downloadVersionManifest(type: Download) {
|
||||
src 'https://launchermeta.mojang.com/mc/game/version_manifest_v2.json'
|
||||
dest file('build/versions/version_manifest.json')
|
||||
useETag 'all'
|
||||
onlyIfModified true
|
||||
quiet true
|
||||
}
|
||||
task downloadJson(type: Download, dependsOn: downloadVersionManifest) {
|
||||
inputs.file downloadVersionManifest.dest
|
||||
src { downloadVersionManifest.dest.json.versions.find{ it.id == MC_VERSION }.url }
|
||||
dest file("build/versions/${MC_VERSION}/version.json")
|
||||
useETag 'all'
|
||||
onlyIfModified true
|
||||
quiet true
|
||||
}
|
||||
['client', 'server'].each { id ->
|
||||
task "download${id.capitalize()}Raw"(type: Download, dependsOn: downloadJson) {
|
||||
inputs.file downloadJson.dest
|
||||
src { downloadJson.dest.json.downloads.get(id).url }
|
||||
dest file("build/versions/${MC_VERSION}/${id}.jar")
|
||||
useETag 'all'
|
||||
onlyIfModified true
|
||||
quiet true
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'eclipse'
|
||||
@@ -136,7 +125,7 @@ subprojects {
|
||||
}
|
||||
}
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(16)
|
||||
|
||||
tasks.withType(Javadoc).configureEach {
|
||||
options.tags = [
|
||||
@@ -274,10 +263,10 @@ def sharedDeps = {
|
||||
installer "net.minecraftforge:coremods:${COREMODS_VERSION}"
|
||||
installer "cpw.mods:modlauncher:${MODLAUNCHER_VERSION}"
|
||||
installer 'net.minecraftforge:unsafe:0.2.+'
|
||||
installer 'com.electronwill.night-config:core:3.6.4'
|
||||
installer 'com.electronwill.night-config:toml:3.6.4'
|
||||
installer 'com.electronwill.night-config:core:3.6.3'
|
||||
installer 'com.electronwill.night-config:toml:3.6.3'
|
||||
installer 'org.apache.maven:maven-artifact:3.6.3'
|
||||
installer 'org.apache.commons:commons-lang3:3.12.0'
|
||||
installer 'org.apache.commons:commons-lang3:3.8.1'
|
||||
installer 'net.jodah:typetools:0.8.3'
|
||||
installer 'org.apache.logging.log4j:log4j-api:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version
|
||||
installer 'org.apache.logging.log4j:log4j-core:2.15.0' //TODO: Unpin in 1.18.1 or when Mojang bumps the Log4J version
|
||||
@@ -288,8 +277,8 @@ def sharedDeps = {
|
||||
installer 'net.sf.jopt-simple:jopt-simple:5.0.4'
|
||||
installer "org.spongepowered:mixin:${MIXIN_VERSION}"
|
||||
installer 'org.openjdk.nashorn:nashorn-core:15.3'
|
||||
installer 'com.google.guava:guava:31.0.1-jre'
|
||||
installer 'com.google.code.gson:gson:2.8.8'
|
||||
installer 'com.google.guava:guava:21.0'
|
||||
installer 'com.google.code.gson:gson:2.8.0'
|
||||
|
||||
/*
|
||||
installer 'org.lwjgl:lwjgl:3.2.2'
|
||||
@@ -313,16 +302,18 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
}
|
||||
} else {
|
||||
prj.task([type: RenameJar, dependsOn: prj.tasks.createMcp2Srg], "create${side}SRG") {
|
||||
tool = FART
|
||||
tool = VIGNETTE
|
||||
args = [
|
||||
'--input', '{input}',
|
||||
'--output', '{output}',
|
||||
'--names', '{mappings}',
|
||||
'--ann-fix', '--ids-fix', '--src-fix', '--record-fix'
|
||||
'--jar-in', '{input}',
|
||||
'--jar-out', '{output}',
|
||||
'--mapping-format', 'tsrg2',
|
||||
'--mappings', '{mappings}',
|
||||
// '--stable',
|
||||
'--create-inits', '--fix-param-annotations', '--fernflower-meta'
|
||||
]
|
||||
mappings = prj.tasks.createMcp2Srg.srg
|
||||
input = prj.tasks.getByName("download${side}Slim").output
|
||||
output = prj.file("build/create${side}SRG/output.jar")
|
||||
output = file("build/create${side}SRG/output.jar")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +331,7 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
}
|
||||
|
||||
prj.task([type: DownloadMavenArtifact], 'downloadInstaller') {
|
||||
artifact = "net.minecraftforge:installer:${INSTALLER_VERSION}:shrunk"
|
||||
artifact = "net.minecraftforge:installer:${INSTALLER_VERSION}:fatjar"
|
||||
changing = true
|
||||
}
|
||||
|
||||
@@ -476,6 +467,11 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
}
|
||||
|
||||
def MODULE_PATH = Util.getArtifacts(prj, prj.configurations.moduleonly, false).values().collect{"libraries/${it.downloads.artifact.path}"}
|
||||
def CLASS_PATH = Util.getArtifacts(prj, prj.configurations.installer, false).values().collect{"libraries/${it.downloads.artifact.path}"} +
|
||||
[
|
||||
'libraries/' + Util.getMavenPath(rootProject.tasks.findByPath(':fmlloader:jar')),
|
||||
"libraries/net/minecraft/server/${MC_VERSION}-${MCP_VERSION}/server-${MC_VERSION}-${MCP_VERSION}-extra.jar"
|
||||
]
|
||||
def tokens = [
|
||||
TASK: prj.name.equals('forge') ? 'forgeserver' : 'fmlserver',
|
||||
MAVEN_PATH: prj.ext.MAVEN_PATH.toString(),
|
||||
@@ -486,37 +482,9 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
IGNORE_LIST: Util.getArtifacts(prj, prj.configurations.moduleonly, false).values().collect{it.downloads.artifact.path.rsplit('/', 1)[1]}.join(','),
|
||||
MODULES: 'ALL-MODULE-PATH'
|
||||
]
|
||||
|
||||
prj.task([dependsOn: rootProject.downloadServerRaw], 'makeClasspathFiles') {
|
||||
doLast {
|
||||
def CLASS_PATH = Util.getArtifacts(prj, prj.configurations.installer, false).values().collect{"libraries/${it.downloads.artifact.path}"} +
|
||||
[
|
||||
'libraries/' + Util.getMavenPath(rootProject.tasks.findByPath(':fmlloader:jar')),
|
||||
"libraries/net/minecraft/server/${MC_VERSION}-${MCP_VERSION}/server-${MC_VERSION}-${MCP_VERSION}-extra.jar"
|
||||
]
|
||||
def claimed = CLASS_PATH.collect{ it.rsplit('/', 2)[0] }.toSet() // Allow us to override versions
|
||||
try (def zip = new java.util.zip.ZipFile(rootProject.downloadServerRaw.dest)) {
|
||||
CLASS_PATH += zip.getInputStream(zip.getEntry('META-INF/classpath-joined')).text.split(';')
|
||||
.findAll{ it.startsWith('libraries/') && !claimed.contains(it.rsplit('/', 2)[0]) }
|
||||
}
|
||||
|
||||
configure(prj.installerJar) {
|
||||
from(rootProject.file('server_files/args.txt')) {
|
||||
filter(ReplaceTokens, tokens: tokens + [MODULE_PATH: MODULE_PATH.join(';'), CLASS_PATH: CLASS_PATH.join(';')])
|
||||
rename { 'data/win_args.txt' }
|
||||
}
|
||||
|
||||
from(rootProject.file('server_files/args.txt')) {
|
||||
filter(ReplaceTokens, tokens: tokens + [MODULE_PATH: MODULE_PATH.join(':'), CLASS_PATH: CLASS_PATH.join(':')])
|
||||
rename { 'data/unix_args.txt' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
prj.afterEvaluate {
|
||||
prj.installerJar {
|
||||
dependsOn('makeClasspathFiles')
|
||||
from(rootProject.file('server_files/')) {
|
||||
exclude 'args.txt'
|
||||
filter(ReplaceTokens, tokens: tokens)
|
||||
@@ -524,6 +492,16 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
//rename 'run.sh', "run_forge_${VERSION.replace('-', '_').sh"
|
||||
//rename 'run.bat', "run_forge_${VERSION.replace('-', '_').bat"
|
||||
}
|
||||
|
||||
from(rootProject.file('server_files/args.txt')) {
|
||||
filter(ReplaceTokens, tokens: tokens + [MODULE_PATH: MODULE_PATH.join(';'), CLASS_PATH: CLASS_PATH.join(';')])
|
||||
rename { 'data/win_args.txt' }
|
||||
}
|
||||
|
||||
from(rootProject.file('server_files/args.txt')) {
|
||||
filter(ReplaceTokens, tokens: tokens + [MODULE_PATH: MODULE_PATH.join(':'), CLASS_PATH: CLASS_PATH.join(':')])
|
||||
rename { 'data/unix_args.txt' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -663,10 +641,6 @@ project(':fmlonly') {
|
||||
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]"
|
||||
@@ -727,26 +701,6 @@ project(':fmlonly') {
|
||||
'--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),
|
||||
@@ -776,12 +730,11 @@ project(':fmlonly') {
|
||||
'--classes', '--reverse-right'
|
||||
]
|
||||
], [
|
||||
sides: ['client'],
|
||||
jar: JAR_SPLITTER,
|
||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
||||
args: [
|
||||
'--input', '{MINECRAFT_JAR}',
|
||||
'--slim', '{MC_SLIM}',
|
||||
'--slim', '{MC_SLIM}',
|
||||
'--extra', '{MC_EXTRA}',
|
||||
'--srg', '{MERGED_MAPPINGS}'
|
||||
],
|
||||
@@ -790,27 +743,15 @@ project(':fmlonly') {
|
||||
'{MC_EXTRA}': '{MC_EXTRA_SHA}'
|
||||
]
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: JAR_SPLITTER,
|
||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
||||
jar: VIGNETTE,
|
||||
classpath: getClasspath(project, libs, VIGNETTE),
|
||||
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'
|
||||
'--jar-in', '{MC_SLIM}',
|
||||
'--jar-out', '{MC_SRG}',
|
||||
'--mapping-format', 'tsrg2',
|
||||
'--mappings', '{MERGED_MAPPINGS}',
|
||||
// '--stable',
|
||||
'--create-inits', '--fix-param-annotations', '--fernflower-meta'
|
||||
]/*,
|
||||
outputs: [
|
||||
'{MC_SRG}': '{MC_SRG_SHA}'
|
||||
@@ -898,11 +839,13 @@ project(':forge') {
|
||||
}
|
||||
|
||||
configurations {
|
||||
internalProject
|
||||
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
|
||||
}
|
||||
moduleonly
|
||||
implementation.extendsFrom(internalProject)
|
||||
api.extendsFrom(installer)
|
||||
}
|
||||
|
||||
@@ -911,10 +854,10 @@ project(':forge') {
|
||||
testImplementation 'org.junit.vintage:junit-vintage-engine:5.+'
|
||||
testImplementation 'org.opentest4j:opentest4j:1.2.0' // needed for junit 5
|
||||
testImplementation 'org.hamcrest:hamcrest-all:1.3' // needs advanced matching for list order
|
||||
implementation project(':fmlcore')
|
||||
implementation project(':fmlloader')
|
||||
implementation project(':javafmllanguage')
|
||||
implementation project(':mclanguage')
|
||||
internalProject project(':fmlcore')
|
||||
internalProject project(':fmlloader')
|
||||
internalProject project(':javafmllanguage')
|
||||
internalProject project(':mclanguage')
|
||||
}
|
||||
dependencies sharedDeps
|
||||
|
||||
@@ -1075,9 +1018,12 @@ project(':forge') {
|
||||
]
|
||||
}
|
||||
|
||||
task crowdin(type: Crowdin) {
|
||||
key = project.hasProperty('crowdinKey') ? project.crowdinKey : null
|
||||
//TODO: Merge our english.json?
|
||||
tasks.register('downloadCrowdin', Download) {
|
||||
src 'https://files.minecraftforge.net/crowdin.zip'
|
||||
dest file('build/crowdin.zip')
|
||||
useETag 'all'
|
||||
onlyIfModified true
|
||||
quiet true
|
||||
}
|
||||
|
||||
sharedFmlonlyForge.call(project)
|
||||
@@ -1089,6 +1035,7 @@ project(':forge') {
|
||||
|
||||
task extractInheritance(type: ExtractInheritance, dependsOn: [genJoinedBinPatches, downloadLibraries]) {
|
||||
tool = INSTALLER_TOOLS + ':fatjar'
|
||||
args.add '--annotations'
|
||||
input = genJoinedBinPatches.cleanJar
|
||||
libraries.addAll downloadLibraries.librariesOutput.map { rf -> Files.readAllLines(rf.asFile.toPath()).stream().map(File::new).collect(java.util.stream.Collectors.toList()) }
|
||||
}
|
||||
@@ -1112,40 +1059,101 @@ project(':forge') {
|
||||
}
|
||||
}
|
||||
|
||||
task checkATs(type: CheckATs, dependsOn: [extractInheritance, createSrg2Mcp]) {
|
||||
inheritance = extractInheritance.output
|
||||
tasks.register('checkAll') {
|
||||
dependsOn 'checkLicenses'
|
||||
group = 'checks'
|
||||
}
|
||||
tasks.register('checkAllAndFix') {
|
||||
dependsOn 'findFieldInstanceChecks', 'checkLicenses'
|
||||
group = 'checks'
|
||||
}
|
||||
|
||||
CheckTask.registerTask(tasks, 'ATs', CheckATs) {
|
||||
dependsOn extractInheritance, createSrg2Mcp
|
||||
ats.from patcher.accessTransformers
|
||||
inheritance = extractInheritance.output
|
||||
mappings = createSrg2Mcp.output
|
||||
}
|
||||
|
||||
task checkSAS(type: CheckSAS, dependsOn: extractInheritance) {
|
||||
inheritance = extractInheritance.output
|
||||
CheckTask.registerTask(tasks, 'SAS', CheckSAS) {
|
||||
dependsOn extractInheritance
|
||||
sass.from patcher.sideAnnotationStrippers
|
||||
inheritance = extractInheritance.output
|
||||
}
|
||||
|
||||
task checkExcs(type: CheckExcs, dependsOn: jar) {
|
||||
CheckTask.registerTask(tasks, 'Excs', CheckExcs) {
|
||||
dependsOn jar
|
||||
binary = jar.archiveFile.get().asFile
|
||||
excs.from patcher.excs
|
||||
}
|
||||
|
||||
task checkAll(dependsOn: [checkATs, checkSAS, checkExcs, findFieldInstanceChecks]){}
|
||||
|
||||
task checkPatchesAndFix(type: CheckPatches, dependsOn: genPatches) {
|
||||
CheckTask.registerTask(tasks, 'Patches', CheckPatches) {
|
||||
dependsOn genPatches
|
||||
patchDir = file("$rootDir/patches")
|
||||
autoFix = true
|
||||
}
|
||||
|
||||
task checkPatches(type: CheckPatches, dependsOn: genPatches) {
|
||||
patchDir = file("$rootDir/patches")
|
||||
autoFix = false
|
||||
patchesWithS2SArtifact = [
|
||||
'minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch',
|
||||
'minecraft/net/minecraft/data/BlockModelDefinition.java.patch',
|
||||
]
|
||||
}
|
||||
|
||||
genPatches {
|
||||
finalizedBy checkPatches
|
||||
finalizedBy checkAndFixPatches
|
||||
autoHeader true
|
||||
lineEnding = '\n'
|
||||
}
|
||||
|
||||
def baseForgeVersionProperty = project.objects.property(String)
|
||||
baseForgeVersionProperty.set(project.provider { getLatestForgeVersion(MC_VERSION) }.map { MC_VERSION + '-' + it })
|
||||
baseForgeVersionProperty.finalizeValueOnRead()
|
||||
def jarCompatibilityTaskSetup = { task ->
|
||||
task.group = 'jar compatibility'
|
||||
task.onlyIf {
|
||||
baseForgeVersionProperty.getOrNull() != null
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('setupCheckJarCompatibility', SetupCheckJarCompatibility) {
|
||||
inputVersion = baseForgeVersionProperty
|
||||
}
|
||||
|
||||
tasks.register('applyBaseCompatibilityJarBinPatches', ApplyBinPatches) {
|
||||
jarCompatibilityTaskSetup(it)
|
||||
|
||||
clean = project.tasks.createJoinedSRG.output
|
||||
patch = project.tasks.named('setupCheckJarCompatibility').flatMap { it.baseBinPatchesOutput }
|
||||
output = project.layout.buildDirectory.dir(name).map { it.file('output.jar') }
|
||||
}
|
||||
|
||||
tasks.register('mergeBaseForgeJar', MergeJars) {
|
||||
jarCompatibilityTaskSetup(it)
|
||||
|
||||
inputJars.from(project.tasks.named('applyBaseCompatibilityJarBinPatches').flatMap { it.output })
|
||||
inputJars.from(baseForgeVersionProperty.map { inputVersion ->
|
||||
def output = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-universal.jar") }.get().asFile
|
||||
project.rootProject.extensions.download.run {
|
||||
src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-universal.jar"
|
||||
dest output
|
||||
}
|
||||
return output
|
||||
})
|
||||
}
|
||||
|
||||
tasks.register('checkJarCompatibility', CheckJarCompatibility) {
|
||||
jarCompatibilityTaskSetup(it)
|
||||
dependsOn 'setupCheckJarCompatibility'
|
||||
|
||||
baseJar = project.tasks.named('mergeBaseForgeJar').flatMap { it.output }
|
||||
baseLibraries.from(project.tasks.named('createJoinedSRG').flatMap { it.output })
|
||||
|
||||
inputJar = project.tasks.named('reobfJar').flatMap { it.output }
|
||||
|
||||
commonLibraries.from(configurations.minecraftImplementation)
|
||||
commonLibraries.from(configurations.installer)
|
||||
commonLibraries.from(configurations.moduleonly)
|
||||
commonLibraries.from(configurations.internalProject)
|
||||
}
|
||||
|
||||
|
||||
task launcherJson(type: LauncherJson) {
|
||||
packedDependencies = [':fmlloader:jar']
|
||||
doFirst {
|
||||
@@ -1216,10 +1224,6 @@ project(':forge') {
|
||||
client: '/data/client.lzma',
|
||||
server: '/data/server.lzma'
|
||||
],
|
||||
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]"
|
||||
@@ -1288,26 +1292,6 @@ project(':forge') {
|
||||
'--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),
|
||||
@@ -1337,7 +1321,6 @@ project(':forge') {
|
||||
'--classes', '--reverse-right'
|
||||
]
|
||||
], [
|
||||
sides: ['client'],
|
||||
jar: JAR_SPLITTER,
|
||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
||||
args: [
|
||||
@@ -1351,27 +1334,15 @@ project(':forge') {
|
||||
'{MC_EXTRA}': '{MC_EXTRA_SHA}'
|
||||
]
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: JAR_SPLITTER,
|
||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
||||
jar: VIGNETTE,
|
||||
classpath: getClasspath(project, libs, VIGNETTE),
|
||||
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'
|
||||
'--jar-in', '{MC_SLIM}',
|
||||
'--jar-out', '{MC_SRG}',
|
||||
'--mapping-format', 'tsrg2',
|
||||
'--mappings', '{MERGED_MAPPINGS}',
|
||||
// '--stable',
|
||||
'--create-inits', '--fix-param-annotations', '--fernflower-meta'
|
||||
]/*,
|
||||
outputs: [
|
||||
'{MC_SRG}': '{MC_SRG_SHA}'
|
||||
@@ -1400,9 +1371,12 @@ project(':forge') {
|
||||
from extraTxts
|
||||
|
||||
// add crowdin locales
|
||||
from { crowdin.output.present && crowdin.output.get().asFile.exists() ? zipTree(crowdin.output) : null}
|
||||
dependsOn crowdin
|
||||
duplicatesStrategy = 'exclude'
|
||||
from zipTree(downloadCrowdin.dest).matching {
|
||||
include 'assets/forge/lang/*.json'
|
||||
}
|
||||
|
||||
dependsOn downloadCrowdin
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
doFirst {
|
||||
MANIFESTS.each{ pkg, values ->
|
||||
@@ -1454,7 +1428,7 @@ project(':forge') {
|
||||
MAPPING_CHANNEL: MAPPING_CHANNEL,
|
||||
MAPPING_VERSION: MAPPING_VERSION,
|
||||
FORGE_SPEC_VERSION: SPEC_VERSION.split("\\.")[0],
|
||||
MC_NEXT_VERSION: "1."+((MC_VERSION.split("[\\.-]")[1] as int)+1)
|
||||
MC_NEXT_VERSION: "1."+((MC_VERSION.split("\\.")[1] as int)+1)
|
||||
])
|
||||
rename 'gitignore\\.txt', '.gitignore'
|
||||
rename 'gitattributes\\.txt', '.gitattributes'
|
||||
@@ -1488,8 +1462,7 @@ project(':forge') {
|
||||
}
|
||||
|
||||
reobfJar {
|
||||
tool = FART
|
||||
args = ['--input', '{input}', '--output', '{output}', '--map', '{srg}']
|
||||
tool = SPECIAL_SOURCE + ':shaded'
|
||||
}
|
||||
|
||||
tasks.eclipse.dependsOn('genEclipseRuns')
|
||||
|
||||
@@ -6,4 +6,6 @@ dependencies {
|
||||
implementation 'org.ow2.asm:asm:9.1'
|
||||
implementation 'org.ow2.asm:asm-tree:9.1'
|
||||
implementation 'net.minecraftforge:srgutils:0.4.+'
|
||||
implementation 'commons-io:commons-io:2.8.0'
|
||||
implementation 'com.google.code.gson:gson:2.10'
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.TupleConstructor
|
||||
|
||||
@CompileStatic
|
||||
@TupleConstructor
|
||||
final class InheritanceData implements Annotatable {
|
||||
String name
|
||||
int access
|
||||
String superName
|
||||
List<String> interfaces = []
|
||||
Map<String, Method> methods = [:]
|
||||
Map<String, Field> fields = [:]
|
||||
List<Annotation> annotations = []
|
||||
|
||||
@TupleConstructor
|
||||
static final class Method implements Annotatable {
|
||||
int access
|
||||
String override
|
||||
List<Annotation> annotations = []
|
||||
}
|
||||
|
||||
@TupleConstructor
|
||||
static final class Field implements Annotatable {
|
||||
int access
|
||||
String desc
|
||||
List<Annotation> annotations = []
|
||||
}
|
||||
|
||||
@TupleConstructor
|
||||
static final class Annotation {
|
||||
String desc
|
||||
}
|
||||
|
||||
private static final Gson GSON = new Gson()
|
||||
static Map<String, InheritanceData> parse(File file) {
|
||||
try (final reader = file.newReader()) {
|
||||
return GSON.fromJson(reader, new TypeToken<Map<String, InheritanceData>>() {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@CompileStatic
|
||||
interface Annotatable {
|
||||
List<InheritanceData.Annotation> getAnnotations()
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.apache.commons.io.IOUtils
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
import java.util.zip.ZipOutputStream
|
||||
|
||||
abstract class MergeJars extends DefaultTask {
|
||||
MergeJars() {
|
||||
output.convention(project.layout.buildDirectory.dir(name).map { it.file('output.jar') })
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
void run() {
|
||||
def jars = inputJars.files
|
||||
|
||||
try (ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(output.get().asFile))) {
|
||||
for (def jar : jars) {
|
||||
try (ZipInputStream zin = new ZipInputStream(new FileInputStream(jar))) {
|
||||
def entry
|
||||
while ((entry = zin.getNextEntry()) != null) {
|
||||
ZipEntry _new = new ZipEntry(entry.getName())
|
||||
_new.setTime(0) //SHOULD be the same time as the main entry, but NOOOO _new.setTime(entry.getTime()) throws DateTimeException, so you get 0, screw you!
|
||||
zout.putNextEntry(_new)
|
||||
IOUtils.copy(zin, zout)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@InputFiles
|
||||
abstract ConfigurableFileCollection getInputJars()
|
||||
|
||||
@OutputFile
|
||||
abstract RegularFileProperty getOutput()
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.StandardCopyOption
|
||||
|
||||
abstract class SetupCheckJarCompatibility extends DefaultTask {
|
||||
SetupCheckJarCompatibility() {
|
||||
group = 'jar compatibility'
|
||||
onlyIf {
|
||||
inputVersion.getOrNull() != null
|
||||
}
|
||||
outputs.upToDateWhen { false } // Never up to date, because this setup task should always run
|
||||
|
||||
baseBinPatchesOutput.convention(project.layout.buildDirectory.dir(name).map { it.file('joined.lzma') })
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
void run() {
|
||||
def inputVersion = inputVersion.get()
|
||||
|
||||
def baseForgeUserdev = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-userdev.jar") }.get().asFile
|
||||
project.rootProject.extensions.download.run {
|
||||
src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-userdev.jar"
|
||||
dest baseForgeUserdev
|
||||
}
|
||||
|
||||
def joinedLzma = project.zipTree(baseForgeUserdev).matching { it.include('joined.lzma') }.singleFile
|
||||
|
||||
Files.copy(joinedLzma.toPath(), baseBinPatchesOutput.get().asFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
|
||||
}
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
abstract Property<String> getInputVersion()
|
||||
|
||||
@OutputFile
|
||||
abstract RegularFileProperty getBaseBinPatchesOutput()
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package net.minecraftforge.forge.tasks
|
||||
|
||||
import groovy.json.JsonBuilder
|
||||
import groovy.json.JsonSlurper
|
||||
|
||||
import java.io.File
|
||||
@@ -17,11 +16,8 @@ public class Util {
|
||||
}
|
||||
return md.digest().collect {String.format "%02x", it}.join()
|
||||
}
|
||||
File.metaClass.getSha1 = { !delegate.exists() ? null : delegate.sha1() }
|
||||
|
||||
File.metaClass.json = { -> new JsonSlurper().parseText(delegate.text) }
|
||||
File.metaClass.getJson = { return delegate.exists() ? new JsonSlurper().parse(delegate) : [:] }
|
||||
File.metaClass.setJson = { json -> delegate.text = new JsonBuilder(json).toPrettyString() }
|
||||
|
||||
Date.metaClass.iso8601 = { ->
|
||||
def format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
@@ -142,4 +138,9 @@ public class Util {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
public static String getLatestForgeVersion(mcVersion) {
|
||||
def json = new JsonSlurper().parseText(new URL("https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json").getText("UTF-8"))
|
||||
return json.promos["$mcVersion-latest"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,310 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import groovy.transform.TupleConstructor
|
||||
import net.minecraftforge.forge.tasks.InheritanceData
|
||||
import net.minecraftforge.srgutils.IMappingFile
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFile
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.objectweb.asm.Opcodes
|
||||
|
||||
@CompileStatic
|
||||
abstract class CheckATs extends CheckTask {
|
||||
|
||||
@InputFile abstract RegularFileProperty getInheritance()
|
||||
@InputFiles abstract ConfigurableFileCollection getAts()
|
||||
@InputFile @Optional abstract RegularFileProperty getMappings()
|
||||
|
||||
@Override
|
||||
void check(Reporter reporter, boolean fix) {
|
||||
final IMappingFile mappings = mappings.map { RegularFile it -> IMappingFile.load(it.asFile) }.getOrNull()
|
||||
final inheritance = InheritanceData.parse(this.inheritance.get().asFile)
|
||||
|
||||
ats.each {
|
||||
final lines = process(it, reporter, inheritance)
|
||||
if (fix) {
|
||||
it.text = joinBack(lines, inheritance, mappings).join('\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static TreeMap<String, ATParser.Entry> process(File file, Reporter reporter, Map<String, InheritanceData> inheritance) {
|
||||
final TreeMap<String, ATParser.Entry> lines = ATParser.parse(file.readLines(), reporter)
|
||||
final Map<String, ATParser.Entry> constructorGroups = [:]
|
||||
|
||||
final itr = lines.entrySet().iterator()
|
||||
final toRemove = []
|
||||
while (itr.hasNext()) {
|
||||
final next = itr.next()
|
||||
String key = next.key
|
||||
final entry = next.value
|
||||
if (entry === null) continue
|
||||
|
||||
final binaryName = entry.cls.replaceAll('\\.', '/')
|
||||
|
||||
// Process Groups, this will remove any entries outside the group that is covered by the group
|
||||
if (entry.group) {
|
||||
final jcls = inheritance[binaryName]
|
||||
if (jcls === null) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid group: $key")
|
||||
} else if ('*' == entry.desc) {
|
||||
if (!jcls.fields) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid group, class has no fields: $key")
|
||||
} else {
|
||||
jcls.fields.each { field, value ->
|
||||
final fkey = entry.cls + ' ' + field
|
||||
if (accessLevel(value.access) < accessStr(entry.modifier)) {
|
||||
if (lines.containsKey(fkey)) {
|
||||
toRemove.add(fkey)
|
||||
} else if (!entry.existing.contains(fkey)) {
|
||||
reporter.report("Missing group entry: $fkey")
|
||||
}
|
||||
entry.children.add(fkey)
|
||||
} else if (lines.containsKey(fkey)) {
|
||||
toRemove.add(fkey)
|
||||
reporter.report("Found invalid group entry: $fkey")
|
||||
}
|
||||
}
|
||||
entry.existing.findAll { it !in entry.children }.each { println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('*()' == entry.desc) {
|
||||
if (!jcls.methods) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid group, class has no methods: $key")
|
||||
} else {
|
||||
jcls.methods.each { mtd, value ->
|
||||
if (mtd.startsWith('<clinit>') || mtd.startsWith('lambda$')) return
|
||||
key = entry.cls + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel(value.access) < accessStr(entry.modifier)) {
|
||||
if (lines.containsKey(key)) {
|
||||
toRemove.add(key)
|
||||
} else if (!entry.existing.contains(key)) {
|
||||
reporter.report("Missing group entry: $key")
|
||||
}
|
||||
entry.children.add(key)
|
||||
} else if (lines.containsKey(key)) {
|
||||
toRemove.add(key)
|
||||
reporter.report("Found invalid group entry: $key")
|
||||
}
|
||||
}
|
||||
entry.existing.findAll { it !in entry.children }.each { println('Removed: ' + it) }
|
||||
}
|
||||
} else if ('<init>' == entry.desc) { //Make all public non-abstract subclasses
|
||||
constructorGroups.put(binaryName, entry)
|
||||
}
|
||||
}
|
||||
|
||||
// Process normal lines, remove invalid and remove narrowing
|
||||
else {
|
||||
def jcls = inheritance.get(binaryName)
|
||||
if (jcls === null) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid: $key")
|
||||
} else if (entry.desc == '') {
|
||||
if (accessLevel(jcls.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid Narrowing: $key")
|
||||
}
|
||||
} else if (!entry.desc.contains('(')) {
|
||||
if (!jcls.fields || !jcls.fields.containsKey(entry.desc)) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid: $key")
|
||||
} else {
|
||||
final value = jcls.fields[entry.desc]
|
||||
if (accessLevel(value.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid Narrowing: $key - ${entry.comment}")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
final jdesc = entry.desc.replace('(', ' (')
|
||||
if (!jcls.methods || !jcls.methods.containsKey(jdesc)) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid: $key")
|
||||
} else {
|
||||
final value = jcls.methods[jdesc]
|
||||
if (accessLevel(value.access) > accessStr(entry.modifier) && (entry.comment === null || !entry.comment.startsWith('#force '))) {
|
||||
itr.remove()
|
||||
reporter.report("Invalid Narrowing: $key")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inheritance.each { tcls, value ->
|
||||
if (!value.methods || ((value.access & Opcodes.ACC_ABSTRACT) !== 0)) return
|
||||
String parent = tcls
|
||||
while (parent !== null) {
|
||||
constructorGroups[parent]?.tap { entry ->
|
||||
value.methods.each { mtd, v ->
|
||||
if (mtd.startsWith('<init>')) {
|
||||
final child = tcls.replaceAll('/', '\\.') + ' ' + mtd.replace(' ', '')
|
||||
if (accessLevel(v.access) < 3) {
|
||||
if (lines.containsKey(child)) {
|
||||
toRemove.add(child)
|
||||
} else if (child !in entry.existing) {
|
||||
reporter.report("Missing group entry: $child")
|
||||
}
|
||||
entry.children.add(child)
|
||||
} else if (lines.containsKey(child)) {
|
||||
toRemove.add(child)
|
||||
reporter.report("Found invalid group entry: $child")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
parent = inheritance[parent]?.superName
|
||||
}
|
||||
}
|
||||
constructorGroups.values().each { entry -> entry.existing.findAll { it !in entry.children }.each{ reporter.report("Found invalid group entry: $it") } }
|
||||
|
||||
toRemove.each(lines.&remove)
|
||||
|
||||
return lines
|
||||
}
|
||||
|
||||
private static List<String> joinBack(TreeMap<String, ATParser.Entry> lines, Map<String, InheritanceData> inheritance, IMappingFile mappings) {
|
||||
final data = []
|
||||
final remapComment = { ATParser.Entry entry ->
|
||||
if (!mappings || !entry || !entry.desc) return null
|
||||
final comment = entry.comment?.substring(1)?.trim()
|
||||
final jsonCls = inheritance.get(entry.cls.replaceAll('\\.', '/'))
|
||||
final mappingsClass = mappings?.getClass(jsonCls.name)
|
||||
if (mappingsClass === null) return entry.comment
|
||||
final idx = entry.desc.indexOf('(')
|
||||
|
||||
String mappedName = idx == -1
|
||||
? mappingsClass.remapField(entry.desc)
|
||||
: mappingsClass.remapMethod(entry.desc.substring(0, idx), entry.desc.substring(idx))
|
||||
if (!mappedName) return entry.comment
|
||||
if (mappedName == '<init>')
|
||||
mappedName = 'constructor'
|
||||
|
||||
if (comment?.startsWith(mappedName))
|
||||
return '# ' + comment
|
||||
if (comment && comment.indexOf(' ') !== -1) {
|
||||
def split = comment.split(' - ').toList()
|
||||
if (split[0].indexOf(' ') !== -1)
|
||||
// The first string is more than one word, so append before it
|
||||
return "# ${mappedName} - ${comment}"
|
||||
split.remove(0)
|
||||
return "# ${mappedName} - ${String.join(' - ', split)}"
|
||||
}
|
||||
return '# ' + mappedName
|
||||
}
|
||||
lines.each { key, value ->
|
||||
if (!value.group) {
|
||||
def comment = remapComment.call(value)
|
||||
data.add(value.modifier + ' ' + key + (comment ? ' ' + comment : ''))
|
||||
} else {
|
||||
data.add(('#group ' + value.modifier + ' ' + key + ' ' + (value.comment ?: '')).trim())
|
||||
value.children.each {
|
||||
final line = value.modifier + ' ' + it
|
||||
final entry = ATParser.parseEntry(line)
|
||||
final comment = remapComment(entry)
|
||||
data.add(line + (comment ? ' ' + comment : ''))
|
||||
}
|
||||
data.add('#endgroup')
|
||||
}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
static int accessStr(String access) {
|
||||
if (access.endsWith('-f') || access.endsWith('+f')) return 4
|
||||
switch (access.toLowerCase()) {
|
||||
case 'public': return 3
|
||||
case 'protected': return 2
|
||||
case 'default': return 1
|
||||
case 'private': return 0
|
||||
default: return -1
|
||||
}
|
||||
}
|
||||
|
||||
static int accessLevel(int access) {
|
||||
if ((access & Opcodes.ACC_PUBLIC) !== 0) return 3
|
||||
if ((access & Opcodes.ACC_PROTECTED) !== 0) return 2
|
||||
if ((access & Opcodes.ACC_PRIVATE) !== 0) return 0
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
@CompileStatic
|
||||
class ATParser {
|
||||
static TreeMap<String, Entry> parse(List<String> lines, CheckTask.Reporter reporter) {
|
||||
TreeMap<String, Entry> outLines = new TreeMap<>()
|
||||
Entry group = null
|
||||
for (final line : lines) {
|
||||
if (line.isEmpty()) continue
|
||||
if (line.startsWith('#group ')) {
|
||||
final entry = parseEntry(line.substring(7))
|
||||
|
||||
if (entry.desc != '*' && entry.desc != '*()' && entry.desc != '<init>') {
|
||||
reporter.report("Invalid group: $line", false)
|
||||
}
|
||||
|
||||
entry.group = true
|
||||
entry.children = []
|
||||
entry.existing = []
|
||||
|
||||
group = entry
|
||||
|
||||
if (outLines.containsKey(entry.key)) {
|
||||
reporter.report("Duplicate group: $line", false)
|
||||
}
|
||||
|
||||
outLines[entry.key] = group
|
||||
} else if (group !== null) {
|
||||
if (line.startsWith('#endgroup')) {
|
||||
group = null
|
||||
} else {
|
||||
final key = parseEntry(line).key
|
||||
group.existing.add(key)
|
||||
}
|
||||
} else if (line.startsWith('#endgroup')) {
|
||||
reporter.report("Invalid group ending: $line", false)
|
||||
} else if (line.startsWith('#')) {
|
||||
//Nom
|
||||
} else {
|
||||
final entry = parseEntry(line)
|
||||
if (outLines.containsKey(entry.key)) {
|
||||
reporter.report("Found duplicate: $line")
|
||||
continue
|
||||
}
|
||||
outLines[entry.key] = entry
|
||||
}
|
||||
}
|
||||
return outLines
|
||||
}
|
||||
|
||||
static Entry parseEntry(String line) {
|
||||
final idx = line.indexOf('#')
|
||||
final String comment = idx === -1 ? null : line.substring(idx)
|
||||
if (idx !== -1) line = line.substring(0, idx - 1)
|
||||
final data = (line.trim() + ' ').split(' ', -1)
|
||||
new Entry(data[0], data[1], data[2], comment)
|
||||
}
|
||||
|
||||
@TupleConstructor
|
||||
static final class Entry {
|
||||
String modifier, cls, desc, comment
|
||||
|
||||
Set<String> existing
|
||||
TreeSet<String> children
|
||||
boolean group = false
|
||||
|
||||
@Lazy
|
||||
String key = {cls + (desc.isEmpty() ? '' : ' ' + desc)}()
|
||||
|
||||
Object getAt(String key) {
|
||||
return getProperty(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.objectweb.asm.ClassReader
|
||||
import org.objectweb.asm.ClassVisitor
|
||||
import org.objectweb.asm.MethodVisitor
|
||||
import org.objectweb.asm.Opcodes
|
||||
import org.objectweb.asm.Type
|
||||
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipInputStream
|
||||
|
||||
abstract class CheckExcs extends CheckTask {
|
||||
|
||||
@InputFile abstract RegularFileProperty getBinary()
|
||||
@InputFiles abstract ConfigurableFileCollection getExcs()
|
||||
|
||||
@Override
|
||||
void check(Reporter reporter, boolean fix) {
|
||||
final Set<String> known = []
|
||||
collectKnown(known)
|
||||
|
||||
excs.each { f ->
|
||||
final lines = []
|
||||
f.eachLine { line ->
|
||||
def idx = line.indexOf('#')
|
||||
if (idx == 0 || line.isEmpty()) {
|
||||
return
|
||||
}
|
||||
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
|
||||
if (!line.contains('=')) {
|
||||
reporter.report("Invalid: $line")
|
||||
return
|
||||
}
|
||||
|
||||
def (String key, String value) = line.split('=', 2)
|
||||
if (!known.contains(key)) {
|
||||
reporter.report("Unknown: $line")
|
||||
return
|
||||
}
|
||||
|
||||
String desc = key.split('\\.', 2)[1]
|
||||
if (!desc.contains('(')) {
|
||||
reporter.report("Invalid: $line")
|
||||
return
|
||||
}
|
||||
desc = '(' + desc.split('\\(', 2)[1]
|
||||
|
||||
def (exceptions, String args) = value.contains('|') ? value.split('|', 2) : [value, '']
|
||||
|
||||
if (args.split(',').length !== Type.getArgumentTypes(desc).length) {
|
||||
reporter.report("Invalid: $line")
|
||||
return
|
||||
}
|
||||
lines.add(line)
|
||||
}
|
||||
|
||||
if (fix) f.text = lines.sort().join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
private void collectKnown(Collection<String> known) {
|
||||
binary.get().asFile.withInputStream { i ->
|
||||
new ZipInputStream(i).withCloseable { zin ->
|
||||
final visitor = new ClassVisitor(Opcodes.ASM9) {
|
||||
private String cls
|
||||
@Override
|
||||
void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
|
||||
this.cls = name
|
||||
}
|
||||
|
||||
@Override
|
||||
MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
|
||||
known.add(this.cls + '.' + name + descriptor)
|
||||
super.visitMethod(access, name, descriptor, signature, exceptions)
|
||||
}
|
||||
}
|
||||
ZipEntry zein
|
||||
while ((zein = zin.nextEntry) !== null) {
|
||||
if (zein.name.endsWith('.class')) {
|
||||
ClassReader reader = new ClassReader(zin)
|
||||
reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
@CompileStatic
|
||||
enum CheckMode {
|
||||
CHECK,
|
||||
FIX
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputDirectory
|
||||
import org.gradle.api.tasks.Optional
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.util.regex.Pattern
|
||||
|
||||
@CompileStatic
|
||||
abstract class CheckPatches extends CheckTask {
|
||||
|
||||
private static final Pattern HUNK_START_PATTERN = Pattern.compile('^@@ -[0-9,]* \\+[0-9,_]* @@$')
|
||||
private static final Pattern WHITESPACE_PATTERN = Pattern.compile('^[+\\-]\\s*$')
|
||||
private static final Pattern IMPORT_PATTERN = Pattern.compile('^[+\\-]\\s*import.*')
|
||||
private static final Pattern FIELD_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^=;]*)(=.*)?;\\s*$')
|
||||
private static final Pattern METHOD_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final)?([^(]*)[(]([^)]*)?[)]\\s*[{]\\s*$')
|
||||
private static final Pattern CLASS_PATTERN = Pattern.compile('^[+\\-][\\s]*((public|protected|private)[\\s]*)?(static[\\s]*)?(final[\\s]*)?(class|interface)([^{]*)[{]\\s*$')
|
||||
private static final Map<String, Integer> ACCESS_MAP = [private: 0, protected: 2, public: 3].tap { it.put(null, 1) }
|
||||
|
||||
@InputDirectory abstract DirectoryProperty getPatchDir()
|
||||
@Input @Optional abstract ListProperty<String> getPatchesWithS2SArtifact()
|
||||
|
||||
@Override
|
||||
void check(Reporter reporter, boolean fix) {
|
||||
final patchDir = getPatchDir().get().asFile.toPath()
|
||||
Files.walk(patchDir).withCloseable {
|
||||
it.filter(Files.&isRegularFile).forEach { path ->
|
||||
final String relativeName = patchDir.relativize(path).toString()
|
||||
verifyPatch(path, reporter, fix, relativeName, patchesWithS2SArtifact.get().contains(relativeName.replace('\\', '/')))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void verifyPatch(Path patch, Reporter reporter, boolean fix, String patchPath, boolean hasS2SArtifact) {
|
||||
final oldFixedErrors = reporter.fixed.size()
|
||||
|
||||
final lines = Files.readAllLines(patch)
|
||||
|
||||
int hunksStart = 0
|
||||
boolean onlyWhiteSpace = false
|
||||
|
||||
final List<String> newLines = []
|
||||
|
||||
// First two lines are file name ++/-- and we do not care
|
||||
newLines.add(lines[0] + '\n')
|
||||
newLines.add(lines[1] + '\n')
|
||||
|
||||
int i
|
||||
for (i = 2; i < lines.size(); ++i) {
|
||||
def line = lines[i]
|
||||
newLines.add(line + '\n')
|
||||
|
||||
if (HUNK_START_PATTERN.matcher(line).find()) {
|
||||
if (onlyWhiteSpace) {
|
||||
if (!hasS2SArtifact)
|
||||
reporter.report("Patch contains only white space hunk starting at line ${hunksStart + 1}, file: $patchPath")
|
||||
int toRemove = i - hunksStart
|
||||
while (toRemove-- > 0)
|
||||
newLines.remove(newLines.size() - 1)
|
||||
}
|
||||
hunksStart = i
|
||||
onlyWhiteSpace = true
|
||||
continue
|
||||
}
|
||||
|
||||
if (line.startsWithAny('+','-')) {
|
||||
def prefixChange = false
|
||||
def prevLine = lines[i - 1]
|
||||
|
||||
if (line.charAt(0) == (char)'+' && prevLine.charAt(0) == (char)'-') {
|
||||
def prevTrim = prevLine.substring(1).replaceAll("\\s", "")
|
||||
def currTrim = line.substring(1).replaceAll("\\s", "")
|
||||
|
||||
if (prevTrim == currTrim) {
|
||||
prefixChange = true
|
||||
}
|
||||
|
||||
def pMatcher = FIELD_PATTERN.matcher(prevLine)
|
||||
def cMatcher = FIELD_PATTERN.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // = ...
|
||||
pMatcher.group(5) == cMatcher.group(5) && // field name
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
|
||||
pMatcher = METHOD_PATTERN.matcher(prevLine)
|
||||
cMatcher = METHOD_PATTERN.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // params
|
||||
pMatcher.group(5) == cMatcher.group(5) && // <T> void name
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
|
||||
pMatcher = CLASS_PATTERN.matcher(prevLine)
|
||||
cMatcher = CLASS_PATTERN.matcher(line)
|
||||
|
||||
if (pMatcher.find() && cMatcher.find() &&
|
||||
pMatcher.group(6) == cMatcher.group(6) && // ClassName<> extends ...
|
||||
pMatcher.group(5) == cMatcher.group(5) && // class | interface
|
||||
pMatcher.group(3) == cMatcher.group(3) && // static
|
||||
(ACCESS_MAP[pMatcher.group(2)] < ACCESS_MAP[cMatcher.group(2)] || pMatcher.group(4) != cMatcher.group(4))) {
|
||||
reporter.report("Patch contains access changes or final removal at line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
}
|
||||
|
||||
if (line.charAt(0) == (char)'-' && i + 1 < lines.size()) {
|
||||
final nextLine = lines[i + 1]
|
||||
if (nextLine.charAt(0) == (char)'+') {
|
||||
final nextTrim = nextLine.substring(1).replaceAll("\\s", "")
|
||||
final currTrim = line.substring(1).replaceAll("\\s", "")
|
||||
|
||||
if (nextTrim == currTrim) {
|
||||
prefixChange = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final isWhiteSpaceChange = WHITESPACE_PATTERN.matcher(line).find()
|
||||
|
||||
if (!prefixChange && !isWhiteSpaceChange) {
|
||||
onlyWhiteSpace = hasS2SArtifact && IMPORT_PATTERN.matcher(line).find()
|
||||
} else if (isWhiteSpaceChange) {
|
||||
final prevLineChange = prevLine.startsWithAny('+','-')
|
||||
final nextLineChange = i + 1 < lines.size() && lines[i + 1].startsWithAny('+','-')
|
||||
|
||||
if (!prevLineChange && !nextLineChange) {
|
||||
reporter.report("Patch contains white space change in valid hunk at line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
}
|
||||
|
||||
if (line.contains('\t')) {
|
||||
reporter.report("Patch contains tabs on line ${i + 1}, file: $patchPath")
|
||||
line = line.replaceAll('\t', ' ')
|
||||
newLines.remove(newLines.size() - 1)
|
||||
newLines.add(line + '\n')
|
||||
}
|
||||
|
||||
if (IMPORT_PATTERN.matcher(line).find() && !hasS2SArtifact) {
|
||||
reporter.report("Patch contains import change on line ${i + 1}, file: $patchPath", false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (onlyWhiteSpace) {
|
||||
if (!hasS2SArtifact)
|
||||
reporter.report("Patch contains only white space hunk starting at line ${hunksStart + 1}, file: $patchPath")
|
||||
def toRemove = i - hunksStart;
|
||||
while (toRemove-- > 0)
|
||||
newLines.remove(newLines.size() - 1)
|
||||
}
|
||||
|
||||
if ((reporter.fixed.size() > oldFixedErrors && fix) || hasS2SArtifact) {
|
||||
if (newLines.size() <= 2) {
|
||||
logger.lifecycle("Patch is now empty removing, file: {}", patchPath)
|
||||
Files.delete(patch)
|
||||
}
|
||||
else {
|
||||
if (!hasS2SArtifact)
|
||||
logger.lifecycle("*** Updating patch file. Please run setup then genPatches again. ***")
|
||||
Files.newBufferedWriter(patch).withCloseable {
|
||||
newLines.each { l -> it.write(l) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import net.minecraftforge.forge.tasks.Annotatable
|
||||
import net.minecraftforge.forge.tasks.InheritanceData
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
|
||||
@CompileStatic
|
||||
abstract class CheckSAS extends CheckTask {
|
||||
|
||||
@InputFile abstract RegularFileProperty getInheritance()
|
||||
@InputFiles abstract ConfigurableFileCollection getSass()
|
||||
|
||||
@Override
|
||||
void check(Reporter reporter, boolean fix) {
|
||||
final inheritance = InheritanceData.parse(this.inheritance.get().asFile)
|
||||
|
||||
sass.each { f ->
|
||||
final lines = []
|
||||
f.eachLine { line ->
|
||||
if (line[0] == '\t') return // Skip any tabbed lines, those are ones we add
|
||||
final idx = line.indexOf('#')
|
||||
if (idx == 0 || line.isEmpty()) {
|
||||
lines.add(line)
|
||||
return
|
||||
}
|
||||
def comment = idx == -1 ? null : line.substring(idx)
|
||||
if (idx != -1) line = line.substring(0, idx - 1)
|
||||
final spl = (line.trim().replace('(', ' (') + ' ').split(' ', -1)
|
||||
def (String cls, String name, String desc) = [spl[0], spl[1], spl[2]]
|
||||
cls = cls.replaceAll('\\.', '/')
|
||||
|
||||
if (inheritance[cls] === null) {
|
||||
reporter.report("Invalid: $line")
|
||||
} else if (name.isEmpty()) { //Class SAS
|
||||
final toAdd = []
|
||||
final clsSided = isSided(inheritance[cls])
|
||||
boolean sided = clsSided
|
||||
|
||||
/* TODO: MergeTool doesn't do fields
|
||||
if (json[cls]['fields'] != null) {
|
||||
for (entry in json[cls]['fields']) {
|
||||
if (isSided(entry.value)) {
|
||||
sided = true
|
||||
toAdd.add('\t' + cls + ' ' + entry.key)
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
final clsInh = inheritance[cls]
|
||||
if (clsInh.methods) {
|
||||
for (entry in clsInh.methods) {
|
||||
if (isSided(entry.value)) {
|
||||
sided = true
|
||||
toAdd.add('\t' + cls + ' ' + entry.key.replaceAll(' ', ''))
|
||||
findChildMethods(inheritance, cls, entry.key).each { lines.add('\t' + it) }
|
||||
findChildMethods(inheritance, cls, entry.key).each { println(line + ' -- ' + it) }
|
||||
} else if (clsSided) {
|
||||
findChildMethods(inheritance, cls, entry.key).each { lines.add('\t' + it) }
|
||||
findChildMethods(inheritance, cls, entry.key).each { println(line + ' -- ' + it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sided) {
|
||||
lines.add(cls + (comment == null ? '' : ' ' + comment))
|
||||
lines.addAll(toAdd.sort())
|
||||
} else {
|
||||
reporter.report("Invalid: $line")
|
||||
}
|
||||
|
||||
} else if (desc.isEmpty()) { // Fields
|
||||
/* TODO: MergeTool doesn't do fields
|
||||
if (json[cls]['fields'] != null && isSided(json[cls]['fields'][name]))
|
||||
lines.add(cls + ' ' + name + (comment == null ? '' : ' ' + comment))
|
||||
else */
|
||||
reporter.report("Invalid: $line")
|
||||
} else { // Methods
|
||||
final clsInh = inheritance[cls]
|
||||
if (clsInh.methods === null || !isSided(clsInh.methods[name + ' ' + desc]))
|
||||
reporter.report("Invalid: $line")
|
||||
else {
|
||||
lines.add(cls + ' ' + name + desc + (comment == null ? '' : ' ' + comment))
|
||||
findChildMethods(inheritance, cls, name + ' ' + desc).each { println(line + ' -- ' + it) }
|
||||
findChildMethods(inheritance, cls, name + ' ' + desc).each { lines.add('\t' + it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fix) f.text = lines.join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
protected static isSided(Annotatable annotatable) {
|
||||
if (annotatable === null) return false
|
||||
for (ann in annotatable.annotations) {
|
||||
if ('Lnet/minecraftforge/api/distmarker/OnlyIn;' == ann.desc)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
protected static findChildMethods(Map<String, InheritanceData> json, String cls, String desc) {
|
||||
return json.values().findAll{ it.methods != null && it.methods[desc] != null && it.methods[desc].override == cls && isSided(it.methods[desc]) }
|
||||
.collect { it.name + ' ' + desc.replace(' ', '') } as TreeSet
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package net.minecraftforge.forge.tasks.checks
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import net.minecraftforge.forge.tasks.Util
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.TaskContainer
|
||||
import org.gradle.api.tasks.VerificationTask
|
||||
|
||||
@CompileStatic
|
||||
abstract class CheckTask extends DefaultTask implements VerificationTask {
|
||||
@Input
|
||||
abstract Property<CheckMode> getMode()
|
||||
|
||||
private boolean ignoreFailures = false
|
||||
|
||||
@Input
|
||||
@Override
|
||||
boolean getIgnoreFailures() {
|
||||
return ignoreFailures
|
||||
}
|
||||
|
||||
@Override
|
||||
void setIgnoreFailures(boolean ignoreFailures) {
|
||||
this.ignoreFailures = ignoreFailures
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
void run() {
|
||||
Util.init()
|
||||
|
||||
final doFix = getMode().get() === CheckMode.FIX
|
||||
final Reporter reporter = new Reporter(doFix)
|
||||
check(reporter, doFix)
|
||||
|
||||
if (reporter.messages) {
|
||||
if (getMode().get() === CheckMode.CHECK) {
|
||||
logger.error("Check task '{}' found errors:\n{}", name, reporter.messages.join('\n'))
|
||||
if (!ignoreFailures) {
|
||||
throw new IllegalArgumentException("${reporter.messages.size()} errors were found!")
|
||||
}
|
||||
} else {
|
||||
if (logger.isEnabled(LogLevel.DEBUG)) {
|
||||
logger.warn("Check task '{}' found {} errors and fixed {}:\n{}", name, reporter.messages.size(), reporter.fixed.size(), reporter.fixed.join('\n'))
|
||||
} else {
|
||||
logger.warn("Check task '{}' found {} errors and fixed {}.", name, reporter.messages.size(), reporter.fixed.size())
|
||||
}
|
||||
|
||||
if (reporter.notFixed) {
|
||||
logger.error('{} errors could not be fixed:\n{}', reporter.notFixed.size(), reporter.notFixed.join('\n'))
|
||||
if (!ignoreFailures) {
|
||||
throw new IllegalArgumentException("${reporter.notFixed.size()} errors which cannot be fixed were found!")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract void check(Reporter reporter, boolean fix)
|
||||
|
||||
@CompileStatic
|
||||
static final class Reporter {
|
||||
final boolean trackFixed
|
||||
Reporter(boolean trackFixed) {
|
||||
this.trackFixed = trackFixed
|
||||
}
|
||||
|
||||
public final List<String> messages = []
|
||||
|
||||
public final List<String> fixed = []
|
||||
public final List<String> notFixed = []
|
||||
|
||||
void report(String message, boolean canBeFixed = true) {
|
||||
messages.add(message)
|
||||
|
||||
if (trackFixed) {
|
||||
if (canBeFixed) {
|
||||
fixed.add(message)
|
||||
} else {
|
||||
notFixed.add(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static <T extends CheckTask> void registerTask(TaskContainer tasks, String taskName, @DelegatesTo.Target('type') Class<T> clazz,
|
||||
@DelegatesTo(genericTypeIndex = 0, target = 'type') Closure configuration) {
|
||||
taskName = taskName.capitalize()
|
||||
tasks.register("check$taskName", clazz) { CheckTask task ->
|
||||
configuration.setDelegate((T) task)
|
||||
configuration.call(task)
|
||||
task.mode.set(CheckMode.CHECK)
|
||||
task.group = 'checks'
|
||||
}
|
||||
tasks.named('checkAll').configure { it.dependsOn("check$taskName") }
|
||||
|
||||
tasks.register("checkAndFix$taskName", clazz) { CheckTask task ->
|
||||
configuration.setDelegate((T) task)
|
||||
configuration.call(task)
|
||||
task.mode.set(CheckMode.FIX)
|
||||
task.group = 'checks'
|
||||
}
|
||||
tasks.named('checkAllAndFix').configure { it.dependsOn("checkAndFix$taskName") }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.minecraftforge.fml;
|
||||
|
||||
import cpw.mods.modlauncher.util.ServiceLoaderUtils;
|
||||
import net.minecraftforge.eventbus.api.BusBuilder;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.config.IConfigEvent;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
|
||||
@@ -28,13 +28,13 @@ public interface IExtensionPoint<T extends Record>
|
||||
* Compatibility display test for the mod.
|
||||
* Used for displaying compatibility with remote servers with the same mod, and on disk saves.
|
||||
*
|
||||
* The supplier provides my "local" version for sending across the impl or writing to disk
|
||||
* The predicate tests the version from a remote instance or save for acceptability (Boolean is true for impl, false for local save)
|
||||
* The supplier provides my "local" version for sending across the network or writing to disk
|
||||
* The predicate tests the version from a remote instance or save for acceptability (Boolean is true for network, false for local save)
|
||||
* and returns true if the version is compatible.
|
||||
*
|
||||
* <p>Return {@code net.minecraftforge.impl.impl.FMLNetworkConstants#IGNORESERVERONLY} in the supplier, if you wish to be ignored
|
||||
* <p>Return {@code net.minecraftforge.fmllegacy.network.FMLNetworkConstants#IGNORESERVERONLY} in the supplier, if you wish to be ignored
|
||||
* as a server side only mod.</p>
|
||||
* <p>Return true in the predicate for all values of the input string (when impl boolean is true) if you are client side,
|
||||
* <p>Return true in the predicate for all values of the input string (when network boolean is true) if you are client side,
|
||||
* and don't care about matching any potential server version.</p>
|
||||
*
|
||||
* <p>
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.minecraftforge.fml;
|
||||
|
||||
import com.google.common.graph.GraphBuilder;
|
||||
import com.google.common.graph.MutableGraph;
|
||||
import cpw.mods.modlauncher.util.ServiceLoaderUtils;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fml.loading.toposort.TopologicalSort;
|
||||
|
||||
@@ -43,6 +43,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2021.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.asm;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.AnnotationNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import cpw.mods.modlauncher.serviceapi.ILaunchPluginService;
|
||||
|
||||
/**
|
||||
* Removes the final modifier from fields with the @CapabilityInject annotation, prevents the JITer from in lining them so our runtime replacements can work.
|
||||
*/
|
||||
@Deprecated(since = "1.18", forRemoval = true)
|
||||
public class CapabilityInjectDefinalize implements ILaunchPluginService {
|
||||
|
||||
private final String CAP = "Lnet/minecraftforge/common/capabilities/Capability;"; //Don't directly reference this to prevent class loading.
|
||||
private final String CAP_INJECT = "Lnet/minecraftforge/common/capabilities/CapabilityInject;"; //Don't directly reference this to prevent class loading.
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return "capability_inject_definalize";
|
||||
}
|
||||
|
||||
private static final EnumSet<Phase> YAY = EnumSet.of(Phase.AFTER);
|
||||
private static final EnumSet<Phase> NAY = EnumSet.noneOf(Phase.class);
|
||||
|
||||
@Override
|
||||
public EnumSet<Phase> handlesClass(Type classType, boolean isEmpty)
|
||||
{
|
||||
return isEmpty ? NAY : YAY;
|
||||
}
|
||||
|
||||
private boolean hasHolder(List<AnnotationNode> lst)
|
||||
{
|
||||
return lst != null && lst.stream().anyMatch(n -> n.desc.equals(CAP_INJECT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processClassWithFlags(final Phase phase, final ClassNode classNode, final Type classType, final String reason)
|
||||
{
|
||||
final int flags = Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL;
|
||||
final AtomicBoolean changed = new AtomicBoolean();
|
||||
classNode.fields.stream().filter(f -> ((f.access & flags) == flags) && f.desc.equals(CAP) && hasHolder(f.visibleAnnotations)).forEach(f ->
|
||||
{
|
||||
int prev = f.access;
|
||||
f.access &= ~Opcodes.ACC_FINAL; //Strip final
|
||||
f.access |= Opcodes.ACC_SYNTHETIC; //Add Synthetic so we can check in runtime.
|
||||
changed.compareAndSet(false, prev != f.access);
|
||||
});
|
||||
|
||||
return changed.get() ? ComputeFlags.SIMPLE_REWRITE : ComputeFlags.NO_REWRITE;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.asm;
|
||||
package net.minecraftforge.common.asm;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
+2
-1
@@ -17,8 +17,9 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.asm;
|
||||
package net.minecraftforge.common.asm;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
+2
-1
@@ -17,8 +17,9 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.asm;
|
||||
package net.minecraftforge.common.asm;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -24,12 +24,15 @@ import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
import com.electronwill.nightconfig.core.file.FileNotFoundAction;
|
||||
import com.electronwill.nightconfig.core.io.ParsingException;
|
||||
import com.electronwill.nightconfig.core.io.WritingMode;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.CORE;
|
||||
|
||||
|
||||
@@ -23,12 +23,9 @@ import cpw.mods.modlauncher.Launcher;
|
||||
import cpw.mods.modlauncher.api.*;
|
||||
import cpw.mods.modlauncher.serviceapi.ILaunchPluginService;
|
||||
import cpw.mods.modlauncher.util.ServiceLoaderUtils;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.BackgroundScanHandler;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModValidator;
|
||||
import net.minecraftforge.accesstransformer.service.AccessTransformerService;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.*;
|
||||
import net.minecraftforge.fml.loading.progress.EarlyProgressVisualization;
|
||||
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
||||
import net.minecraftforge.fml.loading.targets.CommonLaunchHandler;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class FMLServiceProvider implements ITransformationService
|
||||
LOGGER.debug(CORE, "Loading configuration");
|
||||
FMLConfig.load();
|
||||
LOGGER.debug(CORE, "Preparing ModFile");
|
||||
environment.computePropertyIfAbsent(Environment.Keys.MODFILEFACTORY.get(), k->ModFile::new);
|
||||
environment.computePropertyIfAbsent(Environment.Keys.MODFILEFACTORY.get(), k->ModFile.buildFactory());
|
||||
arguments = new HashMap<>();
|
||||
arguments.put("modLists", modListsArgumentList);
|
||||
arguments.put("mods", modsArgumentList);
|
||||
|
||||
@@ -32,7 +32,11 @@ import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.VersionRange;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
@@ -22,8 +22,14 @@ package net.minecraftforge.fml.loading;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.CORE;
|
||||
|
||||
public class LibraryFinder {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -38,9 +44,39 @@ public class LibraryFinder {
|
||||
return libsPath;
|
||||
}
|
||||
|
||||
// Not used anywhere in Forge's codebase, scheduled for deletion unless a good need is expressed.
|
||||
@Deprecated(forRemoval = true, since = "1.17.1")
|
||||
public static Path findJarPathFor(final String className, final String jarName) {
|
||||
final URL resource = LibraryFinder.class.getClassLoader().getResource(className);
|
||||
return findJarPathFor(className, jarName, resource);
|
||||
}
|
||||
|
||||
/*
|
||||
* Only used in ClasspathLocator now, so moved too a private method and depreciated this.
|
||||
* Scheduled for deletion unless a good need is expressed.
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.17.1")
|
||||
public static Path findJarPathFor(final String resourceName, final String jarName, final URL resource) {
|
||||
try {
|
||||
Path path;
|
||||
final URI uri = resource.toURI();
|
||||
if (uri.getScheme().equals("jar") && uri.getRawSchemeSpecificPart().contains("!/")) {
|
||||
int lastExcl = uri.getRawSchemeSpecificPart().lastIndexOf("!/");
|
||||
path = Paths.get(new URI(uri.getRawSchemeSpecificPart().substring(0, lastExcl)));
|
||||
} else {
|
||||
path = Paths.get(new URI("file://"+uri.getRawSchemeSpecificPart().substring(0, uri.getRawSchemeSpecificPart().length()-resourceName.length())));
|
||||
}
|
||||
LOGGER.debug(CORE, "Found JAR {} at path {}", jarName, path.toString());
|
||||
return path;
|
||||
} catch (NullPointerException | URISyntaxException e) {
|
||||
LOGGER.fatal(CORE, "Failed to find JAR for class {} - {}", resourceName, jarName);
|
||||
throw new RuntimeException("Unable to locate "+resourceName+" - "+jarName, e);
|
||||
}
|
||||
}
|
||||
|
||||
static Path getForgeLibraryPath(final String mcVersion, final String forgeVersion, final String forgeGroup) {
|
||||
Path forgePath = findLibsPath().resolve(MavenCoordinateResolver.get(forgeGroup, "forge", "", "universal", mcVersion+"-"+forgeVersion));
|
||||
LOGGER.debug(LogMarkers.CORE, "Found forge path {} is {}", forgePath, pathStatus(forgePath));
|
||||
LOGGER.debug(CORE, "Found forge path {} is {}", forgePath, pathStatus(forgePath));
|
||||
return forgePath;
|
||||
}
|
||||
|
||||
@@ -52,9 +88,9 @@ public class LibraryFinder {
|
||||
Path srgMcPath = findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraft", type, "", "srg", mcVersion+"-"+mcpVersion));
|
||||
Path mcExtrasPath = findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraft", type, "", "extra", mcVersion+"-"+mcpVersion));
|
||||
Path patchedBinariesPath = findLibsPath().resolve(MavenCoordinateResolver.get(forgeGroup, "forge", "", type, mcVersion+"-"+forgeVersion));
|
||||
LOGGER.debug(LogMarkers.CORE,"SRG MC at {} is {}", srgMcPath.toString(), pathStatus(srgMcPath));
|
||||
LOGGER.debug(LogMarkers.CORE,"MC Extras at {} is {}", mcExtrasPath.toString(), pathStatus(mcExtrasPath));
|
||||
LOGGER.debug(LogMarkers.CORE,"Forge patches at {} is {}", patchedBinariesPath.toString(), pathStatus(patchedBinariesPath));
|
||||
LOGGER.debug(CORE,"SRG MC at {} is {}", srgMcPath.toString(), pathStatus(srgMcPath));
|
||||
LOGGER.debug(CORE,"MC Extras at {} is {}", mcExtrasPath.toString(), pathStatus(mcExtrasPath));
|
||||
LOGGER.debug(CORE,"Forge patches at {} is {}", patchedBinariesPath.toString(), pathStatus(patchedBinariesPath));
|
||||
return new Path[] { patchedBinariesPath, mcExtrasPath, srgMcPath };
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.CORE;
|
||||
|
||||
public class MCPNamingService implements INameMappingService {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private HashMap<String, String> methods;
|
||||
@@ -56,7 +58,7 @@ public class MCPNamingService implements INameMappingService {
|
||||
HashMap<String,String> tmpmethods = new HashMap<>(1000);
|
||||
loadMappings("methods.csv", tmpmethods::put);
|
||||
methods = tmpmethods;
|
||||
LOGGER.debug(LogMarkers.CORE, "Loaded {} method mappings from methods.csv", methods.size());
|
||||
LOGGER.debug(CORE, "Loaded {} method mappings from methods.csv", methods.size());
|
||||
}
|
||||
return methods.getOrDefault(origin, origin);
|
||||
}
|
||||
@@ -66,7 +68,7 @@ public class MCPNamingService implements INameMappingService {
|
||||
HashMap<String,String> tmpfields = new HashMap<>(1000);
|
||||
loadMappings("fields.csv", tmpfields::put);
|
||||
fields = tmpfields;
|
||||
LOGGER.debug(LogMarkers.CORE, "Loaded {} field mappings from fields.csv", fields.size());
|
||||
LOGGER.debug(CORE, "Loaded {} field mappings from fields.csv", fields.size());
|
||||
}
|
||||
return fields.getOrDefault(origin, origin);
|
||||
}
|
||||
@@ -79,7 +81,7 @@ public class MCPNamingService implements INameMappingService {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(path.openStream()))) {
|
||||
reader.lines().skip(1).map(e -> e.split(",")).forEach(e -> mapStore.accept(e[0], e[1]));
|
||||
} catch (IOException e1) {
|
||||
LOGGER.error(LogMarkers.CORE, "Error reading mappings", e1);
|
||||
LOGGER.error(CORE, "Error reading mappings", e1);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -30,6 +30,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService {
|
||||
|
||||
@@ -32,12 +32,14 @@ import net.minecraftforge.fml.loading.toposort.TopologicalSort;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.util.StringBuilderFormattable;
|
||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.stream.Collectors.*;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import net.minecraftforge.forgespi.language.MavenVersionAdapter;
|
||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.VersionRange;
|
||||
|
||||
+7
-6
@@ -21,7 +21,6 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import cpw.mods.jarhandling.JarMetadata;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.forgespi.language.IConfigurable;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
@@ -43,6 +42,8 @@ import java.util.jar.Manifest;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.SCAN;
|
||||
|
||||
public abstract class AbstractJarFileLocator implements IModLocator {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
protected static final String MODS_TOML = "META-INF/mods.toml";
|
||||
@@ -50,14 +51,14 @@ public abstract class AbstractJarFileLocator implements IModLocator {
|
||||
|
||||
@Override
|
||||
public void scanFile(final IModFile file, final Consumer<Path> pathConsumer) {
|
||||
LOGGER.debug(LogMarkers.SCAN,"Scan started: {}", file);
|
||||
LOGGER.debug(SCAN,"Scan started: {}", file);
|
||||
final Function<Path, SecureJar.Status> status = p->file.getSecureJar().verifyPath(p);
|
||||
try (Stream<Path> files = Files.find(file.getSecureJar().getRootPath(), Integer.MAX_VALUE, (p, a) -> p.getNameCount() > 0 && p.getFileName().toString().endsWith(".class"))) {
|
||||
file.setSecurityStatus(files.peek(pathConsumer).map(status).reduce((s1, s2)-> SecureJar.Status.values()[Math.min(s1.ordinal(), s2.ordinal())]).orElse(SecureJar.Status.INVALID));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
LOGGER.debug(LogMarkers.SCAN,"Scan finished: {}", file);
|
||||
LOGGER.debug(SCAN,"Scan finished: {}", file);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,10 +89,10 @@ public abstract class AbstractJarFileLocator implements IModLocator {
|
||||
IModFile mod = null;
|
||||
var type = sj.getManifest().getMainAttributes().getValue(ModFile.TYPE);
|
||||
if (sj.findFile(MODS_TOML).isPresent()) {
|
||||
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MODS_TOML, type, path);
|
||||
mod = new ModFile(sj, this, ModFileParser::modsTomlParser);
|
||||
LOGGER.debug(SCAN, "Found {} mod of type {}: {}", MODS_TOML, type, path);
|
||||
mod = ModFile.newFMLInstance(this, sj);
|
||||
} else if (type != null) {
|
||||
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MANIFEST, type, path);
|
||||
LOGGER.debug(SCAN, "Found {} mod of type {}: {}", MANIFEST, type, path);
|
||||
mod = new ModFile(sj, this, this::manifestParser);
|
||||
} else {
|
||||
return Optional.empty();
|
||||
|
||||
+4
-3
@@ -19,9 +19,8 @@
|
||||
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import net.minecraftforge.fml.loading.LoadingModList;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.forgespi.language.ModFileScanData;
|
||||
import net.minecraftforge.fml.loading.LoadingModList;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -31,6 +30,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.SCAN;
|
||||
|
||||
public class BackgroundScanHandler
|
||||
{
|
||||
private enum ScanStatus {
|
||||
@@ -86,7 +87,7 @@ public class BackgroundScanHandler
|
||||
private void addCompletedFile(final ModFile file, final ModFileScanData modFileScanData, final Throwable throwable) {
|
||||
if (throwable != null) {
|
||||
status = ScanStatus.ERRORED;
|
||||
LOGGER.error(LogMarkers.SCAN,"An error occurred scanning file {}", file, throwable);
|
||||
LOGGER.error(SCAN,"An error occurred scanning file {}", file, throwable);
|
||||
}
|
||||
pendingFiles.remove(file);
|
||||
scannedFiles.add(file);
|
||||
|
||||
+3
-3
@@ -19,7 +19,6 @@
|
||||
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -37,6 +36,7 @@ import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.SCAN;
|
||||
|
||||
public class ClasspathLocator extends AbstractJarFileLocator {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -62,7 +62,7 @@ public class ClasspathLocator extends AbstractJarFileLocator {
|
||||
|
||||
return paths.build();
|
||||
} catch (IOException e) {
|
||||
LOGGER.fatal(LogMarkers.SCAN, "Error trying to find resources", e);
|
||||
LOGGER.fatal(SCAN, "Error trying to find resources", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class ClasspathLocator extends AbstractJarFileLocator {
|
||||
//LOGGER.debug(CORE, "Found JAR {} at path {}", jarName, path.toString());
|
||||
return path;
|
||||
} catch (NullPointerException | URISyntaxException e) {
|
||||
LOGGER.fatal(LogMarkers.SCAN, "Failed to find JAR for class {} - {}", resourceName, jarName);
|
||||
LOGGER.fatal(SCAN, "Failed to find JAR for class {} - {}", resourceName, jarName);
|
||||
throw new RuntimeException("Unable to locate "+resourceName+" - "+jarName, e);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-9
@@ -19,7 +19,6 @@
|
||||
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import net.minecraftforge.forgespi.locating.IModLocator;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -35,6 +34,9 @@ import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.SCAN;
|
||||
|
||||
public class ExplodedDirectoryLocator implements IModLocator {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
@@ -45,12 +47,8 @@ public class ExplodedDirectoryLocator implements IModLocator {
|
||||
|
||||
@Override
|
||||
public List<IModFile> scanMods() {
|
||||
explodedMods.forEach(explodedMod ->
|
||||
ModJarMetadata.buildFile(this,
|
||||
jar->jar.findFile("/META-INF/mods.toml").isPresent(),
|
||||
(a,b) -> true,
|
||||
explodedMod.paths().toArray(Path[]::new))
|
||||
.ifPresentOrElse(f->mods.put(explodedMod, f), () -> LOGGER.warn(LogMarkers.LOADING, "Failed to find exploded resource mods.toml in directory {}", explodedMod.paths().get(0).toString())));
|
||||
explodedMods.forEach(explodedMod -> ModJarMetadata.buildFile(this, jar ->jar.findFile("/META-INF/mods.toml").isPresent(), explodedMod.paths().toArray(Path[]::new))
|
||||
.ifPresentOrElse(f->mods.put(explodedMod, f), () -> LOGGER.warn(LOADING, "Failed to find exploded resource mods.toml in directory {}", explodedMod.paths().get(0).toString())));
|
||||
return List.copyOf(mods.values());
|
||||
}
|
||||
|
||||
@@ -61,13 +59,13 @@ public class ExplodedDirectoryLocator implements IModLocator {
|
||||
|
||||
@Override
|
||||
public void scanFile(final IModFile file, final Consumer<Path> pathConsumer) {
|
||||
LOGGER.debug(LogMarkers.SCAN,"Scanning exploded directory {}", file.getFilePath().toString());
|
||||
LOGGER.debug(SCAN,"Scanning exploded directory {}", file.getFilePath().toString());
|
||||
try (Stream<Path> files = Files.find(file.getSecureJar().getRootPath(), Integer.MAX_VALUE, (p, a) -> p.getNameCount() > 0 && p.getFileName().toString().endsWith(".class"))) {
|
||||
files.forEach(pathConsumer);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
LOGGER.debug(LogMarkers.SCAN,"Exploded directory scan complete {}", file.getFilePath().toString());
|
||||
LOGGER.debug(SCAN,"Exploded directory scan complete {}", file.getFilePath().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
-10
@@ -1,10 +1,11 @@
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.electronwill.nightconfig.core.Config;
|
||||
import com.electronwill.nightconfig.core.file.FileConfig;
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
import net.minecraftforge.forgespi.language.MavenVersionAdapter;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import net.minecraftforge.forgespi.locating.IModLocator;
|
||||
import net.minecraftforge.forgespi.locating.ModFileFactory;
|
||||
@@ -17,6 +18,8 @@ import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.SCAN;
|
||||
|
||||
public class MinecraftLocator implements IModLocator {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -26,13 +29,8 @@ public class MinecraftLocator implements IModLocator {
|
||||
final var launchHandler = FMLLoader.getLaunchHandler();
|
||||
var baseMC = launchHandler.getMinecraftPaths();
|
||||
var mcjar = ModJarMetadata.buildFile(j->ModFileFactory.FACTORY.build(j, this, this::buildMinecraftTOML), j->true, baseMC.minecraftFilter(), baseMC.minecraftPaths().toArray(Path[]::new)).orElseThrow();
|
||||
var artifacts = baseMC.otherArtifacts().stream()
|
||||
.map(SecureJar::from)
|
||||
.map(sj -> new ModFile(sj, this, ModFileParser::modsTomlParser))
|
||||
.collect(Collectors.<IModFile>toList());
|
||||
var othermods = baseMC.otherModPaths().stream()
|
||||
.map(p->ModJarMetadata.buildFile(this, p.toArray(Path[]::new)))
|
||||
.toList();
|
||||
var artifacts = baseMC.otherArtifacts().stream().map(SecureJar::from).map(sj->ModFile.newFMLInstance(this, sj)).collect(Collectors.<IModFile>toList());
|
||||
var othermods = baseMC.otherModPaths().stream().map(p->ModJarMetadata.buildFile(this, p.toArray(Path[]::new))).toList();
|
||||
artifacts.add(mcjar);
|
||||
artifacts.addAll(othermods);
|
||||
return artifacts;
|
||||
@@ -99,13 +97,13 @@ public class MinecraftLocator implements IModLocator {
|
||||
|
||||
@Override
|
||||
public void scanFile(final IModFile modFile, final Consumer<Path> pathConsumer) {
|
||||
LOGGER.debug(LogMarkers.SCAN, "Scan started: {}", modFile);
|
||||
LOGGER.debug(SCAN, "Scan started: {}", modFile);
|
||||
try (Stream<Path> files = Files.find(modFile.getSecureJar().getRootPath(), Integer.MAX_VALUE, (p, a) -> p.getNameCount() > 0 && p.getFileName().toString().endsWith(".class"))) {
|
||||
files.forEach(pathConsumer);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
LOGGER.debug(LogMarkers.SCAN, "Scan finished: {}", modFile);
|
||||
LOGGER.debug(SCAN, "Scan finished: {}", modFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
-6
@@ -22,7 +22,6 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
import cpw.mods.modlauncher.Launcher;
|
||||
import cpw.mods.modlauncher.api.IModuleLayerManager;
|
||||
import cpw.mods.modlauncher.util.ServiceLoaderUtils;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
||||
import net.minecraftforge.forgespi.Environment;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
@@ -36,6 +35,9 @@ import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.CORE;
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.SCAN;
|
||||
|
||||
public class ModDiscoverer {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private final ServiceLoader<IModLocator> locators;
|
||||
@@ -43,12 +45,12 @@ public class ModDiscoverer {
|
||||
|
||||
public ModDiscoverer(Map<String, ?> arguments) {
|
||||
Launcher.INSTANCE.environment().computePropertyIfAbsent(Environment.Keys.MODDIRECTORYFACTORY.get(), v->ModsFolderLocator::new);
|
||||
Launcher.INSTANCE.environment().computePropertyIfAbsent(Environment.Keys.PROGRESSMESSAGE.get(), v-> StartupMessageManager.locatorConsumer().orElseGet(()-> s->{}));
|
||||
Launcher.INSTANCE.environment().computePropertyIfAbsent(Environment.Keys.PROGRESSMESSAGE.get(), v->StartupMessageManager.locatorConsumer().orElseGet(()->s->{}));
|
||||
final var moduleLayerManager = Launcher.INSTANCE.environment().findModuleLayerManager().orElseThrow();
|
||||
locators = ServiceLoader.load(moduleLayerManager.getLayer(IModuleLayerManager.Layer.SERVICE).orElseThrow(), IModLocator.class);
|
||||
locatorList = ServiceLoaderUtils.streamServiceLoader(()->locators, sce->LOGGER.error("Failed to load locator list", sce)).collect(Collectors.toList());
|
||||
locatorList.forEach(l->l.initArguments(arguments));
|
||||
LOGGER.debug(LogMarkers.CORE,"Found Mod Locators : {}", ()->locatorList.stream().map(iModLocator -> "("+iModLocator.name() + ":" + iModLocator.getClass().getPackage().getImplementationVersion()+")").collect(Collectors.joining(",")));
|
||||
LOGGER.debug(CORE,"Found Mod Locators : {}", ()->locatorList.stream().map(iModLocator -> "("+iModLocator.name() + ":" + iModLocator.getClass().getPackage().getImplementationVersion()+")").collect(Collectors.joining(",")));
|
||||
}
|
||||
|
||||
ModDiscoverer(List<IModLocator> locatorList) {
|
||||
@@ -57,13 +59,13 @@ public class ModDiscoverer {
|
||||
}
|
||||
|
||||
public ModValidator discoverMods() {
|
||||
LOGGER.debug(LogMarkers.SCAN,"Scanning for mods and other resources to load. We know {} ways to find mods", locatorList.size());
|
||||
LOGGER.debug(SCAN,"Scanning for mods and other resources to load. We know {} ways to find mods", locatorList.size());
|
||||
var loadedFiles = new ArrayList<>();
|
||||
for (IModLocator locator : locatorList) {
|
||||
LOGGER.debug(LogMarkers.SCAN,"Trying locator {}", locator);
|
||||
LOGGER.debug(SCAN,"Trying locator {}", locator);
|
||||
var modFiles = locator.scanMods();
|
||||
for (IModFile mf : modFiles) {
|
||||
LOGGER.info(LogMarkers.SCAN, "Found mod file {} of type {} with locator {}", mf.getFileName(), mf.getType(), mf.getLocator());
|
||||
LOGGER.info(SCAN, "Found mod file {} of type {} with locator {}", mf.getFileName(), mf.getType(), mf.getLocator());
|
||||
StartupMessageManager.modLoaderConsumer().ifPresent(c->c.accept("Found mod file "+mf.getFileName()+" of type "+mf.getType()));
|
||||
}
|
||||
loadedFiles.addAll(modFiles);
|
||||
|
||||
@@ -21,9 +21,8 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import net.minecraftforge.forgespi.language.IModLanguageProvider;
|
||||
@@ -47,9 +46,11 @@ import java.util.function.Supplier;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
|
||||
|
||||
public class ModFile implements IModFile {
|
||||
// Mods either must have a mods.toml or a manifest. We can no longer just put any jar on the classpath.
|
||||
@Deprecated(forRemoval = true, since = "1.18")
|
||||
@Deprecated(forRemoval = true, since = "1.17.1")
|
||||
public static final Manifest DEFAULTMANIFEST;
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
@@ -73,7 +74,8 @@ public class ModFile implements IModFile {
|
||||
private List<CoreModFile> coreMods;
|
||||
private Path accessTransformer;
|
||||
|
||||
static final Attributes.Name TYPE = new Attributes.Name("FMLModType");
|
||||
//TODO: Make package private in 1.18+
|
||||
public static final Attributes.Name TYPE = new Attributes.Name("FMLModType");
|
||||
private SecureJar.Status securityStatus;
|
||||
|
||||
public ModFile(final SecureJar jar, final IModLocator locator, final ModFileFactory.ModFileInfoParser parser) {
|
||||
@@ -118,9 +120,9 @@ public class ModFile implements IModFile {
|
||||
public boolean identifyMods() {
|
||||
this.modFileInfo = ModFileParser.readModList(this, this.parser);
|
||||
if (this.modFileInfo == null) return this.getType() != Type.MOD;
|
||||
LOGGER.debug(LogMarkers.LOADING,"Loading mod file {} with languages {}", this.getFilePath(), this.modFileInfo.requiredLanguageLoaders());
|
||||
LOGGER.debug(LOADING,"Loading mod file {} with languages {}", this.getFilePath(), this.modFileInfo.requiredLanguageLoaders());
|
||||
this.coreMods = ModFileParser.getCoreMods(this);
|
||||
this.coreMods.forEach(mi-> LOGGER.debug(LogMarkers.LOADING,"Found coremod {}", mi.getPath()));
|
||||
this.coreMods.forEach(mi-> LOGGER.debug(LOADING,"Found coremod {}", mi.getPath()));
|
||||
this.accessTransformer = findResource("META-INF", "accesstransformer.cfg");
|
||||
return true;
|
||||
}
|
||||
@@ -187,7 +189,7 @@ public class ModFile implements IModFile {
|
||||
|
||||
public void identifyLanguage() {
|
||||
this.loaders = this.modFileInfo.requiredLanguageLoaders().stream()
|
||||
.map(spec-> FMLLoader.getLanguageLoadingProvider().findLanguage(this, spec.languageName(), spec.acceptedVersions()))
|
||||
.map(spec->FMLLoader.getLanguageLoadingProvider().findLanguage(this, spec.languageName(), spec.acceptedVersions()))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@@ -211,6 +213,24 @@ public class ModFile implements IModFile {
|
||||
return modFileInfo;
|
||||
}
|
||||
|
||||
// TODO: Remove concept of factory from forgeapi.. Why expose this?
|
||||
@Deprecated(forRemoval = true, since="1.17.1")
|
||||
public static ModFileFactory buildFactory() {
|
||||
return ModFile::new;
|
||||
}
|
||||
|
||||
// TODO: Remove helper functions to cleanup api
|
||||
@Deprecated(forRemoval = true, since="1.17.1")
|
||||
public static ModFile newFMLInstance(final IModLocator locator, final SecureJar jar) {
|
||||
return (ModFile) ModFileFactory.FACTORY.build(jar, locator, ModFileParser::modsTomlParser);
|
||||
}
|
||||
|
||||
// TODO: Remove helper functions to cleanup api
|
||||
@Deprecated(forRemoval = true, since="1.17.1")
|
||||
public static ModFile newFMLInstance(final IModLocator locator, final Path... paths) {
|
||||
return (ModFile) ModJarMetadata.buildFile(locator, paths);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSecurityStatus(final SecureJar.Status status) {
|
||||
this.securityStatus = status;
|
||||
|
||||
+3
-2
@@ -21,7 +21,6 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import cpw.mods.modlauncher.api.LamdbaExceptionUtils;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.fml.loading.StringUtils;
|
||||
import net.minecraftforge.forgespi.language.IConfigurable;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
@@ -44,6 +43,8 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
|
||||
|
||||
public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -82,7 +83,7 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
this.mods = modConfigs.stream()
|
||||
.map(mi-> new ModInfo(this, mi))
|
||||
.collect(Collectors.toList());
|
||||
LOGGER.debug(LogMarkers.LOADING, "Found valid mod file {} with {} mods - versions {}",
|
||||
LOGGER.debug(LOADING, "Found valid mod file {} with {} mods - versions {}",
|
||||
this.modFile::getFileName,
|
||||
() -> this.mods.stream().map(IModInfo::getModId).collect(Collectors.joining(",", "{", "}")),
|
||||
() -> this.mods.stream().map(IModInfo::getVersion).map(Objects::toString).collect(Collectors.joining(",", "{", "}")));
|
||||
|
||||
+6
-5
@@ -22,7 +22,6 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
import com.electronwill.nightconfig.core.file.FileConfig;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import net.minecraftforge.forgespi.locating.ModFileFactory;
|
||||
@@ -38,6 +37,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
|
||||
|
||||
public class ModFileParser {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
@@ -47,10 +48,10 @@ public class ModFileParser {
|
||||
|
||||
public static IModFileInfo modsTomlParser(final IModFile imodFile) {
|
||||
ModFile modFile = (ModFile) imodFile;
|
||||
LOGGER.debug(LogMarkers.LOADING,"Considering mod file candidate {}", modFile.getFilePath());
|
||||
LOGGER.debug(LOADING,"Considering mod file candidate {}", modFile.getFilePath());
|
||||
final Path modsjson = modFile.findResource("META-INF", "mods.toml");
|
||||
if (!Files.exists(modsjson)) {
|
||||
LOGGER.warn(LogMarkers.LOADING, "Mod file {} is missing mods.toml file", modFile.getFilePath());
|
||||
LOGGER.warn(LOADING, "Mod file {} is missing mods.toml file", modFile.getFilePath());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -74,12 +75,12 @@ public class ModFileParser {
|
||||
final Gson gson = new Gson();
|
||||
coreModPaths = gson.fromJson(Files.newBufferedReader(coremodsjson), type);
|
||||
} catch (IOException e) {
|
||||
LOGGER.debug(LogMarkers.LOADING,"Failed to read coremod list coremods.json", e);
|
||||
LOGGER.debug(LOADING,"Failed to read coremod list coremods.json", e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return coreModPaths.entrySet().stream()
|
||||
.peek(e-> LOGGER.debug(LogMarkers.LOADING,"Found coremod {} with Javascript path {}", e.getKey(), e.getValue()))
|
||||
.peek(e-> LOGGER.debug(LOADING,"Found coremod {} with Javascript path {}", e.getKey(), e.getValue()))
|
||||
.map(e -> new CoreModFile(e.getKey(), modFile.findResource(e.getValue()),modFile))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
+11
-5
@@ -18,19 +18,25 @@ public final class ModJarMetadata implements JarMetadata {
|
||||
private ModuleDescriptor descriptor;
|
||||
|
||||
// TODO: Remove helper functions to cleanup api
|
||||
@Deprecated(forRemoval = true, since="1.18")
|
||||
@Deprecated(forRemoval = true, since="1.17.1")
|
||||
static Optional<IModFile> buildFile(IModLocator locator, Predicate<SecureJar> jarTest, Path... files) {
|
||||
return buildFile(locator, jarTest, (a,b) -> true, files);
|
||||
}
|
||||
|
||||
// TODO: Remove helper functions to cleanup api
|
||||
@Deprecated(forRemoval = true, since="1.17.1")
|
||||
static Optional<IModFile> buildFile(IModLocator locator, Predicate<SecureJar> jarTest, BiPredicate<String, String> filter, Path... files) {
|
||||
return buildFile(j->new ModFile(j, locator, ModFileParser::modsTomlParser), jarTest, filter, files);
|
||||
return buildFile(j->ModFile.newFMLInstance(locator, j), jarTest, filter, files);
|
||||
}
|
||||
|
||||
// TODO: Remove helper functions to cleanup api
|
||||
@Deprecated(forRemoval = true, since="1.18")
|
||||
@Deprecated(forRemoval = true, since="1.17.1")
|
||||
static IModFile buildFile(IModLocator locator, Path... files) {
|
||||
return buildFile(locator, j->true, (a,b) -> true, files).orElseThrow(()->new IllegalArgumentException("Failed to find valid JAR file"));
|
||||
return buildFile(locator, j->true, files).orElseThrow(()->new IllegalArgumentException("Failed to find valid JAR file"));
|
||||
}
|
||||
|
||||
// TODO: Remove helper functions to cleanup api
|
||||
@Deprecated(forRemoval = true, since="1.18")
|
||||
@Deprecated(forRemoval = true, since="1.17.1")
|
||||
static Optional<IModFile> buildFile(Function<SecureJar, IModFile> mfConstructor, Predicate<SecureJar> jarTest, BiPredicate<String, String> filter, Path... files) {
|
||||
var mjm = new ModJarMetadata();
|
||||
var sj = SecureJar.from(()->ModFile.DEFAULTMANIFEST, j->mjm, filter, files);
|
||||
|
||||
+8
-7
@@ -21,7 +21,6 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
import net.minecraftforge.fml.loading.FileUtils;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.fml.loading.MavenCoordinateResolver;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -36,6 +35,8 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.CORE;
|
||||
|
||||
public class ModListHandler {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
/**
|
||||
@@ -58,22 +59,22 @@ public class ModListHandler {
|
||||
filter(path -> Files.exists(path.getLeft())).
|
||||
findFirst().
|
||||
orElseGet(()->{
|
||||
LOGGER.warn(LogMarkers.CORE, "Failed to find coordinate {}", mc);
|
||||
LOGGER.warn(CORE, "Failed to find coordinate {}", mc);
|
||||
return null;
|
||||
})).
|
||||
filter(Objects::nonNull).
|
||||
collect(Collectors.toList());
|
||||
|
||||
final List<String> found = foundCoordinates.stream().map(Pair::getRight).collect(Collectors.toList());
|
||||
LOGGER.debug(LogMarkers.CORE, "Found mod coordinates from lists: {}", found);
|
||||
LOGGER.debug(CORE, "Found mod coordinates from lists: {}", found);
|
||||
return found;
|
||||
}
|
||||
|
||||
private static List<String> transformPathToList(final String path) {
|
||||
LOGGER.debug(LogMarkers.CORE, "Reading mod list {}", path);
|
||||
LOGGER.debug(CORE, "Reading mod list {}", path);
|
||||
Path filePath = FMLPaths.GAMEDIR.get().resolve(path);
|
||||
if (!Files.exists(filePath)) {
|
||||
LOGGER.warn(LogMarkers.CORE, "Failed to find modlist file at {}", filePath);
|
||||
LOGGER.warn(CORE, "Failed to find modlist file at {}", filePath);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ public class ModListHandler {
|
||||
if (Objects.equals("list",extension)) {
|
||||
return readListFile(filePath).stream().filter(s -> !s.isEmpty()).collect(Collectors.toList());
|
||||
} else {
|
||||
LOGGER.warn(LogMarkers.CORE, "Failed to read unknown file list type {} for file {}", extension, filePath);
|
||||
LOGGER.warn(CORE, "Failed to read unknown file list type {} for file {}", extension, filePath);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -95,7 +96,7 @@ public class ModListHandler {
|
||||
try {
|
||||
return Files.readAllLines(filePath);
|
||||
} catch (IOException e) {
|
||||
LOGGER.warn(LogMarkers.CORE, "Failed to read file list {}", filePath, e);
|
||||
LOGGER.warn(CORE, "Failed to read file list {}", filePath, e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-6
@@ -2,10 +2,7 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import cpw.mods.modlauncher.api.IModuleLayerManager;
|
||||
import cpw.mods.modlauncher.api.ITransformationService;
|
||||
import net.minecraftforge.fml.loading.EarlyLoadingException;
|
||||
import net.minecraftforge.fml.loading.LoadingModList;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.fml.loading.ModSorter;
|
||||
import net.minecraftforge.fml.loading.*;
|
||||
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -13,6 +10,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.SCAN;
|
||||
|
||||
public class ModValidator {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -36,7 +34,7 @@ public class ModValidator {
|
||||
|
||||
public void stage1Validation() {
|
||||
brokenFiles = validateFiles(candidateMods);
|
||||
LOGGER.debug(LogMarkers.SCAN,"Found {} mod files with {} mods", candidateMods::size, ()-> candidateMods.stream().mapToInt(mf -> mf.getModInfos().size()).sum());
|
||||
LOGGER.debug(SCAN,"Found {} mod files with {} mods", candidateMods::size, ()-> candidateMods.stream().mapToInt(mf -> mf.getModInfos().size()).sum());
|
||||
StartupMessageManager.modLoaderConsumer().ifPresent(c->c.accept("Found "+ candidateMods.size()+" modfiles to load"));
|
||||
}
|
||||
|
||||
@@ -47,7 +45,7 @@ public class ModValidator {
|
||||
{
|
||||
ModFile mod = iterator.next();
|
||||
if (!mod.getLocator().isValid(mod) || !mod.identifyMods()) {
|
||||
LOGGER.warn(LogMarkers.SCAN, "File {} has been ignored - it is invalid", mod.getFilePath());
|
||||
LOGGER.warn(SCAN, "File {} has been ignored - it is invalid", mod.getFilePath());
|
||||
iterator.remove();
|
||||
brokenFiles.add(mod);
|
||||
}
|
||||
|
||||
+2
-2
@@ -20,7 +20,6 @@
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.fml.loading.ModDirTransformerDiscoverer;
|
||||
import net.minecraftforge.fml.loading.StringUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -33,6 +32,7 @@ import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static cpw.mods.modlauncher.api.LamdbaExceptionUtils.uncheck;
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.SCAN;
|
||||
|
||||
/**
|
||||
* Support loading mods located in JAR files in the mods folder
|
||||
@@ -58,7 +58,7 @@ public class ModsFolderLocator extends AbstractJarFileLocator {
|
||||
|
||||
@Override
|
||||
public Stream<Path> scanCandidates() {
|
||||
LOGGER.debug(LogMarkers.SCAN,"Scanning mods dir {} for mods", this.modFolder);
|
||||
LOGGER.debug(SCAN,"Scanning mods dir {} for mods", this.modFolder);
|
||||
var excluded = ModDirTransformerDiscoverer.allExcluded();
|
||||
|
||||
return uncheck(()-> Files.list(this.modFolder))
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.forgespi.language.IModLanguageProvider;
|
||||
import net.minecraftforge.forgespi.language.ModFileScanData;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -32,6 +31,8 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.SCAN;
|
||||
|
||||
public class Scanner {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private final ModFile fileToScan;
|
||||
@@ -47,7 +48,7 @@ public class Scanner {
|
||||
final List<IModLanguageProvider> loaders = fileToScan.getLoaders();
|
||||
if (loaders != null) {
|
||||
loaders.forEach(loader -> {
|
||||
LOGGER.debug(LogMarkers.SCAN, "Scanning {} with language loader {}", fileToScan.getFilePath(), loader.name());
|
||||
LOGGER.debug(SCAN, "Scanning {} with language loader {}", fileToScan.getFilePath(), loader.name());
|
||||
loader.getFileVisitor().accept(result);
|
||||
});
|
||||
}
|
||||
@@ -55,7 +56,7 @@ public class Scanner {
|
||||
}
|
||||
|
||||
private void fileVisitor(final Path path, final ModFileScanData result) {
|
||||
LOGGER.debug(LogMarkers.SCAN,"Scanning {} path {}", fileToScan, path);
|
||||
LOGGER.debug(SCAN,"Scanning {} path {}", fileToScan, path);
|
||||
try (InputStream in = Files.newInputStream(path)){
|
||||
ModClassVisitor mcv = new ModClassVisitor();
|
||||
ClassReader cr = new ClassReader(in);
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@
|
||||
package net.minecraftforge.fml.loading.progress;
|
||||
|
||||
import cpw.mods.modlauncher.api.LamdbaExceptionUtils;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.function.IntConsumer;
|
||||
@@ -58,7 +58,7 @@ public enum EarlyProgressVisualization {
|
||||
|
||||
default long handOffWindow(final IntSupplier width, final IntSupplier height, final Supplier<String> title, LongSupplier monitorSupplier) {
|
||||
return FMLLoader.getGameLayer().findModule("forge")
|
||||
.map(l->Class.forName(l, "net.minecraftforge.client.loading.NoVizFallback"))
|
||||
.map(l->Class.forName(l, "net.minecraftforge.fmllegacy.NoVizFallback"))
|
||||
.map(LamdbaExceptionUtils.rethrowFunction(c->c.getMethod("fallback", IntSupplier.class, IntSupplier.class, Supplier.class, LongSupplier.class)))
|
||||
.map(LamdbaExceptionUtils.rethrowFunction(m->(LongSupplier)m.invoke(null, width, height, title, monitorSupplier)))
|
||||
.map(LongSupplier::getAsLong)
|
||||
|
||||
+1
-1
@@ -19,10 +19,10 @@
|
||||
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fml.loading.LibraryFinder;
|
||||
import net.minecraftforge.fml.loading.VersionInfo;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+4
-3
@@ -21,7 +21,6 @@ package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import cpw.mods.modlauncher.api.ILaunchHandlerService;
|
||||
import cpw.mods.modlauncher.api.ITransformingClassLoaderBuilder;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -36,6 +35,8 @@ import java.util.Optional;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.CORE;
|
||||
|
||||
public abstract class CommonLaunchHandler implements ILaunchHandlerService {
|
||||
public record LocatedPaths(List<Path> minecraftPaths, BiPredicate<String, String> minecraftFilter, List<List<Path>> otherModPaths, List<Path> otherArtifacts) {}
|
||||
|
||||
@@ -62,7 +63,7 @@ public abstract class CommonLaunchHandler implements ILaunchHandlerService {
|
||||
|
||||
protected final Map<String, List<Path>> getModClasses() {
|
||||
final String modClasses = Optional.ofNullable(System.getenv("MOD_CLASSES")).orElse("");
|
||||
LOGGER.debug(LogMarkers.CORE, "Got mod coordinates {} from env", modClasses);
|
||||
LOGGER.debug(CORE, "Got mod coordinates {} from env", modClasses);
|
||||
|
||||
record ExplodedModPath(String modid, Path path) {}
|
||||
// "a/b/;c/d/;" -> "modid%%c:\fish\pepper;modid%%c:\fish2\pepper2\;modid2%%c:\fishy\bums;modid2%%c:\hmm"
|
||||
@@ -71,7 +72,7 @@ public abstract class CommonLaunchHandler implements ILaunchHandlerService {
|
||||
.map(splitString -> new ExplodedModPath(splitString.length == 1 ? "defaultmodid" : splitString[0], Paths.get(splitString[splitString.length - 1])))
|
||||
.collect(Collectors.groupingBy(ExplodedModPath::modid, Collectors.mapping(ExplodedModPath::path, Collectors.toList())));
|
||||
|
||||
LOGGER.debug(LogMarkers.CORE, "Found supplied mod coordinates [{}]", modClassPaths);
|
||||
LOGGER.debug(CORE, "Found supplied mod coordinates [{}]", modClassPaths);
|
||||
|
||||
//final var explodedTargets = ((Map<String, List<ExplodedDirectoryLocator.ExplodedMod>>)arguments).computeIfAbsent("explodedTargets", a -> new ArrayList<>());
|
||||
//modClassPaths.forEach((modlabel,paths) -> explodedTargets.add(new ExplodedDirectoryLocator.ExplodedMod(modlabel, paths)));
|
||||
|
||||
+1
-1
@@ -20,10 +20,10 @@
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fml.loading.LibraryFinder;
|
||||
import net.minecraftforge.fml.loading.VersionInfo;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.server;
|
||||
package net.minecraftforge.server;
|
||||
|
||||
import cpw.mods.modlauncher.InvalidLauncherSetupException;
|
||||
import cpw.mods.modlauncher.Launcher;
|
||||
+4
-3
@@ -1,4 +1,5 @@
|
||||
net.minecraftforge.fml.loading.RuntimeDistCleaner
|
||||
net.minecraftforge.fml.common.asm.RuntimeEnumExtender
|
||||
net.minecraftforge.fml.common.asm.ObjectHolderDefinalize
|
||||
net.minecraftforge.fml.common.asm.CapabilityTokenSubclass
|
||||
net.minecraftforge.common.asm.RuntimeEnumExtender
|
||||
net.minecraftforge.common.asm.ObjectHolderDefinalize
|
||||
net.minecraftforge.common.asm.CapabilityInjectDefinalize
|
||||
net.minecraftforge.common.asm.CapabilityTokenSubclass
|
||||
@@ -31,6 +31,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.LoadingFailedException;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
import net.minecraftforge.fml.ModWorkManager;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -38,6 +39,8 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ClientModLoader
|
||||
{
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
+2
-2
@@ -17,8 +17,8 @@ version = '1.0'
|
||||
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'modid'
|
||||
|
||||
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
// Mojang ships Java 16 to end users in 1.17+ instead of Java 8 in 1.16 or lower, so your mod should target Java 16.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(16)
|
||||
|
||||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
||||
minecraft {
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
|
||||
import net.minecraftforge.event.server.ServerStartingEvent;
|
||||
import net.minecraftforge.fmlserverevents.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -58,7 +58,7 @@ public class ExampleMod
|
||||
}
|
||||
// You can use SubscribeEvent and let the Event Bus discover methods to call
|
||||
@SubscribeEvent
|
||||
public void onServerStarting(ServerStartingEvent event) {
|
||||
public void onServerStarting(FMLServerStartingEvent event) {
|
||||
// do something when the server starts
|
||||
LOGGER.info("HELLO from server starting");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "examplemod resources",
|
||||
"pack_format": 8
|
||||
"pack_format": 7
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/platform/GlStateManager.java
|
||||
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
|
||||
@@ -539,9 +_,16 @@
|
||||
@@ -530,9 +_,16 @@
|
||||
f_84077_[f_84076_].f_84800_ = false;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
+ public static float lastBrightnessX = 0.0f;
|
||||
+ public static float lastBrightnessY = 0.0f;
|
||||
public static void m_84160_(int p_84161_, int p_84162_, float p_84163_) {
|
||||
RenderSystem.m_187555_();
|
||||
RenderSystem.m_69393_(RenderSystem::m_69587_);
|
||||
GL11.glTexParameterf(p_84161_, p_84162_, p_84163_);
|
||||
+ if (p_84161_ == GL13.GL_TEXTURE1) {
|
||||
+ lastBrightnessX = p_84162_;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/vertex/VertexConsumer.java
|
||||
+++ b/com/mojang/blaze3d/vertex/VertexConsumer.java
|
||||
@@ -16,7 +_,7 @@
|
||||
@@ -15,7 +_,7 @@
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -9,7 +9,7 @@
|
||||
Logger f_85943_ = LogManager.getLogger();
|
||||
|
||||
VertexConsumer m_5483_(double p_85945_, double p_85946_, double p_85947_);
|
||||
@@ -105,11 +_,12 @@
|
||||
@@ -100,11 +_,12 @@
|
||||
f5 = afloat[k] * p_86001_;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
--- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
||||
+++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
||||
@@ -67,6 +_,15 @@
|
||||
return (new TextComponent("")).m_7220_(this.f_200947_.getFirst()).m_130946_(": ").m_7220_(this.f_200947_.getSecond());
|
||||
@@ -69,6 +_,15 @@
|
||||
return (new TextComponent("")).m_7220_(this.f_88666_).m_130946_(": ").m_7220_(this.f_88667_);
|
||||
}
|
||||
|
||||
+ @Override
|
||||
@@ -15,4 +15,4 @@
|
||||
+
|
||||
public void m_6305_(PoseStack p_88679_, int p_88680_, int p_88681_, float p_88682_) {
|
||||
this.m_7333_(p_88679_);
|
||||
m_93215_(p_88679_, this.f_96547_, this.f_200947_.getFirst(), this.f_96543_ / 2, 80, 16777215);
|
||||
m_93215_(p_88679_, this.f_96547_, this.f_88666_, this.f_96543_ / 2, 80, 16777215);
|
||||
@@ -13,7 +13,7 @@
|
||||
-
|
||||
- p_127520_.append("\n");
|
||||
+ p_127520_.append("Stacktrace:");
|
||||
+ p_127520_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.f_127506_));
|
||||
+ p_127520_.append(net.minecraftforge.fmllegacy.CrashReportExtender.generateEnhancedStackTrace(this.f_127506_));
|
||||
}
|
||||
|
||||
for(CrashReportCategory crashreportcategory : this.f_127503_) {
|
||||
@@ -21,7 +21,7 @@
|
||||
p_127520_.append("\n\n");
|
||||
}
|
||||
|
||||
+ net.minecraftforge.logging.CrashReportExtender.extendSystemReport(f_178624_);
|
||||
+ net.minecraftforge.fmllegacy.CrashReportExtender.extendSystemReport(f_178624_);
|
||||
this.f_178624_.m_143525_(p_127520_);
|
||||
}
|
||||
|
||||
@@ -41,13 +41,13 @@
|
||||
- }
|
||||
-
|
||||
- return s;
|
||||
+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(throwable);
|
||||
+ return net.minecraftforge.fmllegacy.CrashReportExtender.generateEnhancedStackTrace(throwable);
|
||||
}
|
||||
|
||||
public String m_127526_() {
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
stringbuilder.append("---- Minecraft Crash Report ----\n");
|
||||
+ net.minecraftforge.logging.CrashReportExtender.addCrashReportHeader(stringbuilder, this);
|
||||
+ net.minecraftforge.fmllegacy.CrashReportExtender.addCrashReportHeader(stringbuilder, this);
|
||||
stringbuilder.append("// ");
|
||||
stringbuilder.append(m_127531_());
|
||||
stringbuilder.append("\n\n");
|
||||
@@ -22,7 +22,7 @@
|
||||
- p_128169_.append("\n\tat ");
|
||||
- p_128169_.append((Object)stacktraceelement);
|
||||
- }
|
||||
+ p_128169_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.f_128139_));
|
||||
+ p_128169_.append(net.minecraftforge.fmllegacy.CrashReportExtender.generateEnhancedStackTrace(this.f_128139_));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/SharedConstants.java
|
||||
+++ b/net/minecraft/SharedConstants.java
|
||||
@@ -184,6 +_,7 @@
|
||||
@@ -160,6 +_,7 @@
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
--- a/net/minecraft/Util.java
|
||||
+++ b/net/minecraft/Util.java
|
||||
@@ -158,6 +_,9 @@
|
||||
return 255;
|
||||
@@ -127,6 +_,9 @@
|
||||
return executorservice;
|
||||
}
|
||||
|
||||
+ // We add this inner class to compensate for Mojang's missing inner class and allow us to obf subsequent anon inner classes correctly.
|
||||
+ @SuppressWarnings("unused") private static LongSupplier INNER_CLASS_SHIFT = new LongSupplier() { public long getAsLong() { return 0; } };
|
||||
+
|
||||
public static ExecutorService m_183988_() {
|
||||
public static Executor m_137577_() {
|
||||
return f_137443_;
|
||||
}
|
||||
@@ -236,7 +_,7 @@
|
||||
@@ -205,7 +_,7 @@
|
||||
try {
|
||||
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().getWorldVersion())).getChoiceType(p_137552_, p_137553_);
|
||||
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_136187_().getWorldVersion())).getChoiceType(p_137552_, p_137553_);
|
||||
} catch (IllegalArgumentException illegalargumentexception) {
|
||||
- f_137446_.error("No data fixer registered for {}", (Object)p_137553_);
|
||||
+ f_137446_.debug("No data fixer registered for {}", (Object)p_137553_);
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
--- a/net/minecraft/advancements/Advancement.java
|
||||
+++ b/net/minecraft/advancements/Advancement.java
|
||||
@@ -129,8 +_,8 @@
|
||||
@@ -127,7 +_,7 @@
|
||||
return this.f_138305_;
|
||||
}
|
||||
|
||||
- public static class Builder {
|
||||
@Nullable
|
||||
+ public static class Builder implements net.minecraftforge.common.extensions.IForgeAdvancementBuilder {
|
||||
private ResourceLocation f_138332_;
|
||||
@Nullable
|
||||
private Advancement f_138333_;
|
||||
@@ -321,6 +_,7 @@
|
||||
private DisplayInfo f_138334_;
|
||||
@@ -311,6 +_,7 @@
|
||||
}
|
||||
|
||||
public static Advancement.Builder m_138380_(JsonObject p_138381_, DeserializationContext p_138382_) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/advancements/AdvancementList.java
|
||||
+++ b/net/minecraft/advancements/AdvancementList.java
|
||||
@@ -91,6 +_,7 @@
|
||||
@@ -90,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
public void m_9989_(ServerPlayer p_9990_) {
|
||||
p_9990_.m_6756_(this.f_9979_);
|
||||
- LootContext lootcontext = (new LootContext.Builder(p_9990_.m_183503_())).m_78972_(LootContextParams.f_81455_, p_9990_).m_78972_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_78977_(p_9990_.m_21187_()).m_78975_(LootContextParamSets.f_81418_);
|
||||
+ LootContext lootcontext = (new LootContext.Builder(p_9990_.m_183503_())).m_78972_(LootContextParams.f_81455_, p_9990_).m_78972_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_78977_(p_9990_.m_21187_()).m_78963_(p_9990_.m_36336_()).m_78975_(LootContextParamSets.f_81418_); // FORGE: luck to LootContext
|
||||
- LootContext lootcontext = (new LootContext.Builder(p_9990_.m_9236_())).m_78972_(LootContextParams.f_81455_, p_9990_).m_78972_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_78977_(p_9990_.m_21187_()).m_78975_(LootContextParamSets.f_81418_);
|
||||
+ LootContext lootcontext = (new LootContext.Builder(p_9990_.m_9236_())).m_78972_(LootContextParams.f_81455_, p_9990_).m_78972_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_78977_(p_9990_.m_21187_()).m_78963_(p_9990_.m_36336_()).m_78975_(LootContextParamSets.f_81418_); // FORGE: luck to LootContext
|
||||
boolean flag = false;
|
||||
|
||||
for(ResourceLocation resourcelocation : this.f_9980_) {
|
||||
@@ -5,6 +5,6 @@
|
||||
@DontObfuscate
|
||||
public static String m_129629_() {
|
||||
- return "vanilla";
|
||||
+ return net.minecraftforge.internal.BrandingControl.getClientBranding();
|
||||
+ return net.minecraftforge.fmllegacy.BrandingControl.getClientBranding();
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@
|
||||
|
||||
public boolean m_90864_() {
|
||||
- return this.f_90816_.equals(this.f_90814_);
|
||||
+ return this.f_90816_.equals(this.f_90814_) && getKeyModifier() == getDefaultKeyModifier();
|
||||
+ return this.f_90816_.equals(this.f_90814_) && getKeyModifier() == getKeyModifierDefault();
|
||||
}
|
||||
|
||||
public String m_90865_() {
|
||||
@@ -174,7 +174,7 @@
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraftforge.client.settings.KeyModifier getDefaultKeyModifier() {
|
||||
+ public net.minecraftforge.client.settings.KeyModifier getKeyModifierDefault() {
|
||||
+ return keyModifierDefault;
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
--- a/net/minecraft/client/KeyboardHandler.java
|
||||
+++ b/net/minecraft/client/KeyboardHandler.java
|
||||
@@ -307,7 +_,9 @@
|
||||
@@ -312,7 +_,9 @@
|
||||
}
|
||||
|
||||
Screen screen = this.f_90867_.f_91080_;
|
||||
- if (p_90897_ == 1 && (!(this.f_90867_.f_91080_ instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).f_193976_ <= Util.m_137550_() - 20L)) {
|
||||
- if (p_90897_ == 1 && (!(this.f_90867_.f_91080_ instanceof ControlsScreen) || ((ControlsScreen)screen).f_97515_ <= Util.m_137550_() - 20L)) {
|
||||
+
|
||||
+ if ((!(this.f_90867_.f_91080_ instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).f_193976_ <= Util.m_137550_() - 20L)) {
|
||||
+ if ((!(this.f_90867_.f_91080_ instanceof ControlsScreen) || ((ControlsScreen)screen).f_97515_ <= Util.m_137550_() - 20L)) {
|
||||
+ if (p_90897_ == 1) {
|
||||
if (this.f_90867_.f_91066_.f_92105_.m_90832_(p_90895_, p_90896_)) {
|
||||
this.f_90867_.m_91268_().m_85438_();
|
||||
this.f_90867_.f_91066_.f_92052_ = this.f_90867_.m_91268_().m_85440_();
|
||||
@@ -326,6 +_,8 @@
|
||||
@@ -331,6 +_,8 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
+ } else if (p_90897_ == 0 /*GLFW_RELEASE*/ && this.f_90867_.f_91080_ instanceof KeyBindsScreen)
|
||||
+ ((KeyBindsScreen)this.f_90867_.f_91080_).f_193975_ = null; //Forge: Unset pure modifiers.
|
||||
+ } else if (p_90897_ == 0 /*GLFW_RELEASE*/ && this.f_90867_.f_91080_ instanceof ControlsScreen)
|
||||
+ ((ControlsScreen)this.f_90867_.f_91080_).f_97514_ = null; //Forge: Unset pure modifiers.
|
||||
}
|
||||
|
||||
if (NarratorChatListener.f_93311_.m_93316_()) {
|
||||
@@ -349,11 +_,15 @@
|
||||
@@ -354,11 +_,15 @@
|
||||
Screen.m_96579_(() -> {
|
||||
if (p_90897_ != 1 && (p_90897_ != 2 || !this.f_90868_)) {
|
||||
if (p_90897_ == 0) {
|
||||
- aboolean[0] = screen.m_7920_(p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPre(this.f_90867_.f_91080_, p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPre(this.f_90867_.f_91080_, 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] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPost(this.f_90867_.f_91080_, p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyReleasedPost(this.f_90867_.f_91080_, p_90895_, p_90896_, p_90898_);
|
||||
}
|
||||
} else {
|
||||
screen.m_169416_();
|
||||
- aboolean[0] = screen.m_7933_(p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPre(this.f_90867_.f_91080_, p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPre(this.f_90867_.f_91080_, 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] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPost(this.f_90867_.f_91080_, p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPost(this.f_90867_.f_91080_, p_90895_, p_90896_, p_90898_);
|
||||
}
|
||||
|
||||
}, "keyPressed event handler", screen.getClass().getCanonicalName());
|
||||
@@ -406,7 +_,7 @@
|
||||
@@ -411,7 +_,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,22 +47,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,12 +_,16 @@
|
||||
@@ -421,12 +_,16 @@
|
||||
if (guieventlistener != null && this.f_90867_.m_91265_() == null) {
|
||||
if (Character.charCount(p_90891_) == 1) {
|
||||
Screen.m_96579_(() -> {
|
||||
- guieventlistener.m_5534_((char)p_90891_, p_90892_);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(this.f_90867_.f_91080_, (char)p_90891_, p_90892_)) return;
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.f_90867_.f_91080_, (char)p_90891_, p_90892_)) return;
|
||||
+ if (guieventlistener.m_5534_((char)p_90891_, p_90892_)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(this.f_90867_.f_91080_, (char)p_90891_, p_90892_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.f_90867_.f_91080_, (char)p_90891_, p_90892_);
|
||||
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
|
||||
} else {
|
||||
for(char c0 : Character.toChars(p_90891_)) {
|
||||
Screen.m_96579_(() -> {
|
||||
- guieventlistener.m_5534_(c0, p_90892_);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(this.f_90867_.f_91080_, c0, p_90892_)) return;
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPre(this.f_90867_.f_91080_, c0, p_90892_)) return;
|
||||
+ if (guieventlistener.m_5534_(c0, p_90892_)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(this.f_90867_.f_91080_, c0, p_90892_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.f_90867_.f_91080_, c0, p_90892_);
|
||||
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/client/Minecraft.java
|
||||
+++ b/net/minecraft/client/Minecraft.java
|
||||
@@ -254,7 +_,7 @@
|
||||
@@ -257,7 +_,7 @@
|
||||
import org.lwjgl.util.tinyfd.TinyFileDialogs;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-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 SnooperPopulator, WindowEventHandler {
|
||||
+public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements SnooperPopulator, WindowEventHandler, net.minecraftforge.client.extensions.IForgeMinecraft {
|
||||
private static Minecraft f_90981_;
|
||||
private static final Logger f_90982_ = LogManager.getLogger();
|
||||
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
|
||||
@@ -394,14 +_,13 @@
|
||||
@@ -397,14 +_,13 @@
|
||||
this.f_91029_ = p_91084_.f_101908_.f_101928_;
|
||||
this.f_90986_ = p_91084_.f_101905_.f_101944_;
|
||||
this.f_91037_ = new ClientPackSource(new File(this.f_91069_, "server-resource-packs"), p_91084_.f_101907_.m_101925_());
|
||||
@@ -18,14 +18,14 @@
|
||||
this.f_91030_ = p_91084_.f_101905_.f_101945_;
|
||||
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.f_91030_);
|
||||
this.f_91048_ = yggdrasilauthenticationservice.createMinecraftSessionService();
|
||||
this.f_193584_ = this.m_193585_(yggdrasilauthenticationservice, p_91084_);
|
||||
this.f_91049_ = this.m_91130_(yggdrasilauthenticationservice, p_91084_);
|
||||
this.f_90998_ = p_91084_.f_101905_.f_101942_;
|
||||
f_90982_.info("Setting user: {}", (Object)this.f_90998_.m_92546_());
|
||||
- f_90982_.debug("(Session ID is {})", (Object)this.f_90998_.m_92544_());
|
||||
this.f_91033_ = p_91084_.f_101908_.f_101926_;
|
||||
this.f_91034_ = !p_91084_.f_101908_.f_101929_;
|
||||
this.f_91035_ = !p_91084_.f_101908_.f_101930_;
|
||||
@@ -433,6 +_,7 @@
|
||||
@@ -436,6 +_,7 @@
|
||||
}
|
||||
|
||||
Util.f_137440_ = RenderSystem.m_69576_();
|
||||
@@ -33,7 +33,7 @@
|
||||
this.f_90989_ = new VirtualScreen(this);
|
||||
this.f_90990_ = this.f_90989_.m_110872_(displaydata, this.f_91066_.f_92123_, this.m_91270_());
|
||||
this.m_7440_(true);
|
||||
@@ -448,7 +_,6 @@
|
||||
@@ -450,7 +_,6 @@
|
||||
|
||||
this.f_90990_.m_85380_(this.f_91066_.f_92113_);
|
||||
this.f_91067_ = new MouseHandler(this);
|
||||
@@ -41,15 +41,15 @@
|
||||
this.f_91068_ = new KeyboardHandler(this);
|
||||
this.f_91068_.m_90887_(this.f_90990_.m_85439_());
|
||||
RenderSystem.m_69580_(this.f_91066_.f_92035_, false);
|
||||
@@ -456,6 +_,7 @@
|
||||
@@ -458,6 +_,7 @@
|
||||
this.f_91042_.m_83931_(0.0F, 0.0F, 0.0F, 0.0F);
|
||||
this.f_91042_.m_83954_(f_91002_);
|
||||
this.f_91036_ = new SimpleReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.f_91038_, this.f_91036_, this.f_91037_);
|
||||
+ net.minecraftforge.fmlclient.ClientModLoader.begin(this, this.f_91038_, this.f_91036_, this.f_91037_);
|
||||
this.f_91038_.m_10506_();
|
||||
this.f_91066_.m_92145_(this.f_91038_);
|
||||
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_);
|
||||
@@ -504,6 +_,7 @@
|
||||
@@ -506,6 +_,7 @@
|
||||
this.m_91271_();
|
||||
this.f_91036_.m_7217_(this.f_90997_);
|
||||
this.f_91061_ = new ParticleEngine(this.f_91073_, this.f_90987_);
|
||||
@@ -57,7 +57,7 @@
|
||||
this.f_91036_.m_7217_(this.f_91061_);
|
||||
this.f_91053_ = new PaintingTextureManager(this.f_90987_);
|
||||
this.f_91036_.m_7217_(this.f_91053_);
|
||||
@@ -511,7 +_,8 @@
|
||||
@@ -513,7 +_,8 @@
|
||||
this.f_91036_.m_7217_(this.f_91054_);
|
||||
this.f_91047_ = new GpuWarnlistManager();
|
||||
this.f_91036_.m_7217_(this.f_91047_);
|
||||
@@ -67,7 +67,7 @@
|
||||
this.f_91064_ = new DebugRenderer(this);
|
||||
RenderSystem.m_69900_(this::m_91113_);
|
||||
if (this.f_91042_.f_83915_ == this.f_90990_.m_85441_() && this.f_91042_.f_83916_ == this.f_90990_.m_85442_()) {
|
||||
@@ -529,6 +_,10 @@
|
||||
@@ -531,6 +_,10 @@
|
||||
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
|
||||
}
|
||||
|
||||
@@ -78,11 +78,11 @@
|
||||
this.f_90990_.m_85409_(this.f_91066_.f_92041_);
|
||||
this.f_90990_.m_85424_(this.f_91066_.f_92034_);
|
||||
this.f_90990_.m_85426_();
|
||||
@@ -544,13 +_,16 @@
|
||||
@@ -546,13 +_,16 @@
|
||||
}
|
||||
|
||||
this.f_167847_.m_168556_();
|
||||
+ if (net.minecraftforge.client.loading.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen
|
||||
+ if (net.minecraftforge.fmlclient.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen
|
||||
+ // FORGE: Move opening initial screen to after startup and events are enabled.
|
||||
+ // Also Fixes MC-145102
|
||||
+ if (s != null) {
|
||||
@@ -100,16 +100,16 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -585,6 +_,8 @@
|
||||
@@ -587,6 +_,8 @@
|
||||
|
||||
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
||||
private SocialInteractionsService m_91130_(YggdrasilAuthenticationService p_91131_, GameConfig p_91132_) {
|
||||
try {
|
||||
+ if ("0".equals(p_193587_.f_101905_.f_101942_.m_92547_())) // Forge: We use "0" in dev. Short circuit to stop exception spam.
|
||||
+ return UserApiService.OFFLINE;
|
||||
return p_193586_.createUserApiService(p_193587_.f_101905_.f_101942_.m_92547_());
|
||||
+ if ("0".equals(p_91132_.f_101905_.f_101942_.m_92547_())) // Forge: We use "0" in dev. Short circuit to stop exception spam.
|
||||
+ return new OfflineSocialInteractions();
|
||||
return p_91131_.createSocialInteractionsService(p_91132_.f_101905_.f_101942_.m_92547_());
|
||||
} catch (AuthenticationException authenticationexception) {
|
||||
f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception);
|
||||
@@ -597,7 +_,7 @@
|
||||
@@ -599,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void m_91239_(Throwable p_91240_) {
|
||||
@@ -118,7 +118,7 @@
|
||||
Component component;
|
||||
if (p_91240_ instanceof SimpleReloadableResourceManager.ResourcePackLoadingFailure) {
|
||||
component = new TextComponent(((SimpleReloadableResourceManager.ResourcePackLoadingFailure)p_91240_).m_10921_().m_8017_());
|
||||
@@ -691,7 +_,7 @@
|
||||
@@ -690,7 +_,7 @@
|
||||
return Stream.of(Registry.f_122827_.m_7981_(p_91317_.m_41720_()));
|
||||
});
|
||||
ReloadableIdSearchTree<ItemStack> reloadableidsearchtree = new ReloadableIdSearchTree<>((p_91121_) -> {
|
||||
@@ -127,24 +127,24 @@
|
||||
});
|
||||
NonNullList<ItemStack> nonnulllist = NonNullList.m_122779_();
|
||||
|
||||
@@ -761,13 +_,13 @@
|
||||
@@ -760,13 +_,13 @@
|
||||
Bootstrap.m_135875_(p_91333_.m_127526_());
|
||||
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);
|
||||
+ net.minecraftforge.fmllegacy.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);
|
||||
+ net.minecraftforge.fmllegacy.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);
|
||||
+ net.minecraftforge.fmllegacy.server.ServerLifecycleHooks.handleExit(-2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -877,10 +_,6 @@
|
||||
@@ -876,10 +_,6 @@
|
||||
f_90982_.error("setScreen called from non-game thread");
|
||||
}
|
||||
|
||||
@@ -155,37 +155,37 @@
|
||||
if (p_91153_ == null && this.f_91073_ == null) {
|
||||
p_91153_ = new TitleScreen();
|
||||
} else if (p_91153_ == null && this.f_91074_.m_21224_()) {
|
||||
@@ -891,6 +_,15 @@
|
||||
@@ -890,6 +_,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
|
||||
+ Screen old = this.f_91080_;
|
||||
+ net.minecraftforge.client.event.ScreenOpenEvent event = new net.minecraftforge.client.event.ScreenOpenEvent(p_91153_);
|
||||
+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(p_91153_);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
|
||||
+
|
||||
+ p_91153_ = event.getScreen();
|
||||
+ p_91153_ = event.getGui();
|
||||
+ if (old != null && p_91153_ != old)
|
||||
+ old.m_7861_();
|
||||
+
|
||||
this.f_91080_ = p_91153_;
|
||||
BufferUploader.m_166835_();
|
||||
if (p_91153_ != null) {
|
||||
@@ -1019,11 +_,13 @@
|
||||
@@ -1018,11 +_,13 @@
|
||||
RenderSystem.m_69481_();
|
||||
this.f_91026_.m_7238_();
|
||||
if (!this.f_91079_) {
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_);
|
||||
+ net.minecraftforge.fmllegacy.hooks.BasicEventHooks.onRenderTickStart(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_);
|
||||
this.f_91026_.m_6182_("gameRenderer");
|
||||
this.f_91063_.m_109093_(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_, i, p_91384_);
|
||||
this.f_91026_.m_6182_("toasts");
|
||||
this.f_91003_.m_94920_(new PoseStack());
|
||||
this.f_91026_.m_7238_();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_);
|
||||
+ net.minecraftforge.fmllegacy.hooks.BasicEventHooks.onRenderTickEnd(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_);
|
||||
}
|
||||
|
||||
if (this.f_91056_ != null) {
|
||||
@@ -1129,10 +_,12 @@
|
||||
@@ -1132,10 +_,12 @@
|
||||
this.f_90990_.m_85378_((double)i);
|
||||
if (this.f_91080_ != null) {
|
||||
this.f_91080_.m_6574_(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_());
|
||||
@@ -198,7 +198,7 @@
|
||||
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
|
||||
this.f_91067_.m_91599_();
|
||||
}
|
||||
@@ -1429,11 +_,21 @@
|
||||
@@ -1432,11 +_,21 @@
|
||||
if (p_91387_ && this.f_91077_ != null && this.f_91077_.m_6662_() == HitResult.Type.BLOCK) {
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
||||
BlockPos blockpos = blockhitresult.m_82425_();
|
||||
@@ -222,7 +222,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1452,6 +_,8 @@
|
||||
@@ -1455,6 +_,8 @@
|
||||
}
|
||||
|
||||
} else if (!this.f_91074_.m_108637_()) {
|
||||
@@ -231,7 +231,7 @@
|
||||
switch(this.f_91077_.m_6662_()) {
|
||||
case ENTITY:
|
||||
this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_());
|
||||
@@ -1459,7 +_,7 @@
|
||||
@@ -1462,7 +_,7 @@
|
||||
case BLOCK:
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
||||
BlockPos blockpos = blockhitresult.m_82425_();
|
||||
@@ -240,7 +240,7 @@
|
||||
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_());
|
||||
break;
|
||||
}
|
||||
@@ -1469,8 +_,10 @@
|
||||
@@ -1472,8 +_,10 @@
|
||||
}
|
||||
|
||||
this.f_91074_.m_36334_();
|
||||
@@ -251,7 +251,7 @@
|
||||
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
@@ -1485,6 +_,11 @@
|
||||
@@ -1488,6 +_,11 @@
|
||||
}
|
||||
|
||||
for(InteractionHand interactionhand : InteractionHand.values()) {
|
||||
@@ -263,7 +263,7 @@
|
||||
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
|
||||
if (this.f_91077_ != null) {
|
||||
switch(this.f_91077_.m_6662_()) {
|
||||
@@ -1502,6 +_,7 @@
|
||||
@@ -1501,6 +_,7 @@
|
||||
|
||||
if (interactionresult.m_19077_()) {
|
||||
if (interactionresult.m_19080_()) {
|
||||
@@ -271,7 +271,7 @@
|
||||
this.f_91074_.m_6674_(interactionhand);
|
||||
}
|
||||
|
||||
@@ -1514,6 +_,7 @@
|
||||
@@ -1513,6 +_,7 @@
|
||||
InteractionResult interactionresult1 = this.f_91072_.m_105262_(this.f_91074_, this.f_91073_, interactionhand, blockhitresult);
|
||||
if (interactionresult1.m_19077_()) {
|
||||
if (interactionresult1.m_19080_()) {
|
||||
@@ -279,7 +279,7 @@
|
||||
this.f_91074_.m_6674_(interactionhand);
|
||||
if (!itemstack.m_41619_() && (itemstack.m_41613_() != i || this.f_91072_.m_105290_())) {
|
||||
this.f_91063_.f_109055_.m_109320_(interactionhand);
|
||||
@@ -1529,6 +_,9 @@
|
||||
@@ -1528,6 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,25 +289,25 @@
|
||||
if (!itemstack.m_41619_()) {
|
||||
InteractionResult interactionresult2 = this.f_91072_.m_105235_(this.f_91074_, this.f_91073_, interactionhand);
|
||||
if (interactionresult2.m_19077_()) {
|
||||
@@ -1555,6 +_,8 @@
|
||||
@@ -1554,6 +_,8 @@
|
||||
--this.f_91011_;
|
||||
}
|
||||
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
|
||||
+ net.minecraftforge.fmllegacy.hooks.BasicEventHooks.onPreClientTick();
|
||||
+
|
||||
this.f_91026_.m_6180_("gui");
|
||||
this.f_91065_.m_193832_(this.f_91012_);
|
||||
this.f_91026_.m_7238_();
|
||||
@@ -1683,6 +_,8 @@
|
||||
if (!this.f_91012_) {
|
||||
this.f_91065_.m_93066_();
|
||||
@@ -1679,6 +_,8 @@
|
||||
this.f_91026_.m_6182_("keyboard");
|
||||
this.f_91068_.m_90931_();
|
||||
this.f_91026_.m_7238_();
|
||||
+
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPostClientTick();
|
||||
+ net.minecraftforge.fmllegacy.hooks.BasicEventHooks.onPostClientTick();
|
||||
}
|
||||
|
||||
private boolean m_91278_() {
|
||||
@@ -1821,11 +_,11 @@
|
||||
@@ -1814,11 +_,11 @@
|
||||
}
|
||||
|
||||
public void m_91200_(String p_91201_) {
|
||||
@@ -321,7 +321,7 @@
|
||||
return p_91204_.m_46934_();
|
||||
}, (p_167886_, p_167887_, p_167888_, p_167889_) -> {
|
||||
RegistryWriteOps<JsonElement> registrywriteops = RegistryWriteOps.m_135767_(JsonOps.INSTANCE, p_91205_);
|
||||
@@ -1835,10 +_,10 @@
|
||||
@@ -1828,10 +_,10 @@
|
||||
});
|
||||
WorldGenSettings worldgensettings = dataresult.resultOrPartial(Util.m_137489_("Error reading worldgen settings after loading data packs: ", f_90982_::error)).orElse(p_91206_);
|
||||
return new PrimaryLevelData(p_91204_, worldgensettings, dataresult.lifecycle());
|
||||
@@ -334,7 +334,7 @@
|
||||
LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess;
|
||||
try {
|
||||
levelstoragesource$levelstorageaccess = this.f_91031_.m_78260_(p_91220_);
|
||||
@@ -1850,12 +_,17 @@
|
||||
@@ -1843,12 +_,17 @@
|
||||
}
|
||||
|
||||
Minecraft.ServerStem minecraft$serverstem;
|
||||
@@ -354,7 +354,7 @@
|
||||
}));
|
||||
|
||||
try {
|
||||
@@ -1875,7 +_,7 @@
|
||||
@@ -1868,7 +_,7 @@
|
||||
this.f_90999_.set((StoringChunkProgressListener)null);
|
||||
|
||||
try {
|
||||
@@ -363,8 +363,8 @@
|
||||
minecraft$serverstem.m_91433_().m_136179_();
|
||||
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.f_91030_);
|
||||
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
|
||||
@@ -1885,7 +_,7 @@
|
||||
SkullBlockEntity.m_196700_(gameprofilecache, minecraftsessionservice, this);
|
||||
@@ -1880,7 +_,7 @@
|
||||
SkullBlockEntity.m_182462_(this);
|
||||
GameProfileCache.m_11004_(false);
|
||||
this.f_91007_ = MinecraftServer.m_129872_((p_167898_) -> {
|
||||
- return new IntegratedServer(p_167898_, this, p_91221_, levelstoragesource$levelstorageaccess, minecraft$serverstem.m_91432_(), minecraft$serverstem.m_91433_(), worlddata, minecraftsessionservice, gameprofilerepository, gameprofilecache, (p_168000_) -> {
|
||||
@@ -372,7 +372,7 @@
|
||||
StoringChunkProgressListener storingchunkprogresslistener = new StoringChunkProgressListener(p_168000_ + 0);
|
||||
this.f_90999_.set(storingchunkprogresslistener);
|
||||
return ProcessorChunkProgressListener.m_143583_(storingchunkprogresslistener, this.f_91023_::add);
|
||||
@@ -1929,11 +_,16 @@
|
||||
@@ -1924,11 +_,16 @@
|
||||
connection.m_129505_(new ClientHandshakePacketListenerImpl(connection, this, (Screen)null, (p_167998_) -> {
|
||||
}));
|
||||
connection.m_129512_(new ClientIntentionPacket(socketaddress.toString(), 0, ConnectionProtocol.LOGIN));
|
||||
@@ -391,7 +391,7 @@
|
||||
});
|
||||
minecraft$serverstem.close();
|
||||
|
||||
@@ -2021,6 +_,7 @@
|
||||
@@ -2016,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_91156_(ClientLevel p_91157_) {
|
||||
@@ -399,7 +399,7 @@
|
||||
ProgressScreen progressscreen = new ProgressScreen(true);
|
||||
progressscreen.m_6309_(new TranslatableComponent("connect.joining"));
|
||||
this.m_91362_(progressscreen);
|
||||
@@ -2053,10 +_,12 @@
|
||||
@@ -2049,10 +_,12 @@
|
||||
IntegratedServer integratedserver = this.f_91007_;
|
||||
this.f_91007_ = null;
|
||||
this.f_91063_.m_109150_();
|
||||
@@ -412,15 +412,23 @@
|
||||
if (integratedserver != null) {
|
||||
this.f_91026_.m_6180_("waitForServer");
|
||||
|
||||
@@ -2071,6 +_,7 @@
|
||||
@@ -2067,6 +_,7 @@
|
||||
this.f_91065_.m_93089_();
|
||||
this.f_91008_ = null;
|
||||
this.f_91010_ = false;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(f_91073_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.handleClientWorldClosing(f_91073_);
|
||||
this.f_91004_.m_90740_();
|
||||
}
|
||||
|
||||
@@ -2157,66 +_,9 @@
|
||||
@@ -2097,6 +_,7 @@
|
||||
this.f_91061_.m_107342_(p_91325_);
|
||||
this.f_167845_.m_112257_(p_91325_);
|
||||
this.m_91341_();
|
||||
+ net.minecraftforge.client.MinecraftForgeClient.clearRenderCache();
|
||||
}
|
||||
|
||||
public boolean m_91400_() {
|
||||
@@ -2152,66 +_,9 @@
|
||||
|
||||
private void m_91280_() {
|
||||
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
|
||||
@@ -490,7 +498,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2707,7 +_,7 @@
|
||||
@@ -2768,7 +_,7 @@
|
||||
return this.f_90993_;
|
||||
}
|
||||
|
||||
@@ -499,7 +507,7 @@
|
||||
int i = p_167938_.m_10374_();
|
||||
Supplier<PackResources> supplier = p_167937_;
|
||||
if (i <= 3) {
|
||||
@@ -2718,7 +_,7 @@
|
||||
@@ -2779,7 +_,7 @@
|
||||
supplier = m_91352_(supplier);
|
||||
}
|
||||
|
||||
@@ -508,7 +516,7 @@
|
||||
}
|
||||
|
||||
private static Supplier<PackResources> m_91330_(Supplier<PackResources> p_91331_) {
|
||||
@@ -2735,6 +_,14 @@
|
||||
@@ -2796,6 +_,14 @@
|
||||
|
||||
public void m_91312_(int p_91313_) {
|
||||
this.f_91051_.m_119410_(p_91313_);
|
||||
|
||||
@@ -13,19 +13,19 @@
|
||||
screen.m_169415_();
|
||||
Screen.m_96579_(() -> {
|
||||
- aboolean[0] = screen.m_6375_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseClickedPre(this.f_91503_.f_91080_, d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPre(this.f_91503_.f_91080_, d0, d1, i);
|
||||
+ if (!aboolean[0]) {
|
||||
+ aboolean[0] = this.f_91503_.f_91080_.m_6375_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseClickedPost(this.f_91503_.f_91080_, d0, d1, i, aboolean[0]);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPost(this.f_91503_.f_91080_, d0, d1, i, aboolean[0]);
|
||||
+ }
|
||||
}, "mouseClicked event handler", screen.getClass().getCanonicalName());
|
||||
} else {
|
||||
Screen.m_96579_(() -> {
|
||||
- aboolean[0] = screen.m_6348_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseReleasedPre(this.f_91503_.f_91080_, d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPre(this.f_91503_.f_91080_, d0, d1, i);
|
||||
+ if (!aboolean[0]) {
|
||||
+ aboolean[0] = this.f_91503_.f_91080_.m_6348_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseReleasedPost(this.f_91503_.f_91080_, d0, d1, i, aboolean[0]);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPost(this.f_91503_.f_91080_, d0, d1, i, aboolean[0]);
|
||||
+ }
|
||||
}, "mouseReleased event handler", screen.getClass().getCanonicalName());
|
||||
}
|
||||
@@ -54,9 +54,9 @@
|
||||
double d2 = this.f_91508_ * (double)this.f_91503_.m_91268_().m_85446_() / (double)this.f_91503_.m_91268_().m_85444_();
|
||||
- this.f_91503_.f_91080_.m_6050_(d1, d2, d0);
|
||||
this.f_91503_.f_91080_.m_169415_();
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenMouseScrollPre(this, this.f_91503_.f_91080_, d0)) return;
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPre(this, this.f_91503_.f_91080_, d0)) return;
|
||||
+ if (this.f_91503_.f_91080_.m_6050_(d1, d2, d0)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseScrollPost(this, this.f_91503_.f_91080_, d0);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPost(this, this.f_91503_.f_91080_, d0);
|
||||
} else if (this.f_91503_.f_91074_ != null) {
|
||||
if (this.f_91518_ != 0.0D && Math.signum(d0) != Math.signum(this.f_91518_)) {
|
||||
this.f_91518_ = 0.0D;
|
||||
@@ -73,9 +73,9 @@
|
||||
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(this.f_91503_.f_91080_, d0, d1, this.f_91510_, d2, d3)) return;
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPre(this.f_91503_.f_91080_, 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(this.f_91503_.f_91080_, d0, d1, this.f_91510_, d2, d3);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseDragPost(this.f_91503_.f_91080_, d0, d1, this.f_91510_, d2, d3);
|
||||
}, "mouseDragged event handler", screen.getClass().getCanonicalName());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/Options.java
|
||||
+++ b/net/minecraft/client/Options.java
|
||||
@@ -187,6 +_,7 @@
|
||||
@@ -179,6 +_,7 @@
|
||||
public boolean f_92076_;
|
||||
|
||||
public Options(Minecraft p_92138_, File p_92139_) {
|
||||
@@ -8,8 +8,8 @@
|
||||
this.f_92060_ = p_92138_;
|
||||
this.f_92110_ = new File(p_92139_, "options.txt");
|
||||
if (p_92138_.m_91103_() && Runtime.getRuntime().maxMemory() >= 1000000000L) {
|
||||
@@ -300,10 +_,14 @@
|
||||
this.f_193762_ = p_168428_.m_142682_("allowServerListing", this.f_193762_);
|
||||
@@ -283,10 +_,14 @@
|
||||
this.f_92076_ = p_168428_.m_142682_("syncChunkWrites", this.f_92076_);
|
||||
|
||||
for(KeyMapping keymapping : this.f_92059_) {
|
||||
- String s = keymapping.m_90865_();
|
||||
@@ -25,15 +25,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,6 +_,7 @@
|
||||
@@ -474,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_92169_() {
|
||||
+ 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.fmlclient.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
|
||||
try {
|
||||
final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.f_92110_), StandardCharsets.UTF_8));
|
||||
|
||||
@@ -639,6 +_,23 @@
|
||||
@@ -622,6 +_,23 @@
|
||||
}
|
||||
|
||||
p_92146_.m_10509_(set);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
+ }
|
||||
+ final File target = event.getScreenshotFile();
|
||||
+
|
||||
Util.m_183992_().execute(() -> {
|
||||
Util.m_137579_().execute(() -> {
|
||||
try {
|
||||
- nativeimage.m_85056_(file2);
|
||||
+ nativeimage.m_85056_(target);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
--- 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_;
|
||||
@@ -18,8 +_,22 @@
|
||||
private final String f_92536_;
|
||||
private final String f_92537_;
|
||||
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";
|
||||
public User(String p_92540_, String p_92541_, String p_92542_, String p_92543_) {
|
||||
+ if (p_92540_ == null || p_92540_.isEmpty()) {
|
||||
+ p_92540_ = "MissingName";
|
||||
+ p_92541_ = p_92542_ = "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");
|
||||
@@ -20,10 +20,10 @@
|
||||
+ logger.warn("when asking for help!");
|
||||
+ logger.warn("=========================================================");
|
||||
+ }
|
||||
this.f_92535_ = p_193799_;
|
||||
this.f_92536_ = p_193800_;
|
||||
this.f_92537_ = p_193801_;
|
||||
@@ -58,10 +_,22 @@
|
||||
this.f_92535_ = p_92540_;
|
||||
this.f_92536_ = p_92541_;
|
||||
this.f_92537_ = p_92542_;
|
||||
@@ -45,10 +_,22 @@
|
||||
public GameProfile m_92548_() {
|
||||
try {
|
||||
UUID uuid = UUIDTypeAdapter.fromString(this.m_92545_());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/Gui.java
|
||||
+++ b/net/minecraft/client/gui/Gui.java
|
||||
@@ -463,6 +_,10 @@
|
||||
@@ -446,6 +_,10 @@
|
||||
|
||||
for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
|
||||
MobEffect mobeffect = mobeffectinstance.m_19544_();
|
||||
@@ -9,17 +9,17 @@
|
||||
+ // Rebind in case previous renderHUDEffect changed texture
|
||||
+ RenderSystem.m_157456_(0, AbstractContainerScreen.f_97725_);
|
||||
if (mobeffectinstance.m_19575_()) {
|
||||
int i = this.f_92977_;
|
||||
int j = 1;
|
||||
@@ -500,6 +_,7 @@
|
||||
int k = this.f_92977_;
|
||||
int l = 1;
|
||||
@@ -483,6 +_,7 @@
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, f1);
|
||||
m_93200_(p_93029_, l + 3, i1 + 3, this.m_93252_(), 18, 18, textureatlassprite);
|
||||
m_93200_(p_93029_, j1 + 3, k1 + 3, this.m_93252_(), 18, 18, textureatlassprite);
|
||||
});
|
||||
+ renderer.renderHUDEffect(mobeffectinstance,this, p_93029_, i, j, this.m_93252_(), f);
|
||||
+ renderer.renderHUDEffect(mobeffectinstance,this, p_93029_, k, l, this.m_93252_(), f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,7 +_,8 @@
|
||||
@@ -608,7 +_,8 @@
|
||||
mutablecomponent.m_130940_(ChatFormatting.ITALIC);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
int j = (this.f_92977_ - i) / 2;
|
||||
int k = this.f_92978_ - 59;
|
||||
if (!this.f_92986_.f_91072_.m_105205_()) {
|
||||
@@ -641,7 +_,13 @@
|
||||
@@ -624,7 +_,13 @@
|
||||
RenderSystem.m_69478_();
|
||||
RenderSystem.m_69453_();
|
||||
m_93172_(p_93070_, j - 2, k - 2, j + i + 2, k + 9 + 2, this.f_92986_.f_91066_.m_92143_(0));
|
||||
@@ -44,7 +44,7 @@
|
||||
RenderSystem.m_69461_();
|
||||
}
|
||||
}
|
||||
@@ -1153,7 +_,7 @@
|
||||
@@ -1128,7 +_,7 @@
|
||||
ItemStack itemstack = this.f_92986_.f_91074_.m_150109_().m_36056_();
|
||||
if (itemstack.m_41619_()) {
|
||||
this.f_92993_ = 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/MapRenderer.java
|
||||
+++ b/net/minecraft/client/gui/MapRenderer.java
|
||||
@@ -118,6 +_,7 @@
|
||||
@@ -123,6 +_,7 @@
|
||||
|
||||
for(MapDecoration mapdecoration : this.f_93280_.m_164811_()) {
|
||||
if (!p_93294_ || mapdecoration.m_77809_()) {
|
||||
|
||||
+1
-1
@@ -13,4 +13,4 @@
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public abstract static class Entry<E extends AbstractSelectionList.Entry<E>> implements GuiEventListener {
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
@@ -5,7 +5,7 @@
|
||||
for(LerpingBossEvent lerpingbossevent : this.f_93699_.values()) {
|
||||
int k = i / 2 - 91;
|
||||
+ net.minecraftforge.client.event.RenderGameOverlayEvent.BossInfo event =
|
||||
+ net.minecraftforge.client.ForgeHooksClient.renderBossEventPre(p_93705_, this.f_93698_.m_91268_(), lerpingbossevent, k, j, 10 + this.f_93698_.f_91062_.f_92710_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPre(p_93705_, this.f_93698_.m_91268_(), lerpingbossevent, k, j, 10 + this.f_93698_.f_91062_.f_92710_);
|
||||
+ if (!event.isCanceled()) {
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.m_157456_(0, f_93697_);
|
||||
@@ -17,7 +17,7 @@
|
||||
- j += 10 + 9;
|
||||
+ }
|
||||
+ j += event.getIncrement();
|
||||
+ net.minecraftforge.client.ForgeHooksClient.renderBossEventPost(p_93705_, this.f_93698_.m_91268_());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPost(p_93705_, this.f_93698_.m_91268_());
|
||||
if (j >= this.f_93698_.m_91268_().m_85446_() / 3) {
|
||||
break;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/components/DebugScreenOverlay.java
|
||||
+++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java
|
||||
@@ -363,7 +_,7 @@
|
||||
@@ -354,7 +_,7 @@
|
||||
list.add(this.m_94071_(entry));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
list.add("#" + resourcelocation);
|
||||
}
|
||||
}
|
||||
@@ -379,7 +_,7 @@
|
||||
@@ -370,7 +_,7 @@
|
||||
list.add(this.m_94071_(entry1));
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
list.add("#" + resourcelocation1);
|
||||
}
|
||||
}
|
||||
@@ -389,6 +_,7 @@
|
||||
@@ -380,6 +_,7 @@
|
||||
list.add("");
|
||||
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
|
||||
list.add(String.valueOf((Object)Registry.f_122826_.m_7981_(entity.m_6095_())));
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
int k1 = (int)((double)this.f_96163_.m_91268_().m_85446_() * 0.8325D);
|
||||
float f6 = this.f_96164_.m_7750_();
|
||||
this.f_96167_ = Mth.m_14036_(this.f_96167_ * 0.95F + f6 * 0.050000012F, 0.0F, 1.0F);
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.renderProgressText();
|
||||
+ net.minecraftforge.fmlclient.ClientModLoader.renderProgressText();
|
||||
if (f < 1.0F) {
|
||||
this.m_96182_(p_96178_, i / 2 - j1, k1 - 5, i / 2 + j1, k1 + 5, 1.0F - Mth.m_14036_(f, 0.0F, 1.0F));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/OptionsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/OptionsScreen.java
|
||||
@@ -141,4 +_,12 @@
|
||||
@@ -134,4 +_,12 @@
|
||||
m_93215_(p_96249_, this.f_96547_, this.f_96539_, this.f_96543_ / 2, 15, 16777215);
|
||||
super.m_6305_(p_96249_, p_96250_, p_96251_, p_96252_);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/Screen.java
|
||||
+++ b/net/minecraft/client/gui/screens/Screen.java
|
||||
@@ -126,7 +_,7 @@
|
||||
@@ -125,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_7379_() {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
protected <T extends GuiEventListener & Widget & NarratableEntry> T m_142416_(T p_169406_) {
|
||||
@@ -163,15 +_,29 @@
|
||||
@@ -162,15 +_,29 @@
|
||||
this.f_169368_.clear();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
this.m_169383_(p_169389_, list, p_169392_, p_169393_);
|
||||
}
|
||||
|
||||
@@ -184,20 +_,44 @@
|
||||
@@ -183,20 +_,48 @@
|
||||
}
|
||||
|
||||
public void m_96597_(PoseStack p_96598_, List<Component> p_96599_, int p_96600_, int p_96601_) {
|
||||
@@ -57,7 +57,9 @@
|
||||
+ public void renderComponentTooltip(PoseStack poseStack, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, @Nullable Font font) {
|
||||
+ this.renderComponentTooltip(poseStack, tooltips, mouseX, mouseY, font, ItemStack.f_41583_);
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated(forRemoval = true, since = "1.17.1") public void renderComponentToolTip(PoseStack poseStack, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, @Nullable Font font) {
|
||||
+ renderComponentTooltip(poseStack, tooltips, mouseX, mouseY, font);
|
||||
+ }
|
||||
+ public void renderComponentTooltip(PoseStack poseStack, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, @Nullable Font font, ItemStack stack) {
|
||||
+ this.tooltipFont = font;
|
||||
+ this.tooltipStack = stack;
|
||||
@@ -70,27 +72,29 @@
|
||||
public void m_96617_(PoseStack p_96618_, List<? extends FormattedCharSequence> p_96619_, int p_96620_, int p_96621_) {
|
||||
this.m_169383_(p_96618_, p_96619_.stream().map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()), p_96620_, p_96621_);
|
||||
}
|
||||
|
||||
+ @Deprecated(forRemoval = true, since = "1.17.1") public void renderToolTip(PoseStack p_96618_, List<? extends FormattedCharSequence> p_96619_, int p_96620_, int p_96621_, Font font) {
|
||||
+ renderTooltip(p_96618_, p_96619_, p_96620_, p_96621_, font);
|
||||
+ }
|
||||
+ public void renderTooltip(PoseStack poseStack, List<? extends FormattedCharSequence> lines, int x, int y, Font font) {
|
||||
+ this.tooltipFont = font;
|
||||
+ this.m_96617_(poseStack, lines, x, y);
|
||||
+ this.tooltipFont = null;
|
||||
+ }
|
||||
+
|
||||
|
||||
private void m_169383_(PoseStack p_169384_, List<ClientTooltipComponent> p_169385_, int p_169386_, int p_169387_) {
|
||||
if (!p_169385_.isEmpty()) {
|
||||
+ net.minecraftforge.client.event.RenderTooltipEvent.Pre preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(this.tooltipStack, p_169384_, p_169386_, p_169387_, f_96543_, f_96544_, p_169385_, this.tooltipFont, this.f_96547_);
|
||||
+ net.minecraftforge.client.event.RenderTooltipEvent.Pre preEvent = net.minecraftforge.client.ForgeHooksClient.preTooltipEvent(this.tooltipStack, p_169384_, p_169386_, p_169387_, f_96543_, f_96544_, p_169385_, this.tooltipFont, this.f_96547_);
|
||||
+ if (preEvent.isCanceled()) return;
|
||||
int i = 0;
|
||||
int j = p_169385_.size() == 1 ? -2 : 0;
|
||||
|
||||
for(ClientTooltipComponent clienttooltipcomponent : p_169385_) {
|
||||
- int k = clienttooltipcomponent.m_142069_(this.f_96547_);
|
||||
+ int k = clienttooltipcomponent.m_142069_(preEvent.getFont());
|
||||
+ int k = clienttooltipcomponent.m_142069_(preEvent.getFontRenderer());
|
||||
if (k > i) {
|
||||
i = k;
|
||||
}
|
||||
@@ -205,8 +_,8 @@
|
||||
@@ -204,8 +_,8 @@
|
||||
j += clienttooltipcomponent.m_142103_();
|
||||
}
|
||||
|
||||
@@ -101,7 +105,7 @@
|
||||
if (j2 + i > this.f_96543_) {
|
||||
j2 -= 28 + i;
|
||||
}
|
||||
@@ -227,15 +_,16 @@
|
||||
@@ -226,15 +_,16 @@
|
||||
RenderSystem.m_157427_(GameRenderer::m_172811_);
|
||||
bufferbuilder.m_166779_(VertexFormat.Mode.QUADS, DefaultVertexFormat.f_85815_);
|
||||
Matrix4f matrix4f = p_169384_.m_85850_().m_85861_();
|
||||
@@ -114,7 +118,7 @@
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 + i + 2, k2 - 3 + 1, j2 + i + 3, k2 + j + 3 - 1, 400, 1347420415, 1344798847);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 - 3 + 1, 400, 1347420415, 1347420415);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 + j + 2, j2 + i + 3, k2 + j + 3, 400, 1344798847, 1344798847);
|
||||
+ net.minecraftforge.client.event.RenderTooltipEvent.Color colorEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipColor(this.tooltipStack, p_169384_, j2, k2, preEvent.getFont(), p_169385_);
|
||||
+ net.minecraftforge.client.event.RenderTooltipEvent.Color colorEvent = net.minecraftforge.client.ForgeHooksClient.colorTooltipEvent(this.tooltipStack, p_169384_, j2, k2, preEvent.getFontRenderer(), p_169385_);
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 4, j2 + i + 3, k2 - 3, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundStart());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 + j + 3, j2 + i + 3, k2 + j + 4, 400, colorEvent.getBackgroundEnd(), colorEvent.getBackgroundEnd());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 + j + 3, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd());
|
||||
@@ -127,25 +131,25 @@
|
||||
RenderSystem.m_69482_();
|
||||
RenderSystem.m_69472_();
|
||||
RenderSystem.m_69478_();
|
||||
@@ -250,7 +_,7 @@
|
||||
@@ -249,7 +_,7 @@
|
||||
|
||||
for(int i2 = 0; i2 < p_169385_.size(); ++i2) {
|
||||
ClientTooltipComponent clienttooltipcomponent1 = p_169385_.get(i2);
|
||||
- clienttooltipcomponent1.m_142440_(this.f_96547_, j2, l1, matrix4f, multibuffersource$buffersource);
|
||||
+ clienttooltipcomponent1.m_142440_(preEvent.getFont(), j2, l1, matrix4f, multibuffersource$buffersource);
|
||||
+ clienttooltipcomponent1.m_142440_(preEvent.getFontRenderer(), j2, l1, matrix4f, multibuffersource$buffersource);
|
||||
l1 += clienttooltipcomponent1.m_142103_() + (i2 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -260,7 +_,7 @@
|
||||
@@ -259,7 +_,7 @@
|
||||
|
||||
for(int l2 = 0; l2 < p_169385_.size(); ++l2) {
|
||||
ClientTooltipComponent clienttooltipcomponent2 = p_169385_.get(l2);
|
||||
- clienttooltipcomponent2.m_183452_(this.f_96547_, j2, l1, p_169384_, this.f_96542_, 400);
|
||||
+ clienttooltipcomponent2.m_183452_(preEvent.getFont(), j2, l1, p_169384_, this.f_96542_, 400);
|
||||
- clienttooltipcomponent2.m_142162_(this.f_96547_, j2, l1, p_169384_, this.f_96542_, 400, this.f_96541_.m_91097_());
|
||||
+ clienttooltipcomponent2.m_142162_(preEvent.getFontRenderer(), j2, l1, p_169384_, this.f_96542_, 400, this.f_96541_.m_91097_());
|
||||
l1 += clienttooltipcomponent2.m_142103_() + (l2 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -354,9 +_,12 @@
|
||||
@@ -353,9 +_,12 @@
|
||||
}
|
||||
|
||||
public void m_96612_(String p_96613_, boolean p_96614_) {
|
||||
@@ -158,7 +162,7 @@
|
||||
|
||||
this.f_96541_.f_91074_.m_108739_(p_96613_);
|
||||
}
|
||||
@@ -367,11 +_,21 @@
|
||||
@@ -366,11 +_,21 @@
|
||||
this.f_96547_ = p_96607_.f_91062_;
|
||||
this.f_96543_ = p_96608_;
|
||||
this.f_96544_ = p_96609_;
|
||||
@@ -169,34 +173,34 @@
|
||||
+ this.f_169368_.add(ne);
|
||||
+ f_96540_.add(b);
|
||||
+ };
|
||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.InitScreenEvent.Pre(this, this.f_96540_, add, this::m_169411_))) {
|
||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.f_96540_, add, this::m_169411_))) {
|
||||
this.m_169413_();
|
||||
this.m_7522_((GuiEventListener)null);
|
||||
this.m_7856_();
|
||||
this.m_169407_(false);
|
||||
this.m_169378_(f_169370_);
|
||||
+ }
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.InitScreenEvent.Post(this, this.f_96540_, add, this::m_169411_));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.f_96540_, add, this::m_169411_));
|
||||
}
|
||||
|
||||
public List<? extends GuiEventListener> m_6702_() {
|
||||
@@ -394,6 +_,7 @@
|
||||
@@ -393,6 +_,7 @@
|
||||
public void m_96558_(PoseStack p_96559_, int p_96560_) {
|
||||
if (this.f_96541_.f_91073_ != null) {
|
||||
this.m_93179_(p_96559_, 0, 0, this.f_96543_, this.f_96544_, -1072689136, -804253680);
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundDrawnEvent(this, p_96559_));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this, p_96559_));
|
||||
} else {
|
||||
this.m_96626_(p_96560_);
|
||||
}
|
||||
@@ -413,6 +_,7 @@
|
||||
@@ -412,6 +_,7 @@
|
||||
bufferbuilder.m_5483_((double)this.f_96543_, 0.0D, 0.0D).m_7421_((float)this.f_96543_ / 32.0F, (float)p_96627_).m_6122_(64, 64, 64, 255).m_5752_();
|
||||
bufferbuilder.m_5483_(0.0D, 0.0D, 0.0D).m_7421_(0.0F, (float)p_96627_).m_6122_(64, 64, 64, 255).m_5752_();
|
||||
tesselator.m_85914_();
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundDrawnEvent(this, new PoseStack()));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this, new PoseStack()));
|
||||
}
|
||||
|
||||
public boolean m_7043_() {
|
||||
@@ -498,6 +_,10 @@
|
||||
@@ -497,6 +_,10 @@
|
||||
}
|
||||
|
||||
public void m_7400_(List<Path> p_96591_) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/TitleScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/TitleScreen.java
|
||||
@@ -64,6 +_,7 @@
|
||||
@@ -63,6 +_,7 @@
|
||||
private final PanoramaRenderer f_96729_ = new PanoramaRenderer(f_96716_);
|
||||
private final boolean f_96714_;
|
||||
private long f_96715_;
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public TitleScreen() {
|
||||
this(false);
|
||||
@@ -107,11 +_,16 @@
|
||||
@@ -106,11 +_,16 @@
|
||||
this.f_96728_ = this.f_96543_ - this.f_96727_ - 2;
|
||||
int i = 24;
|
||||
int j = this.f_96544_ / 4 + 48;
|
||||
@@ -18,14 +18,14 @@
|
||||
} else {
|
||||
this.m_96763_(j, 24);
|
||||
+ modButton = this.m_142416_(new Button(this.f_96543_ / 2 - 100, j + 24 * 2, 98, 20, new TranslatableComponent("fml.menu.mods"), button -> {
|
||||
+ this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this));
|
||||
+ this.f_96541_.m_91152_(new net.minecraftforge.fmlclient.gui.screen.ModListScreen(this));
|
||||
+ }));
|
||||
}
|
||||
+ modUpdateNotification = net.minecraftforge.client.gui.NotificationModUpdateScreen.init(this, modButton);
|
||||
|
||||
this.m_142416_(new ImageButton(this.f_96543_ / 2 - 124, j + 72 + 12, 20, 20, 0, 106, 20, Button.f_93617_, 256, 256, (p_96791_) -> {
|
||||
this.f_96541_.m_91152_(new LanguageSelectScreen(this, this.f_96541_.f_91066_, this.f_96541_.m_91102_()));
|
||||
@@ -159,7 +_,7 @@
|
||||
@@ -158,7 +_,7 @@
|
||||
Screen screen = (Screen)(this.f_96541_.f_91066_.f_92083_ ? new JoinMultiplayerScreen(this) : new SafetyScreen(this));
|
||||
this.f_96541_.m_91152_(screen);
|
||||
}, button$ontooltip))).f_93623_ = flag;
|
||||
@@ -34,7 +34,7 @@
|
||||
this.m_96793_();
|
||||
}, button$ontooltip))).f_93623_ = flag;
|
||||
}
|
||||
@@ -284,6 +_,7 @@
|
||||
@@ -283,6 +_,7 @@
|
||||
|
||||
RenderSystem.m_157456_(0, f_96724_);
|
||||
m_93133_(p_96739_, j + 88, 67, 0.0F, 0.0F, 98, 14, 128, 16);
|
||||
@@ -42,23 +42,23 @@
|
||||
if (this.f_96721_ != null) {
|
||||
p_96739_.m_85836_();
|
||||
p_96739_.m_85837_((double)(this.f_96543_ / 2 + 90), 70.0D, 0.0D);
|
||||
@@ -306,7 +_,14 @@
|
||||
@@ -305,7 +_,14 @@
|
||||
s = s + I18n.m_118938_("menu.modded");
|
||||
}
|
||||
|
||||
- m_93236_(p_96739_, this.f_96547_, s, 2, this.f_96544_ - 10, 16777215 | l);
|
||||
+ net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brdline, brd) ->
|
||||
+ net.minecraftforge.fmllegacy.BrandingControl.forEachLine(true, true, (brdline, brd) ->
|
||||
+ m_93236_(p_96739_, this.f_96547_, brd, 2, this.f_96544_ - ( 10 + brdline * (this.f_96547_.f_92710_ + 1)), 16777215 | l)
|
||||
+ );
|
||||
+
|
||||
+ net.minecraftforge.internal.BrandingControl.forEachAboveCopyrightLine((brdline, brd) ->
|
||||
+ net.minecraftforge.fmllegacy.BrandingControl.forEachAboveCopyrightLine((brdline, brd) ->
|
||||
+ m_93236_(p_96739_, this.f_96547_, brd, this.f_96543_ - f_96547_.m_92895_(brd), this.f_96544_ - (10 + (brdline + 1) * ( this.f_96547_.f_92710_ + 1)), 16777215 | l)
|
||||
+ );
|
||||
+
|
||||
m_93236_(p_96739_, this.f_96547_, "Copyright Mojang AB. Do not distribute!", this.f_96728_, this.f_96544_ - 10, 16777215 | l);
|
||||
if (p_96740_ > this.f_96728_ && p_96740_ < this.f_96728_ + this.f_96727_ && p_96741_ > this.f_96544_ - 10 && p_96741_ < this.f_96544_) {
|
||||
m_93172_(p_96739_, this.f_96728_, this.f_96544_ - 1, this.f_96728_ + this.f_96727_, this.f_96544_, 16777215 | l);
|
||||
@@ -322,6 +_,7 @@
|
||||
@@ -321,6 +_,7 @@
|
||||
if (this.m_96789_() && f1 >= 1.0F) {
|
||||
this.f_96726_.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_);
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
|
||||
@@ -43,6 +_,7 @@
|
||||
@Nullable
|
||||
@@ -42,6 +_,7 @@
|
||||
private final Map<Advancement, AdvancementTab> f_97335_ = Maps.newLinkedHashMap();
|
||||
private AdvancementTab f_97336_;
|
||||
private boolean f_97337_;
|
||||
+ private static int tabPage, maxPages;
|
||||
|
||||
public AdvancementsScreen(ClientAdvancements p_97340_) {
|
||||
super(NarratorChatListener.f_93310_);
|
||||
@@ -58,7 +_,13 @@
|
||||
@@ -57,7 +_,13 @@
|
||||
} else {
|
||||
this.f_97334_.m_104401_(this.f_97336_ == null ? null : this.f_97336_.m_97182_(), true);
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
|
||||
public void m_7861_() {
|
||||
@@ -76,7 +_,7 @@
|
||||
@@ -75,7 +_,7 @@
|
||||
int j = (this.f_96544_ - 140) / 2;
|
||||
|
||||
for(AdvancementTab advancementtab : this.f_97335_.values()) {
|
||||
@@ -32,7 +32,7 @@
|
||||
this.f_97334_.m_104401_(advancementtab.m_97182_(), true);
|
||||
break;
|
||||
}
|
||||
@@ -100,6 +_,11 @@
|
||||
@@ -99,6 +_,11 @@
|
||||
int i = (this.f_96543_ - 252) / 2;
|
||||
int j = (this.f_96544_ - 140) / 2;
|
||||
this.m_7333_(p_97361_);
|
||||
@@ -44,7 +44,7 @@
|
||||
this.m_97373_(p_97361_, p_97362_, p_97363_, i, j);
|
||||
this.m_97356_(p_97361_, i, j);
|
||||
this.m_97381_(p_97361_, p_97362_, p_97363_, i, j);
|
||||
@@ -150,12 +_,14 @@
|
||||
@@ -149,12 +_,14 @@
|
||||
RenderSystem.m_157456_(0, f_97330_);
|
||||
|
||||
for(AdvancementTab advancementtab : this.f_97335_.values()) {
|
||||
@@ -59,7 +59,7 @@
|
||||
advancementtab1.m_97159_(p_97358_, p_97359_, this.f_96542_);
|
||||
}
|
||||
|
||||
@@ -181,7 +_,7 @@
|
||||
@@ -180,7 +_,7 @@
|
||||
|
||||
if (this.f_97335_.size() > 1) {
|
||||
for(AdvancementTab advancementtab : this.f_97335_.values()) {
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
--- a/net/minecraft/client/gui/screens/controls/ControlList.java
|
||||
+++ b/net/minecraft/client/gui/screens/controls/ControlList.java
|
||||
@@ -53,7 +_,7 @@
|
||||
}
|
||||
|
||||
protected int m_5756_() {
|
||||
- return super.m_5756_() + 15;
|
||||
+ return super.m_5756_() + 15 + 20;
|
||||
}
|
||||
|
||||
public int m_5759_() {
|
||||
@@ -109,7 +_,7 @@
|
||||
KeyEntry(final KeyMapping p_97451_, final Component p_97452_) {
|
||||
this.f_97445_ = p_97451_;
|
||||
this.f_97446_ = p_97452_;
|
||||
- this.f_97447_ = new Button(0, 0, 75, 20, p_97452_, (p_97479_) -> {
|
||||
+ this.f_97447_ = new Button(0, 0, 75 + 20 /*Forge: add space*/, 20, p_97452_, (p_97479_) -> {
|
||||
ControlList.this.f_97396_.f_97514_ = p_97451_;
|
||||
}) {
|
||||
protected MutableComponent m_5646_() {
|
||||
@@ -117,6 +_,7 @@
|
||||
}
|
||||
};
|
||||
this.f_97448_ = new Button(0, 0, 50, 20, new TranslatableComponent("controls.reset"), (p_97475_) -> {
|
||||
+ f_97445_.setToDefault();
|
||||
ControlList.this.f_93386_.f_91066_.m_92159_(p_97451_, p_97451_.m_90861_());
|
||||
KeyMapping.m_90854_();
|
||||
}) {
|
||||
@@ -130,7 +_,7 @@
|
||||
boolean flag = ControlList.this.f_97396_.f_97514_ == this.f_97445_;
|
||||
float f = (float)(p_97466_ + 90 - ControlList.this.f_97397_);
|
||||
ControlList.this.f_93386_.f_91062_.m_92889_(p_97463_, this.f_97446_, f, (float)(p_97465_ + p_97468_ / 2 - 9 / 2), 16777215);
|
||||
- this.f_97448_.f_93620_ = p_97466_ + 190;
|
||||
+ this.f_97448_.f_93620_ = p_97466_ + 190 + 20;
|
||||
this.f_97448_.f_93621_ = p_97465_;
|
||||
this.f_97448_.f_93623_ = !this.f_97445_.m_90864_();
|
||||
this.f_97448_.m_6305_(p_97463_, p_97469_, p_97470_, p_97472_);
|
||||
@@ -138,11 +_,12 @@
|
||||
this.f_97447_.f_93621_ = p_97465_;
|
||||
this.f_97447_.m_93666_(this.f_97445_.m_90863_());
|
||||
boolean flag1 = false;
|
||||
+ boolean keyCodeModifierConflict = true; // less severe form of conflict, like SHIFT conflicting with SHIFT+G
|
||||
if (!this.f_97445_.m_90862_()) {
|
||||
for(KeyMapping keymapping : ControlList.this.f_93386_.f_91066_.f_92059_) {
|
||||
if (keymapping != this.f_97445_ && this.f_97445_.m_90850_(keymapping)) {
|
||||
flag1 = true;
|
||||
- break;
|
||||
+ keyCodeModifierConflict &= keymapping.hasKeyCodeModifierConflict(keymapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,7 +_,7 @@
|
||||
if (flag) {
|
||||
this.f_97447_.m_93666_((new TextComponent("> ")).m_7220_(this.f_97447_.m_6035_().m_6881_().m_130940_(ChatFormatting.YELLOW)).m_130946_(" <").m_130940_(ChatFormatting.YELLOW));
|
||||
} else if (flag1) {
|
||||
- this.f_97447_.m_93666_(this.f_97447_.m_6035_().m_6881_().m_130940_(ChatFormatting.RED));
|
||||
+ this.f_97447_.m_93666_(this.f_97447_.m_6035_().m_6881_().m_130940_(keyCodeModifierConflict ? ChatFormatting.GOLD : ChatFormatting.RED));
|
||||
}
|
||||
|
||||
this.f_97447_.m_6305_(p_97463_, p_97469_, p_97470_, p_97472_);
|
||||
@@ -0,0 +1,26 @@
|
||||
--- a/net/minecraft/client/gui/screens/controls/ControlsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/controls/ControlsScreen.java
|
||||
@@ -35,7 +_,7 @@
|
||||
this.m_7787_(this.f_97516_);
|
||||
this.f_97517_ = this.m_142416_(new Button(this.f_96543_ / 2 - 155, this.f_96544_ - 29, 150, 20, new TranslatableComponent("controls.resetAll"), (p_97538_) -> {
|
||||
for(KeyMapping keymapping : this.f_96282_.f_92059_) {
|
||||
- keymapping.m_90848_(keymapping.m_90861_());
|
||||
+ keymapping.setToDefault();
|
||||
}
|
||||
|
||||
KeyMapping.m_90854_();
|
||||
@@ -59,11 +_,14 @@
|
||||
public boolean m_7933_(int p_97526_, int p_97527_, int p_97528_) {
|
||||
if (this.f_97514_ != null) {
|
||||
if (p_97526_ == 256) {
|
||||
+ this.f_97514_.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputConstants.f_84822_);
|
||||
this.f_96282_.m_92159_(this.f_97514_, InputConstants.f_84822_);
|
||||
} else {
|
||||
+ this.f_97514_.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputConstants.m_84827_(p_97526_, p_97527_));
|
||||
this.f_96282_.m_92159_(this.f_97514_, InputConstants.m_84827_(p_97526_, p_97527_));
|
||||
}
|
||||
|
||||
+ if (!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.f_97514_.getKey()))
|
||||
this.f_97514_ = null;
|
||||
this.f_97515_ = Util.m_137550_();
|
||||
KeyMapping.m_90854_();
|
||||
@@ -1,60 +0,0 @@
|
||||
--- a/net/minecraft/client/gui/screens/controls/KeyBindsList.java
|
||||
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsList.java
|
||||
@@ -53,7 +_,7 @@
|
||||
}
|
||||
|
||||
protected int m_5756_() {
|
||||
- return super.m_5756_() + 15;
|
||||
+ return super.m_5756_() + 15 + 20;
|
||||
}
|
||||
|
||||
public int m_5759_() {
|
||||
@@ -109,7 +_,7 @@
|
||||
KeyEntry(final KeyMapping p_193916_, final Component p_193917_) {
|
||||
this.f_193910_ = p_193916_;
|
||||
this.f_193911_ = p_193917_;
|
||||
- this.f_193912_ = new Button(0, 0, 75, 20, p_193917_, (p_193939_) -> {
|
||||
+ this.f_193912_ = new Button(0, 0, 75 + 20 /* Forge: Add space */, 20, p_193917_, (p_193939_) -> {
|
||||
KeyBindsList.this.f_193858_.f_193975_ = p_193916_;
|
||||
}) {
|
||||
protected MutableComponent m_5646_() {
|
||||
@@ -117,6 +_,7 @@
|
||||
}
|
||||
};
|
||||
this.f_193913_ = new Button(0, 0, 50, 20, new TranslatableComponent("controls.reset"), (p_193935_) -> {
|
||||
+ this.f_193910_.setToDefault();
|
||||
KeyBindsList.this.f_93386_.f_91066_.m_92159_(p_193916_, p_193916_.m_90861_());
|
||||
KeyMapping.m_90854_();
|
||||
}) {
|
||||
@@ -130,7 +_,7 @@
|
||||
boolean flag = KeyBindsList.this.f_193858_.f_193975_ == this.f_193910_;
|
||||
float f = (float)(p_193926_ + 90 - KeyBindsList.this.f_193859_);
|
||||
KeyBindsList.this.f_93386_.f_91062_.m_92889_(p_193923_, this.f_193911_, f, (float)(p_193925_ + p_193928_ / 2 - 9 / 2), 16777215);
|
||||
- this.f_193913_.f_93620_ = p_193926_ + 190;
|
||||
+ this.f_193913_.f_93620_ = p_193926_ + 190 + 20;
|
||||
this.f_193913_.f_93621_ = p_193925_;
|
||||
this.f_193913_.f_93623_ = !this.f_193910_.m_90864_();
|
||||
this.f_193913_.m_6305_(p_193923_, p_193929_, p_193930_, p_193932_);
|
||||
@@ -138,11 +_,12 @@
|
||||
this.f_193912_.f_93621_ = p_193925_;
|
||||
this.f_193912_.m_93666_(this.f_193910_.m_90863_());
|
||||
boolean flag1 = false;
|
||||
+ boolean keyCodeModifierConflict = true; // gracefully handle conflicts like SHIFT vs SHIFT+G
|
||||
if (!this.f_193910_.m_90862_()) {
|
||||
for(KeyMapping keymapping : KeyBindsList.this.f_93386_.f_91066_.f_92059_) {
|
||||
if (keymapping != this.f_193910_ && this.f_193910_.m_90850_(keymapping)) {
|
||||
flag1 = true;
|
||||
- break;
|
||||
+ keyCodeModifierConflict &= keymapping.hasKeyModifierConflict(this.f_193910_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,7 +_,7 @@
|
||||
if (flag) {
|
||||
this.f_193912_.m_93666_((new TextComponent("> ")).m_7220_(this.f_193912_.m_6035_().m_6881_().m_130940_(ChatFormatting.YELLOW)).m_130946_(" <").m_130940_(ChatFormatting.YELLOW));
|
||||
} else if (flag1) {
|
||||
- this.f_193912_.m_93666_(this.f_193912_.m_6035_().m_6881_().m_130940_(ChatFormatting.RED));
|
||||
+ this.f_193912_.m_93666_(this.f_193912_.m_6035_().m_6881_().m_130940_(keyCodeModifierConflict ? ChatFormatting.GOLD : ChatFormatting.RED));
|
||||
}
|
||||
|
||||
this.f_193912_.m_6305_(p_193923_, p_193929_, p_193930_, p_193932_);
|
||||
@@ -1,26 +0,0 @@
|
||||
--- a/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
|
||||
@@ -31,7 +_,7 @@
|
||||
this.m_7787_(this.f_193977_);
|
||||
this.f_193978_ = this.m_142416_(new Button(this.f_96543_ / 2 - 155, this.f_96544_ - 29, 150, 20, new TranslatableComponent("controls.resetAll"), (p_193999_) -> {
|
||||
for(KeyMapping keymapping : this.f_96282_.f_92059_) {
|
||||
- keymapping.m_90848_(keymapping.m_90861_());
|
||||
+ keymapping.setToDefault();
|
||||
}
|
||||
|
||||
KeyMapping.m_90854_();
|
||||
@@ -55,11 +_,14 @@
|
||||
public boolean m_7933_(int p_193987_, int p_193988_, int p_193989_) {
|
||||
if (this.f_193975_ != null) {
|
||||
if (p_193987_ == 256) {
|
||||
+ this.f_193975_.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputConstants.f_84822_);
|
||||
this.f_96282_.m_92159_(this.f_193975_, InputConstants.f_84822_);
|
||||
} else {
|
||||
+ this.f_193975_.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputConstants.m_84827_(p_193987_, p_193988_));
|
||||
this.f_96282_.m_92159_(this.f_193975_, InputConstants.m_84827_(p_193987_, p_193988_));
|
||||
}
|
||||
|
||||
+ if(!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.f_193975_.getKey()))
|
||||
this.f_193975_ = null;
|
||||
this.f_193976_ = Util.m_137550_();
|
||||
KeyMapping.m_90854_();
|
||||
+5
-5
@@ -4,7 +4,7 @@
|
||||
int i = this.f_97735_;
|
||||
int j = this.f_97736_;
|
||||
this.m_7286_(p_97795_, p_97798_, p_97796_, p_97797_);
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.DrawBackground(this, p_97795_, p_97796_, p_97797_));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiContainerEvent.DrawBackground(this, p_97795_, p_97796_, p_97797_));
|
||||
RenderSystem.m_69465_();
|
||||
super.m_6305_(p_97795_, p_97796_, p_97797_, p_97798_);
|
||||
PoseStack posestack = RenderSystem.m_157191_();
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
|
||||
this.m_7027_(p_97795_, p_97796_, p_97797_);
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.DrawForeground(this, p_97795_, p_97796_, p_97797_));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiContainerEvent.DrawForeground(this, p_97795_, p_97796_, p_97797_));
|
||||
ItemStack itemstack = this.f_97711_.m_41619_() ? this.f_97732_.m_142621_() : this.f_97711_;
|
||||
if (!itemstack.m_41619_()) {
|
||||
int l1 = 8;
|
||||
@@ -53,7 +53,7 @@
|
||||
if (super.m_6375_(p_97748_, p_97749_, p_97750_)) {
|
||||
return true;
|
||||
} else {
|
||||
- boolean flag = this.f_96541_.f_91066_.f_92097_.m_90830_(p_97750_) && this.f_96541_.f_91072_.m_105290_();
|
||||
- boolean flag = this.f_96541_.f_91066_.f_92097_.m_90830_(p_97750_);
|
||||
+ InputConstants.Key mouseKey = InputConstants.Type.MOUSE.m_84895_(p_97750_);
|
||||
+ boolean flag = this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey);
|
||||
Slot slot = this.m_97744_(p_97748_, p_97749_);
|
||||
@@ -71,7 +71,7 @@
|
||||
}
|
||||
} else if (!this.f_97738_) {
|
||||
if (this.f_97732_.m_142621_().m_41619_()) {
|
||||
- if (flag) {
|
||||
- if (this.f_96541_.f_91066_.f_92097_.m_90830_(p_97750_)) {
|
||||
+ if (this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey)) {
|
||||
this.m_6597_(slot, l, p_97750_, ClickType.CLONE);
|
||||
} else {
|
||||
@@ -80,7 +80,7 @@
|
||||
this.f_97717_ = 0;
|
||||
} else if (p_97750_ == 1) {
|
||||
this.f_97717_ = 1;
|
||||
- } else if (flag) {
|
||||
- } else if (this.f_96541_.f_91066_.f_92097_.m_90830_(p_97750_)) {
|
||||
+ } else if (this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey)) {
|
||||
this.f_97717_ = 2;
|
||||
}
|
||||
|
||||
+18
-18
@@ -9,7 +9,7 @@
|
||||
private boolean f_98515_;
|
||||
private final Map<ResourceLocation, Tag<Item>> f_98516_ = Maps.newTreeMap();
|
||||
|
||||
@@ -233,6 +_,12 @@
|
||||
@@ -242,6 +_,12 @@
|
||||
protected void m_7856_() {
|
||||
if (this.f_96541_.f_91072_.m_105290_()) {
|
||||
super.m_7856_();
|
||||
@@ -22,7 +22,7 @@
|
||||
this.f_96541_.f_91068_.m_90926_(true);
|
||||
this.f_98510_ = new EditBox(this.f_96547_, this.f_97735_ + 82, this.f_97736_ + 6, 80, 9, new TranslatableComponent("itemGroup.search"));
|
||||
this.f_98510_.m_94199_(50);
|
||||
@@ -274,7 +_,7 @@
|
||||
@@ -283,7 +_,7 @@
|
||||
public boolean m_5534_(char p_98521_, int p_98522_) {
|
||||
if (this.f_98514_) {
|
||||
return false;
|
||||
@@ -31,7 +31,7 @@
|
||||
return false;
|
||||
} else {
|
||||
String s = this.f_98510_.m_94155_();
|
||||
@@ -292,7 +_,7 @@
|
||||
@@ -301,7 +_,7 @@
|
||||
|
||||
public boolean m_7933_(int p_98547_, int p_98548_, int p_98549_) {
|
||||
this.f_98514_ = false;
|
||||
@@ -40,7 +40,7 @@
|
||||
if (this.f_96541_.f_91066_.f_92098_.m_90832_(p_98547_, p_98548_)) {
|
||||
this.f_98514_ = true;
|
||||
this.m_98560_(CreativeModeTab.f_40754_);
|
||||
@@ -329,6 +_,32 @@
|
||||
@@ -338,6 +_,32 @@
|
||||
private void m_98630_() {
|
||||
(this.f_97732_).f_98639_.clear();
|
||||
this.f_98516_.clear();
|
||||
@@ -73,7 +73,7 @@
|
||||
String s = this.f_98510_.m_94155_();
|
||||
if (s.isEmpty()) {
|
||||
for(Item item : Registry.f_122827_) {
|
||||
@@ -374,9 +_,9 @@
|
||||
@@ -383,9 +_,9 @@
|
||||
|
||||
protected void m_7027_(PoseStack p_98616_, int p_98617_, int p_98618_) {
|
||||
CreativeModeTab creativemodetab = CreativeModeTab.f_40748_[f_98507_];
|
||||
@@ -85,7 +85,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -387,7 +_,7 @@
|
||||
@@ -396,7 +_,7 @@
|
||||
double d1 = p_98532_ - (double)this.f_97736_;
|
||||
|
||||
for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) {
|
||||
@@ -94,7 +94,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -408,7 +_,7 @@
|
||||
@@ -417,7 +_,7 @@
|
||||
this.f_98509_ = false;
|
||||
|
||||
for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) {
|
||||
@@ -103,7 +103,7 @@
|
||||
this.m_98560_(creativemodetab);
|
||||
return true;
|
||||
}
|
||||
@@ -419,12 +_,15 @@
|
||||
@@ -428,12 +_,15 @@
|
||||
}
|
||||
|
||||
private boolean m_98631_() {
|
||||
@@ -119,7 +119,7 @@
|
||||
this.f_97737_.clear();
|
||||
(this.f_97732_).f_98639_.clear();
|
||||
if (p_98561_ == CreativeModeTab.f_40760_) {
|
||||
@@ -501,13 +_,15 @@
|
||||
@@ -510,13 +_,15 @@
|
||||
}
|
||||
|
||||
if (this.f_98510_ != null) {
|
||||
@@ -136,7 +136,7 @@
|
||||
|
||||
this.m_98630_();
|
||||
} else {
|
||||
@@ -567,16 +_,34 @@
|
||||
@@ -576,16 +_,34 @@
|
||||
this.m_7333_(p_98577_);
|
||||
super.m_6305_(p_98577_, p_98578_, p_98579_, p_98580_);
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.m_7025_(p_98577_, p_98578_, p_98579_);
|
||||
}
|
||||
@@ -611,7 +_,7 @@
|
||||
@@ -620,7 +_,7 @@
|
||||
list1.add(1, creativemodetab.m_40786_().m_6881_().m_130940_(ChatFormatting.BLUE));
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
} else {
|
||||
super.m_6057_(p_98590_, p_98591_, p_98592_, p_98593_);
|
||||
}
|
||||
@@ -622,16 +_,32 @@
|
||||
@@ -631,16 +_,32 @@
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
CreativeModeTab creativemodetab = CreativeModeTab.f_40748_[f_98507_];
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
this.m_93228_(p_98572_, this.f_97735_, this.f_97736_, 0, 0, this.f_97726_, this.f_97727_);
|
||||
this.f_98510_.m_6305_(p_98572_, p_98574_, p_98575_, p_98573_);
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
@@ -639,11 +_,14 @@
|
||||
@@ -648,11 +_,14 @@
|
||||
int j = this.f_97736_ + 18;
|
||||
int k = j + 112;
|
||||
RenderSystem.m_157427_(GameRenderer::m_172817_);
|
||||
@@ -235,7 +235,7 @@
|
||||
this.m_98581_(p_98572_, creativemodetab);
|
||||
if (creativemodetab == CreativeModeTab.f_40761_) {
|
||||
InventoryScreen.m_98850_(this.f_97735_ + 88, this.f_97736_ + 45, 20, (float)(this.f_97735_ + 88 - p_98574_), (float)(this.f_97736_ + 45 - 30 - p_98575_), this.f_96541_.f_91074_);
|
||||
@@ -652,6 +_,7 @@
|
||||
@@ -661,6 +_,7 @@
|
||||
}
|
||||
|
||||
protected boolean m_98562_(CreativeModeTab p_98563_, double p_98564_, double p_98565_) {
|
||||
@@ -243,15 +243,15 @@
|
||||
int i = p_98563_.m_40793_();
|
||||
int j = 28 * i;
|
||||
int k = 0;
|
||||
@@ -720,6 +_,7 @@
|
||||
i1 += this.f_97727_ - 4;
|
||||
@@ -729,6 +_,7 @@
|
||||
i1 = i1 + (this.f_97727_ - 4);
|
||||
}
|
||||
|
||||
+ RenderSystem.m_69478_(); //Forge: Make sure blend is enabled else tabs show a white border.
|
||||
this.m_93228_(p_98582_, l, i1, j, k, 28, 32);
|
||||
this.f_96542_.f_115093_ = 100.0F;
|
||||
l += 6;
|
||||
@@ -909,6 +_,22 @@
|
||||
l = l + 6;
|
||||
@@ -918,6 +_,22 @@
|
||||
|
||||
public boolean m_8010_(Player p_98665_) {
|
||||
return this.f_98655_.m_8010_(p_98665_);
|
||||
|
||||
+20
-49
@@ -1,40 +1,25 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
||||
@@ -32,13 +_,21 @@
|
||||
}
|
||||
|
||||
public boolean m_194018_() {
|
||||
- int i = this.f_97735_ + this.f_97726_ + 2;
|
||||
+ int i;
|
||||
+ if(cancelShift)
|
||||
+ i = (this.f_96543_ - this.f_97726_) / 2;
|
||||
+ else
|
||||
+ i = this.f_97735_ + this.f_97726_ + 2;
|
||||
int j = this.f_96543_ - i;
|
||||
return j >= 32;
|
||||
}
|
||||
|
||||
private void m_194014_(PoseStack p_194015_, int p_194016_, int p_194017_) {
|
||||
- int i = this.f_97735_ + this.f_97726_ + 2;
|
||||
+ int i;
|
||||
+ if(cancelShift)
|
||||
+ i = (this.f_96543_ - this.f_97726_) / 2;
|
||||
+ else
|
||||
+ i = this.f_97735_ + this.f_97726_ + 2;
|
||||
int j = this.f_96543_ - i;
|
||||
Collection<MobEffectInstance> collection = this.f_96541_.f_91074_.m_21220_();
|
||||
if (!collection.isEmpty() && j >= 32) {
|
||||
@@ -49,7 +_,8 @@
|
||||
k = 132 / (collection.size() - 1);
|
||||
@@ -34,6 +_,9 @@
|
||||
this.f_97735_ = (this.f_96543_ - this.f_97726_) / 2;
|
||||
this.f_98699_ = false;
|
||||
} else {
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.PotionShiftEvent(this)))
|
||||
+ this.f_97735_ = (this.f_96543_ - this.f_97726_) / 2;
|
||||
+ else
|
||||
this.f_97735_ = 160 + (this.f_96543_ - this.f_97726_ - 200) / 2;
|
||||
this.f_98699_ = true;
|
||||
}
|
||||
@@ -58,7 +_,7 @@
|
||||
j = 132 / (collection.size() - 1);
|
||||
}
|
||||
|
||||
- Iterable<MobEffectInstance> iterable = Ordering.natural().sortedCopy(collection);
|
||||
+
|
||||
+ Iterable<MobEffectInstance> iterable = collection.stream().filter(net.minecraftforge.client.ForgeHooksClient::shouldRenderEffect).sorted().collect(java.util.stream.Collectors.toList());
|
||||
this.m_194002_(p_194015_, i, k, iterable, flag);
|
||||
this.m_194008_(p_194015_, i, k, iterable, flag);
|
||||
if (flag) {
|
||||
@@ -110,6 +_,12 @@
|
||||
+ Iterable<MobEffectInstance> iterable = collection.stream().filter(net.minecraftforge.client.ForgeHooksClient::shouldRender).sorted().collect(java.util.stream.Collectors.toList());
|
||||
this.m_98709_(p_98716_, i, j, iterable);
|
||||
this.m_98717_(p_98716_, i, j, iterable);
|
||||
this.m_98722_(p_98716_, i, j, iterable);
|
||||
@@ -95,6 +_,12 @@
|
||||
int i = this.f_97736_;
|
||||
|
||||
for(MobEffectInstance mobeffectinstance : p_98726_) {
|
||||
@@ -44,20 +29,6 @@
|
||||
+ i += p_98725_;
|
||||
+ continue;
|
||||
+ }
|
||||
Component component = this.m_194000_(mobeffectinstance);
|
||||
this.f_96547_.m_92763_(p_98723_, component, (float)(p_98724_ + 10 + 18), (float)(i + 6), 16777215);
|
||||
String s = MobEffectUtil.m_19581_(mobeffectinstance, 1.0F);
|
||||
@@ -126,5 +_,13 @@
|
||||
}
|
||||
|
||||
return mutablecomponent;
|
||||
+ }
|
||||
+
|
||||
+ // FORGE START
|
||||
+ boolean cancelShift = false;
|
||||
+ @Override
|
||||
+ protected void m_7856_() {
|
||||
+ super.m_7856_();
|
||||
+ cancelShift = net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.PotionShiftEvent(this));
|
||||
}
|
||||
}
|
||||
String s = I18n.m_118938_(mobeffectinstance.m_19544_().m_19481_());
|
||||
if (mobeffectinstance.m_19564_() >= 1 && mobeffectinstance.m_19564_() <= 9) {
|
||||
s = s + " " + I18n.m_118938_("enchantment.level." + (mobeffectinstance.m_19564_() + 1));
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
@@ -21,6 +_,8 @@
|
||||
@@ -22,6 +_,8 @@
|
||||
if (p_169951_ instanceof BundleTooltip) {
|
||||
return new ClientBundleTooltip((BundleTooltip)p_169951_);
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
|
||||
@@ -250,6 +_,11 @@
|
||||
@@ -247,6 +_,11 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
||||
+++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
||||
@@ -334,6 +_,8 @@
|
||||
@@ -333,6 +_,8 @@
|
||||
this.f_99855_.m_99707_(list1);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -1,19 +1,19 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
@@ -116,7 +_,7 @@
|
||||
@@ -117,7 +_,7 @@
|
||||
|
||||
public static CreateWorldScreen m_100898_(@Nullable Screen p_100899_) {
|
||||
RegistryAccess.RegistryHolder registryaccess$registryholder = RegistryAccess.m_123086_();
|
||||
- return new CreateWorldScreen(p_100899_, DataPackConfig.f_45842_, new WorldGenSettingsComponent(registryaccess$registryholder, WorldGenSettings.m_190050_(registryaccess$registryholder), Optional.of(WorldPreset.f_101506_), OptionalLong.empty()));
|
||||
+ return new CreateWorldScreen(p_100899_, DataPackConfig.f_45842_, new WorldGenSettingsComponent(registryaccess$registryholder, net.minecraftforge.client.ForgeHooksClient.getDefaultWorldPreset().map(type -> type.m_7012_(registryaccess$registryholder, new java.util.Random().nextLong(), true, false)).orElseGet(() -> WorldGenSettings.m_190050_(registryaccess$registryholder)), net.minecraftforge.client.ForgeHooksClient.getDefaultWorldPreset(), OptionalLong.empty()));
|
||||
- return new CreateWorldScreen(p_100899_, DataPackConfig.f_45842_, new WorldGenSettingsComponent(registryaccess$registryholder, WorldGenSettings.m_64641_(registryaccess$registryholder.m_175515_(Registry.f_122818_), registryaccess$registryholder.m_175515_(Registry.f_122885_), registryaccess$registryholder.m_175515_(Registry.f_122878_)), Optional.of(WorldPreset.f_101506_), OptionalLong.empty()));
|
||||
+ return new CreateWorldScreen(p_100899_, DataPackConfig.f_45842_, new WorldGenSettingsComponent(registryaccess$registryholder, net.minecraftforge.client.ForgeHooksClient.getDefaultWorldType().map(type -> type.m_7012_(registryaccess$registryholder, new java.util.Random().nextLong(), true, false)).orElseGet(() -> WorldGenSettings.m_64641_(registryaccess$registryholder.m_175512_(Registry.f_122818_), registryaccess$registryholder.m_175512_(Registry.f_122885_), registryaccess$registryholder.m_175512_(Registry.f_122878_))), net.minecraftforge.client.ForgeHooksClient.getDefaultWorldType(), OptionalLong.empty()));
|
||||
}
|
||||
|
||||
private CreateWorldScreen(@Nullable Screen p_100861_, DataPackConfig p_100862_, WorldGenSettingsComponent p_100863_) {
|
||||
@@ -595,6 +_,7 @@
|
||||
@@ -596,6 +_,7 @@
|
||||
File file1 = path.toFile();
|
||||
if (this.f_100832_ == null) {
|
||||
this.f_100832_ = new PackRepository(PackType.SERVER_DATA, new ServerPacksSource(), new FolderRepositorySource(file1, PackSource.f_10527_));
|
||||
+ net.minecraftforge.resource.ResourcePackLoader.loadResourcePacks(this.f_100832_, net.minecraftforge.server.ServerLifecycleHooks::buildPackFinder);
|
||||
+ net.minecraftforge.fmllegacy.packs.ResourcePackLoader.loadResourcePacks(this.f_100832_, net.minecraftforge.fmllegacy.server.ServerLifecycleHooks::buildPackFinderNew);
|
||||
this.f_100832_.m_10506_();
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
this.f_170244_.f_93624_ = false;
|
||||
this.f_101391_ = p_101430_.m_142416_(new Button(j, 120, 150, 20, new TranslatableComponent("selectWorld.customizeType"), (p_170248_) -> {
|
||||
WorldPreset.PresetEditor worldpreset$preseteditor = WorldPreset.f_101509_.get(this.f_101395_);
|
||||
+ worldpreset$preseteditor = net.minecraftforge.client.ForgeHooksClient.getPresetEditor(this.f_101395_, worldpreset$preseteditor);
|
||||
+ worldpreset$preseteditor = net.minecraftforge.client.ForgeHooksClient.getBiomeGeneratorTypeScreenFactory(this.f_101395_, worldpreset$preseteditor);
|
||||
if (worldpreset$preseteditor != null) {
|
||||
p_101431_.m_91152_(worldpreset$preseteditor.m_101642_(p_101430_, this.f_101394_));
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
this.f_101389_.f_93624_ = p_170288_;
|
||||
this.f_101380_.f_93624_ = p_170288_;
|
||||
- this.f_101391_.f_93624_ = p_170288_ && WorldPreset.f_101509_.containsKey(this.f_101395_);
|
||||
+ this.f_101391_.f_93624_ = p_170288_ && (WorldPreset.f_101509_.containsKey(this.f_101395_) || net.minecraftforge.client.ForgeHooksClient.hasPresetEditor(this.f_101395_));
|
||||
+ this.f_101391_.f_93624_ = p_170288_ && (WorldPreset.f_101509_.containsKey(this.f_101395_) || net.minecraftforge.client.ForgeHooksClient.hasBiomeGeneratorSettingsOptionsScreen(this.f_101395_));
|
||||
this.f_101392_.f_93624_ = p_170288_;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldPreset.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldPreset.java
|
||||
@@ -83,6 +_,9 @@
|
||||
@@ -116,6 +_,9 @@
|
||||
WorldPreset(String p_101519_) {
|
||||
this.f_101516_ = new TranslatableComponent("generator." + p_101519_);
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
private static WorldGenSettings m_101549_(RegistryAccess p_101550_, WorldGenSettings p_101551_, WorldPreset p_101552_, Biome p_101553_) {
|
||||
BiomeSource biomesource = new FixedBiomeSource(p_101553_);
|
||||
@@ -125,4 +_,8 @@
|
||||
@@ -173,4 +_,8 @@
|
||||
public interface PresetEditor {
|
||||
Screen m_101642_(CreateWorldScreen p_101643_, WorldGenSettings p_101644_);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/client/main/Main.java
|
||||
+++ b/net/minecraft/client/main/Main.java
|
||||
@@ -135,7 +_,7 @@
|
||||
}
|
||||
|
||||
@@ -122,7 +_,7 @@
|
||||
String s7 = m_129638_(optionset, optionspec);
|
||||
Integer integer = m_129638_(optionset, optionspec1);
|
||||
CrashReport.m_127529_();
|
||||
- Bootstrap.m_135870_();
|
||||
+ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(()->Bootstrap.m_135870_(), net.minecraftforge.fml.loading.FMLLoader.progressWindowTick);
|
||||
Bootstrap.m_135889_();
|
||||
Util.m_137584_();
|
||||
String s10 = optionspec23.value(optionset);
|
||||
User user = new User(optionspec9.value(optionset), s5, optionspec11.value(optionset), optionspec20.value(optionset));
|
||||
Loaded 100 of 1029 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user