mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40a174310d | ||
|
|
be0a6819ac | ||
|
|
82a7ee1416 | ||
|
|
b4feee8046 | ||
|
|
df8954869a | ||
|
|
8a552136a2 | ||
|
|
34ec627457 | ||
|
|
28dd76ebbf | ||
|
|
b639bcb5c7 | ||
|
|
7538cf5501 | ||
|
|
1112819fc8 | ||
|
|
cdd38270e9 | ||
|
|
20e309c339 | ||
|
|
5f87bde00e | ||
|
|
a4e574fa6b | ||
|
|
ec7cb00f86 | ||
|
|
ebe375dac0 | ||
|
|
4a2572d545 | ||
|
|
55db597baa | ||
|
|
c24d05173f | ||
|
|
d711982a1c | ||
|
|
8a38416e0f | ||
|
|
a784bdb0d0 | ||
|
|
dc9a7f6ad5 | ||
|
|
417798f2eb | ||
|
|
394e76eed3 | ||
|
|
9e476551be | ||
|
|
1dc421e6a4 | ||
|
|
e431bb1caa | ||
|
|
8bd517ca91 | ||
|
|
69ddf58600 | ||
|
|
1e040c9f1f | ||
|
|
11bdf592c8 | ||
|
|
f4a827ab01 | ||
|
|
827ca83cfd | ||
|
|
e9f8acd191 | ||
|
|
febfd5ab62 | ||
|
|
4ca2a8058f | ||
|
|
4acafcccfd | ||
|
|
937b719e24 | ||
|
|
2b5bfd923c | ||
|
|
249aaa5806 | ||
|
|
46f57e6a9a | ||
|
|
cfd79130de | ||
|
|
6a25c99097 | ||
|
|
95be0d87d9 | ||
|
|
6125ec3bc8 | ||
|
|
9944a8252a | ||
|
|
fd544dd414 | ||
|
|
c00777e6ea | ||
|
|
b2cea78006 | ||
|
|
79272361f0 | ||
|
|
fe4be54774 | ||
|
|
eecb8cc783 | ||
|
|
5e2e404828 | ||
|
|
96303f6570 | ||
|
|
166feefc02 | ||
|
|
cd67762bee | ||
|
|
347a0b3c0d | ||
|
|
be1698bb15 | ||
|
|
a3e9d7a397 | ||
|
|
b2dbe9de51 | ||
|
|
a31adc2823 | ||
|
|
30a33f5c3e | ||
|
|
b01a217f45 | ||
|
|
69136fce19 | ||
|
|
ee21224fff | ||
|
|
804f390064 | ||
|
|
ca2023fa80 | ||
|
|
4e562664f4 | ||
|
|
c8d3ad1d1c | ||
|
|
b7379953d5 | ||
|
|
9d7f5dd32a | ||
|
|
049ed79e7b | ||
|
|
675bf8bde2 | ||
|
|
8dc58ad469 | ||
|
|
827c963d7e | ||
|
|
2ac616b293 | ||
|
|
dcfbc08504 | ||
|
|
19f470ee8c | ||
|
|
a96d078a7a | ||
|
|
b375da6962 | ||
|
|
d17f10d80c | ||
|
|
a336e443f7 | ||
|
|
c5a1c90366 | ||
|
|
95c0aa1e98 | ||
|
|
559b801cc4 | ||
|
|
aa97ddad8b | ||
|
|
d612dc3a6d | ||
|
|
9165d4c3a1 | ||
|
|
12d0f96fc2 | ||
|
|
bec9d6f534 | ||
|
|
892c3669e0 | ||
|
|
ce13efbac9 | ||
|
|
1018b077dc | ||
|
|
9746db5129 | ||
|
|
c4de1f33ba | ||
|
|
a8a4623d24 | ||
|
|
10b51f257f | ||
|
|
52d7df06da | ||
|
|
fcc819584a | ||
|
|
4721d4c461 | ||
|
|
dbdc345d4a | ||
|
|
14c6fc3388 | ||
|
|
33419ed5b1 | ||
|
|
9ec1e24dc5 | ||
|
|
06804675be | ||
|
|
2f43f9910d | ||
|
|
ea9a72af85 | ||
|
|
9a92363e15 | ||
|
|
94389d0efd | ||
|
|
9080886c1a | ||
|
|
13ca55f34d | ||
|
|
5dbea18e30 | ||
|
|
30cfd848d8 | ||
|
|
80d08dbf3a | ||
|
|
7d4c238165 | ||
|
|
0ea9401d90 | ||
|
|
4bdfd8674d | ||
|
|
3e9e0a6447 | ||
|
|
76da41dd46 | ||
|
|
6ddf56ef15 | ||
|
|
eeec737188 | ||
|
|
119ac8f4ab | ||
|
|
bdf0d9cf22 | ||
|
|
bd58ced0e4 | ||
|
|
5af6649435 | ||
|
|
695e1fbb94 | ||
|
|
b027a92dd2 |
No files matched your search
+3
-2
@@ -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,3 +44,4 @@ changelog.txt
|
||||
*.py
|
||||
*.7z
|
||||
/logs/
|
||||
|
||||
Vendored
+12
-1
@@ -7,7 +7,7 @@ pipeline {
|
||||
agent {
|
||||
docker {
|
||||
image 'gradle:7-jdk16'
|
||||
args '-v forgegc:/home/gradle/.gradle/'
|
||||
//args '-v forgegc:/home/gradle/.gradle_cache/'
|
||||
}
|
||||
}
|
||||
environment {
|
||||
@@ -34,6 +34,15 @@ pipeline {
|
||||
)
|
||||
}
|
||||
}
|
||||
/*
|
||||
stage('pull_cache') {
|
||||
steps {
|
||||
sh 'cp -r /home/gradle/.gradle_cache/jdks/ /home/gradle/.gradle/jdks/'
|
||||
sh 'cp -r /home/gradle/.gradle_cache/wrapper/ /home/gradle/.gradle/wrapper/'
|
||||
sh 'cp -r /home/gradle/.gradle_cache/caches/ /home/gradle/.gradle/caches/'
|
||||
}
|
||||
}
|
||||
*/
|
||||
stage('setup') {
|
||||
steps {
|
||||
withGradle {
|
||||
@@ -41,6 +50,7 @@ pipeline {
|
||||
}
|
||||
script {
|
||||
env.MYVERSION = sh(returnStdout: true, script: './gradlew :forge:properties -q | grep "^version:" | cut -d" " -f2').trim()
|
||||
env.FMLONLY_VERSION = sh(returnStdout: true, script: './gradlew :fmlonly:properties -q | grep "^version:" | cut -d" " -f2').trim()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,6 +86,7 @@ pipeline {
|
||||
post {
|
||||
success {
|
||||
build job: 'filegenerator', parameters: [string(name: 'COMMAND', value: "promote net.minecraftforge:forge ${env.MYVERSION} latest")], propagate: false, wait: false
|
||||
build job: 'filegenerator', parameters: [string(name: 'COMMAND', value: "promote net.minecraftforge:fmlonly ${env.FMLONLY_VERSION} latest")], propagate: false, wait: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+48
-44
@@ -43,18 +43,19 @@ ext {
|
||||
]
|
||||
}
|
||||
MAPPING_CHANNEL = 'official'
|
||||
MAPPING_VERSION = '1.17.1'
|
||||
MC_VERSION = '1.17.1'
|
||||
MCP_VERSION = '20210706.113038'
|
||||
SPI_VERSION = '4.0.9'
|
||||
MAPPING_VERSION = '1.18'
|
||||
MC_VERSION = '1.18'
|
||||
MCP_VERSION = '20211130.085255'
|
||||
SPI_VERSION = '4.0.10'
|
||||
ACCESSTRANSFORMERS_VERSION = '8.0.4'
|
||||
COREMODS_VERSION = '5.0.1'
|
||||
EVENTBUS_VERSION = '5.0.3'
|
||||
MODLAUNCHER_VERSION = '9.0.7'
|
||||
SECUREJARHANDLER_VERSION = '0.9.44'
|
||||
BOOTSTRAPLAUNCHER_VERSION = '0.1.15'
|
||||
SECUREJARHANDLER_VERSION = '0.9.54'
|
||||
BOOTSTRAPLAUNCHER_VERSION = '0.1.17'
|
||||
ASM_VERSION = '9.1'
|
||||
INSTALLER_VERSION = '2.1.4'
|
||||
INSTALLER_VERSION = '2.1.+'
|
||||
MIXIN_VERSION = '0.8.4'
|
||||
|
||||
GIT_INFO = gradleutils.gitInfo
|
||||
VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION)
|
||||
@@ -62,10 +63,10 @@ ext {
|
||||
FORGE_VERSION = VERSION.substring(MC_VERSION.length() + 1)
|
||||
|
||||
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.7'
|
||||
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
|
||||
FART = 'net.minecraftforge:ForgeAutoRenamingTool:0.1.17:all'
|
||||
}
|
||||
|
||||
println('Version: ' + VERSION +
|
||||
@@ -108,7 +109,16 @@ subprojects {
|
||||
}
|
||||
}
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(16)
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
tasks.withType(Javadoc).configureEach {
|
||||
options.tags = [
|
||||
'apiNote:a:<em>API Note:</em>',
|
||||
'implSpec:a:<em>Implementation Requirements:</em>',
|
||||
'implNote:a:<em>Implementation Note:</em>'
|
||||
]
|
||||
options.addStringOption('Xdoclint:all,-missing', '-public')
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
@@ -248,8 +258,8 @@ def sharedDeps = {
|
||||
installer 'org.jline:jline-reader:3.12.+' //Dep of TerminaalConsoleeAppender
|
||||
installer 'org.jline:jline-terminal:3.12.+' //Dep of TerminaalConsoleeAppender
|
||||
installer 'net.sf.jopt-simple:jopt-simple:5.0.4'
|
||||
// installer 'org.spongepowered:mixin:0.8.3'
|
||||
installer 'org.openjdk.nashorn:nashorn-core:15.1.1'
|
||||
installer "org.spongepowered:mixin:${MIXIN_VERSION}"
|
||||
installer 'org.openjdk.nashorn:nashorn-core:15.3'
|
||||
installer 'com.google.guava:guava:21.0'
|
||||
installer 'com.google.code.gson:gson:2.8.0'
|
||||
|
||||
@@ -275,18 +285,16 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
}
|
||||
} else {
|
||||
prj.task([type: RenameJar, dependsOn: prj.tasks.createMcp2Srg], "create${side}SRG") {
|
||||
tool = VIGNETTE
|
||||
tool = FART
|
||||
args = [
|
||||
'--jar-in', '{input}',
|
||||
'--jar-out', '{output}',
|
||||
'--mapping-format', 'tsrg2',
|
||||
'--mappings', '{mappings}',
|
||||
// '--stable',
|
||||
'--create-inits', '--fix-param-annotations', '--fernflower-meta'
|
||||
'--input', '{input}',
|
||||
'--output', '{output}',
|
||||
'--names', '{mappings}',
|
||||
'--ann-fix', '--ids-fix', '--src-fix', '--record-fix'
|
||||
]
|
||||
mappings = prj.tasks.createMcp2Srg.srg
|
||||
input = prj.tasks.getByName("download${side}Slim").output
|
||||
output = file("build/create${side}SRG/output.jar")
|
||||
output = prj.file("build/create${side}SRG/output.jar")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,12 +399,13 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
}
|
||||
|
||||
// SecureJarHandler bootstrap values.
|
||||
run.property 'legacyClassPath', '{runtime_classpath}'
|
||||
run.property 'ignoreList', prj.configurations.moduleonly.files.collect {it.name}.join(',') + ",client-extra,fmlcore,javafmllanguage,mclanguage,${prj.name}-${prj.version},${prj.rootProject.ext.MC_VERSION}-${prj.name}${prj.version.substring(prj.rootProject.ext.MC_VERSION.length())}"
|
||||
run.property 'ignoreList', prj.configurations.moduleonly.files.collect {it.name.replaceAll(/([-_]([.\d]*\d+)|\.jar$)/, '') }.join(',') + ",client-extra,fmlcore,javafmllanguage,mclanguage,${prj.name}-"
|
||||
run.property 'mergeModules', 'jna-5.8.0.jar,jna-platform-58.0.jar,java-objc-bridge-1.0.0.jar'
|
||||
if (userdevRuns.contains(run)) {
|
||||
run.property 'legacyClassPath.file', '{minecraft_classpath_file}'
|
||||
run.jvmArgs '-p', '{modules}'
|
||||
} else {
|
||||
run.property 'legacyClassPath.file', '{runtime_classpath_file}'
|
||||
run.jvmArgs '-p', prj.configurations.moduleonly.files.collect { it.path }.join(File.pathSeparator)
|
||||
}
|
||||
run.jvmArgs '--add-modules', 'ALL-MODULE-PATH'
|
||||
@@ -570,8 +579,7 @@ project(':fmlonly') {
|
||||
'--fml.mcVersion', MC_VERSION,
|
||||
'--fml.forgeGroup', project.group,
|
||||
'--fml.mcpVersion', MCP_VERSION],
|
||||
jvm: ['-DlegacyClassPath=${classpath}',
|
||||
"-DignoreList=${fmlonly_client.properties.ignoreList}",
|
||||
jvm: ["-DignoreList=${fmlonly_client.properties.ignoreList},\${version_name}.jar",
|
||||
"-DmergeModules=${fmlonly_client.properties.mergeModules}",
|
||||
'-DlibraryDirectory=${library_directory}',
|
||||
'-p', Util.getArtifacts(project, configurations.moduleonly, false).values().collect{"\${library_directory}/${it.downloads.artifact.path}"}.join('${classpath_separator}'),
|
||||
@@ -586,7 +594,7 @@ project(':fmlonly') {
|
||||
}
|
||||
}
|
||||
|
||||
task installerJson(type: InstallerJson) {
|
||||
task installerJson(type: InstallerJson, dependsOn: 'signUniversalJar') {
|
||||
icon = rootProject.file('icon.ico')
|
||||
packedDependencies = PACKED_DEPS
|
||||
|
||||
@@ -716,15 +724,13 @@ project(':fmlonly') {
|
||||
'{MC_EXTRA}': '{MC_EXTRA_SHA}'
|
||||
]
|
||||
], [
|
||||
jar: VIGNETTE,
|
||||
classpath: getClasspath(project, libs, VIGNETTE),
|
||||
jar: FART,
|
||||
classpath: getClasspath(project, libs, FART),
|
||||
args: [
|
||||
'--jar-in', '{MC_SLIM}',
|
||||
'--jar-out', '{MC_SRG}',
|
||||
'--mapping-format', 'tsrg2',
|
||||
'--mappings', '{MERGED_MAPPINGS}',
|
||||
// '--stable',
|
||||
'--create-inits', '--fix-param-annotations', '--fernflower-meta'
|
||||
'--input', '{MC_SLIM}',
|
||||
'--output', '{MC_SRG}',
|
||||
'--names', '{MERGED_MAPPINGS}',
|
||||
'--ann-fix', '--ids-fix', '--src-fix', '--record-fix'
|
||||
]/*,
|
||||
outputs: [
|
||||
'{MC_SRG}': '{MC_SRG_SHA}'
|
||||
@@ -930,6 +936,7 @@ project(':forge') {
|
||||
'--mod', 'scaffolding_test',
|
||||
'--mod', 'custom_tag_types_test',
|
||||
'--mod', 'new_model_loader_test',
|
||||
'--mod', 'remove_tag_datagen_test',
|
||||
'--output', rootProject.file('src/generated_test/resources/'),
|
||||
'--existing', sourceSets.main.resources.srcDirs[0],
|
||||
'--existing', sourceSets.test.resources.srcDirs[0]
|
||||
@@ -1078,8 +1085,7 @@ project(':forge') {
|
||||
'--fml.mcVersion', MC_VERSION,
|
||||
'--fml.forgeGroup', project.group,
|
||||
'--fml.mcpVersion', MCP_VERSION],
|
||||
jvm: ['-DlegacyClassPath=${classpath}',
|
||||
"-DignoreList=${forge_client.properties.ignoreList}",
|
||||
jvm: ["-DignoreList=${forge_client.properties.ignoreList},\${version_name}.jar",
|
||||
"-DmergeModules=${forge_client.properties.mergeModules}",
|
||||
'-DlibraryDirectory=${library_directory}',
|
||||
'-p', Util.getArtifacts(project, configurations.moduleonly, false).values().collect{'${library_directory}/' + it.downloads.artifact.path}.join('${classpath_separator}'),
|
||||
@@ -1094,7 +1100,7 @@ project(':forge') {
|
||||
}
|
||||
}
|
||||
|
||||
task installerJson(type: InstallerJson, dependsOn: [launcherJson, genClientBinPatches, applyClientBinPatches, applyServerBinPatches]) {
|
||||
task installerJson(type: InstallerJson, dependsOn: [launcherJson, genClientBinPatches, applyClientBinPatches, applyServerBinPatches, 'signUniversalJar']) {
|
||||
ext {
|
||||
// remove :fatjar
|
||||
BIN_PATCHER = BINPATCH_TOOL.substring(0, BINPATCH_TOOL.length() - 1 - BINPATCH_TOOL.split(':')[3].length())
|
||||
@@ -1240,15 +1246,13 @@ project(':forge') {
|
||||
'{MC_EXTRA}': '{MC_EXTRA_SHA}'
|
||||
]
|
||||
], [
|
||||
jar: VIGNETTE,
|
||||
classpath: getClasspath(project, libs, VIGNETTE),
|
||||
jar: FART,
|
||||
classpath: getClasspath(project, libs, FART),
|
||||
args: [
|
||||
'--jar-in', '{MC_SLIM}',
|
||||
'--jar-out', '{MC_SRG}',
|
||||
'--mapping-format', 'tsrg2',
|
||||
'--mappings', '{MERGED_MAPPINGS}',
|
||||
// '--stable',
|
||||
'--create-inits', '--fix-param-annotations', '--fernflower-meta'
|
||||
'--input', '{MC_SLIM}',
|
||||
'--output', '{MC_SRG}',
|
||||
'--names', '{MERGED_MAPPINGS}',
|
||||
'--ann-fix', '--ids-fix', '--src-fix', '--record-fix'
|
||||
]/*,
|
||||
outputs: [
|
||||
'{MC_SRG}': '{MC_SRG_SHA}'
|
||||
@@ -1331,7 +1335,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'
|
||||
|
||||
@@ -48,14 +48,16 @@ abstract class LauncherJson extends DefaultTask {
|
||||
protected void exec() {
|
||||
if (!json.libraries)
|
||||
json.libraries = []
|
||||
getArtifacts(project, project.configurations.installer, false).each { key, lib -> json.libraries.add(lib) }
|
||||
getArtifacts(project, project.configurations.moduleonly, false).each { key, lib -> json.libraries.add(lib) }
|
||||
def libs = [:]
|
||||
getArtifacts(project, project.configurations.installer, false).each { key, lib -> libs[key] = lib }
|
||||
getArtifacts(project, project.configurations.moduleonly, false).each { key, lib -> libs[key] = lib }
|
||||
|
||||
packedDependencies.get().collect{ project.rootProject.tasks.findByPath(it) }.forEach {
|
||||
def path = Util.getMavenPath(it)
|
||||
def key = Util.getMavenDep(it)
|
||||
|
||||
json.libraries.add([
|
||||
name: Util.getMavenDep(it),
|
||||
libs[key] = [
|
||||
name: key,
|
||||
downloads: [
|
||||
artifact: [
|
||||
path: path,
|
||||
@@ -64,8 +66,9 @@ abstract class LauncherJson extends DefaultTask {
|
||||
size: it.archiveFile.get().asFile.length()
|
||||
]
|
||||
]
|
||||
])
|
||||
]
|
||||
}
|
||||
libs.each { key, lib -> json.libraries.add(lib) }
|
||||
Files.writeString(output.get().asFile.toPath(), new JsonBuilder(json).toPrettyString())
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,4 @@ Contributor License Agreement
|
||||
- You grant Forge a license to use your code contributed to the primary codebase (everything **not** under patches) in Forge, under the LGPLv2.1 license.
|
||||
- You assign copyright ownership of your contributions to the patches codebase (everything under patches) to Forge, where it will be licensed under the LGPLv2.1 license.
|
||||
|
||||
Additionally, while 1.9.4 is being maintained, you will be asked to acknowledge these two additional clauses.
|
||||
- You grant Forge a license to use your code contributed to the primary codebase (everything **not** under patches) in Forge, under the MinecraftForge license.
|
||||
- You grant assign copyright ownership of your contributions to the patches codebase (everything under patches) to Forge, where it will be licensed under the MinecraftForge license.
|
||||
|
||||
"Forge" is Forge Development LLC, a legally incorporated entity in Oregon, USA.
|
||||
+5
-5
@@ -2,16 +2,16 @@
|
||||
|
||||
MinecraftForge
|
||||
=============
|
||||
[](https://files.minecraftforge.net)
|
||||
[](https://files.minecraftforge.net)
|
||||
[](https://files.minecraftforge.net) [](https://discord.gg/UvedJ9m) [](https://www.patreon.com/LexManos)
|
||||
|
||||
Forge is a free, open-source modding API all of your favourite mods use!
|
||||
|
||||
| Version | Support |
|
||||
| Version | Support |
|
||||
| ------------- | ------------- |
|
||||
| 1.16.x | Active |
|
||||
| 1.15.x | LTS |
|
||||
| 1.17.x | Active |
|
||||
| 1.16.x | LTS |
|
||||
|
||||
* [Download]
|
||||
* [Forum]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
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;
|
||||
|
||||
@@ -34,15 +34,13 @@ import com.google.common.base.Stopwatch;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
|
||||
/**
|
||||
* Utility for running code on the main launch thread at the next available
|
||||
* opportunity. There is no guaranteed order that work from various mods will be
|
||||
* run, but your own work will be run sequentially.
|
||||
* <p>
|
||||
* <strong>Use of this class after startup is not possible.</strong> At that
|
||||
* point, {@link IThreadListener} should be used instead.
|
||||
* point, {@code ReentrantBlockableEventLoop} should be used instead.
|
||||
* <p>
|
||||
* Exceptions from tasks will be handled gracefully, causing a mod loading
|
||||
* error. Tasks that take egregiously long times to run will be logged.
|
||||
@@ -78,7 +76,12 @@ public class DeferredWorkQueue
|
||||
private static void makeRunnable(TaskInfo ti, Executor executor) {
|
||||
executor.execute(() -> {
|
||||
Stopwatch timer = Stopwatch.createStarted();
|
||||
ti.task.run();
|
||||
ModLoadingContext.get().setActiveContainer(ti.owner);
|
||||
try {
|
||||
ti.task.run();
|
||||
} finally {
|
||||
ModLoadingContext.get().setActiveContainer(null);
|
||||
}
|
||||
timer.stop();
|
||||
if (timer.elapsed(TimeUnit.SECONDS) >= 1) {
|
||||
LOGGER.warn(LOADING, "Mod '{}' took {} to run a deferred task.", ti.owner.getModId(), timer);
|
||||
@@ -86,13 +89,13 @@ public class DeferredWorkQueue
|
||||
});
|
||||
}
|
||||
|
||||
public CompletableFuture<Void> enqueueWork(final IModInfo modInfo, final Runnable work) {
|
||||
public CompletableFuture<Void> enqueueWork(final ModContainer modInfo, final Runnable work) {
|
||||
return CompletableFuture.runAsync(work, r->tasks.add(new TaskInfo(modInfo, r)));
|
||||
}
|
||||
|
||||
public <T> CompletableFuture<T> enqueueWork(final IModInfo modInfo, final Supplier<T> work) {
|
||||
public <T> CompletableFuture<T> enqueueWork(final ModContainer modInfo, final Supplier<T> work) {
|
||||
return CompletableFuture.supplyAsync(work, r->tasks.add(new TaskInfo(modInfo, r)));
|
||||
}
|
||||
|
||||
record TaskInfo(IModInfo owner, Runnable task) {}
|
||||
record TaskInfo(ModContainer owner, Runnable task) {}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public final class DistExecutor
|
||||
private DistExecutor() {}
|
||||
|
||||
/**
|
||||
* Run the callable in the supplier only on the specified {@link Side}.
|
||||
* Run the callable in the supplier only on the specified {@link Dist}.
|
||||
* This method is NOT sided-safe and special care needs to be taken in code using this method that implicit class
|
||||
* loading is not triggered by the Callable.
|
||||
*
|
||||
|
||||
@@ -28,34 +28,34 @@ 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 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)
|
||||
* 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)
|
||||
* and returns true if the version is compatible.
|
||||
*
|
||||
* <p>Return {@link net.minecraftforge.fml.network.FMLNetworkConstants#IGNORESERVERONLY} in the supplier, if you wish to be ignored
|
||||
* <p>Return {@code net.minecraftforge.impl.impl.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 network boolean is true) if you are client side,
|
||||
* <p>Return true in the predicate for all values of the input string (when impl boolean is true) if you are client side,
|
||||
* and don't care about matching any potential server version.</p>
|
||||
*
|
||||
* <p>
|
||||
* Examples: A server only mod
|
||||
*
|
||||
* <code><pre>
|
||||
* </p>
|
||||
* <pre>{@code
|
||||
* registerExtensionPoint(DISPLAYTEST, ()->Pair.of(
|
||||
* ()->FMLNetworkConstants.IGNORESERVERONLY, // ignore me, I'm a server only mod
|
||||
* (s,b)->true // i accept anything from the server or the save, if I'm asked
|
||||
* )
|
||||
* </pre></code>
|
||||
* </p>
|
||||
* }</pre>
|
||||
*
|
||||
* <p>
|
||||
* Examples: A client only mod
|
||||
* <code><pre>
|
||||
* </p>
|
||||
* <pre>{@code
|
||||
* registerExtensionPoint(DISPLAYTEST, ()->Pair.of(
|
||||
* ()->"anything. i don't care", // if i'm actually on the server, this string is sent but i'm a client only mod, so it won't be
|
||||
* (remoteversionstring,networkbool)->networkbool // i accept anything from the server, by returning true if it's asking about the server
|
||||
* )
|
||||
* </pre></code>
|
||||
* </p>
|
||||
* }</pre>
|
||||
*
|
||||
*/
|
||||
record DisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) implements IExtensionPoint<DisplayTest> {}
|
||||
|
||||
@@ -116,13 +116,13 @@ public abstract class ModContainer
|
||||
final Executor executor) {
|
||||
return CompletableFuture
|
||||
.runAsync(() -> {
|
||||
ModLoadingContext.get().setActiveContainer(target, target.contextExtension.get());
|
||||
ModLoadingContext.get().setActiveContainer(target);
|
||||
target.activityMap.getOrDefault(target.modLoadingStage, ()->{}).run();
|
||||
target.acceptEvent(eventGenerator.apply(target));
|
||||
}, executor)
|
||||
.whenComplete((mc, exception) -> {
|
||||
target.modLoadingStage = stateChangeHandler.apply(target.modLoadingStage, exception);
|
||||
ModLoadingContext.get().setActiveContainer(null, null);
|
||||
ModLoadingContext.get().setActiveContainer(null);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ 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;
|
||||
@@ -53,7 +52,7 @@ import static net.minecraftforge.fml.Logging.LOADING;
|
||||
/**
|
||||
* Loads mods.
|
||||
*
|
||||
* Dispatch cycle is seen in {@link #loadMods()} and {@link #finishMods()}
|
||||
* Dispatch cycle is seen in {@code #loadMods()} and {@code #finishMods()}
|
||||
*
|
||||
* Overall sequence for loadMods is:
|
||||
* <dl>
|
||||
@@ -61,28 +60,28 @@ import static net.minecraftforge.fml.Logging.LOADING;
|
||||
* <dd>Constructs the mod instance. Mods can typically setup basic environment such as Event listeners
|
||||
* and Configuration specifications here.</dd>
|
||||
* <dt>Automated dispatches</dt>
|
||||
* <dd>Dispatches automated elements : {@link net.minecraftforge.fml.common.Mod.EventBusSubscriber},
|
||||
* {@link net.minecraftforge.event.RegistryEvent}, {@link net.minecraftforge.common.capabilities.CapabilityInject}
|
||||
* <dd>Dispatches automated elements : {@code net.minecraftforge.fml.common.Mod.EventBusSubscriber},
|
||||
* {@code net.minecraftforge.event.RegistryEvent}, {@code net.minecraftforge.common.capabilities.CapabilityInject}
|
||||
* and others</dd>
|
||||
* <dt>CONFIG_LOAD</dt>
|
||||
* <dd>Dispatches ConfigLoadEvent to mods</dd>
|
||||
* <dt>COMMON_SETUP</dt>
|
||||
* <dd>Dispatches {@link net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent} to mods</dd>
|
||||
* <dd>Dispatches {@code net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent} to mods</dd>
|
||||
* <dt>SIDED_SETUP</dt>
|
||||
* <dd>Dispatches {@link net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent} or
|
||||
* {@link net.minecraftforge.fml.event.lifecycle.FMLDedicatedServerSetupEvent} to mods</dd>
|
||||
* <dd>Dispatches {@code net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent} or
|
||||
* {@code net.minecraftforge.fml.event.lifecycle.FMLDedicatedServerSetupEvent} to mods</dd>
|
||||
* </dl>
|
||||
*
|
||||
* Overall sequence for finishMods is:
|
||||
* <dl>
|
||||
* <dt>ENQUEUE_IMC</dt>
|
||||
* <dd>Dispatches {@link net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent} to mods,
|
||||
* <dd>Dispatches {@code net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent} to mods,
|
||||
* for enqueuing {@link InterModComms} messages for other mods to receive subsequently</dd>
|
||||
* <dt>PROCESS_IMC</dt>
|
||||
* <dd>Dispatches {@link net.minecraftforge.fml.event.lifecycle.InterModProcessEvent} to mods,
|
||||
* <dd>Dispatches {@code net.minecraftforge.fml.event.lifecycle.InterModProcessEvent} to mods,
|
||||
* for processing {@link InterModComms} messages received from other mods prior to this event</dd>
|
||||
* <dt>COMPLETE</dt>
|
||||
* <dd>Dispatches {@link net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent} to mods,
|
||||
* <dd>Dispatches {@code net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent} to mods,
|
||||
* and completes the mod loading sequence.</dd>
|
||||
* </dl>
|
||||
*/
|
||||
|
||||
@@ -36,9 +36,9 @@ public class ModLoadingContext
|
||||
|
||||
private ModContainer activeContainer;
|
||||
|
||||
public void setActiveContainer(final ModContainer container, final Object languageExtension) {
|
||||
public void setActiveContainer(final ModContainer container) {
|
||||
this.activeContainer = container;
|
||||
this.languageExtension = languageExtension;
|
||||
this.languageExtension = container == null ? null : container.contextExtension.get();
|
||||
}
|
||||
|
||||
public ModContainer getActiveContainer() {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
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;
|
||||
|
||||
@@ -19,22 +19,24 @@
|
||||
|
||||
package net.minecraftforge.fml;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.gson.Gson;
|
||||
import net.minecraftforge.fml.loading.FMLConfig;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.maven.artifact.versioning.ComparableVersion;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.http.HttpClient;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -42,6 +44,8 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import static net.minecraftforge.fml.VersionChecker.Status.*;
|
||||
|
||||
@@ -49,6 +53,7 @@ public class VersionChecker
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final int MAX_HTTP_REDIRECTS = Integer.getInteger("http.maxRedirects", 20);
|
||||
private static final int HTTP_TIMEOUT_SECS = Integer.getInteger("http.timeoutSecs", 15);
|
||||
|
||||
public enum Status
|
||||
{
|
||||
@@ -108,6 +113,8 @@ public class VersionChecker
|
||||
{
|
||||
new Thread("Forge Version Check")
|
||||
{
|
||||
private HttpClient client;
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
@@ -117,46 +124,52 @@ public class VersionChecker
|
||||
return;
|
||||
}
|
||||
|
||||
client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(HTTP_TIMEOUT_SECS)).build();
|
||||
gatherMods().forEach(this::process);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens stream for given URL while following redirects
|
||||
* Returns the response body as a String for the given URL while following redirects
|
||||
*/
|
||||
private InputStream openUrlStream(URL url) throws IOException
|
||||
{
|
||||
private String openUrlString(URL url) throws IOException, URISyntaxException, InterruptedException {
|
||||
URL currentUrl = url;
|
||||
for (int redirects = 0; redirects < MAX_HTTP_REDIRECTS; redirects++)
|
||||
{
|
||||
URLConnection c = currentUrl.openConnection();
|
||||
if (c instanceof HttpURLConnection)
|
||||
var request = HttpRequest.newBuilder()
|
||||
.uri(currentUrl.toURI())
|
||||
.timeout(Duration.ofSeconds(HTTP_TIMEOUT_SECS))
|
||||
.setHeader("Accept-Encoding", "gzip")
|
||||
.GET()
|
||||
.build();
|
||||
|
||||
final HttpResponse<InputStream> response = client.send(request, HttpResponse.BodyHandlers.ofInputStream());
|
||||
|
||||
int responseCode = response.statusCode();
|
||||
if (responseCode >= 300 && responseCode <= 399)
|
||||
{
|
||||
HttpURLConnection huc = (HttpURLConnection) c;
|
||||
huc.setInstanceFollowRedirects(false);
|
||||
int responseCode = huc.getResponseCode();
|
||||
if (responseCode >= 300 && responseCode <= 399)
|
||||
{
|
||||
try
|
||||
{
|
||||
String loc = huc.getHeaderField("Location");
|
||||
currentUrl = new URL(currentUrl, loc);
|
||||
continue;
|
||||
}
|
||||
finally
|
||||
{
|
||||
huc.disconnect();
|
||||
}
|
||||
}
|
||||
String newLocation = response.headers().firstValue("Location")
|
||||
.orElseThrow(() -> new IOException("Got a 3xx response code but Location header was null while trying to fetch " + url));
|
||||
currentUrl = new URL(currentUrl, newLocation);
|
||||
continue;
|
||||
}
|
||||
|
||||
return c.getInputStream();
|
||||
final boolean isGzipEncoded = response.headers().firstValue("Content-Encoding").orElse("").equals("gzip");
|
||||
|
||||
final String bodyStr;
|
||||
try (InputStream inStream = isGzipEncoded ? new GZIPInputStream(response.body()) : response.body())
|
||||
{
|
||||
try (var bufferedReader = new BufferedReader(new InputStreamReader(inStream)))
|
||||
{
|
||||
bodyStr = bufferedReader.lines().collect(Collectors.joining("\n"));
|
||||
}
|
||||
}
|
||||
return bodyStr;
|
||||
}
|
||||
throw new IOException("Too many redirects while trying to fetch " + url);
|
||||
}
|
||||
|
||||
private void process(IModInfo mod)
|
||||
{
|
||||
// HttpClient.newBuilder().build();
|
||||
Status status = PENDING;
|
||||
ComparableVersion target = null;
|
||||
Map<ComparableVersion, String> changes = null;
|
||||
@@ -167,9 +180,7 @@ public class VersionChecker
|
||||
URL url = mod.getUpdateURL().get();
|
||||
LOGGER.info("[{}] Starting version check at {}", mod.getModId(), url.toString());
|
||||
|
||||
InputStream con = openUrlStream(url);
|
||||
String data = new String(ByteStreams.toByteArray(con), StandardCharsets.UTF_8);
|
||||
con.close();
|
||||
String data = openUrlString(url);
|
||||
|
||||
LOGGER.debug("[{}] Received version check data:\n{}", mod.getModId(), data);
|
||||
|
||||
@@ -180,8 +191,7 @@ public class VersionChecker
|
||||
Map<String, String> promos = (Map<String, String>)json.get("promos");
|
||||
display_url = (String)json.get("homepage");
|
||||
|
||||
// String mcVersion = MCPVersion.getMCVersion();
|
||||
var mcVersion = "1.17";
|
||||
var mcVersion = FMLLoader.versionInfo().mcVersion();
|
||||
String rec = promos.get(mcVersion + "-recommended");
|
||||
String lat = promos.get(mcVersion + "-latest");
|
||||
ComparableVersion current = new ComparableVersion(mod.getVersion().toString());
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* 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.nio.file.Path;
|
||||
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.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* 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.fml.common.asm;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.signature.SignatureReader;
|
||||
import org.objectweb.asm.signature.SignatureVisitor;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import cpw.mods.modlauncher.serviceapi.ILaunchPluginService;
|
||||
|
||||
/**
|
||||
* Implements getType() in CapabilityToken subclasses.
|
||||
*
|
||||
* Using the class's signature to determine the generic type of TypeToken, and then implements getType() using that value.
|
||||
* <pre>
|
||||
* Example:
|
||||
*
|
||||
* <code>new CapabilityToken<String>(){}</code>
|
||||
* Has the signature <code>"CapabilityToken<Ljava/lang/String;>"</code>
|
||||
*
|
||||
* Implements the method:
|
||||
* <code>public String getType() {
|
||||
* return "java/lang/String";
|
||||
* }</code>
|
||||
* </pre>
|
||||
*/
|
||||
public class CapabilityTokenSubclass implements ILaunchPluginService {
|
||||
|
||||
private final String FUNC_NAME = "getType";
|
||||
private final String FUNC_DESC = "()Ljava/lang/String;";
|
||||
private final String CAP_INJECT = "net/minecraftforge/common/capabilities/CapabilityToken"; //Don't directly reference this to prevent class loading.
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return "capability_token_subclass";
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int processClassWithFlags(final Phase phase, final ClassNode classNode, final Type classType, final String reason)
|
||||
{
|
||||
if (CAP_INJECT.equals(classNode.name))
|
||||
{
|
||||
for (MethodNode mtd : classNode.methods)
|
||||
{
|
||||
if (FUNC_NAME.equals(mtd.name) && FUNC_DESC.equals(mtd.desc))
|
||||
{
|
||||
mtd.access &= ~Opcodes.ACC_FINAL; // We have it final in code so people don't override it, cuz that'd be stupid, and make our transformer more complicated.
|
||||
}
|
||||
}
|
||||
return ComputeFlags.SIMPLE_REWRITE;
|
||||
}
|
||||
else if (CAP_INJECT.equals(classNode.superName))
|
||||
{
|
||||
Holder cls = new Holder();
|
||||
|
||||
SignatureReader reader = new SignatureReader(classNode.signature); // Having a node version of this would probably be useful.
|
||||
reader.accept(new SignatureVisitor(Opcodes.ASM9)
|
||||
{
|
||||
Deque<String> stack = new ArrayDeque<>();
|
||||
|
||||
@Override
|
||||
public void visitClassType(final String name)
|
||||
{
|
||||
stack.push(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInnerClassType(final String name)
|
||||
{
|
||||
stack.push(stack.pop() + '$' + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEnd()
|
||||
{
|
||||
var val = stack.pop();
|
||||
if (!stack.isEmpty() && CAP_INJECT.equals(stack.peek()))
|
||||
cls.value = val;
|
||||
}
|
||||
});
|
||||
|
||||
if (cls.value == null)
|
||||
throw new IllegalStateException("Could not find signature for CapabilityToken on " + classNode.name + " from " + classNode.signature);
|
||||
|
||||
var mtd = classNode.visitMethod(Opcodes.ACC_PUBLIC, FUNC_NAME, FUNC_DESC, null, new String[0]);
|
||||
mtd.visitLdcInsn(cls.value);
|
||||
mtd.visitInsn(Opcodes.ARETURN);
|
||||
mtd.visitEnd();
|
||||
return ComputeFlags.COMPUTE_MAXS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ComputeFlags.NO_REWRITE;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Holder {
|
||||
String value;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-2
@@ -17,9 +17,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.asm;
|
||||
package net.minecraftforge.fml.common.asm;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
+1
-2
@@ -17,9 +17,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.asm;
|
||||
package net.minecraftforge.fml.common.asm;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -24,15 +24,12 @@ 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,9 +23,12 @@ 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;
|
||||
@@ -138,9 +141,10 @@ public class FMLLoader
|
||||
}
|
||||
}
|
||||
|
||||
static void setupLaunchHandler(final IEnvironment environment, final Map<String, ?> arguments)
|
||||
static void setupLaunchHandler(final IEnvironment environment, final Map<String, Object> arguments)
|
||||
{
|
||||
final String launchTarget = environment.getProperty(IEnvironment.Keys.LAUNCHTARGET.get()).orElse("MISSING");
|
||||
arguments.put("launchTarget", launchTarget);
|
||||
final Optional<ILaunchHandlerService> launchHandler = environment.findLaunchHandler(launchTarget);
|
||||
LOGGER.debug(CORE, "Using {} as launch service", launchTarget);
|
||||
if (launchHandler.isEmpty()) {
|
||||
|
||||
@@ -19,30 +19,23 @@
|
||||
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import cpw.mods.modlauncher.api.*;
|
||||
import joptsimple.ArgumentAcceptingOptionSpec;
|
||||
import joptsimple.OptionSpecBuilder;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
||||
import net.minecraftforge.forgespi.Environment;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.CORE;
|
||||
|
||||
public class FMLServiceProvider implements ITransformationService
|
||||
@@ -85,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.buildFactory());
|
||||
environment.computePropertyIfAbsent(Environment.Keys.MODFILEFACTORY.get(), k->ModFile::new);
|
||||
arguments = new HashMap<>();
|
||||
arguments.put("modLists", modListsArgumentList);
|
||||
arguments.put("mods", modsArgumentList);
|
||||
|
||||
@@ -32,11 +32,7 @@ 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,14 +22,8 @@ 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();
|
||||
@@ -44,32 +38,9 @@ public class LibraryFinder {
|
||||
return libsPath;
|
||||
}
|
||||
|
||||
public static Path findJarPathFor(final String className, final String jarName) {
|
||||
final URL resource = LibraryFinder.class.getClassLoader().getResource(className);
|
||||
return findJarPathFor(className, jarName, resource);
|
||||
}
|
||||
|
||||
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(CORE, "Found forge path {} is {}", forgePath, pathStatus(forgePath));
|
||||
LOGGER.debug(LogMarkers.CORE, "Found forge path {} is {}", forgePath, pathStatus(forgePath));
|
||||
return forgePath;
|
||||
}
|
||||
|
||||
@@ -81,9 +52,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(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));
|
||||
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));
|
||||
return new Path[] { patchedBinariesPath, mcExtrasPath, srgMcPath };
|
||||
}
|
||||
|
||||
@@ -93,7 +64,4 @@ public class LibraryFinder {
|
||||
public static Path findPathForMaven(final String maven) {
|
||||
return findLibsPath().resolve(MavenCoordinateResolver.get(maven));
|
||||
}
|
||||
public static Path getFMLCorePath() {
|
||||
return findLibsPath().resolve(MavenCoordinateResolver.get("net.minecraftforge:fmlcore:1.0"));
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,6 @@ 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;
|
||||
@@ -58,7 +56,7 @@ public class MCPNamingService implements INameMappingService {
|
||||
HashMap<String,String> tmpmethods = new HashMap<>(1000);
|
||||
loadMappings("methods.csv", tmpmethods::put);
|
||||
methods = tmpmethods;
|
||||
LOGGER.debug(CORE, "Loaded {} method mappings from methods.csv", methods.size());
|
||||
LOGGER.debug(LogMarkers.CORE, "Loaded {} method mappings from methods.csv", methods.size());
|
||||
}
|
||||
return methods.getOrDefault(origin, origin);
|
||||
}
|
||||
@@ -68,7 +66,7 @@ public class MCPNamingService implements INameMappingService {
|
||||
HashMap<String,String> tmpfields = new HashMap<>(1000);
|
||||
loadMappings("fields.csv", tmpfields::put);
|
||||
fields = tmpfields;
|
||||
LOGGER.debug(CORE, "Loaded {} field mappings from fields.csv", fields.size());
|
||||
LOGGER.debug(LogMarkers.CORE, "Loaded {} field mappings from fields.csv", fields.size());
|
||||
}
|
||||
return fields.getOrDefault(origin, origin);
|
||||
}
|
||||
@@ -81,7 +79,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(CORE, "Error reading mappings", e1);
|
||||
LOGGER.error(LogMarkers.CORE, "Error reading mappings", e1);
|
||||
}
|
||||
}
|
||||
}
|
||||
-1
@@ -30,7 +30,6 @@ 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,14 +32,12 @@ 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.*;
|
||||
@@ -92,6 +90,7 @@ public class ModSorter
|
||||
AtomicInteger counter = new AtomicInteger();
|
||||
Map<IModFileInfo, Integer> infos = modFiles.stream()
|
||||
.map(ModFile::getModFileInfo)
|
||||
.filter(ModFileInfo.class::isInstance)
|
||||
.collect(toMap(Function.identity(), e -> counter.incrementAndGet()));
|
||||
infos.keySet().forEach(i -> graph.addNode((ModFileInfo) i));
|
||||
modFiles.stream()
|
||||
@@ -150,9 +149,9 @@ public class ModSorter
|
||||
|
||||
private void buildUniqueList()
|
||||
{
|
||||
// Collect mod files by first modid in the file. This will be used for deduping purposes
|
||||
// Collect mod files by module name. This will be used for deduping purposes
|
||||
final Map<String, List<IModFile>> modFilesByFirstId = modFiles.stream()
|
||||
.collect(groupingBy(mf -> mf.getModInfos().get(0).getModId()));
|
||||
.collect(groupingBy(mf -> mf.getModFileInfo().moduleName()));
|
||||
|
||||
// Capture forge and MC here, so we can keep them for later
|
||||
forgeAndMC = new ArrayList<>();
|
||||
@@ -161,6 +160,10 @@ public class ModSorter
|
||||
forgeAndMC.add((ModFile) mc.get(0));
|
||||
else
|
||||
throw new IllegalStateException("Failed to find minecraft somehow?");
|
||||
// TODO: remove this hardcoding and make it more flexible
|
||||
var forge = modFilesByFirstId.get("forge");
|
||||
if (forge != null && !forge.isEmpty())
|
||||
forgeAndMC.add((ModFile) forge.get(0)); // Silently ignore if Forge isn't present
|
||||
|
||||
// Select the newest by artifact version sorting of non-unique files thus identified
|
||||
this.modFiles = modFilesByFirstId.entrySet().stream()
|
||||
@@ -242,6 +245,6 @@ public class ModSorter
|
||||
private boolean modVersionNotContained(final IModInfo.ModVersion mv, final Map<String, ArtifactVersion> modVersions)
|
||||
{
|
||||
return !(VersionSupportMatrix.testVersionSupportMatrix(mv.getVersionRange(), mv.getModId(), "mod", (modId, range) -> modVersions.containsKey(modId) &&
|
||||
(range.containsVersion(modVersions.get(modId)) || modVersions.get(modId).toString().equals("NONE"))));
|
||||
(range.containsVersion(modVersions.get(modId)) || modVersions.get(modId).toString().equals("0.0NONE"))));
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
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;
|
||||
|
||||
+76
-5
@@ -20,6 +20,11 @@
|
||||
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;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import net.minecraftforge.forgespi.locating.IModLocator;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -28,33 +33,39 @@ import org.apache.logging.log4j.Logger;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
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";
|
||||
protected static final String MANIFEST = "META-INF/MANIFEST.MF";
|
||||
|
||||
@Override
|
||||
public void scanFile(final IModFile file, final Consumer<Path> pathConsumer) {
|
||||
LOGGER.debug(SCAN,"Scan started: {}", file);
|
||||
LOGGER.debug(LogMarkers.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(SCAN,"Scan finished: {}", file);
|
||||
LOGGER.debug(LogMarkers.SCAN,"Scan finished: {}", file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IModFile> scanMods() {
|
||||
return scanCandidates()
|
||||
.map(mc -> ModFile.newFMLInstance(this, mc))
|
||||
.map(this::createMod)
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -64,4 +75,64 @@ public abstract class AbstractJarFileLocator implements IModLocator {
|
||||
public boolean isValid(final IModFile modFile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private Optional<IModFile> createMod(Path path) {
|
||||
var mjm = new ModJarMetadata();
|
||||
var sj = SecureJar.from(
|
||||
Manifest::new,
|
||||
jar -> jar.findFile(MODS_TOML).isPresent() ? mjm : JarMetadata.from(jar, path),
|
||||
(root, p) -> true,
|
||||
path
|
||||
);
|
||||
|
||||
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);
|
||||
} else if (type != null) {
|
||||
LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MANIFEST, type, path);
|
||||
mod = new ModFile(sj, this, this::manifestParser);
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
mjm.setModFile(mod);
|
||||
return Optional.ofNullable(mod);
|
||||
}
|
||||
|
||||
private IModFileInfo manifestParser(final IModFile mod) {
|
||||
Function<String, Optional<String>> cfg = name -> Optional.ofNullable(mod.getSecureJar().getManifest().getMainAttributes().getValue(name));
|
||||
var license = cfg.apply("LICENSE").orElse("");
|
||||
var dummy = new IConfigurable() {
|
||||
@Override
|
||||
public <T> Optional<T> getConfigElement(String... key) {
|
||||
return Optional.empty();
|
||||
}
|
||||
@Override
|
||||
public List<? extends IConfigurable> getConfigList(String... key) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
};
|
||||
|
||||
return new IModFileInfo() {
|
||||
@Override public List<IModInfo> getMods() { return Collections.emptyList(); }
|
||||
@Override public List<LanguageSpec> requiredLanguageLoaders() { return Collections.emptyList(); }
|
||||
@Override public boolean showAsResourcePack() { return false; }
|
||||
@Override public Map<String, Object> getFileProperties() { return Collections.emptyMap(); }
|
||||
@Override public String getLicense() { return license; }
|
||||
@Override public IModFile getFile() { return mod; }
|
||||
@Override public IConfigurable getConfig() { return dummy; }
|
||||
|
||||
// These Should never be called as it's only called from ModJarMetadata.version and we bypass that
|
||||
@Override public String moduleName() { return mod.getSecureJar().name(); }
|
||||
@Override public String versionString() { return null; }
|
||||
@Override public List<String> usesServices() { return null; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IModFileInfo(" + mod.getFilePath() + ")";
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+27
-11
@@ -19,25 +19,36 @@
|
||||
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import net.minecraftforge.forgespi.language.ModFileScanData;
|
||||
import net.minecraftforge.fml.loading.LoadingModList;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.forgespi.language.ModFileScanData;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
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 {
|
||||
NOT_STARTED,
|
||||
RUNNING,
|
||||
COMPLETE,
|
||||
TIMED_OUT,
|
||||
INTERRUPTED,
|
||||
ERRORED
|
||||
}
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private final ExecutorService modContentScanner;
|
||||
private final List<ModFile> pendingFiles;
|
||||
private final List<ModFile> scannedFiles;
|
||||
private final List<ModFile> allFiles;
|
||||
private final List<ModFile> modFiles;
|
||||
private ScanStatus status;
|
||||
private LoadingModList loadingModList;
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
@@ -51,6 +62,7 @@ public class BackgroundScanHandler
|
||||
scannedFiles = new ArrayList<>();
|
||||
pendingFiles = new ArrayList<>();
|
||||
allFiles = new ArrayList<>();
|
||||
status = ScanStatus.NOT_STARTED;
|
||||
}
|
||||
|
||||
public List<ModFile> getModFiles() {
|
||||
@@ -59,8 +71,10 @@ public class BackgroundScanHandler
|
||||
|
||||
public void submitForScanning(final ModFile file) {
|
||||
if (modContentScanner.isShutdown()) {
|
||||
status = ScanStatus.ERRORED;
|
||||
throw new IllegalStateException("Scanner has shutdown");
|
||||
}
|
||||
status = ScanStatus.RUNNING;
|
||||
allFiles.add(file);
|
||||
pendingFiles.add(file);
|
||||
final CompletableFuture<ModFileScanData> future = CompletableFuture.supplyAsync(file::compileContent, modContentScanner)
|
||||
@@ -71,7 +85,8 @@ public class BackgroundScanHandler
|
||||
|
||||
private void addCompletedFile(final ModFile file, final ModFileScanData modFileScanData, final Throwable throwable) {
|
||||
if (throwable != null) {
|
||||
LOGGER.error(SCAN,"An error occurred scanning file {}", file, throwable);
|
||||
status = ScanStatus.ERRORED;
|
||||
LOGGER.error(LogMarkers.SCAN,"An error occurred scanning file {}", file, throwable);
|
||||
}
|
||||
pendingFiles.remove(file);
|
||||
scannedFiles.add(file);
|
||||
@@ -88,18 +103,19 @@ public class BackgroundScanHandler
|
||||
}
|
||||
|
||||
public void waitForScanToComplete(final Runnable ticker) {
|
||||
boolean interrupted = false;
|
||||
boolean succeeded = false;
|
||||
boolean timeoutActive = System.getProperty("fml.disableScanTimeout") == null;
|
||||
Instant deadline = Instant.now().plus(Duration.ofMinutes(10));
|
||||
modContentScanner.shutdown();
|
||||
do {
|
||||
ticker.run();
|
||||
try {
|
||||
succeeded = modContentScanner.awaitTermination(50, TimeUnit.MILLISECONDS);
|
||||
status = modContentScanner.awaitTermination(50, TimeUnit.MILLISECONDS) ? ScanStatus.COMPLETE : ScanStatus.RUNNING;
|
||||
} catch (InterruptedException e) {
|
||||
interrupted = true;
|
||||
status = ScanStatus.INTERRUPTED;
|
||||
}
|
||||
} while (!modContentScanner.isShutdown());
|
||||
if (interrupted) Thread.currentThread().interrupt();
|
||||
if (!succeeded) throw new IllegalStateException("Failed to complete mod scan");
|
||||
if (timeoutActive && Instant.now().isAfter(deadline)) status = ScanStatus.TIMED_OUT;
|
||||
} while (status == ScanStatus.RUNNING);
|
||||
if (status == ScanStatus.INTERRUPTED) Thread.currentThread().interrupt();
|
||||
if (status != ScanStatus.COMPLETE) throw new IllegalStateException("Failed to complete mod scan");
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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.fml.loading.moddiscovery;
|
||||
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ClasspathLocator extends AbstractJarFileLocator {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private final List<Path> legacyClasspath = Arrays.stream(System.getProperty("legacyClassPath", "").split(File.pathSeparator)).map(Path::of).toList();
|
||||
private boolean enabled = false;
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return "userdev classpath";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<Path> scanCandidates() {
|
||||
if (!enabled)
|
||||
return Stream.of();
|
||||
|
||||
try {
|
||||
var claimed = new ArrayList<>(legacyClasspath);
|
||||
var paths = Stream.<Path>builder();
|
||||
|
||||
findPaths(claimed, MODS_TOML).forEach(paths::add);
|
||||
findPaths(claimed, MANIFEST).forEach(paths::add);
|
||||
|
||||
return paths.build();
|
||||
} catch (IOException e) {
|
||||
LOGGER.fatal(LogMarkers.SCAN, "Error trying to find resources", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Path> findPaths(List<Path> claimed, String resource) throws IOException {
|
||||
var ret = new ArrayList<Path>();
|
||||
final Enumeration<URL> resources = ClassLoader.getSystemClassLoader().getResources(resource);
|
||||
while (resources.hasMoreElements()) {
|
||||
URL url = resources.nextElement();
|
||||
Path path = findJarPathFor(resource, resource, url);
|
||||
if (claimed.stream().anyMatch(path::equals) || !Files.exists(path) || Files.isDirectory(path))
|
||||
continue;
|
||||
ret.add(path);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initArguments(Map<String, ?> arguments) {
|
||||
var launchTarget = (String) arguments.get("launchTarget");
|
||||
enabled = launchTarget != null && launchTarget.contains("dev");
|
||||
}
|
||||
|
||||
private 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(LogMarkers.SCAN, "Failed to find JAR for class {} - {}", resourceName, jarName);
|
||||
throw new RuntimeException("Unable to locate "+resourceName+" - "+jarName, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-7
@@ -19,6 +19,7 @@
|
||||
|
||||
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;
|
||||
@@ -34,9 +35,6 @@ 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();
|
||||
|
||||
@@ -47,8 +45,12 @@ public class ExplodedDirectoryLocator implements IModLocator {
|
||||
|
||||
@Override
|
||||
public List<IModFile> scanMods() {
|
||||
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())));
|
||||
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())));
|
||||
return List.copyOf(mods.values());
|
||||
}
|
||||
|
||||
@@ -59,13 +61,13 @@ public class ExplodedDirectoryLocator implements IModLocator {
|
||||
|
||||
@Override
|
||||
public void scanFile(final IModFile file, final Consumer<Path> pathConsumer) {
|
||||
LOGGER.debug(SCAN,"Scanning exploded directory {}", file.getFilePath().toString());
|
||||
LOGGER.debug(LogMarkers.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(SCAN,"Exploded directory scan complete {}", file.getFilePath().toString());
|
||||
LOGGER.debug(LogMarkers.SCAN,"Exploded directory scan complete {}", file.getFilePath().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+10
-8
@@ -1,11 +1,10 @@
|
||||
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;
|
||||
@@ -18,8 +17,6 @@ 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();
|
||||
@@ -29,8 +26,13 @@ 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->ModFile.newFMLInstance(this, sj)).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 -> 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();
|
||||
artifacts.add(mcjar);
|
||||
artifacts.addAll(othermods);
|
||||
return artifacts;
|
||||
@@ -97,13 +99,13 @@ public class MinecraftLocator implements IModLocator {
|
||||
|
||||
@Override
|
||||
public void scanFile(final IModFile modFile, final Consumer<Path> pathConsumer) {
|
||||
LOGGER.debug(SCAN, "Scan started: {}", modFile);
|
||||
LOGGER.debug(LogMarkers.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(SCAN, "Scan finished: {}", modFile);
|
||||
LOGGER.debug(LogMarkers.SCAN, "Scan finished: {}", modFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+17
-15
@@ -22,6 +22,7 @@ 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;
|
||||
@@ -29,16 +30,12 @@ import net.minecraftforge.forgespi.locating.IModLocator;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
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;
|
||||
@@ -46,12 +43,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(CORE,"Found Mod Locators : {}", ()->locatorList.stream().map(iModLocator -> "("+iModLocator.name() + ":" + iModLocator.getClass().getPackage().getImplementationVersion()+")").collect(Collectors.joining(",")));
|
||||
LOGGER.debug(LogMarkers.CORE,"Found Mod Locators : {}", ()->locatorList.stream().map(iModLocator -> "("+iModLocator.name() + ":" + iModLocator.getClass().getPackage().getImplementationVersion()+")").collect(Collectors.joining(",")));
|
||||
}
|
||||
|
||||
ModDiscoverer(List<IModLocator> locatorList) {
|
||||
@@ -60,17 +57,22 @@ public class ModDiscoverer {
|
||||
}
|
||||
|
||||
public ModValidator discoverMods() {
|
||||
LOGGER.debug(SCAN,"Scanning for mods and other resources to load. We know {} ways to find mods", locatorList.size());
|
||||
final var modFiles = locatorList.stream()
|
||||
.peek(loc -> LOGGER.debug(SCAN,"Trying locator {}", loc))
|
||||
.map(IModLocator::scanMods)
|
||||
.<IModFile>mapMulti(Iterable::forEach)
|
||||
.peek(mf -> LOGGER.info(SCAN,"Found mod file {} of type {} with locator {}", mf.getFileName(), mf.getType(), mf.getLocator()))
|
||||
.peek(mf -> StartupMessageManager.modLoaderConsumer().ifPresent(c->c.accept("Found mod file "+mf.getFileName()+" of type "+mf.getType())))
|
||||
LOGGER.debug(LogMarkers.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);
|
||||
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());
|
||||
StartupMessageManager.modLoaderConsumer().ifPresent(c->c.accept("Found mod file "+mf.getFileName()+" of type "+mf.getType()));
|
||||
}
|
||||
loadedFiles.addAll(modFiles);
|
||||
}
|
||||
final var modFilesMap = loadedFiles.stream()
|
||||
.map(ModFile.class::cast)
|
||||
.collect(Collectors.groupingBy(IModFile::getType));
|
||||
|
||||
var validator = new ModValidator(modFiles);
|
||||
var validator = new ModValidator(modFilesMap);
|
||||
validator.stage1Validation();
|
||||
return validator;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,9 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import net.minecraftforge.forgespi.language.IModLanguageProvider;
|
||||
@@ -46,9 +47,9 @@ 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")
|
||||
public static final Manifest DEFAULTMANIFEST;
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
@@ -72,7 +73,7 @@ public class ModFile implements IModFile {
|
||||
private List<CoreModFile> coreMods;
|
||||
private Path accessTransformer;
|
||||
|
||||
public static final Attributes.Name TYPE = new Attributes.Name("FMLModType");
|
||||
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) {
|
||||
@@ -116,10 +117,10 @@ public class ModFile implements IModFile {
|
||||
|
||||
public boolean identifyMods() {
|
||||
this.modFileInfo = ModFileParser.readModList(this, this.parser);
|
||||
if (this.modFileInfo == null) return false;
|
||||
LOGGER.debug(LOADING,"Loading mod file {} with languages {}", this.getFilePath(), this.modFileInfo.requiredLanguageLoaders());
|
||||
if (this.modFileInfo == null) return this.getType() != Type.MOD;
|
||||
LOGGER.debug(LogMarkers.LOADING,"Loading mod file {} with languages {}", this.getFilePath(), this.modFileInfo.requiredLanguageLoaders());
|
||||
this.coreMods = ModFileParser.getCoreMods(this);
|
||||
this.coreMods.forEach(mi-> LOGGER.debug(LOADING,"Found coremod {}", mi.getPath()));
|
||||
this.coreMods.forEach(mi-> LOGGER.debug(LogMarkers.LOADING,"Found coremod {}", mi.getPath()));
|
||||
this.accessTransformer = findResource("META-INF", "accesstransformer.cfg");
|
||||
return true;
|
||||
}
|
||||
@@ -139,8 +140,7 @@ public class ModFile implements IModFile {
|
||||
locator.scanFile(this, pathConsumer);
|
||||
}
|
||||
|
||||
public void setFutureScanResult(CompletableFuture<ModFileScanData> future)
|
||||
{
|
||||
public void setFutureScanResult(CompletableFuture<ModFileScanData> future) {
|
||||
this.futureScanResult = future;
|
||||
}
|
||||
|
||||
@@ -168,20 +168,17 @@ public class ModFile implements IModFile {
|
||||
StartupMessageManager.modLoaderConsumer().ifPresent(c->c.accept("Completed deep scan of "+this.getFileName()));
|
||||
}
|
||||
|
||||
public void setFileProperties(Map<String, Object> fileProperties)
|
||||
{
|
||||
public void setFileProperties(Map<String, Object> fileProperties) {
|
||||
this.fileProperties = fileProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IModLanguageProvider> getLoaders()
|
||||
{
|
||||
public List<IModLanguageProvider> getLoaders() {
|
||||
return loaders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path findResource(String... path)
|
||||
{
|
||||
public Path findResource(String... path) {
|
||||
if (path.length < 1) {
|
||||
throw new IllegalArgumentException("Missing path");
|
||||
}
|
||||
@@ -190,7 +187,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();
|
||||
}
|
||||
|
||||
@@ -214,17 +211,6 @@ public class ModFile implements IModFile {
|
||||
return modFileInfo;
|
||||
}
|
||||
|
||||
public static ModFileFactory buildFactory() {
|
||||
return ModFile::new;
|
||||
}
|
||||
|
||||
public static ModFile newFMLInstance(final IModLocator locator, final SecureJar jar) {
|
||||
return (ModFile) ModFileFactory.FACTORY.build(jar, locator, ModFileParser::modsTomlParser);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
+2
-8
@@ -21,17 +21,14 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import cpw.mods.modlauncher.api.LamdbaExceptionUtils;
|
||||
import cpw.mods.util.LambdaExceptionUtils;
|
||||
import net.minecraftforge.fml.loading.LogMarkers;
|
||||
import net.minecraftforge.fml.loading.StringUtils;
|
||||
import net.minecraftforge.forgespi.language.IConfigurable;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import net.minecraftforge.forgespi.language.MavenVersionAdapter;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.maven.artifact.versioning.VersionRange;
|
||||
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
import java.net.URL;
|
||||
import java.security.CodeSigner;
|
||||
@@ -44,12 +41,9 @@ import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.*;
|
||||
import java.util.jar.Manifest;
|
||||
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();
|
||||
@@ -88,7 +82,7 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
this.mods = modConfigs.stream()
|
||||
.map(mi-> new ModInfo(this, mi))
|
||||
.collect(Collectors.toList());
|
||||
LOGGER.debug(LOADING, "Found valid mod file {} with {} mods - versions {}",
|
||||
LOGGER.debug(LogMarkers.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(",", "{", "}")));
|
||||
|
||||
+5
-6
@@ -22,6 +22,7 @@ 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;
|
||||
@@ -37,8 +38,6 @@ 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();
|
||||
|
||||
@@ -48,10 +47,10 @@ public class ModFileParser {
|
||||
|
||||
public static IModFileInfo modsTomlParser(final IModFile imodFile) {
|
||||
ModFile modFile = (ModFile) imodFile;
|
||||
LOGGER.debug(LOADING,"Considering mod file candidate {}", modFile.getFilePath());
|
||||
LOGGER.debug(LogMarkers.LOADING,"Considering mod file candidate {}", modFile.getFilePath());
|
||||
final Path modsjson = modFile.findResource("META-INF", "mods.toml");
|
||||
if (!Files.exists(modsjson)) {
|
||||
LOGGER.warn(LOADING, "Mod file {} is missing mods.toml file", modFile.getFilePath());
|
||||
LOGGER.warn(LogMarkers.LOADING, "Mod file {} is missing mods.toml file", modFile.getFilePath());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -75,12 +74,12 @@ public class ModFileParser {
|
||||
final Gson gson = new Gson();
|
||||
coreModPaths = gson.fromJson(Files.newBufferedReader(coremodsjson), type);
|
||||
} catch (IOException e) {
|
||||
LOGGER.debug(LOADING,"Failed to read coremod list coremods.json", e);
|
||||
LOGGER.debug(LogMarkers.LOADING,"Failed to read coremod list coremods.json", e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return coreModPaths.entrySet().stream()
|
||||
.peek(e-> LOGGER.debug(LOADING,"Found coremod {} with Javascript path {}", e.getKey(), e.getValue()))
|
||||
.peek(e-> LOGGER.debug(LogMarkers.LOADING,"Found coremod {} with Javascript path {}", e.getKey(), e.getValue()))
|
||||
.map(e -> new CoreModFile(e.getKey(), modFile.findResource(e.getValue()),modFile))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
+9
-7
@@ -17,18 +17,20 @@ public final class ModJarMetadata implements JarMetadata {
|
||||
private IModFile modFile;
|
||||
private ModuleDescriptor descriptor;
|
||||
|
||||
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.18")
|
||||
static Optional<IModFile> buildFile(IModLocator locator, Predicate<SecureJar> jarTest, BiPredicate<String, String> filter, Path... files) {
|
||||
return buildFile(j->ModFile.newFMLInstance(locator, j), jarTest, filter, files);
|
||||
return buildFile(j->new ModFile(j, locator, ModFileParser::modsTomlParser), jarTest, filter, files);
|
||||
}
|
||||
|
||||
// TODO: Remove helper functions to cleanup api
|
||||
@Deprecated(forRemoval = true, since="1.18")
|
||||
static IModFile buildFile(IModLocator locator, Path... files) {
|
||||
return buildFile(locator, j->true, files).orElseThrow(()->new IllegalArgumentException("Failed to find valid JAR file"));
|
||||
return buildFile(locator, j->true, (a,b) -> true, files).orElseThrow(()->new IllegalArgumentException("Failed to find valid JAR file"));
|
||||
}
|
||||
|
||||
// TODO: Remove helper functions to cleanup api
|
||||
@Deprecated(forRemoval = true, since="1.18")
|
||||
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);
|
||||
@@ -41,7 +43,7 @@ public final class ModJarMetadata implements JarMetadata {
|
||||
}
|
||||
}
|
||||
|
||||
private ModJarMetadata() {
|
||||
ModJarMetadata() {
|
||||
}
|
||||
|
||||
public void setModFile(IModFile file) {
|
||||
|
||||
+7
-8
@@ -21,6 +21,7 @@ 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;
|
||||
@@ -35,8 +36,6 @@ 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();
|
||||
/**
|
||||
@@ -59,22 +58,22 @@ public class ModListHandler {
|
||||
filter(path -> Files.exists(path.getLeft())).
|
||||
findFirst().
|
||||
orElseGet(()->{
|
||||
LOGGER.warn(CORE, "Failed to find coordinate {}", mc);
|
||||
LOGGER.warn(LogMarkers.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(CORE, "Found mod coordinates from lists: {}", found);
|
||||
LOGGER.debug(LogMarkers.CORE, "Found mod coordinates from lists: {}", found);
|
||||
return found;
|
||||
}
|
||||
|
||||
private static List<String> transformPathToList(final String path) {
|
||||
LOGGER.debug(CORE, "Reading mod list {}", path);
|
||||
LOGGER.debug(LogMarkers.CORE, "Reading mod list {}", path);
|
||||
Path filePath = FMLPaths.GAMEDIR.get().resolve(path);
|
||||
if (!Files.exists(filePath)) {
|
||||
LOGGER.warn(CORE, "Failed to find modlist file at {}", filePath);
|
||||
LOGGER.warn(LogMarkers.CORE, "Failed to find modlist file at {}", filePath);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -82,7 +81,7 @@ public class ModListHandler {
|
||||
if (Objects.equals("list",extension)) {
|
||||
return readListFile(filePath).stream().filter(s -> !s.isEmpty()).collect(Collectors.toList());
|
||||
} else {
|
||||
LOGGER.warn(CORE, "Failed to read unknown file list type {} for file {}", extension, filePath);
|
||||
LOGGER.warn(LogMarkers.CORE, "Failed to read unknown file list type {} for file {}", extension, filePath);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -96,7 +95,7 @@ public class ModListHandler {
|
||||
try {
|
||||
return Files.readAllLines(filePath);
|
||||
} catch (IOException e) {
|
||||
LOGGER.warn(CORE, "Failed to read file list {}", filePath, e);
|
||||
LOGGER.warn(LogMarkers.CORE, "Failed to read file list {}", filePath, e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
+14
-12
@@ -1,21 +1,18 @@
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import cpw.mods.modlauncher.api.IModuleLayerManager;
|
||||
import cpw.mods.modlauncher.api.ITransformationService;
|
||||
import net.minecraftforge.fml.loading.*;
|
||||
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.progress.StartupMessageManager;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import net.minecraftforge.forgespi.locating.ModFileFactory;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static net.minecraftforge.fml.loading.LogMarkers.SCAN;
|
||||
|
||||
public class ModValidator {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -27,14 +24,19 @@ public class ModValidator {
|
||||
|
||||
public ModValidator(final Map<IModFile.Type, List<ModFile>> modFiles) {
|
||||
this.modFiles = modFiles;
|
||||
this.candidateMods = new ArrayList<>(modFiles.getOrDefault(IModFile.Type.MOD, List.of()));
|
||||
this.candidatePlugins = new ArrayList<>(modFiles.getOrDefault(IModFile.Type.LANGPROVIDER, List.of()));
|
||||
this.candidatePlugins.addAll(modFiles.getOrDefault(IModFile.Type.LIBRARY, List.of()));
|
||||
this.candidateMods = lst(modFiles.get(IModFile.Type.MOD));
|
||||
this.candidateMods.addAll(lst(modFiles.get(IModFile.Type.GAMELIBRARY)));
|
||||
this.candidatePlugins = lst(modFiles.get(IModFile.Type.LANGPROVIDER));
|
||||
this.candidatePlugins.addAll(lst(modFiles.get(IModFile.Type.LIBRARY)));
|
||||
}
|
||||
|
||||
private static List<ModFile> lst(List<ModFile> files) {
|
||||
return files == null ? new ArrayList<>() : new ArrayList<>(files);
|
||||
}
|
||||
|
||||
public void stage1Validation() {
|
||||
brokenFiles = validateFiles(candidateMods);
|
||||
LOGGER.debug(SCAN,"Found {} mod files with {} mods", candidateMods::size, ()-> candidateMods.stream().mapToInt(mf -> mf.getModInfos().size()).sum());
|
||||
LOGGER.debug(LogMarkers.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"));
|
||||
}
|
||||
|
||||
@@ -45,7 +47,7 @@ public class ModValidator {
|
||||
{
|
||||
ModFile mod = iterator.next();
|
||||
if (!mod.getLocator().isValid(mod) || !mod.identifyMods()) {
|
||||
LOGGER.warn(SCAN, "File {} has been ignored - it is invalid", mod.getFilePath());
|
||||
LOGGER.warn(LogMarkers.SCAN, "File {} has been ignored - it is invalid", mod.getFilePath());
|
||||
iterator.remove();
|
||||
brokenFiles.add(mod);
|
||||
}
|
||||
|
||||
+2
-5
@@ -20,22 +20,19 @@
|
||||
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 net.minecraftforge.forgespi.locating.IModFile;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
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
|
||||
@@ -61,7 +58,7 @@ public class ModsFolderLocator extends AbstractJarFileLocator {
|
||||
|
||||
@Override
|
||||
public Stream<Path> scanCandidates() {
|
||||
LOGGER.debug(SCAN,"Scanning mods dir {} for mods", this.modFolder);
|
||||
LOGGER.debug(LogMarkers.SCAN,"Scanning mods dir {} for mods", this.modFolder);
|
||||
var excluded = ModDirTransformerDiscoverer.allExcluded();
|
||||
|
||||
return uncheck(()-> Files.list(this.modFolder))
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
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;
|
||||
@@ -31,8 +32,6 @@ 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;
|
||||
@@ -48,7 +47,7 @@ public class Scanner {
|
||||
final List<IModLanguageProvider> loaders = fileToScan.getLoaders();
|
||||
if (loaders != null) {
|
||||
loaders.forEach(loader -> {
|
||||
LOGGER.debug(SCAN, "Scanning {} with language loader {}", fileToScan.getFilePath(), loader.name());
|
||||
LOGGER.debug(LogMarkers.SCAN, "Scanning {} with language loader {}", fileToScan.getFilePath(), loader.name());
|
||||
loader.getFileVisitor().accept(result);
|
||||
});
|
||||
}
|
||||
@@ -56,7 +55,7 @@ public class Scanner {
|
||||
}
|
||||
|
||||
private void fileVisitor(final Path path, final ModFileScanData result) {
|
||||
LOGGER.debug(SCAN,"Scanning {} path {}", fileToScan, path);
|
||||
LOGGER.debug(LogMarkers.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.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
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.fmllegacy.NoVizFallback"))
|
||||
.map(l->Class.forName(l, "net.minecraftforge.client.loading.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;
|
||||
|
||||
+3
-4
@@ -21,6 +21,7 @@ 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;
|
||||
@@ -35,8 +36,6 @@ 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) {}
|
||||
|
||||
@@ -63,7 +62,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(CORE, "Got mod coordinates {} from env", modClasses);
|
||||
LOGGER.debug(LogMarkers.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"
|
||||
@@ -72,7 +71,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(CORE, "Found supplied mod coordinates [{}]", modClassPaths);
|
||||
LOGGER.debug(LogMarkers.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.server;
|
||||
package net.minecraftforge.fml.server;
|
||||
|
||||
import cpw.mods.modlauncher.InvalidLauncherSetupException;
|
||||
import cpw.mods.modlauncher.Launcher;
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
net.minecraftforge.fml.loading.RuntimeDistCleaner
|
||||
net.minecraftforge.common.asm.RuntimeEnumExtender
|
||||
net.minecraftforge.common.asm.ObjectHolderDefinalize
|
||||
net.minecraftforge.common.asm.CapabilityInjectDefinalize
|
||||
net.minecraftforge.fml.common.asm.RuntimeEnumExtender
|
||||
net.minecraftforge.fml.common.asm.ObjectHolderDefinalize
|
||||
net.minecraftforge.fml.common.asm.CapabilityTokenSubclass
|
||||
+1
@@ -2,3 +2,4 @@ net.minecraftforge.fml.loading.moddiscovery.ModsFolderLocator
|
||||
net.minecraftforge.fml.loading.moddiscovery.MavenDirectoryLocator
|
||||
net.minecraftforge.fml.loading.moddiscovery.ExplodedDirectoryLocator
|
||||
net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator
|
||||
net.minecraftforge.fml.loading.moddiscovery.ClasspathLocator
|
||||
@@ -31,7 +31,6 @@ 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;
|
||||
|
||||
@@ -39,8 +38,6 @@ 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-snapshots/gradle-7.2-20210702220150+0000-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,67 +17,101 @@
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MSYS* | MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
@@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
@@ -106,80 +140,95 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
@@ -33,7 +33,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
/**
|
||||
* This defines a Mod to FML.
|
||||
* Any class found with this annotation applied will be loaded as a Mod. The instance that is loaded will
|
||||
* represent the mod to other Mods in the system. It will be sent various subclasses of {@link ModLifecycleEvent}
|
||||
* represent the mod to other Mods in the system. It will be sent various subclasses of {@code ModLifecycleEvent}
|
||||
* at pre-defined times during the loading of the game.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@@ -51,7 +51,7 @@ public @interface Mod
|
||||
|
||||
/**
|
||||
* Annotate a class which will be subscribed to an Event Bus at mod construction time.
|
||||
* Defaults to subscribing the current modid to the {@link MinecraftForge#EVENT_BUS}
|
||||
* Defaults to subscribing the current modid to the {@code MinecraftForge#EVENT_BUS}
|
||||
* on both sides.
|
||||
*
|
||||
* @see Bus
|
||||
@@ -84,7 +84,8 @@ public @interface Mod
|
||||
enum Bus {
|
||||
/**
|
||||
* The main Forge Event Bus.
|
||||
* @see MinecraftForge#EVENT_BUS
|
||||
*
|
||||
* <p>See {@code MinecraftForge#EVENT_BUS}</p>
|
||||
*/
|
||||
FORGE(Bindings.getForgeBus()),
|
||||
/**
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ import static net.minecraftforge.fml.Logging.LOADING;
|
||||
/**
|
||||
* Automatic eventbus subscriber - reads {@link net.minecraftforge.fml.common.Mod.EventBusSubscriber}
|
||||
* annotations and passes the class instances to the {@link net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus}
|
||||
* defined by the annotation. Defaults to {@link MinecraftForge#EVENT_BUS}
|
||||
* defined by the annotation. Defaults to {@code MinecraftForge#EVENT_BUS}
|
||||
*/
|
||||
public class AutomaticEventSubscriber
|
||||
{
|
||||
|
||||
+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 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)
|
||||
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
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.fmlserverevents.FMLServerStartingEvent;
|
||||
import net.minecraftforge.event.server.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "examplemod resources",
|
||||
"pack_format": 6,
|
||||
"_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods."
|
||||
"pack_format": 8
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/com/mojang/blaze3d/platform/GlStateManager.java
|
||||
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
|
||||
@@ -530,9 +_,16 @@
|
||||
@@ -539,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_69393_(RenderSystem::m_69587_);
|
||||
RenderSystem.m_187555_();
|
||||
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
|
||||
@@ -15,7 +_,7 @@
|
||||
@@ -16,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_);
|
||||
@@ -100,11 +_,12 @@
|
||||
@@ -105,11 +_,12 @@
|
||||
f5 = afloat[k] * p_86001_;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
--- a/com/mojang/math/Vector3f.java
|
||||
+++ b/com/mojang/math/Vector3f.java
|
||||
@@ -138,7 +_,7 @@
|
||||
|
||||
public boolean m_122278_() {
|
||||
float f = this.f_122228_ * this.f_122228_ + this.f_122229_ * this.f_122229_ + this.f_122230_ * this.f_122230_;
|
||||
- if ((double)f < 1.0E-5D) {
|
||||
+ if (f < Float.MIN_NORMAL) { //Forge: Fix MC-239212
|
||||
return false;
|
||||
} else {
|
||||
float f1 = Mth.m_14195_(f);
|
||||
@@ -207,4 +_,16 @@
|
||||
public String toString() {
|
||||
return "[" + this.f_122228_ + ", " + this.f_122229_ + ", " + this.f_122230_ + "]";
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
-
|
||||
- p_127520_.append("\n");
|
||||
+ p_127520_.append("Stacktrace:");
|
||||
+ p_127520_.append(net.minecraftforge.fmllegacy.CrashReportExtender.generateEnhancedStackTrace(this.f_127506_));
|
||||
+ p_127520_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.f_127506_));
|
||||
}
|
||||
|
||||
for(CrashReportCategory crashreportcategory : this.f_127503_) {
|
||||
@@ -21,7 +21,7 @@
|
||||
p_127520_.append("\n\n");
|
||||
}
|
||||
|
||||
+ net.minecraftforge.fmllegacy.CrashReportExtender.extendSystemReport(f_178624_);
|
||||
+ net.minecraftforge.logging.CrashReportExtender.extendSystemReport(f_178624_);
|
||||
this.f_178624_.m_143525_(p_127520_);
|
||||
}
|
||||
|
||||
@@ -41,13 +41,13 @@
|
||||
- }
|
||||
-
|
||||
- return s;
|
||||
+ return net.minecraftforge.fmllegacy.CrashReportExtender.generateEnhancedStackTrace(throwable);
|
||||
+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(throwable);
|
||||
}
|
||||
|
||||
public String m_127526_() {
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
stringbuilder.append("---- Minecraft Crash Report ----\n");
|
||||
+ net.minecraftforge.fmllegacy.CrashReportExtender.addCrashReportHeader(stringbuilder, this);
|
||||
+ net.minecraftforge.logging.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.fmllegacy.CrashReportExtender.generateEnhancedStackTrace(this.f_128139_));
|
||||
+ p_128169_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.f_128139_));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/SharedConstants.java
|
||||
+++ b/net/minecraft/SharedConstants.java
|
||||
@@ -160,6 +_,7 @@
|
||||
@@ -184,6 +_,7 @@
|
||||
}
|
||||
|
||||
static {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
--- a/net/minecraft/Util.java
|
||||
+++ b/net/minecraft/Util.java
|
||||
@@ -127,6 +_,9 @@
|
||||
return executorservice;
|
||||
@@ -149,6 +_,9 @@
|
||||
return 255;
|
||||
}
|
||||
|
||||
+ // 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 Executor m_137577_() {
|
||||
public static ExecutorService m_183988_() {
|
||||
return f_137443_;
|
||||
}
|
||||
@@ -205,7 +_,7 @@
|
||||
@@ -227,7 +_,7 @@
|
||||
try {
|
||||
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_136187_().getWorldVersion())).getChoiceType(p_137552_, p_137553_);
|
||||
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().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,6 +1,16 @@
|
||||
--- a/net/minecraft/advancements/Advancement.java
|
||||
+++ b/net/minecraft/advancements/Advancement.java
|
||||
@@ -311,6 +_,7 @@
|
||||
@@ -129,8 +_,8 @@
|
||||
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 @@
|
||||
}
|
||||
|
||||
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
|
||||
@@ -90,6 +_,7 @@
|
||||
@@ -91,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_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
|
||||
- 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
|
||||
boolean flag = false;
|
||||
|
||||
for(ResourceLocation resourcelocation : this.f_9980_) {
|
||||
@@ -5,6 +5,6 @@
|
||||
@DontObfuscate
|
||||
public static String m_129629_() {
|
||||
- return "vanilla";
|
||||
+ return net.minecraftforge.fmllegacy.BrandingControl.getClientBranding();
|
||||
+ return net.minecraftforge.internal.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() == getKeyModifierDefault();
|
||||
+ return this.f_90816_.equals(this.f_90814_) && getKeyModifier() == getDefaultKeyModifier();
|
||||
}
|
||||
|
||||
public String m_90865_() {
|
||||
@@ -174,7 +174,7 @@
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraftforge.client.settings.KeyModifier getKeyModifierDefault() {
|
||||
+ public net.minecraftforge.client.settings.KeyModifier getDefaultKeyModifier() {
|
||||
+ return keyModifierDefault;
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
--- a/net/minecraft/client/KeyboardHandler.java
|
||||
+++ b/net/minecraft/client/KeyboardHandler.java
|
||||
@@ -312,7 +_,9 @@
|
||||
@@ -307,7 +_,9 @@
|
||||
}
|
||||
|
||||
Screen screen = this.f_90867_.f_91080_;
|
||||
- if (p_90897_ == 1 && (!(this.f_90867_.f_91080_ instanceof ControlsScreen) || ((ControlsScreen)screen).f_97515_ <= Util.m_137550_() - 20L)) {
|
||||
- if (p_90897_ == 1 && (!(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 ((!(this.f_90867_.f_91080_ instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).f_193976_ <= 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_();
|
||||
@@ -331,6 +_,8 @@
|
||||
@@ -326,6 +_,8 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
+ } 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.
|
||||
+ } 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.
|
||||
}
|
||||
|
||||
if (NarratorChatListener.f_93311_.m_93316_()) {
|
||||
@@ -354,11 +_,15 @@
|
||||
@@ -349,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.onGuiKeyReleasedPre(this.f_90867_.f_91080_, p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPre(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.onGuiKeyReleasedPost(this.f_90867_.f_91080_, 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_);
|
||||
}
|
||||
} else {
|
||||
screen.m_169416_();
|
||||
- aboolean[0] = screen.m_7933_(p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiKeyPressedPre(this.f_90867_.f_91080_, p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPre(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.onGuiKeyPressedPost(this.f_90867_.f_91080_, 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_);
|
||||
}
|
||||
|
||||
}, "keyPressed event handler", screen.getClass().getCanonicalName());
|
||||
@@ -411,7 +_,7 @@
|
||||
@@ -406,7 +_,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,22 +47,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,12 +_,16 @@
|
||||
@@ -416,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.onGuiCharTypedPre(this.f_90867_.f_91080_, (char)p_90891_, p_90892_)) return;
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(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.onGuiCharTypedPost(this.f_90867_.f_91080_, (char)p_90891_, p_90892_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(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.onGuiCharTypedPre(this.f_90867_.f_91080_, c0, p_90892_)) return;
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(this.f_90867_.f_91080_, c0, p_90892_)) return;
|
||||
+ if (guieventlistener.m_5534_(c0, p_90892_)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiCharTypedPost(this.f_90867_.f_91080_, c0, p_90892_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(this.f_90867_.f_91080_, c0, p_90892_);
|
||||
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
--- a/net/minecraft/client/Minecraft.java
|
||||
+++ b/net/minecraft/client/Minecraft.java
|
||||
@@ -390,6 +_,7 @@
|
||||
public Minecraft(GameConfig p_91084_) {
|
||||
super("Client");
|
||||
f_90981_ = this;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.invalidateLog4jThreadCache();
|
||||
this.f_91069_ = p_91084_.f_101907_.f_101916_;
|
||||
File file1 = p_91084_.f_101907_.f_101918_;
|
||||
this.f_90985_ = p_91084_.f_101907_.f_101917_;
|
||||
@@ -397,14 +_,13 @@
|
||||
@@ -254,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 {
|
||||
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 @@
|
||||
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_());
|
||||
@@ -17,14 +18,22 @@
|
||||
this.f_91030_ = p_91084_.f_101905_.f_101945_;
|
||||
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.f_91030_);
|
||||
this.f_91048_ = yggdrasilauthenticationservice.createMinecraftSessionService();
|
||||
this.f_91049_ = this.m_91130_(yggdrasilauthenticationservice, p_91084_);
|
||||
this.f_193584_ = this.m_193585_(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_;
|
||||
@@ -450,7 +_,6 @@
|
||||
@@ -433,6 +_,7 @@
|
||||
}
|
||||
|
||||
Util.f_137440_ = RenderSystem.m_69576_();
|
||||
+ if (net.minecraftforge.common.ForgeConfig.CLIENT.forceSystemNanoTime.get()) Util.f_137440_ = System::nanoTime;
|
||||
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 @@
|
||||
|
||||
this.f_90990_.m_85380_(this.f_91066_.f_92113_);
|
||||
this.f_91067_ = new MouseHandler(this);
|
||||
@@ -32,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);
|
||||
@@ -458,6 +_,7 @@
|
||||
@@ -456,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.fmlclient.ClientModLoader.begin(this, this.f_91038_, this.f_91036_, this.f_91037_);
|
||||
+ net.minecraftforge.client.loading.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_);
|
||||
@@ -506,6 +_,7 @@
|
||||
@@ -504,6 +_,7 @@
|
||||
this.m_91271_();
|
||||
this.f_91036_.m_7217_(this.f_90997_);
|
||||
this.f_91061_ = new ParticleEngine(this.f_91073_, this.f_90987_);
|
||||
@@ -48,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_);
|
||||
@@ -513,7 +_,8 @@
|
||||
@@ -511,7 +_,8 @@
|
||||
this.f_91036_.m_7217_(this.f_91054_);
|
||||
this.f_91047_ = new GpuWarnlistManager();
|
||||
this.f_91036_.m_7217_(this.f_91047_);
|
||||
@@ -58,11 +67,22 @@
|
||||
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_()) {
|
||||
@@ -546,13 +_,16 @@
|
||||
@@ -529,6 +_,10 @@
|
||||
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
|
||||
}
|
||||
|
||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RegisterClientReloadListenersEvent(this.f_91036_));
|
||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.EntityRenderersEvent.RegisterLayerDefinitions());
|
||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.EntityRenderersEvent.RegisterRenderers());
|
||||
+
|
||||
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 @@
|
||||
}
|
||||
|
||||
this.f_167847_.m_168556_();
|
||||
+ if (net.minecraftforge.fmlclient.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen
|
||||
+ if (net.minecraftforge.client.loading.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) {
|
||||
@@ -80,16 +100,16 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -587,6 +_,8 @@
|
||||
@@ -585,6 +_,8 @@
|
||||
|
||||
private SocialInteractionsService m_91130_(YggdrasilAuthenticationService p_91131_, GameConfig p_91132_) {
|
||||
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
||||
try {
|
||||
+ 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_());
|
||||
+ 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_());
|
||||
} catch (AuthenticationException authenticationexception) {
|
||||
f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception);
|
||||
@@ -599,7 +_,7 @@
|
||||
@@ -597,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void m_91239_(Throwable p_91240_) {
|
||||
@@ -98,7 +118,7 @@
|
||||
Component component;
|
||||
if (p_91240_ instanceof SimpleReloadableResourceManager.ResourcePackLoadingFailure) {
|
||||
component = new TextComponent(((SimpleReloadableResourceManager.ResourcePackLoadingFailure)p_91240_).m_10921_().m_8017_());
|
||||
@@ -690,7 +_,7 @@
|
||||
@@ -691,7 +_,7 @@
|
||||
return Stream.of(Registry.f_122827_.m_7981_(p_91317_.m_41720_()));
|
||||
});
|
||||
ReloadableIdSearchTree<ItemStack> reloadableidsearchtree = new ReloadableIdSearchTree<>((p_91121_) -> {
|
||||
@@ -107,32 +127,24 @@
|
||||
});
|
||||
NonNullList<ItemStack> nonnulllist = NonNullList.m_122779_();
|
||||
|
||||
@@ -760,13 +_,13 @@
|
||||
@@ -761,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.fmllegacy.server.ServerLifecycleHooks.handleExit(-1);
|
||||
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-1);
|
||||
} else if (p_91333_.m_127512_(file2)) {
|
||||
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
|
||||
- System.exit(-1);
|
||||
+ net.minecraftforge.fmllegacy.server.ServerLifecycleHooks.handleExit(-1);
|
||||
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-1);
|
||||
} else {
|
||||
Bootstrap.m_135875_("#@?@# Game crashed! Crash report could not be saved. #@?@#");
|
||||
- System.exit(-2);
|
||||
+ net.minecraftforge.fmllegacy.server.ServerLifecycleHooks.handleExit(-2);
|
||||
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -779,6 +_,7 @@
|
||||
return this.m_168019_(false);
|
||||
}
|
||||
|
||||
+ @Deprecated // Forge: Use selective refreshResources method in FMLClientHandler
|
||||
private CompletableFuture<Void> m_168019_(boolean p_168020_) {
|
||||
if (this.f_91024_ != null) {
|
||||
return this.f_91024_;
|
||||
@@ -876,10 +_,6 @@
|
||||
@@ -877,10 +_,6 @@
|
||||
f_90982_.error("setScreen called from non-game thread");
|
||||
}
|
||||
|
||||
@@ -143,36 +155,42 @@
|
||||
if (p_91153_ == null && this.f_91073_ == null) {
|
||||
p_91153_ = new TitleScreen();
|
||||
} else if (p_91153_ == null && this.f_91074_.m_21224_()) {
|
||||
@@ -890,6 +_,14 @@
|
||||
@@ -891,6 +_,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
|
||||
+ Screen old = this.f_91080_;
|
||||
+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(p_91153_);
|
||||
+ net.minecraftforge.client.event.ScreenOpenEvent event = new net.minecraftforge.client.event.ScreenOpenEvent(p_91153_);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
|
||||
+
|
||||
+ p_91153_ = event.getGui();
|
||||
+ p_91153_ = event.getScreen();
|
||||
+ if (old != null && p_91153_ != old)
|
||||
+ old.m_7861_();
|
||||
+
|
||||
this.f_91080_ = p_91153_;
|
||||
BufferUploader.m_166835_();
|
||||
if (p_91153_ != null) {
|
||||
@@ -1018,11 +_,13 @@
|
||||
@@ -1019,11 +_,13 @@
|
||||
RenderSystem.m_69481_();
|
||||
this.f_91026_.m_7238_();
|
||||
if (!this.f_91079_) {
|
||||
+ net.minecraftforge.fmllegacy.hooks.BasicEventHooks.onRenderTickStart(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_);
|
||||
+ net.minecraftforge.event.ForgeEventFactory.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.fmllegacy.hooks.BasicEventHooks.onRenderTickEnd(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_);
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_);
|
||||
}
|
||||
|
||||
if (this.f_91056_ != null) {
|
||||
@@ -1136,6 +_,7 @@
|
||||
@@ -1129,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_());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_());
|
||||
}
|
||||
|
||||
RenderTarget rendertarget = this.m_91385_();
|
||||
rendertarget.m_83941_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_(), f_91002_);
|
||||
@@ -180,7 +198,7 @@
|
||||
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
|
||||
this.f_91067_.m_91599_();
|
||||
}
|
||||
@@ -1432,11 +_,21 @@
|
||||
@@ -1429,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_();
|
||||
@@ -204,7 +222,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1455,6 +_,8 @@
|
||||
@@ -1452,6 +_,8 @@
|
||||
}
|
||||
|
||||
} else if (!this.f_91074_.m_108637_()) {
|
||||
@@ -213,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_());
|
||||
@@ -1462,7 +_,7 @@
|
||||
@@ -1459,7 +_,7 @@
|
||||
case BLOCK:
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
||||
BlockPos blockpos = blockhitresult.m_82425_();
|
||||
@@ -222,7 +240,7 @@
|
||||
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_());
|
||||
break;
|
||||
}
|
||||
@@ -1472,8 +_,10 @@
|
||||
@@ -1469,8 +_,10 @@
|
||||
}
|
||||
|
||||
this.f_91074_.m_36334_();
|
||||
@@ -233,7 +251,7 @@
|
||||
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
@@ -1488,6 +_,11 @@
|
||||
@@ -1485,6 +_,11 @@
|
||||
}
|
||||
|
||||
for(InteractionHand interactionhand : InteractionHand.values()) {
|
||||
@@ -245,7 +263,7 @@
|
||||
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
|
||||
if (this.f_91077_ != null) {
|
||||
switch(this.f_91077_.m_6662_()) {
|
||||
@@ -1501,6 +_,7 @@
|
||||
@@ -1502,6 +_,7 @@
|
||||
|
||||
if (interactionresult.m_19077_()) {
|
||||
if (interactionresult.m_19080_()) {
|
||||
@@ -253,7 +271,7 @@
|
||||
this.f_91074_.m_6674_(interactionhand);
|
||||
}
|
||||
|
||||
@@ -1513,6 +_,7 @@
|
||||
@@ -1514,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_()) {
|
||||
@@ -261,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);
|
||||
@@ -1528,6 +_,9 @@
|
||||
@@ -1529,6 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,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_()) {
|
||||
@@ -1554,6 +_,8 @@
|
||||
@@ -1555,6 +_,8 @@
|
||||
--this.f_91011_;
|
||||
}
|
||||
|
||||
+ net.minecraftforge.fmllegacy.hooks.BasicEventHooks.onPreClientTick();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
|
||||
+
|
||||
this.f_91026_.m_6180_("gui");
|
||||
if (!this.f_91012_) {
|
||||
this.f_91065_.m_93066_();
|
||||
@@ -1679,6 +_,8 @@
|
||||
this.f_91065_.m_193832_(this.f_91012_);
|
||||
this.f_91026_.m_7238_();
|
||||
@@ -1683,6 +_,8 @@
|
||||
this.f_91026_.m_6182_("keyboard");
|
||||
this.f_91068_.m_90931_();
|
||||
this.f_91026_.m_7238_();
|
||||
+
|
||||
+ net.minecraftforge.fmllegacy.hooks.BasicEventHooks.onPostClientTick();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPostClientTick();
|
||||
}
|
||||
|
||||
private boolean m_91278_() {
|
||||
@@ -1814,11 +_,11 @@
|
||||
@@ -1821,11 +_,11 @@
|
||||
}
|
||||
|
||||
public void m_91200_(String p_91201_) {
|
||||
@@ -303,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_);
|
||||
@@ -1828,10 +_,10 @@
|
||||
@@ -1835,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());
|
||||
@@ -316,7 +334,7 @@
|
||||
LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess;
|
||||
try {
|
||||
levelstoragesource$levelstorageaccess = this.f_91031_.m_78260_(p_91220_);
|
||||
@@ -1843,12 +_,17 @@
|
||||
@@ -1850,12 +_,17 @@
|
||||
}
|
||||
|
||||
Minecraft.ServerStem minecraft$serverstem;
|
||||
@@ -336,7 +354,7 @@
|
||||
}));
|
||||
|
||||
try {
|
||||
@@ -1868,7 +_,7 @@
|
||||
@@ -1875,7 +_,7 @@
|
||||
this.f_90999_.set((StoringChunkProgressListener)null);
|
||||
|
||||
try {
|
||||
@@ -345,8 +363,8 @@
|
||||
minecraft$serverstem.m_91433_().m_136179_();
|
||||
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(this.f_91030_);
|
||||
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
|
||||
@@ -1880,7 +_,7 @@
|
||||
SkullBlockEntity.m_182462_(this);
|
||||
@@ -1885,7 +_,7 @@
|
||||
SkullBlockEntity.m_196700_(gameprofilecache, minecraftsessionservice, 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_) -> {
|
||||
@@ -354,7 +372,7 @@
|
||||
StoringChunkProgressListener storingchunkprogresslistener = new StoringChunkProgressListener(p_168000_ + 0);
|
||||
this.f_90999_.set(storingchunkprogresslistener);
|
||||
return ProcessorChunkProgressListener.m_143583_(storingchunkprogresslistener, this.f_91023_::add);
|
||||
@@ -1924,11 +_,16 @@
|
||||
@@ -1929,11 +_,16 @@
|
||||
connection.m_129505_(new ClientHandshakePacketListenerImpl(connection, this, (Screen)null, (p_167998_) -> {
|
||||
}));
|
||||
connection.m_129512_(new ClientIntentionPacket(socketaddress.toString(), 0, ConnectionProtocol.LOGIN));
|
||||
@@ -373,7 +391,7 @@
|
||||
});
|
||||
minecraft$serverstem.close();
|
||||
|
||||
@@ -2016,6 +_,7 @@
|
||||
@@ -2021,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_91156_(ClientLevel p_91157_) {
|
||||
@@ -381,11 +399,11 @@
|
||||
ProgressScreen progressscreen = new ProgressScreen(true);
|
||||
progressscreen.m_6309_(new TranslatableComponent("connect.joining"));
|
||||
this.m_91362_(progressscreen);
|
||||
@@ -2049,10 +_,12 @@
|
||||
@@ -2053,10 +_,12 @@
|
||||
IntegratedServer integratedserver = this.f_91007_;
|
||||
this.f_91007_ = null;
|
||||
this.f_91063_.m_109150_();
|
||||
+ net.minecraftforge.fmlclient.ClientHooks.firePlayerLogout(this.f_91072_, this.f_91074_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.firePlayerLogout(this.f_91072_, this.f_91074_);
|
||||
this.f_91072_ = null;
|
||||
NarratorChatListener.f_93311_.m_93328_();
|
||||
this.m_91362_(p_91321_);
|
||||
@@ -394,23 +412,15 @@
|
||||
if (integratedserver != null) {
|
||||
this.f_91026_.m_6180_("waitForServer");
|
||||
|
||||
@@ -2067,6 +_,7 @@
|
||||
@@ -2071,6 +_,7 @@
|
||||
this.f_91065_.m_93089_();
|
||||
this.f_91008_ = null;
|
||||
this.f_91010_ = false;
|
||||
+ net.minecraftforge.fmlclient.ClientHooks.handleClientWorldClosing(f_91073_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(f_91073_);
|
||||
this.f_91004_.m_90740_();
|
||||
}
|
||||
|
||||
@@ -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 @@
|
||||
@@ -2157,66 +_,9 @@
|
||||
|
||||
private void m_91280_() {
|
||||
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
|
||||
@@ -480,15 +490,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2318,6 +_,7 @@
|
||||
return f_90981_;
|
||||
}
|
||||
|
||||
+ @Deprecated // Forge: Use selective scheduleResourceRefresh method in FMLClientHandler
|
||||
public CompletableFuture<Void> m_91088_() {
|
||||
return this.m_18691_(() -> this.m_91391_()).thenCompose((p_167945_) -> {
|
||||
return p_167945_;
|
||||
@@ -2768,7 +_,7 @@
|
||||
@@ -2707,7 +_,7 @@
|
||||
return this.f_90993_;
|
||||
}
|
||||
|
||||
@@ -497,7 +499,7 @@
|
||||
int i = p_167938_.m_10374_();
|
||||
Supplier<PackResources> supplier = p_167937_;
|
||||
if (i <= 3) {
|
||||
@@ -2779,7 +_,7 @@
|
||||
@@ -2718,7 +_,7 @@
|
||||
supplier = m_91352_(supplier);
|
||||
}
|
||||
|
||||
@@ -506,7 +508,7 @@
|
||||
}
|
||||
|
||||
private static Supplier<PackResources> m_91330_(Supplier<PackResources> p_91331_) {
|
||||
@@ -2796,6 +_,14 @@
|
||||
@@ -2735,6 +_,14 @@
|
||||
|
||||
public void m_91312_(int p_91313_) {
|
||||
this.f_91051_.m_119410_(p_91313_);
|
||||
|
||||
Regular → Executable
+15
-11
@@ -8,21 +8,25 @@
|
||||
boolean[] aboolean = new boolean[]{false};
|
||||
if (this.f_91503_.m_91265_() == null) {
|
||||
if (this.f_91503_.f_91080_ == null) {
|
||||
@@ -82,11 +_,15 @@
|
||||
@@ -82,11 +_,19 @@
|
||||
if (flag) {
|
||||
screen.m_169415_();
|
||||
Screen.m_96579_(() -> {
|
||||
- aboolean[0] = screen.m_6375_(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);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseClickedPost(this.f_91503_.f_91080_, d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseClickedPre(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]);
|
||||
+ }
|
||||
}, "mouseClicked event handler", screen.getClass().getCanonicalName());
|
||||
} else {
|
||||
Screen.m_96579_(() -> {
|
||||
- aboolean[0] = screen.m_6348_(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);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onGuiMouseReleasedPost(this.f_91503_.f_91080_, d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseReleasedPre(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]);
|
||||
+ }
|
||||
}, "mouseReleased event handler", screen.getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
@@ -50,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.onGuiMouseScrollPre(this, this.f_91503_.f_91080_, d0)) return;
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenMouseScrollPre(this, this.f_91503_.f_91080_, d0)) return;
|
||||
+ if (this.f_91503_.f_91080_.m_6050_(d1, d2, d0)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onGuiMouseScrollPost(this, this.f_91503_.f_91080_, d0);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseScrollPost(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;
|
||||
@@ -69,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.onGuiMouseDragPre(this.f_91503_.f_91080_, d0, d1, this.f_91510_, d2, d3)) return;
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenMouseDragPre(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.onGuiMouseDragPost(this.f_91503_.f_91080_, d0, d1, this.f_91510_, d2, d3);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseDragPost(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
|
||||
@@ -179,6 +_,7 @@
|
||||
@@ -186,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) {
|
||||
@@ -283,10 +_,14 @@
|
||||
this.f_92076_ = p_168428_.m_142682_("syncChunkWrites", this.f_92076_);
|
||||
@@ -299,10 +_,14 @@
|
||||
this.f_193762_ = p_168428_.m_142682_("allowServerListing", this.f_193762_);
|
||||
|
||||
for(KeyMapping keymapping : this.f_92059_) {
|
||||
- String s = keymapping.m_90865_();
|
||||
@@ -25,15 +25,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,6 +_,7 @@
|
||||
@@ -490,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_92169_() {
|
||||
+ if (net.minecraftforge.fmlclient.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
|
||||
+ if (net.minecraftforge.client.loading.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
|
||||
try {
|
||||
final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.f_92110_), StandardCharsets.UTF_8));
|
||||
|
||||
@@ -622,6 +_,23 @@
|
||||
@@ -638,6 +_,23 @@
|
||||
}
|
||||
|
||||
p_92146_.m_10509_(set);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
+ }
|
||||
+ final File target = event.getScreenshotFile();
|
||||
+
|
||||
Util.m_137579_().execute(() -> {
|
||||
Util.m_183992_().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
|
||||
@@ -18,8 +_,22 @@
|
||||
private final String f_92536_;
|
||||
private final String f_92537_;
|
||||
@@ -21,8 +_,22 @@
|
||||
private final Optional<String> f_193796_;
|
||||
private final Optional<String> f_193797_;
|
||||
private final User.Type f_92538_;
|
||||
+ /** Forge: Cache of the local session's GameProfile properties. */
|
||||
+ private com.mojang.authlib.properties.PropertyMap properties;
|
||||
|
||||
public User(String p_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";
|
||||
public User(String p_193799_, String p_193800_, String p_193801_, Optional<String> p_193802_, Optional<String> p_193803_, User.Type p_193804_) {
|
||||
+ if (p_193799_ == null || p_193799_.isEmpty()) {
|
||||
+ p_193799_ = "MissingName";
|
||||
+ p_193800_ = p_193801_ = "NotValid";
|
||||
+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger(getClass().getName());
|
||||
+ logger.warn("=========================================================");
|
||||
+ logger.warn("WARNING!! the username was not set for this session, typically");
|
||||
@@ -20,10 +20,10 @@
|
||||
+ logger.warn("when asking for help!");
|
||||
+ logger.warn("=========================================================");
|
||||
+ }
|
||||
this.f_92535_ = p_92540_;
|
||||
this.f_92536_ = p_92541_;
|
||||
this.f_92537_ = p_92542_;
|
||||
@@ -45,10 +_,22 @@
|
||||
this.f_92535_ = p_193799_;
|
||||
this.f_92536_ = p_193800_;
|
||||
this.f_92537_ = p_193801_;
|
||||
@@ -58,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
|
||||
@@ -446,6 +_,10 @@
|
||||
@@ -463,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 k = this.f_92977_;
|
||||
int l = 1;
|
||||
@@ -483,6 +_,7 @@
|
||||
int i = this.f_92977_;
|
||||
int j = 1;
|
||||
@@ -500,6 +_,7 @@
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, f1);
|
||||
m_93200_(p_93029_, j1 + 3, k1 + 3, this.m_93252_(), 18, 18, textureatlassprite);
|
||||
m_93200_(p_93029_, l + 3, i1 + 3, this.m_93252_(), 18, 18, textureatlassprite);
|
||||
});
|
||||
+ renderer.renderHUDEffect(mobeffectinstance,this, p_93029_, k, l, this.m_93252_(), f);
|
||||
+ renderer.renderHUDEffect(mobeffectinstance,this, p_93029_, i, j, this.m_93252_(), f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,7 +_,8 @@
|
||||
@@ -625,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_()) {
|
||||
@@ -624,7 +_,13 @@
|
||||
@@ -641,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_();
|
||||
}
|
||||
}
|
||||
@@ -1128,7 +_,7 @@
|
||||
@@ -1153,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
|
||||
@@ -123,6 +_,7 @@
|
||||
@@ -118,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.bossBarRenderPre(p_93705_, this.f_93698_.m_91268_(), lerpingbossevent, k, j, 10 + this.f_93698_.f_91062_.f_92710_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.renderBossEventPre(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.bossBarRenderPost(p_93705_, this.f_93698_.m_91268_());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.renderBossEventPost(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
|
||||
@@ -354,7 +_,7 @@
|
||||
@@ -363,7 +_,7 @@
|
||||
list.add(this.m_94071_(entry));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
list.add("#" + resourcelocation);
|
||||
}
|
||||
}
|
||||
@@ -370,7 +_,7 @@
|
||||
@@ -379,7 +_,7 @@
|
||||
list.add(this.m_94071_(entry1));
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
list.add("#" + resourcelocation1);
|
||||
}
|
||||
}
|
||||
@@ -380,6 +_,7 @@
|
||||
@@ -389,6 +_,7 @@
|
||||
list.add("");
|
||||
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
|
||||
list.add(String.valueOf((Object)Registry.f_122826_.m_7981_(entity.m_6095_())));
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/client/gui/screens/LanguageSelectScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/LanguageSelectScreen.java
|
||||
@@ -36,7 +_,7 @@
|
||||
if (languageselectscreen$languageselectionlist$entry != null && !languageselectscreen$languageselectionlist$entry.f_96116_.getCode().equals(this.f_96080_.m_118983_().getCode())) {
|
||||
this.f_96080_.m_118974_(languageselectscreen$languageselectionlist$entry.f_96116_);
|
||||
this.f_96282_.f_92075_ = languageselectscreen$languageselectionlist$entry.f_96116_.getCode();
|
||||
- this.f_96541_.m_91391_();
|
||||
+ net.minecraftforge.client.ForgeHooksClient.refreshResources(this.f_96541_, net.minecraftforge.resource.VanillaResourceType.LANGUAGES);
|
||||
this.f_96282_.m_92169_();
|
||||
}
|
||||
|
||||
@@ -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.fmlclient.ClientModLoader.renderProgressText();
|
||||
+ net.minecraftforge.client.loading.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
|
||||
@@ -134,4 +_,12 @@
|
||||
@@ -141,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,81 +1,151 @@
|
||||
--- a/net/minecraft/client/gui/screens/Screen.java
|
||||
+++ b/net/minecraft/client/gui/screens/Screen.java
|
||||
@@ -163,7 +_,10 @@
|
||||
@@ -126,7 +_,7 @@
|
||||
}
|
||||
|
||||
public void m_7379_() {
|
||||
- this.f_96541_.m_91152_((Screen)null);
|
||||
+ this.f_96541_.popGuiLayer();
|
||||
}
|
||||
|
||||
protected <T extends GuiEventListener & Widget & NarratableEntry> T m_142416_(T p_169406_) {
|
||||
@@ -163,15 +_,29 @@
|
||||
this.f_169368_.clear();
|
||||
}
|
||||
|
||||
+ private Font tooltipFont = null;
|
||||
+ private ItemStack tooltipStack = ItemStack.f_41583_;
|
||||
protected void m_6057_(PoseStack p_96566_, ItemStack p_96567_, int p_96568_, int p_96569_) {
|
||||
- this.m_169388_(p_96566_, this.m_96555_(p_96567_), p_96567_.m_150921_(), p_96568_, p_96569_);
|
||||
+ Font font = net.minecraftforge.client.RenderProperties.get(p_96567_).getFont(p_96567_);
|
||||
+ net.minecraftforge.fmlclient.gui.GuiUtils.preItemToolTip(p_96567_);
|
||||
+ this.renderComponentToolTip(p_96566_, this.m_96555_(p_96567_), p_96568_, p_96569_, (font == null ? this.f_96547_ : font));
|
||||
+ net.minecraftforge.fmlclient.gui.GuiUtils.postItemToolTip();
|
||||
+ tooltipStack = p_96567_;
|
||||
this.m_169388_(p_96566_, this.m_96555_(p_96567_), p_96567_.m_150921_(), p_96568_, p_96569_);
|
||||
+ tooltipStack = ItemStack.f_41583_;
|
||||
}
|
||||
|
||||
+ public void renderTooltip(PoseStack poseStack, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, int x, int y, ItemStack stack) {
|
||||
+ this.renderTooltip(poseStack, textComponents, tooltipComponent, x, y, null, stack);
|
||||
+ }
|
||||
+ public void renderTooltip(PoseStack poseStack, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, int x, int y, @Nullable Font font) {
|
||||
+ this.renderTooltip(poseStack, textComponents, tooltipComponent, x, y, font, ItemStack.f_41583_);
|
||||
+ }
|
||||
+ public void renderTooltip(PoseStack poseStack, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, int x, int y, @Nullable Font font, ItemStack stack) {
|
||||
+ this.tooltipFont = font;
|
||||
+ this.tooltipStack = stack;
|
||||
+ this.m_169388_(poseStack, textComponents, tooltipComponent, x, y);
|
||||
+ this.tooltipFont = null;
|
||||
+ this.tooltipStack = ItemStack.f_41583_;
|
||||
+ }
|
||||
public void m_169388_(PoseStack p_169389_, List<Component> p_169390_, Optional<TooltipComponent> p_169391_, int p_169392_, int p_169393_) {
|
||||
@@ -171,7 +_,7 @@
|
||||
p_169391_.ifPresent((p_169399_) -> {
|
||||
list.add(1, ClientTooltipComponent.m_169950_(p_169399_));
|
||||
});
|
||||
- this.m_169383_(p_169389_, list, p_169392_, p_169393_);
|
||||
+ this.renderTooltipInternal(p_169389_, list, p_169392_, p_169393_, f_96547_);
|
||||
- List<ClientTooltipComponent> list = p_169390_.stream().map(Component::m_7532_).map(ClientTooltipComponent::m_169948_).collect(Collectors.toList());
|
||||
- p_169391_.ifPresent((p_169399_) -> {
|
||||
- list.add(1, ClientTooltipComponent.m_169950_(p_169399_));
|
||||
- });
|
||||
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_169390_, p_169391_, p_169392_, f_96543_, f_96544_, this.tooltipFont, this.f_96547_);
|
||||
this.m_169383_(p_169389_, list, p_169392_, p_169393_);
|
||||
}
|
||||
|
||||
public List<Component> m_96555_(ItemStack p_96556_) {
|
||||
@@ -179,24 +_,30 @@
|
||||
}
|
||||
|
||||
public void m_96602_(PoseStack p_96603_, Component p_96604_, int p_96605_, int p_96606_) {
|
||||
- this.m_96617_(p_96603_, Arrays.asList(p_96604_.m_7532_()), p_96605_, p_96606_);
|
||||
+ this.m_96597_(p_96603_, Arrays.asList(p_96604_), p_96605_, p_96606_);
|
||||
@@ -184,20 +_,44 @@
|
||||
}
|
||||
|
||||
public void m_96597_(PoseStack p_96598_, List<Component> p_96599_, int p_96600_, int p_96601_) {
|
||||
- this.m_96617_(p_96598_, Lists.transform(p_96599_, Component::m_7532_), p_96600_, p_96601_);
|
||||
+ this.renderComponentToolTip(p_96598_, p_96599_, p_96600_, p_96601_, f_96547_);
|
||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_96599_, p_96600_, f_96543_, f_96544_, this.tooltipFont, this.f_96547_);
|
||||
+ this.m_169383_(p_96598_, components, p_96600_, p_96601_);
|
||||
+ }
|
||||
+ public void renderComponentToolTip(PoseStack matrixStack, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, Font font) {
|
||||
+ net.minecraftforge.fmlclient.gui.GuiUtils.drawHoveringText(matrixStack, tooltips, mouseX, mouseY, f_96543_, f_96544_, -1, font);
|
||||
+ public void renderComponentTooltip(PoseStack poseStack, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, ItemStack stack) {
|
||||
+ this.renderComponentTooltip(poseStack, tooltips, mouseX, mouseY, null, stack);
|
||||
+ }
|
||||
+ 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_);
|
||||
+ }
|
||||
+
|
||||
+ 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;
|
||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, f_96543_, f_96544_, this.tooltipFont, this.f_96547_);
|
||||
+ this.m_169383_(poseStack, components, mouseX, mouseY);
|
||||
+ this.tooltipFont = null;
|
||||
+ this.tooltipStack = ItemStack.f_41583_;
|
||||
}
|
||||
|
||||
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_);
|
||||
+ this.renderToolTip(p_96618_, p_96619_, p_96620_, p_96621_, f_96547_);
|
||||
+ }
|
||||
+ public void renderToolTip(PoseStack p_96618_, List<? extends FormattedCharSequence> p_96619_, int p_96620_, int p_96621_, Font font) {
|
||||
+ this.renderTooltipInternal(p_96618_, p_96619_.stream().map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()), p_96620_, p_96621_, font);
|
||||
this.m_169383_(p_96618_, p_96619_.stream().map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()), p_96620_, p_96621_);
|
||||
}
|
||||
|
||||
- private void m_169383_(PoseStack p_169384_, List<ClientTooltipComponent> p_169385_, int p_169386_, int p_169387_) {
|
||||
+ private void renderTooltipInternal(PoseStack p_169384_, List<ClientTooltipComponent> p_169385_, int p_169386_, int p_169387_, Font 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_);
|
||||
+ 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_(font);
|
||||
+ int k = clienttooltipcomponent.m_142069_(preEvent.getFont());
|
||||
if (k > i) {
|
||||
i = k;
|
||||
}
|
||||
@@ -249,7 +_,7 @@
|
||||
@@ -205,8 +_,8 @@
|
||||
j += clienttooltipcomponent.m_142103_();
|
||||
}
|
||||
|
||||
- int j2 = p_169386_ + 12;
|
||||
- int k2 = p_169387_ - 12;
|
||||
+ int j2 = preEvent.getX() + 12;
|
||||
+ int k2 = preEvent.getY() - 12;
|
||||
if (j2 + i > this.f_96543_) {
|
||||
j2 -= 28 + i;
|
||||
}
|
||||
@@ -227,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_();
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 4, j2 + i + 3, k2 - 3, 400, -267386864, -267386864);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 + j + 3, j2 + i + 3, k2 + j + 4, 400, -267386864, -267386864);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 + j + 3, 400, -267386864, -267386864);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 4, k2 - 3, j2 - 3, k2 + j + 3, 400, -267386864, -267386864);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 + i + 3, k2 - 3, j2 + i + 4, k2 + j + 3, 400, -267386864, -267386864);
|
||||
- m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + j + 3 - 1, 400, 1347420415, 1344798847);
|
||||
- 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_);
|
||||
+ 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());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 4, k2 - 3, j2 - 3, k2 + j + 3, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 + i + 3, k2 - 3, j2 + i + 4, k2 + j + 3, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + j + 3 - 1, 400, colorEvent.getBorderStart(), colorEvent.getBorderEnd());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 + i + 2, k2 - 3 + 1, j2 + i + 3, k2 + j + 3 - 1, 400, colorEvent.getBorderStart(), colorEvent.getBorderEnd());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 - 3, j2 + i + 3, k2 - 3 + 1, 400, colorEvent.getBorderStart(), colorEvent.getBorderStart());
|
||||
+ m_93123_(matrix4f, bufferbuilder, j2 - 3, k2 + j + 2, j2 + i + 3, k2 + j + 3, 400, colorEvent.getBorderEnd(), colorEvent.getBorderEnd());
|
||||
RenderSystem.m_69482_();
|
||||
RenderSystem.m_69472_();
|
||||
RenderSystem.m_69478_();
|
||||
@@ -250,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_(font, j2, l1, matrix4f, multibuffersource$buffersource);
|
||||
+ clienttooltipcomponent1.m_142440_(preEvent.getFont(), j2, l1, matrix4f, multibuffersource$buffersource);
|
||||
l1 += clienttooltipcomponent1.m_142103_() + (i2 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -259,7 +_,7 @@
|
||||
@@ -260,7 +_,7 @@
|
||||
|
||||
for(int l2 = 0; l2 < p_169385_.size(); ++l2) {
|
||||
ClientTooltipComponent clienttooltipcomponent2 = p_169385_.get(l2);
|
||||
- clienttooltipcomponent2.m_142162_(this.f_96547_, j2, l1, p_169384_, this.f_96542_, 400, this.f_96541_.m_91097_());
|
||||
+ clienttooltipcomponent2.m_142162_(font, j2, l1, p_169384_, this.f_96542_, 400, this.f_96541_.m_91097_());
|
||||
- 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);
|
||||
l1 += clienttooltipcomponent2.m_142103_() + (l2 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -353,9 +_,12 @@
|
||||
@@ -354,9 +_,12 @@
|
||||
}
|
||||
|
||||
public void m_96612_(String p_96613_, boolean p_96614_) {
|
||||
@@ -88,48 +158,45 @@
|
||||
|
||||
this.f_96541_.f_91074_.m_108739_(p_96613_);
|
||||
}
|
||||
@@ -366,11 +_,24 @@
|
||||
@@ -367,11 +_,21 @@
|
||||
this.f_96547_ = p_96607_.f_91062_;
|
||||
this.f_96543_ = p_96608_;
|
||||
this.f_96544_ = p_96609_;
|
||||
+ java.util.function.Consumer<GuiEventListener> add = (b) -> {
|
||||
+ if (b instanceof Widget) {
|
||||
+ this.f_169369_.add((Widget)b);
|
||||
+ }
|
||||
+
|
||||
+ if (b instanceof NarratableEntry) {
|
||||
+ this.f_169368_.add((NarratableEntry)b);
|
||||
+ }
|
||||
+ f_96540_.remove(b);
|
||||
+ if (b instanceof Widget w)
|
||||
+ this.f_169369_.add(w);
|
||||
+ if (b instanceof NarratableEntry ne)
|
||||
+ this.f_169368_.add(ne);
|
||||
+ f_96540_.add(b);
|
||||
+ };
|
||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.f_96540_, add, this::m_169411_))) {
|
||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.InitScreenEvent.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.GuiScreenEvent.InitGuiEvent.Post(this, this.f_96540_, add, this::m_169411_));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.InitScreenEvent.Post(this, this.f_96540_, add, this::m_169411_));
|
||||
}
|
||||
|
||||
public List<? extends GuiEventListener> m_6702_() {
|
||||
@@ -393,6 +_,7 @@
|
||||
@@ -394,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.GuiScreenEvent.BackgroundDrawnEvent(this, p_96559_));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundDrawnEvent(this, p_96559_));
|
||||
} else {
|
||||
this.m_96626_(p_96560_);
|
||||
}
|
||||
@@ -412,6 +_,7 @@
|
||||
@@ -413,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.GuiScreenEvent.BackgroundDrawnEvent(this, new PoseStack()));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundDrawnEvent(this, new PoseStack()));
|
||||
}
|
||||
|
||||
public boolean m_7043_() {
|
||||
@@ -497,6 +_,10 @@
|
||||
@@ -498,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
|
||||
@@ -63,6 +_,7 @@
|
||||
@@ -64,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);
|
||||
@@ -106,11 +_,16 @@
|
||||
@@ -107,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.fmlclient.gui.screen.ModListScreen(this));
|
||||
+ this.f_96541_.m_91152_(new net.minecraftforge.client.gui.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_()));
|
||||
@@ -158,7 +_,7 @@
|
||||
@@ -159,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;
|
||||
}
|
||||
@@ -283,6 +_,7 @@
|
||||
@@ -284,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);
|
||||
@@ -305,7 +_,14 @@
|
||||
@@ -306,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.fmllegacy.BrandingControl.forEachLine(true, true, (brdline, brd) ->
|
||||
+ net.minecraftforge.internal.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.fmllegacy.BrandingControl.forEachAboveCopyrightLine((brdline, brd) ->
|
||||
+ net.minecraftforge.internal.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);
|
||||
@@ -321,6 +_,7 @@
|
||||
@@ -322,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
|
||||
@@ -42,6 +_,7 @@
|
||||
private final Map<Advancement, AdvancementTab> f_97335_ = Maps.newLinkedHashMap();
|
||||
@@ -43,6 +_,7 @@
|
||||
@Nullable
|
||||
private AdvancementTab f_97336_;
|
||||
private boolean f_97337_;
|
||||
+ private static int tabPage, maxPages;
|
||||
|
||||
public AdvancementsScreen(ClientAdvancements p_97340_) {
|
||||
super(NarratorChatListener.f_93310_);
|
||||
@@ -57,7 +_,13 @@
|
||||
@@ -58,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_() {
|
||||
@@ -75,7 +_,7 @@
|
||||
@@ -76,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;
|
||||
}
|
||||
@@ -99,6 +_,11 @@
|
||||
@@ -100,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);
|
||||
@@ -149,12 +_,14 @@
|
||||
@@ -150,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_);
|
||||
}
|
||||
|
||||
@@ -180,7 +_,7 @@
|
||||
@@ -181,7 +_,7 @@
|
||||
|
||||
if (this.f_97335_.size() > 1) {
|
||||
for(AdvancementTab advancementtab : this.f_97335_.values()) {
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
--- 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_);
|
||||
@@ -1,26 +0,0 @@
|
||||
--- 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_();
|
||||
@@ -0,0 +1,60 @@
|
||||
--- 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(keymapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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_);
|
||||
@@ -0,0 +1,26 @@
|
||||
--- 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_();
|
||||
+6
-6
@@ -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.GuiContainerEvent.DrawBackground(this, p_97795_, 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_));
|
||||
RenderSystem.m_69465_();
|
||||
super.m_6305_(p_97795_, p_97796_, p_97797_, p_97798_);
|
||||
PoseStack posestack = RenderSystem.m_157191_();
|
||||
@@ -13,12 +13,12 @@
|
||||
int l = slot.f_40220_;
|
||||
int i1 = slot.f_40221_;
|
||||
- m_169606_(p_97795_, l, i1, this.m_93252_());
|
||||
+ renderSlotHighlight(p_97795_, l, i1, this.m_93252_(), this.getSlotColor(i1));
|
||||
+ renderSlotHighlight(p_97795_, l, i1, this.m_93252_(), this.getSlotColor(k));
|
||||
}
|
||||
}
|
||||
|
||||
this.m_7027_(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_));
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.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_);
|
||||
- boolean flag = this.f_96541_.f_91066_.f_92097_.m_90830_(p_97750_) && this.f_96541_.f_91072_.m_105290_();
|
||||
+ 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 (this.f_96541_.f_91066_.f_92097_.m_90830_(p_97750_)) {
|
||||
- if (flag) {
|
||||
+ 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 (this.f_96541_.f_91066_.f_92097_.m_90830_(p_97750_)) {
|
||||
- } else if (flag) {
|
||||
+ } else if (this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey)) {
|
||||
this.f_97717_ = 2;
|
||||
}
|
||||
|
||||
+19
-22
@@ -9,7 +9,7 @@
|
||||
private boolean f_98515_;
|
||||
private final Map<ResourceLocation, Tag<Item>> f_98516_ = Maps.newTreeMap();
|
||||
|
||||
@@ -242,6 +_,12 @@
|
||||
@@ -233,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);
|
||||
@@ -283,7 +_,7 @@
|
||||
@@ -274,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_();
|
||||
@@ -301,7 +_,7 @@
|
||||
@@ -292,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_);
|
||||
@@ -338,6 +_,32 @@
|
||||
@@ -329,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_) {
|
||||
@@ -383,9 +_,9 @@
|
||||
@@ -374,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 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -396,7 +_,7 @@
|
||||
@@ -387,7 +_,7 @@
|
||||
double d1 = p_98532_ - (double)this.f_97736_;
|
||||
|
||||
for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) {
|
||||
@@ -94,7 +94,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -417,7 +_,7 @@
|
||||
@@ -408,7 +_,7 @@
|
||||
this.f_98509_ = false;
|
||||
|
||||
for(CreativeModeTab creativemodetab : CreativeModeTab.f_40748_) {
|
||||
@@ -103,7 +103,7 @@
|
||||
this.m_98560_(creativemodetab);
|
||||
return true;
|
||||
}
|
||||
@@ -428,12 +_,15 @@
|
||||
@@ -419,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_) {
|
||||
@@ -510,13 +_,15 @@
|
||||
@@ -501,13 +_,15 @@
|
||||
}
|
||||
|
||||
if (this.f_98510_ != null) {
|
||||
@@ -136,7 +136,7 @@
|
||||
|
||||
this.m_98630_();
|
||||
} else {
|
||||
@@ -576,16 +_,34 @@
|
||||
@@ -567,16 +_,34 @@
|
||||
this.m_7333_(p_98577_);
|
||||
super.m_6305_(p_98577_, p_98578_, p_98579_, p_98580_);
|
||||
|
||||
@@ -173,19 +173,16 @@
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.m_7025_(p_98577_, p_98578_, p_98579_);
|
||||
}
|
||||
@@ -620,7 +_,10 @@
|
||||
@@ -611,7 +_,7 @@
|
||||
list1.add(1, creativemodetab.m_40786_().m_6881_().m_130940_(ChatFormatting.BLUE));
|
||||
}
|
||||
|
||||
- this.m_169388_(p_98590_, list1, p_98591_.m_150921_(), p_98592_, p_98593_);
|
||||
+ net.minecraft.client.gui.Font font = net.minecraftforge.client.RenderProperties.get(p_98591_).getFont(p_98591_);
|
||||
+ net.minecraftforge.fmlclient.gui.GuiUtils.preItemToolTip(p_98591_);
|
||||
+ this.renderComponentToolTip(p_98590_, list1, p_98592_, p_98593_, (font == null ? this.f_96547_ : font));
|
||||
+ net.minecraftforge.fmlclient.gui.GuiUtils.postItemToolTip();
|
||||
+ this.renderTooltip(p_98590_, list1, p_98591_.m_150921_(), p_98592_, p_98593_, p_98591_);
|
||||
} else {
|
||||
super.m_6057_(p_98590_, p_98591_, p_98592_, p_98593_);
|
||||
}
|
||||
@@ -631,16 +_,32 @@
|
||||
@@ -622,16 +_,32 @@
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
CreativeModeTab creativemodetab = CreativeModeTab.f_40748_[f_98507_];
|
||||
|
||||
@@ -222,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);
|
||||
@@ -648,11 +_,14 @@
|
||||
@@ -639,11 +_,14 @@
|
||||
int j = this.f_97736_ + 18;
|
||||
int k = j + 112;
|
||||
RenderSystem.m_157427_(GameRenderer::m_172817_);
|
||||
@@ -238,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_);
|
||||
@@ -661,6 +_,7 @@
|
||||
@@ -652,6 +_,7 @@
|
||||
}
|
||||
|
||||
protected boolean m_98562_(CreativeModeTab p_98563_, double p_98564_, double p_98565_) {
|
||||
@@ -246,15 +243,15 @@
|
||||
int i = p_98563_.m_40793_();
|
||||
int j = 28 * i;
|
||||
int k = 0;
|
||||
@@ -729,6 +_,7 @@
|
||||
i1 = i1 + (this.f_97727_ - 4);
|
||||
@@ -720,6 +_,7 @@
|
||||
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 = l + 6;
|
||||
@@ -918,6 +_,22 @@
|
||||
l += 6;
|
||||
@@ -909,6 +_,22 @@
|
||||
|
||||
public boolean m_8010_(Player p_98665_) {
|
||||
return this.f_98655_.m_8010_(p_98665_);
|
||||
|
||||
+49
-20
@@ -1,25 +1,40 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
- Iterable<MobEffectInstance> iterable = Ordering.natural().sortedCopy(collection);
|
||||
+ 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 @@
|
||||
+
|
||||
+ 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 @@
|
||||
int i = this.f_97736_;
|
||||
|
||||
for(MobEffectInstance mobeffectinstance : p_98726_) {
|
||||
@@ -29,6 +44,20 @@
|
||||
+ i += p_98725_;
|
||||
+ continue;
|
||||
+ }
|
||||
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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
|
||||
@@ -21,6 +_,8 @@
|
||||
if (p_169951_ instanceof BundleTooltip) {
|
||||
return new ClientBundleTooltip((BundleTooltip)p_169951_);
|
||||
} else {
|
||||
+ ClientTooltipComponent result = net.minecraftforge.client.MinecraftForgeClient.getClientTooltipComponent(p_169951_);
|
||||
+ if (result != null) return result;
|
||||
throw new IllegalArgumentException("Unknown TooltipComponent");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
|
||||
@@ -247,6 +_,11 @@
|
||||
@@ -250,6 +_,11 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
||||
+++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
|
||||
@@ -333,6 +_,8 @@
|
||||
@@ -334,6 +_,8 @@
|
||||
this.f_99855_.m_99707_(list1);
|
||||
}
|
||||
|
||||
+ net.minecraftforge.fmlclient.ClientHooks.drawForgePingInfo(this.f_99855_, f_99857_, p_99879_, p_99882_, p_99881_, p_99883_, i1, j1);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.drawForgePingInfo(this.f_99855_, f_99857_, p_99879_, p_99882_, p_99881_, p_99883_, i1, j1);
|
||||
+
|
||||
if (this.f_99856_.f_91066_.f_92051_ || p_99887_) {
|
||||
RenderSystem.m_157456_(0, ServerSelectionList.f_99759_);
|
||||
|
||||
+7
-7
@@ -9,12 +9,12 @@
|
||||
this.f_100279_.add(new RecipeBookTabButton(recipebookcategories));
|
||||
}
|
||||
|
||||
@@ -462,7 +_,7 @@
|
||||
|
||||
languagemanager.m_118974_(languageinfo);
|
||||
this.f_100272_.f_91066_.f_92075_ = languageinfo.getCode();
|
||||
- this.f_100272_.m_91391_();
|
||||
+ net.minecraftforge.client.ForgeHooksClient.refreshResources(this.f_100272_, net.minecraftforge.resource.VanillaResourceType.LANGUAGES);
|
||||
this.f_100272_.f_91066_.m_92169_();
|
||||
@@ -319,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (itemstack != null && this.f_100272_.f_91080_ != null) {
|
||||
- this.f_100272_.f_91080_.m_96597_(p_100375_, this.f_100272_.f_91080_.m_96555_(itemstack), p_100378_, p_100379_);
|
||||
+ this.f_100272_.f_91080_.renderComponentTooltip(p_100375_, this.f_100272_.f_91080_.m_96555_(itemstack), p_100378_, p_100379_, itemstack);
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/client/gui/screens/recipebook/RecipeBookPage.java
|
||||
+++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookPage.java
|
||||
@@ -115,7 +_,7 @@
|
||||
|
||||
public void m_100417_(PoseStack p_100418_, int p_100419_, int p_100420_) {
|
||||
if (this.f_100397_.f_91080_ != null && this.f_100395_ != null && !this.f_100396_.m_100212_()) {
|
||||
- this.f_100397_.f_91080_.m_96597_(p_100418_, this.f_100395_.m_100477_(this.f_100397_.f_91080_), p_100419_, p_100420_);
|
||||
+ this.f_100397_.f_91080_.renderComponentTooltip(p_100418_, this.f_100395_.m_100477_(this.f_100397_.f_91080_), p_100419_, p_100420_, this.f_100395_.m_100488_().m_8043_());
|
||||
}
|
||||
|
||||
}
|
||||
+5
-5
@@ -1,19 +1,19 @@
|
||||
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||
@@ -117,7 +_,7 @@
|
||||
@@ -116,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_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()));
|
||||
- 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()));
|
||||
}
|
||||
|
||||
private CreateWorldScreen(@Nullable Screen p_100861_, DataPackConfig p_100862_, WorldGenSettingsComponent p_100863_) {
|
||||
@@ -596,6 +_,7 @@
|
||||
@@ -595,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.fmllegacy.packs.ResourcePackLoader.loadResourcePacks(this.f_100832_, net.minecraftforge.fmllegacy.server.ServerLifecycleHooks::buildPackFinder);
|
||||
+ net.minecraftforge.resource.ResourcePackLoader.loadResourcePacks(this.f_100832_, net.minecraftforge.server.ServerLifecycleHooks::buildPackFinder);
|
||||
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.getBiomeGeneratorTypeScreenFactory(this.f_101395_, worldpreset$preseteditor);
|
||||
+ worldpreset$preseteditor = net.minecraftforge.client.ForgeHooksClient.getPresetEditor(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.hasBiomeGeneratorSettingsOptionsScreen(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_101392_.f_93624_ = p_170288_;
|
||||
}
|
||||
|
||||
Loaded 100 of 830 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user