mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 19:59:42 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b97c181b9 | ||
|
|
c42b0847d2 | ||
|
|
f182cb00c1 | ||
|
|
3181b5da23 | ||
|
|
983c119477 | ||
|
|
874ff1bba2 | ||
|
|
06d9d89f98 | ||
|
|
c713bad8c3 | ||
|
|
fe19491822 | ||
|
|
c80e8a1aca | ||
|
|
6845c094ab | ||
|
|
3c1126a7b4 | ||
|
|
326e0329b9 | ||
|
|
f9d0daa91c | ||
|
|
094200e687 | ||
|
|
bb4818630c | ||
|
|
7af3155b39 | ||
|
|
d988b4a811 | ||
|
|
18f5bdb7ca | ||
|
|
f41d493552 | ||
|
|
8cd2c9c63f | ||
|
|
427b335cac | ||
|
|
2049096c6f | ||
|
|
98d4fa6dc2 | ||
|
|
5306471aec | ||
|
|
aa8818b049 | ||
|
|
2d86f17363 | ||
|
|
3a36a01913 | ||
|
|
47d70a7f31 | ||
|
|
d5b5e6f4db | ||
|
|
e76d814439 | ||
|
|
b8b40e1f54 | ||
|
|
5e8c786406 | ||
|
|
5b8224f839 | ||
|
|
cd621eb081 | ||
|
|
b1113f0363 | ||
|
|
daf5933b79 | ||
|
|
47fd2e8604 | ||
|
|
05297fd72f | ||
|
|
f20cf19f94 | ||
|
|
061cd3da53 | ||
|
|
03202a8ab4 | ||
|
|
8a67be4afd | ||
|
|
4c1ab67f33 | ||
|
|
7e06a2105f | ||
|
|
4a0c8be742 | ||
|
|
0c030ee5e1 | ||
|
|
1134fac54c | ||
|
|
ac44d72530 | ||
|
|
12468bd8d2 | ||
|
|
a98eeb9d08 | ||
|
|
b558b132cd | ||
|
|
c102633566 | ||
|
|
cce002ad29 | ||
|
|
b1ed321438 | ||
|
|
c7c2478cb0 | ||
|
|
b70d99489b | ||
|
|
57f45eaca0 | ||
|
|
52fcc4d649 | ||
|
|
959ab9abc9 | ||
|
|
c3a91872fe | ||
|
|
4d074f0a1e | ||
|
|
c2225ab1da | ||
|
|
bb03b1a7d1 | ||
|
|
be7275443f | ||
|
|
dc1c973684 | ||
|
|
06d568408c | ||
|
|
2256e88fb4 | ||
|
|
9b962c8ff0 | ||
|
|
7656b75992 | ||
|
|
58a5449c2f | ||
|
|
702abe0665 | ||
|
|
2070b77fd4 | ||
|
|
fd00822015 | ||
|
|
17565c0ea2 | ||
|
|
22668ad2c2 | ||
|
|
0dcc3d700d | ||
|
|
2ab3d9b8a3 | ||
|
|
d578d8f6df | ||
|
|
fd61016a7e | ||
|
|
7f77d24f45 | ||
|
|
3ebdcb34d1 | ||
|
|
05240fecf7 | ||
|
|
d5860d7cfa | ||
|
|
7bb97dafda | ||
|
|
ca90babc4a | ||
|
|
4b813e4319 | ||
|
|
fa84c22662 | ||
|
|
2ae640b530 | ||
|
|
4f95a20c5e | ||
|
|
915d570b17 | ||
|
|
5979636ee5 | ||
|
|
5acfc6ae3c | ||
|
|
48341120fb | ||
|
|
ff45bb4c27 | ||
|
|
eabba46595 | ||
|
|
683bf99fe4 | ||
|
|
2a05c7c01d | ||
|
|
e386229b66 | ||
|
|
59b8ec5625 | ||
|
|
50ae5db357 | ||
|
|
3aa99a1250 | ||
|
|
00c8513129 | ||
|
|
9c1404fecc | ||
|
|
c11686ab6c | ||
|
|
2818984f6c | ||
|
|
db225ed04a | ||
|
|
0ec4c34a34 | ||
|
|
597ebc3267 | ||
|
|
e16f54eebe | ||
|
|
27480c15fa | ||
|
|
df0dea59f3 | ||
|
|
d7bc564512 | ||
|
|
e6a73ef36c | ||
|
|
1ba7c6aecd | ||
|
|
7c5e95222e | ||
|
|
38df3d2a15 | ||
|
|
3beaa817f3 | ||
|
|
3ebd7ba0ef | ||
|
|
1ba9c34650 | ||
|
|
2f9e726aea | ||
|
|
ade2b8cc80 | ||
|
|
9b144f4541 | ||
|
|
0c35436217 | ||
|
|
0e66b7b217 |
No files matched your search
@@ -1,16 +0,0 @@
|
|||||||
# Configuration for support-requests - https://github.com/dessant/support-requests
|
|
||||||
|
|
||||||
# Label used to mark issues as support requests
|
|
||||||
supportLabel: Forum
|
|
||||||
# Comment to post on issues marked as support requests. Add a link
|
|
||||||
# to a support page, or set to `false` to disable
|
|
||||||
supportComment: >
|
|
||||||
👋 We use the issue tracker exclusively for final bug reports and feature requests.
|
|
||||||
However, this issue appears to be better suited for the
|
|
||||||
[Forge Support Forums](http://www.minecraftforge.net/forum/forum/18-support-bug-reports/).
|
|
||||||
Please create a new topic on the support forum with this issue, and the conversation can
|
|
||||||
continue there.
|
|
||||||
# Whether to close issues marked as support requests
|
|
||||||
close: true
|
|
||||||
# Whether to lock issues marked as support requests
|
|
||||||
lock: true
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
name: Support Requests
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types:
|
||||||
|
- labeled
|
||||||
|
- unlabeled
|
||||||
|
- reopened
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
support:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: dessant/support-requests@v2
|
||||||
|
with:
|
||||||
|
support-label: Forum
|
||||||
|
issue-comment: >
|
||||||
|
:wave: We use the issue tracker exclusively for final bug reports and feature requests.
|
||||||
|
However, this issue appears to be better suited for the
|
||||||
|
[Forge Support Forums](https://forums.minecraftforge.net/) or
|
||||||
|
[Forge Discord](https://discord.gg/UvedJ9m). Please create a new topic on the support forum
|
||||||
|
with this issue or ask in the `#tech-support` channel in the Discord server, and the
|
||||||
|
conversation can continue there.
|
||||||
|
lock-issue: true
|
||||||
+32
-18
@@ -20,8 +20,8 @@ plugins {
|
|||||||
id 'net.minecraftforge.gradleutils' version '2.+'
|
id 'net.minecraftforge.gradleutils' version '2.+'
|
||||||
id 'eclipse'
|
id 'eclipse'
|
||||||
id 'de.undercouch.download' version '4.1.2'
|
id 'de.undercouch.download' version '4.1.2'
|
||||||
id 'net.minecraftforge.gradle.patcher' version '[5.1.39,)' apply false
|
id 'net.minecraftforge.gradle.patcher' version '[5.1.50,5.2.0)' apply false
|
||||||
id 'net.minecraftforge.gradle.mcp' version '[5.1.39,)' apply false
|
id 'net.minecraftforge.gradle.mcp' version '[5.1.50,5.2.0)' apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.init() //Init all our extension methods!
|
Util.init() //Init all our extension methods!
|
||||||
@@ -36,16 +36,17 @@ ext {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
MAPPING_CHANNEL = 'official'
|
MAPPING_CHANNEL = 'official'
|
||||||
MAPPING_VERSION = '1.19'
|
MAPPING_VERSION = '1.19.2'
|
||||||
MC_VERSION = '1.19'
|
MC_VERSION = '1.19.2'
|
||||||
MCP_VERSION = '20220607.102129'
|
MC_NEXT_VERSION = '1.20'
|
||||||
SPI_VERSION = '4.0.10'
|
MCP_VERSION = '20220805.130853'
|
||||||
|
SPI_VERSION = '6.0.0'
|
||||||
ACCESSTRANSFORMERS_VERSION = '8.0.4'
|
ACCESSTRANSFORMERS_VERSION = '8.0.4'
|
||||||
COREMODS_VERSION = '5.0.1'
|
COREMODS_VERSION = '5.0.1'
|
||||||
EVENTBUS_VERSION = '5.0.3'
|
EVENTBUS_VERSION = '6.0.0'
|
||||||
MODLAUNCHER_VERSION = '9.1.3'
|
MODLAUNCHER_VERSION = '10.0.8'
|
||||||
SECUREJARHANDLER_VERSION = '1.0.3'
|
SECUREJARHANDLER_VERSION = '2.1.4'
|
||||||
BOOTSTRAPLAUNCHER_VERSION = '1.0.0'
|
BOOTSTRAPLAUNCHER_VERSION = '1.1.2'
|
||||||
ASM_VERSION = '9.3'
|
ASM_VERSION = '9.3'
|
||||||
INSTALLER_VERSION = '2.1.+'
|
INSTALLER_VERSION = '2.1.+'
|
||||||
MIXIN_VERSION = '0.8.5'
|
MIXIN_VERSION = '0.8.5'
|
||||||
@@ -65,6 +66,7 @@ ext {
|
|||||||
APACHE_COMMONS_LANG3_VERSION = '3.12.0'
|
APACHE_COMMONS_LANG3_VERSION = '3.12.0'
|
||||||
JOPT_SIMPLE_VERSION = '5.0.4'
|
JOPT_SIMPLE_VERSION = '5.0.4'
|
||||||
COMMONS_IO_VERSION = '2.11.0'
|
COMMONS_IO_VERSION = '2.11.0'
|
||||||
|
JARJAR_VERSION = '0.3.16'
|
||||||
|
|
||||||
GIT_INFO = gradleutils.gitInfo
|
GIT_INFO = gradleutils.gitInfo
|
||||||
VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION)
|
VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION)
|
||||||
@@ -75,7 +77,7 @@ ext {
|
|||||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0'
|
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0'
|
||||||
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
|
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
|
||||||
FART = 'net.minecraftforge:ForgeAutoRenamingTool:0.1.22:all'
|
FART = 'net.minecraftforge:ForgeAutoRenamingTool:0.1.22:all'
|
||||||
MIN_TAG_FOR_CHANGELOG = "39.0"
|
MIN_TAG_FOR_CHANGELOG = "41.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
println('Version: ' + VERSION +
|
println('Version: ' + VERSION +
|
||||||
@@ -94,7 +96,7 @@ def extraTxts = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
task downloadVersionManifest(type: Download) {
|
task downloadVersionManifest(type: Download) {
|
||||||
src 'https://launchermeta.mojang.com/mc/game/version_manifest_v2.json'
|
src 'https://piston-meta.mojang.com/mc/game/version_manifest_v2.json'
|
||||||
dest file('build/versions/version_manifest.json')
|
dest file('build/versions/version_manifest.json')
|
||||||
useETag 'all'
|
useETag 'all'
|
||||||
onlyIfModified true
|
onlyIfModified true
|
||||||
@@ -260,6 +262,7 @@ def sharedDeps = {
|
|||||||
moduleonly "org.ow2.asm:asm-util:${ASM_VERSION}"
|
moduleonly "org.ow2.asm:asm-util:${ASM_VERSION}"
|
||||||
moduleonly "org.ow2.asm:asm-analysis:${ASM_VERSION}"
|
moduleonly "org.ow2.asm:asm-analysis:${ASM_VERSION}"
|
||||||
moduleonly "cpw.mods:bootstraplauncher:${BOOTSTRAPLAUNCHER_VERSION}"
|
moduleonly "cpw.mods:bootstraplauncher:${BOOTSTRAPLAUNCHER_VERSION}"
|
||||||
|
moduleonly "net.minecraftforge:JarJarFileSystems:${JARJAR_VERSION}"
|
||||||
|
|
||||||
installer "cpw.mods:securejarhandler:${SECUREJARHANDLER_VERSION}"
|
installer "cpw.mods:securejarhandler:${SECUREJARHANDLER_VERSION}"
|
||||||
installer "org.ow2.asm:asm:${ASM_VERSION}"
|
installer "org.ow2.asm:asm:${ASM_VERSION}"
|
||||||
@@ -283,6 +286,8 @@ def sharedDeps = {
|
|||||||
installer "org.jline:jline-terminal:${JLINE_VERSION}" // Dep of TerminalConsoleAppender
|
installer "org.jline:jline-terminal:${JLINE_VERSION}" // Dep of TerminalConsoleAppender
|
||||||
installer "org.spongepowered:mixin:${MIXIN_VERSION}"
|
installer "org.spongepowered:mixin:${MIXIN_VERSION}"
|
||||||
installer 'org.openjdk.nashorn:nashorn-core:15.3'
|
installer 'org.openjdk.nashorn:nashorn-core:15.3'
|
||||||
|
installer "net.minecraftforge:JarJarSelector:${JARJAR_VERSION}"
|
||||||
|
installer "net.minecraftforge:JarJarMetadata:${JARJAR_VERSION}"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
installer 'org.lwjgl:lwjgl:3.2.2'
|
installer 'org.lwjgl:lwjgl:3.2.2'
|
||||||
@@ -375,7 +380,8 @@ def sharedFmlonlyForge = { Project prj ->
|
|||||||
environment 'MOD_CLASSES', '{source_roots}'
|
environment 'MOD_CLASSES', '{source_roots}'
|
||||||
environment 'MCP_MAPPINGS', '{mcp_mappings}'
|
environment 'MCP_MAPPINGS', '{mcp_mappings}'
|
||||||
|
|
||||||
property 'nativesDirectory', '{natives}'
|
// Natives are loaded from the classpath now in all cases
|
||||||
|
// property 'nativesDirectory', '{natives}'
|
||||||
if (prj.name == 'forge') {
|
if (prj.name == 'forge') {
|
||||||
property 'forge.enableGameTest', 'true'
|
property 'forge.enableGameTest', 'true'
|
||||||
}
|
}
|
||||||
@@ -429,6 +435,8 @@ def sharedFmlonlyForge = { Project prj ->
|
|||||||
run.args '--fml.forgeGroup', prj.group
|
run.args '--fml.forgeGroup', prj.group
|
||||||
run.args '--fml.mcpVersion', MCP_VERSION
|
run.args '--fml.mcpVersion', MCP_VERSION
|
||||||
|
|
||||||
|
run.jvmArgs '-Djava.net.preferIPv6Addresses=system'
|
||||||
|
|
||||||
if (run.name.contains('client')) {
|
if (run.name.contains('client')) {
|
||||||
run.client true
|
run.client true
|
||||||
} else {
|
} else {
|
||||||
@@ -438,7 +446,7 @@ def sharedFmlonlyForge = { Project prj ->
|
|||||||
// SecureJarHandler bootstrap values.
|
// SecureJarHandler bootstrap values.
|
||||||
run.property 'ignoreList', prj.configurations.moduleonly.files.collect {it.name.replaceAll(/([-_]([.\d]*\d+)|\.jar$)/, '') }.join(',') + ",client-extra,fmlcore,javafmllanguage,lowcodelanguage,mclanguage,${prj.name}-"
|
run.property 'ignoreList', prj.configurations.moduleonly.files.collect {it.name.replaceAll(/([-_]([.\d]*\d+)|\.jar$)/, '') }.join(',') + ",client-extra,fmlcore,javafmllanguage,lowcodelanguage,mclanguage,${prj.name}-"
|
||||||
// FIXME: Without this jna doesn't work at runtime. Someone figure out why please?
|
// FIXME: Without this jna doesn't work at runtime. Someone figure out why please?
|
||||||
run.property 'mergeModules', 'jna-5.10.0.jar,jna-platform-5.10.0.jar,java-objc-bridge-1.0.0.jar'
|
run.property 'mergeModules', 'jna-5.10.0.jar,jna-platform-5.10.0.jar'
|
||||||
if (userdevRuns.contains(run)) {
|
if (userdevRuns.contains(run)) {
|
||||||
run.property 'legacyClassPath.file', '{minecraft_classpath_file}'
|
run.property 'legacyClassPath.file', '{minecraft_classpath_file}'
|
||||||
run.jvmArgs '-p', '{modules}'
|
run.jvmArgs '-p', '{modules}'
|
||||||
@@ -449,6 +457,7 @@ def sharedFmlonlyForge = { Project prj ->
|
|||||||
run.jvmArgs '--add-modules', 'ALL-MODULE-PATH'
|
run.jvmArgs '--add-modules', 'ALL-MODULE-PATH'
|
||||||
// Additions to these JVM module args should be mirrored to server_files/args.txt and other similar blocks in the buildscript
|
// Additions to these JVM module args should be mirrored to server_files/args.txt and other similar blocks in the buildscript
|
||||||
run.jvmArgs '--add-opens', 'java.base/java.util.jar=cpw.mods.securejarhandler'
|
run.jvmArgs '--add-opens', 'java.base/java.util.jar=cpw.mods.securejarhandler'
|
||||||
|
run.jvmArgs '--add-opens', 'java.base/java.lang.invoke=cpw.mods.securejarhandler'
|
||||||
run.jvmArgs '--add-exports', 'java.base/sun.security.util=cpw.mods.securejarhandler'
|
run.jvmArgs '--add-exports', 'java.base/sun.security.util=cpw.mods.securejarhandler'
|
||||||
run.jvmArgs '--add-exports', 'jdk.naming.dns/com.sun.jndi.dns=java.naming'
|
run.jvmArgs '--add-exports', 'jdk.naming.dns/com.sun.jndi.dns=java.naming'
|
||||||
}
|
}
|
||||||
@@ -457,7 +466,8 @@ def sharedFmlonlyForge = { Project prj ->
|
|||||||
run.workingDirectory prj.file('run')
|
run.workingDirectory prj.file('run')
|
||||||
|
|
||||||
if (run.name.contains('client') || run.name.contains('data')) {
|
if (run.name.contains('client') || run.name.contains('data')) {
|
||||||
run.property 'nativesDirectory', prj.extractNatives.output.get().asFile
|
// Natives are loaded from the classpath now in all cases
|
||||||
|
// run.property 'nativesDirectory', prj.extractNatives.output.get().asFile
|
||||||
run.args '--assetsDir', prj.downloadAssets.output
|
run.args '--assetsDir', prj.downloadAssets.output
|
||||||
run.args '--assetIndex', "{asset_index}"
|
run.args '--assetIndex', "{asset_index}"
|
||||||
}
|
}
|
||||||
@@ -639,6 +649,7 @@ project(':fmlonly') {
|
|||||||
'--add-modules', 'ALL-MODULE-PATH',
|
'--add-modules', 'ALL-MODULE-PATH',
|
||||||
// Additions to these JVM module args should be mirrored to server_files/args.txt and other similar blocks in the buildscript
|
// Additions to these JVM module args should be mirrored to server_files/args.txt and other similar blocks in the buildscript
|
||||||
'--add-opens', 'java.base/java.util.jar=cpw.mods.securejarhandler',
|
'--add-opens', 'java.base/java.util.jar=cpw.mods.securejarhandler',
|
||||||
|
'--add-opens', 'java.base/java.lang.invoke=cpw.mods.securejarhandler',
|
||||||
'--add-exports', 'java.base/sun.security.util=cpw.mods.securejarhandler',
|
'--add-exports', 'java.base/sun.security.util=cpw.mods.securejarhandler',
|
||||||
'--add-exports', 'jdk.naming.dns/com.sun.jndi.dns=java.naming'
|
'--add-exports', 'jdk.naming.dns/com.sun.jndi.dns=java.naming'
|
||||||
]
|
]
|
||||||
@@ -1059,6 +1070,7 @@ project(':forge') {
|
|||||||
'--mod', 'custom_transformtype_test',
|
'--mod', 'custom_transformtype_test',
|
||||||
'--mod', 'data_pack_registries_test',
|
'--mod', 'data_pack_registries_test',
|
||||||
'--mod', 'biome_modifiers_test',
|
'--mod', 'biome_modifiers_test',
|
||||||
|
'--mod', 'structure_modifiers_test',
|
||||||
'--output', rootProject.file('src/generated_test/resources/'),
|
'--output', rootProject.file('src/generated_test/resources/'),
|
||||||
'--existing', sourceSets.main.resources.srcDirs[0],
|
'--existing', sourceSets.main.resources.srcDirs[0],
|
||||||
'--existing', sourceSets.test.resources.srcDirs[0]
|
'--existing', sourceSets.test.resources.srcDirs[0]
|
||||||
@@ -1228,7 +1240,7 @@ project(':forge') {
|
|||||||
}.toArray(Dependency[]::new))
|
}.toArray(Dependency[]::new))
|
||||||
|
|
||||||
baseJar = project.tasks.applyBaseCompatibilityJarBinPatches.output
|
baseJar = project.tasks.applyBaseCompatibilityJarBinPatches.output
|
||||||
baseLibraries.from(baseForgeUniversal)
|
baseLibraries.from(project.configurations.detachedConfiguration(baseForgeUniversal))
|
||||||
baseLibraries.from(project.tasks.createJoinedSRG.output)
|
baseLibraries.from(project.tasks.createJoinedSRG.output)
|
||||||
baseLibraries.from(fmlLibs)
|
baseLibraries.from(fmlLibs)
|
||||||
|
|
||||||
@@ -1260,13 +1272,15 @@ project(':forge') {
|
|||||||
'--fml.mcVersion', MC_VERSION,
|
'--fml.mcVersion', MC_VERSION,
|
||||||
'--fml.forgeGroup', project.group,
|
'--fml.forgeGroup', project.group,
|
||||||
'--fml.mcpVersion', MCP_VERSION],
|
'--fml.mcpVersion', MCP_VERSION],
|
||||||
jvm: ["-DignoreList=${forge_client.properties.ignoreList},\${version_name}.jar",
|
jvm: ['-Djava.net.preferIPv6Addresses=system',
|
||||||
|
"-DignoreList=${forge_client.properties.ignoreList},\${version_name}.jar",
|
||||||
"-DmergeModules=${forge_client.properties.mergeModules}",
|
"-DmergeModules=${forge_client.properties.mergeModules}",
|
||||||
'-DlibraryDirectory=${library_directory}',
|
'-DlibraryDirectory=${library_directory}',
|
||||||
'-p', Util.getArtifacts(project, configurations.moduleonly, false).values().collect{'${library_directory}/' + it.downloads.artifact.path}.join('${classpath_separator}'),
|
'-p', Util.getArtifacts(project, configurations.moduleonly, false).values().collect{'${library_directory}/' + it.downloads.artifact.path}.join('${classpath_separator}'),
|
||||||
'--add-modules', 'ALL-MODULE-PATH',
|
'--add-modules', 'ALL-MODULE-PATH',
|
||||||
// Additions to these JVM module args should be mirrored to server_files/args.txt and other similar blocks in the buildscript
|
// Additions to these JVM module args should be mirrored to server_files/args.txt and other similar blocks in the buildscript
|
||||||
'--add-opens', 'java.base/java.util.jar=cpw.mods.securejarhandler',
|
'--add-opens', 'java.base/java.util.jar=cpw.mods.securejarhandler',
|
||||||
|
'--add-opens', 'java.base/java.lang.invoke=cpw.mods.securejarhandler',
|
||||||
'--add-exports', 'java.base/sun.security.util=cpw.mods.securejarhandler',
|
'--add-exports', 'java.base/sun.security.util=cpw.mods.securejarhandler',
|
||||||
'--add-exports', 'jdk.naming.dns/com.sun.jndi.dns=java.naming'
|
'--add-exports', 'jdk.naming.dns/com.sun.jndi.dns=java.naming'
|
||||||
]
|
]
|
||||||
@@ -1550,7 +1564,7 @@ project(':forge') {
|
|||||||
MAPPING_CHANNEL: MAPPING_CHANNEL,
|
MAPPING_CHANNEL: MAPPING_CHANNEL,
|
||||||
MAPPING_VERSION: MAPPING_VERSION,
|
MAPPING_VERSION: MAPPING_VERSION,
|
||||||
FORGE_SPEC_VERSION: SPEC_VERSION.split("\\.")[0],
|
FORGE_SPEC_VERSION: SPEC_VERSION.split("\\.")[0],
|
||||||
MC_NEXT_VERSION: "1."+((MC_VERSION.split("[\\.-]")[1] as int)+1)
|
MC_NEXT_VERSION: MC_NEXT_VERSION
|
||||||
])
|
])
|
||||||
rename 'gitignore\\.txt', '.gitignore'
|
rename 'gitignore\\.txt', '.gitignore'
|
||||||
rename 'gitattributes\\.txt', '.gitattributes'
|
rename 'gitattributes\\.txt', '.gitattributes'
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
MinecraftForge
|
MinecraftForge
|
||||||
=============
|
=============
|
||||||
[](https://files.minecraftforge.net)
|
[](https://files.minecraftforge.net)
|
||||||
[](https://files.minecraftforge.net) [](https://discord.gg/UvedJ9m) [](https://www.patreon.com/LexManos)
|
)](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!
|
Forge is a free, open-source modding API all of your favourite mods use!
|
||||||
|
|||||||
@@ -93,5 +93,7 @@ public interface IExtensionPoint<T extends Record>
|
|||||||
* @see net.minecraftforge.client.ForgeHooksClient#processForgeListPingData(net.minecraft.network.protocol.status.ServerStatus, net.minecraft.client.multiplayer.ServerData)
|
* @see net.minecraftforge.client.ForgeHooksClient#processForgeListPingData(net.minecraft.network.protocol.status.ServerStatus, net.minecraft.client.multiplayer.ServerData)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("JavadocReference") // reference to NetworkConstants, ForgeHooksClient
|
@SuppressWarnings("JavadocReference") // reference to NetworkConstants, ForgeHooksClient
|
||||||
record DisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) implements IExtensionPoint<DisplayTest> {}
|
record DisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) implements IExtensionPoint<DisplayTest> {
|
||||||
|
public static final String IGNORESERVERONLY = "OHNOES\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -56,9 +56,24 @@ public abstract class ModContainer
|
|||||||
this.namespace = this.modId;
|
this.namespace = this.modId;
|
||||||
this.modInfo = info;
|
this.modInfo = info;
|
||||||
this.modLoadingStage = ModLoadingStage.CONSTRUCT;
|
this.modLoadingStage = ModLoadingStage.CONSTRUCT;
|
||||||
// default displaytest extension checks for version string match
|
|
||||||
registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(()->this.modInfo.getVersion().toString(),
|
final String displayTestString = info.getConfig().<String>getConfigElement("displayTest").orElse("MATCH_VERSION"); // missing defaults to DEFAULT type
|
||||||
(incoming, isNetwork)->Objects.equals(incoming, this.modInfo.getVersion().toString())));
|
Supplier<IExtensionPoint.DisplayTest> displayTestSupplier = switch (displayTestString) {
|
||||||
|
case "MATCH_VERSION" -> // default displaytest checks for version string match
|
||||||
|
() -> new IExtensionPoint.DisplayTest(() -> this.modInfo.getVersion().toString(),
|
||||||
|
(incoming, isNetwork) -> Objects.equals(incoming, this.modInfo.getVersion().toString()));
|
||||||
|
case "IGNORE_SERVER_VERSION" -> // Ignores any version information coming from the server - use for server only mods
|
||||||
|
() -> new IExtensionPoint.DisplayTest(() -> IExtensionPoint.DisplayTest.IGNORESERVERONLY, (incoming, isNetwork) -> true);
|
||||||
|
case "IGNORE_ALL_VERSION" -> // Ignores all information and provides no information
|
||||||
|
() -> new IExtensionPoint.DisplayTest(() -> "", (incoming, isNetwork) -> true);
|
||||||
|
case "NONE" -> null; // NO display test at all - use this if you're going to do your own display test
|
||||||
|
default -> // any other value throws an exception
|
||||||
|
throw new IllegalArgumentException("Invalid displayTest value supplied in mods.toml");
|
||||||
|
};
|
||||||
|
if (displayTestSupplier != null)
|
||||||
|
registerExtensionPoint(IExtensionPoint.DisplayTest.class, displayTestSupplier);
|
||||||
|
else
|
||||||
|
extensionPoints.remove(IExtensionPoint.DisplayTest.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import java.util.AbstractMap;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -53,6 +54,7 @@ public class ModList
|
|||||||
private List<ModContainer> mods;
|
private List<ModContainer> mods;
|
||||||
private Map<String, ModContainer> indexedMods;
|
private Map<String, ModContainer> indexedMods;
|
||||||
private List<ModFileScanData> modFileScanData;
|
private List<ModFileScanData> modFileScanData;
|
||||||
|
private List<ModContainer> sortedContainers;
|
||||||
|
|
||||||
private ModList(final List<ModFile> modFiles, final List<ModInfo> sortedList)
|
private ModList(final List<ModFile> modFiles, final List<ModInfo> sortedList)
|
||||||
{
|
{
|
||||||
@@ -155,6 +157,7 @@ public class ModList
|
|||||||
void setLoadedMods(final List<ModContainer> modContainers)
|
void setLoadedMods(final List<ModContainer> modContainers)
|
||||||
{
|
{
|
||||||
this.mods = modContainers;
|
this.mods = modContainers;
|
||||||
|
this.sortedContainers = modContainers.stream().sorted(Comparator.comparingInt(c->sortedList.indexOf(c.getModInfo()))).toList();
|
||||||
this.indexedMods = modContainers.stream().collect(Collectors.toMap(ModContainer::getModId, Function.identity()));
|
this.indexedMods = modContainers.stream().collect(Collectors.toMap(ModContainer::getModId, Function.identity()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,6 +221,10 @@ public class ModList
|
|||||||
indexedMods.forEach(modContainerConsumer);
|
indexedMods.forEach(modContainerConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void forEachModInOrder(Consumer<ModContainer> containerConsumer) {
|
||||||
|
this.sortedContainers.forEach(containerConsumer);
|
||||||
|
}
|
||||||
|
|
||||||
public <T> Stream<T> applyForEachModContainer(Function<ModContainer, T> function) {
|
public <T> Stream<T> applyForEachModContainer(Function<ModContainer, T> function) {
|
||||||
return indexedMods.values().stream().map(function);
|
return indexedMods.values().stream().map(function);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,18 +8,22 @@ package net.minecraftforge.fml;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import net.minecraftforge.eventbus.api.Event;
|
import net.minecraftforge.eventbus.api.Event;
|
||||||
import net.minecraftforge.fml.event.IModBusEvent;
|
import net.minecraftforge.fml.event.IModBusEvent;
|
||||||
|
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||||
import net.minecraftforge.fml.loading.FMLLoader;
|
import net.minecraftforge.fml.loading.FMLLoader;
|
||||||
import net.minecraftforge.fml.loading.LoadingModList;
|
import net.minecraftforge.fml.loading.LoadingModList;
|
||||||
import net.minecraftforge.fml.loading.moddiscovery.InvalidModIdentifier;
|
import net.minecraftforge.fml.loading.moddiscovery.InvalidModIdentifier;
|
||||||
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
|
||||||
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
||||||
|
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
|
||||||
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
||||||
import net.minecraftforge.forgespi.language.IModInfo;
|
import net.minecraftforge.forgespi.language.IModInfo;
|
||||||
import net.minecraftforge.forgespi.language.IModLanguageProvider;
|
import net.minecraftforge.forgespi.language.IModLanguageProvider;
|
||||||
|
import net.minecraftforge.forgespi.locating.ForgeFeature;
|
||||||
|
import net.minecraftforge.forgespi.locating.IModFile;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -28,6 +32,7 @@ import java.util.Optional;
|
|||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.CompletionException;
|
import java.util.concurrent.CompletionException;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -96,7 +101,7 @@ public class ModLoader
|
|||||||
.map(file -> new ModLoadingWarning(null, ModLoadingStage.VALIDATE, InvalidModIdentifier.identifyJarProblem(file.getFilePath()).orElse("fml.modloading.brokenfile"), file.getFileName()))
|
.map(file -> new ModLoadingWarning(null, ModLoadingStage.VALIDATE, InvalidModIdentifier.identifyJarProblem(file.getFilePath()).orElse("fml.modloading.brokenfile"), file.getFileName()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
FMLLoader.getLoadingModList().getModFiles().stream()
|
FMLLoader.getLoadingModList().getModFiles().stream()
|
||||||
.filter(ModFileInfo::missingLicense) //Search for files with missing licenses
|
.filter(ModFileInfo::missingLicense)
|
||||||
.filter(modFileInfo -> modFileInfo.getMods().stream().noneMatch(thisModInfo -> this.loadingExceptions.stream().map(ModLoadingException::getModInfo).anyMatch(otherInfo -> otherInfo == thisModInfo))) //Ignore files where any other mod already encountered an error
|
.filter(modFileInfo -> modFileInfo.getMods().stream().noneMatch(thisModInfo -> this.loadingExceptions.stream().map(ModLoadingException::getModInfo).anyMatch(otherInfo -> otherInfo == thisModInfo))) //Ignore files where any other mod already encountered an error
|
||||||
.map(modFileInfo -> new ModLoadingException(null, ModLoadingStage.VALIDATE, "fml.modloading.missinglicense", null, modFileInfo.getFile()))
|
.map(modFileInfo -> new ModLoadingException(null, ModLoadingStage.VALIDATE, "fml.modloading.missinglicense", null, modFileInfo.getFile()))
|
||||||
.forEach(this.loadingExceptions::add);
|
.forEach(this.loadingExceptions::add);
|
||||||
@@ -133,6 +138,7 @@ public class ModLoader
|
|||||||
* @param periodicTask Optional periodic task to perform on the main thread while other activities run
|
* @param periodicTask Optional periodic task to perform on the main thread while other activities run
|
||||||
*/
|
*/
|
||||||
public void gatherAndInitializeMods(final ModWorkManager.DrivenExecutor syncExecutor, final Executor parallelExecutor, final Runnable periodicTask) {
|
public void gatherAndInitializeMods(final ModWorkManager.DrivenExecutor syncExecutor, final Executor parallelExecutor, final Runnable periodicTask) {
|
||||||
|
ForgeFeature.registerFeature("java_version", ForgeFeature.VersionFeatureTest.forVersionString(IModInfo.DependencySide.SERVER, System.getProperty("java.version")));
|
||||||
loadingStateValid = true;
|
loadingStateValid = true;
|
||||||
statusConsumer.ifPresent(c->c.accept("Waiting for scan to complete"));
|
statusConsumer.ifPresent(c->c.accept("Waiting for scan to complete"));
|
||||||
FMLLoader.backgroundScanHandler.waitForScanToComplete(periodicTask);
|
FMLLoader.backgroundScanHandler.waitForScanToComplete(periodicTask);
|
||||||
@@ -145,6 +151,22 @@ public class ModLoader
|
|||||||
loadingStateValid = false;
|
loadingStateValid = false;
|
||||||
throw new LoadingFailedException(loadingExceptions);
|
throw new LoadingFailedException(loadingExceptions);
|
||||||
}
|
}
|
||||||
|
statusConsumer.ifPresent(c->c.accept("Validating features"));
|
||||||
|
List<? extends ForgeFeature.Bound> failedBounds = loadingModList.getMods().stream()
|
||||||
|
.map(ModInfo::getForgeFeatures)
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.filter(bound -> !ForgeFeature.testFeature(FMLEnvironment.dist, bound))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if (!failedBounds.isEmpty()) {
|
||||||
|
LOGGER.fatal(CORE, "Failed to validate feature bounds for mods");
|
||||||
|
modList.setLoadedMods(Collections.emptyList());
|
||||||
|
loadingStateValid = false;
|
||||||
|
throw new LoadingFailedException(failedBounds.stream()
|
||||||
|
.map(fb -> new ModLoadingException(fb.modInfo(), ModLoadingStage.CONSTRUCT, "fml.modloading.feature.missing", null, fb.featureName(), fb.featureBound(), ForgeFeature.featureValue(fb)))
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
statusConsumer.ifPresent(c->c.accept("Building Mod List"));
|
statusConsumer.ifPresent(c->c.accept("Building Mod List"));
|
||||||
final List<ModContainer> modContainers = loadingModList.getModFiles().stream()
|
final List<ModContainer> modContainers = loadingModList.getModFiles().stream()
|
||||||
.map(ModFileInfo::getFile)
|
.map(ModFileInfo::getFile)
|
||||||
@@ -222,7 +244,7 @@ public class ModLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ModContainer> buildMods(final ModFile modFile)
|
private List<ModContainer> buildMods(final IModFile modFile)
|
||||||
{
|
{
|
||||||
final Map<String, IModInfo> modInfoMap = modFile.getModFileInfo().getMods().stream().collect(Collectors.toMap(IModInfo::getModId, Function.identity()));
|
final Map<String, IModInfo> modInfoMap = modFile.getModFileInfo().getMods().stream().collect(Collectors.toMap(IModInfo::getModId, Function.identity()));
|
||||||
|
|
||||||
@@ -244,7 +266,7 @@ public class ModLoader
|
|||||||
return containers.stream().filter(mc -> mc.modLoadingStage != ModLoadingStage.ERROR).collect(Collectors.toList());
|
return containers.stream().filter(mc -> mc.modLoadingStage != ModLoadingStage.ERROR).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModContainer buildModContainerFromTOML(final ModFile modFile, final Map<String, IModInfo> modInfoMap, final Map.Entry<String, ? extends IModLanguageProvider.IModLanguageLoader> idToProviderEntry) {
|
private ModContainer buildModContainerFromTOML(final IModFile modFile, final Map<String, IModInfo> modInfoMap, final Map.Entry<String, ? extends IModLanguageProvider.IModLanguageLoader> idToProviderEntry) {
|
||||||
try {
|
try {
|
||||||
final String modId = idToProviderEntry.getKey();
|
final String modId = idToProviderEntry.getKey();
|
||||||
final IModLanguageProvider.IModLanguageLoader languageLoader = idToProviderEntry.getValue();
|
final IModLanguageProvider.IModLanguageLoader languageLoader = idToProviderEntry.getValue();
|
||||||
@@ -273,7 +295,7 @@ public class ModLoader
|
|||||||
LOGGER.error("Cowardly refusing to send event generator to a broken mod state");
|
LOGGER.error("Cowardly refusing to send event generator to a broken mod state");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ModList.get().forEachModContainer((id, mc) -> mc.acceptEvent(generator.apply(mc)));
|
ModList.get().forEachModInOrder(mc -> mc.acceptEvent(generator.apply(mc)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Event & IModBusEvent> void postEvent(T e) {
|
public <T extends Event & IModBusEvent> void postEvent(T e) {
|
||||||
@@ -281,7 +303,18 @@ public class ModLoader
|
|||||||
LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName());
|
LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ModList.get().forEachModContainer((id, mc) -> mc.acceptEvent(e));
|
ModList.get().forEachModInOrder(mc -> mc.acceptEvent(e));
|
||||||
|
}
|
||||||
|
public <T extends Event & IModBusEvent> void postEventWithWrapInModOrder(T e, BiConsumer<ModContainer, T> pre, BiConsumer<ModContainer, T> post) {
|
||||||
|
if (!loadingStateValid) {
|
||||||
|
LOGGER.error("Cowardly refusing to send event {} to a broken mod state", e.getClass().getName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ModList.get().forEachModInOrder(mc -> {
|
||||||
|
pre.accept(mc, e);
|
||||||
|
mc.acceptEvent(e);
|
||||||
|
post.accept(mc, e);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ModLoadingWarning> getWarnings()
|
public List<ModLoadingWarning> getWarnings()
|
||||||
|
|||||||
@@ -117,14 +117,22 @@ public class VersionChecker
|
|||||||
/**
|
/**
|
||||||
* Returns the response body as a String for the given URL while following redirects
|
* Returns the response body as a String for the given URL while following redirects
|
||||||
*/
|
*/
|
||||||
private String openUrlString(URL url) throws IOException, URISyntaxException, InterruptedException {
|
private String openUrlString(URL url, IModInfo mod) throws IOException, URISyntaxException, InterruptedException {
|
||||||
URL currentUrl = url;
|
URL currentUrl = url;
|
||||||
|
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("Java-http-client/").append(System.getProperty("java.version")).append(' ');
|
||||||
|
sb.append("MinecraftForge/").append(FMLLoader.versionInfo().mcAndForgeVersion()).append(' ');
|
||||||
|
sb.append(mod.getModId()).append('/').append(mod.getVersion());
|
||||||
|
final String userAgent = sb.toString();
|
||||||
|
|
||||||
for (int redirects = 0; redirects < MAX_HTTP_REDIRECTS; redirects++)
|
for (int redirects = 0; redirects < MAX_HTTP_REDIRECTS; redirects++)
|
||||||
{
|
{
|
||||||
var request = HttpRequest.newBuilder()
|
var request = HttpRequest.newBuilder()
|
||||||
.uri(currentUrl.toURI())
|
.uri(currentUrl.toURI())
|
||||||
.timeout(Duration.ofSeconds(HTTP_TIMEOUT_SECS))
|
.timeout(Duration.ofSeconds(HTTP_TIMEOUT_SECS))
|
||||||
.setHeader("Accept-Encoding", "gzip")
|
.setHeader("Accept-Encoding", "gzip")
|
||||||
|
.setHeader("User-Agent", userAgent)
|
||||||
.GET()
|
.GET()
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -166,7 +174,7 @@ public class VersionChecker
|
|||||||
URL url = mod.getUpdateURL().get();
|
URL url = mod.getUpdateURL().get();
|
||||||
LOGGER.info("[{}] Starting version check at {}", mod.getModId(), url.toString());
|
LOGGER.info("[{}] Starting version check at {}", mod.getModId(), url.toString());
|
||||||
|
|
||||||
String data = openUrlString(url);
|
String data = openUrlString(url, mod);
|
||||||
|
|
||||||
LOGGER.debug("[{}] Received version check data:\n{}", mod.getModId(), data);
|
LOGGER.debug("[{}] Received version check data:\n{}", mod.getModId(), data);
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ dependencies {
|
|||||||
api("cpw.mods:modlauncher:${MODLAUNCHER_VERSION}")
|
api("cpw.mods:modlauncher:${MODLAUNCHER_VERSION}")
|
||||||
api("net.minecraftforge:coremods:${COREMODS_VERSION}")
|
api("net.minecraftforge:coremods:${COREMODS_VERSION}")
|
||||||
api("com.mojang:logging:${MOJANG_LOGGING_VERSION}")
|
api("com.mojang:logging:${MOJANG_LOGGING_VERSION}")
|
||||||
|
api "net.minecraftforge:JarJarSelector:${JARJAR_VERSION}"
|
||||||
|
api "net.minecraftforge:JarJarMetadata:${JARJAR_VERSION}"
|
||||||
|
|
||||||
implementation("net.sf.jopt-simple:jopt-simple:${JOPT_SIMPLE_VERSION}")
|
implementation("net.sf.jopt-simple:jopt-simple:${JOPT_SIMPLE_VERSION}")
|
||||||
implementation("cpw.mods:securejarhandler:${SECUREJARHANDLER_VERSION}")
|
implementation("cpw.mods:securejarhandler:${SECUREJARHANDLER_VERSION}")
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Forge Development LLC and contributors
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.minecraftforge.fml.loading;
|
||||||
|
|
||||||
|
import com.mojang.logging.LogUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
public class ClasspathLocatorUtils {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
|
||||||
|
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.error(LogMarkers.SCAN, "Failed to find JAR for class {} - {}", resourceName, jarName);
|
||||||
|
throw new RuntimeException("Unable to locate "+resourceName+" - "+jarName, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Forge Development LLC and contributors
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.minecraftforge.fml.loading;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.NamedPath;
|
||||||
|
import cpw.mods.modlauncher.serviceapi.ITransformerDiscoveryService;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class ClasspathTransformerDiscoverer implements ITransformerDiscoveryService {
|
||||||
|
|
||||||
|
private final List<Path> legacyClasspath = Arrays.stream(System.getProperty("legacyClassPath", "").split(File.pathSeparator)).map(Path::of).toList();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NamedPath> candidates(Path gameDirectory) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NamedPath> candidates(final Path gameDirectory, final String launchTarget) {
|
||||||
|
if (launchTarget != null && launchTarget.contains("dev")) {
|
||||||
|
this.scan(gameDirectory);
|
||||||
|
}
|
||||||
|
return List.copyOf(found);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static List<NamedPath> found = new ArrayList<>();
|
||||||
|
|
||||||
|
public static List<Path> allExcluded() {
|
||||||
|
return found.stream().map(np->np.paths()[0]).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void scan(final Path gameDirectory) {
|
||||||
|
try {
|
||||||
|
locateTransformers("META-INF/services/cpw.mods.modlauncher.api.ITransformationService");
|
||||||
|
locateTransformers("META-INF/services/net.minecraftforge.forgespi.locating.IModLocator");
|
||||||
|
} catch (IOException e) {
|
||||||
|
LogManager.getLogger().error("Error during discovery of transform services from the classpath", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void locateTransformers(String resource) throws IOException {
|
||||||
|
final Enumeration<URL> resources = ClassLoader.getSystemClassLoader().getResources(resource);
|
||||||
|
while (resources.hasMoreElements()) {
|
||||||
|
URL url = resources.nextElement();
|
||||||
|
Path path = ClasspathLocatorUtils.findJarPathFor(resource, url.toString(), url);
|
||||||
|
if (legacyClasspath.stream().anyMatch(path::equals) || !Files.exists(path) || Files.isDirectory(path))
|
||||||
|
continue;
|
||||||
|
found.add(new NamedPath(path.toUri().toString(), path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -47,7 +47,7 @@ public class EarlyLoadingException extends RuntimeException {
|
|||||||
return errorMessages;
|
return errorMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
EarlyLoadingException(final String message, final Throwable originalException, List<ExceptionData> errorMessages) {
|
public EarlyLoadingException(final String message, final Throwable originalException, List<ExceptionData> errorMessages) {
|
||||||
super(message, originalException);
|
super(message, originalException);
|
||||||
this.errorMessages = errorMessages;
|
this.errorMessages = errorMessages;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class FMLConfig
|
|||||||
configSpec.define("maxThreads", -1);
|
configSpec.define("maxThreads", -1);
|
||||||
configSpec.define("versionCheck", Boolean.TRUE);
|
configSpec.define("versionCheck", Boolean.TRUE);
|
||||||
configSpec.define("defaultConfigPath", "defaultconfigs");
|
configSpec.define("defaultConfigPath", "defaultconfigs");
|
||||||
|
configSpec.define("disableOptimizedDFU", Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommentedFileConfig configData;
|
private CommentedFileConfig configData;
|
||||||
@@ -88,4 +89,8 @@ public class FMLConfig
|
|||||||
public static String defaultConfigPath() {
|
public static String defaultConfigPath() {
|
||||||
return INSTANCE.configData.<String>getOptional("defaultConfigPath").orElse("defaultconfigs");
|
return INSTANCE.configData.<String>getOptional("defaultConfigPath").orElse("defaultconfigs");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isOptimizedDFUDisabled() {
|
||||||
|
return INSTANCE.configData.<Boolean>getOptional("disableOptimizedDFU").orElse(Boolean.TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ public class LanguageLoadingProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IModLanguageProvider findLanguage(ModFile mf, String modLoader, VersionRange modLoaderVersion) {
|
public IModLanguageProvider findLanguage(ModFile mf, String modLoader, VersionRange modLoaderVersion) {
|
||||||
final String languageFileName = mf.getLocator() instanceof ExplodedDirectoryLocator ? "in-development" : mf.getFileName();
|
final String languageFileName = mf.getProvider() instanceof ExplodedDirectoryLocator ? "in-development" : mf.getFileName();
|
||||||
final ModLanguageWrapper mlw = languageProviderMap.get(modLoader);
|
final ModLanguageWrapper mlw = languageProviderMap.get(modLoader);
|
||||||
if (mlw == null) {
|
if (mlw == null) {
|
||||||
LOGGER.error(LOADING,"Missing language {} version {} wanted by {}", modLoader, modLoaderVersion, languageFileName);
|
LOGGER.error(LOADING,"Missing language {} version {} wanted by {}", modLoader, modLoaderVersion, languageFileName);
|
||||||
|
|||||||
@@ -10,11 +10,18 @@ import net.minecraftforge.fml.loading.moddiscovery.BackgroundScanHandler;
|
|||||||
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
||||||
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
||||||
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
|
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
|
||||||
|
import net.minecraftforge.forgespi.locating.IModFile;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,7 +35,7 @@ public class LoadingModList
|
|||||||
private final List<ModInfo> sortedList;
|
private final List<ModInfo> sortedList;
|
||||||
private final Map<String, ModFileInfo> fileById;
|
private final Map<String, ModFileInfo> fileById;
|
||||||
private final List<EarlyLoadingException> preLoadErrors;
|
private final List<EarlyLoadingException> preLoadErrors;
|
||||||
private List<ModFile> brokenFiles;
|
private List<IModFile> brokenFiles;
|
||||||
|
|
||||||
private LoadingModList(final List<ModFile> modFiles, final List<ModInfo> sortedList)
|
private LoadingModList(final List<ModFile> modFiles, final List<ModInfo> sortedList)
|
||||||
{
|
{
|
||||||
@@ -154,11 +161,11 @@ public class LoadingModList
|
|||||||
return preLoadErrors;
|
return preLoadErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBrokenFiles(final List<ModFile> brokenFiles) {
|
public void setBrokenFiles(final List<IModFile> brokenFiles) {
|
||||||
this.brokenFiles = brokenFiles;
|
this.brokenFiles = brokenFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ModFile> getBrokenFiles() {
|
public List<IModFile> getBrokenFiles() {
|
||||||
return this.brokenFiles;
|
return this.brokenFiles;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,6 @@ import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
|||||||
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
|
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
|
||||||
import net.minecraftforge.fml.loading.toposort.CyclePresentException;
|
import net.minecraftforge.fml.loading.toposort.CyclePresentException;
|
||||||
import net.minecraftforge.fml.loading.toposort.TopologicalSort;
|
import net.minecraftforge.fml.loading.toposort.TopologicalSort;
|
||||||
import net.minecraftforge.forgespi.locating.IModFile;
|
|
||||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -36,14 +35,15 @@ import static net.minecraftforge.fml.loading.LogMarkers.LOADING;
|
|||||||
public class ModSorter
|
public class ModSorter
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
private final UniqueModListBuilder uniqueModListBuilder;
|
||||||
private List<ModFile> modFiles;
|
private List<ModFile> modFiles;
|
||||||
private List<ModInfo> sortedList;
|
private List<ModInfo> sortedList;
|
||||||
private Map<String, ModInfo> modIdNameLookup;
|
private Map<String, IModInfo> modIdNameLookup;
|
||||||
private List<ModFile> systemMods;
|
private List<ModFile> systemMods;
|
||||||
|
|
||||||
private ModSorter(final List<ModFile> modFiles)
|
private ModSorter(final List<ModFile> modFiles)
|
||||||
{
|
{
|
||||||
this.modFiles = modFiles;
|
this.uniqueModListBuilder = new UniqueModListBuilder(modFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoadingModList sort(List<ModFile> mods, final List<ExceptionData> errors)
|
public static LoadingModList sort(List<ModFile> mods, final List<ExceptionData> errors)
|
||||||
@@ -78,11 +78,12 @@ public class ModSorter
|
|||||||
// lambdas are identity based, so sorting them is impossible unless you hold reference to them
|
// lambdas are identity based, so sorting them is impossible unless you hold reference to them
|
||||||
final MutableGraph<ModFileInfo> graph = GraphBuilder.directed().build();
|
final MutableGraph<ModFileInfo> graph = GraphBuilder.directed().build();
|
||||||
AtomicInteger counter = new AtomicInteger();
|
AtomicInteger counter = new AtomicInteger();
|
||||||
Map<IModFileInfo, Integer> infos = modFiles.stream()
|
Map<ModFileInfo, Integer> infos = modFiles.stream()
|
||||||
.map(ModFile::getModFileInfo)
|
.map(ModFile::getModFileInfo)
|
||||||
.filter(ModFileInfo.class::isInstance)
|
.filter(ModFileInfo.class::isInstance)
|
||||||
|
.map(ModFileInfo.class::cast)
|
||||||
.collect(toMap(Function.identity(), e -> counter.incrementAndGet()));
|
.collect(toMap(Function.identity(), e -> counter.incrementAndGet()));
|
||||||
infos.keySet().forEach(i -> graph.addNode((ModFileInfo) i));
|
infos.keySet().forEach(graph::addNode);
|
||||||
modFiles.stream()
|
modFiles.stream()
|
||||||
.map(ModFile::getModInfos)
|
.map(ModFile::getModInfos)
|
||||||
.<IModInfo>mapMulti(Iterable::forEach)
|
.<IModInfo>mapMulti(Iterable::forEach)
|
||||||
@@ -124,10 +125,9 @@ public class ModSorter
|
|||||||
private void addDependency(MutableGraph<ModFileInfo> topoGraph, IModInfo.ModVersion dep)
|
private void addDependency(MutableGraph<ModFileInfo> topoGraph, IModInfo.ModVersion dep)
|
||||||
{
|
{
|
||||||
final ModFileInfo self = (ModFileInfo)dep.getOwner().getOwningFile();
|
final ModFileInfo self = (ModFileInfo)dep.getOwner().getOwningFile();
|
||||||
final ModInfo targetModInfo = modIdNameLookup.get(dep.getModId());
|
final IModInfo targetModInfo = modIdNameLookup.get(dep.getModId());
|
||||||
// soft dep that doesn't exist. Just return. No edge required.
|
// soft dep that doesn't exist. Just return. No edge required.
|
||||||
if (targetModInfo == null) return;
|
if (targetModInfo == null || !(targetModInfo.getOwningFile() instanceof final ModFileInfo target)) return;
|
||||||
final ModFileInfo target = targetModInfo.getOwningFile();
|
|
||||||
if (self == target)
|
if (self == target)
|
||||||
return; // in case a jar has two mods that have dependencies between
|
return; // in case a jar has two mods that have dependencies between
|
||||||
switch (dep.getOrdering()) {
|
switch (dep.getOrdering()) {
|
||||||
@@ -138,19 +138,32 @@ public class ModSorter
|
|||||||
|
|
||||||
private void buildUniqueList()
|
private void buildUniqueList()
|
||||||
{
|
{
|
||||||
// Collect mod files by module name. This will be used for deduping purposes
|
final UniqueModListBuilder.UniqueModListData uniqueModListData = uniqueModListBuilder.buildUniqueList();
|
||||||
final Map<String, List<IModFile>> modFilesByFirstId = modFiles.stream()
|
|
||||||
.collect(groupingBy(mf -> mf.getModFileInfo().moduleName()));
|
|
||||||
|
|
||||||
|
this.modFiles = uniqueModListData.modFiles();
|
||||||
|
|
||||||
|
detectSystemMods(uniqueModListData.modFilesByFirstId());
|
||||||
|
|
||||||
|
modIdNameLookup = uniqueModListData.modFilesByFirstId().entrySet().stream()
|
||||||
|
.filter(e -> !e.getValue().get(0).getModInfos().isEmpty())
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
Map.Entry::getKey,
|
||||||
|
e -> e.getValue().get(0).getModInfos().get(0)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void detectSystemMods(final Map<String, List<ModFile>> modFilesByFirstId)
|
||||||
|
{
|
||||||
// Capture system mods (ex. MC, Forge) here, so we can keep them for later
|
// Capture system mods (ex. MC, Forge) here, so we can keep them for later
|
||||||
final Set<String> systemMods = new HashSet<>();
|
final Set<String> systemMods = new HashSet<>();
|
||||||
// The minecraft mod is always a system mod
|
// The minecraft mod is always a system mod
|
||||||
systemMods.add("minecraft");
|
systemMods.add("minecraft");
|
||||||
// Find mod file from MinecraftLocator to define the system mods
|
// Find mod file from MinecraftLocator to define the system mods
|
||||||
modFiles.stream()
|
modFiles.stream()
|
||||||
.filter(modFile -> modFile.getLocator().getClass() == MinecraftLocator.class)
|
.filter(modFile -> modFile.getProvider().getClass() == MinecraftLocator.class)
|
||||||
.map(ModFile::getSecureJar)
|
.map(ModFile::getSecureJar)
|
||||||
.map(SecureJar::getManifest)
|
.map(SecureJar::moduleDataProvider)
|
||||||
|
.map(SecureJar.ModuleDataProvider::getManifest)
|
||||||
.map(Manifest::getMainAttributes)
|
.map(Manifest::getMainAttributes)
|
||||||
.map(mf -> mf.getValue("FML-System-Mods"))
|
.map(mf -> mf.getValue("FML-System-Mods"))
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
@@ -168,47 +181,6 @@ public class ModSorter
|
|||||||
throw new IllegalStateException("Failed to find system mod: " + systemMod);
|
throw new IllegalStateException("Failed to find system mod: " + systemMod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select the newest by artifact version sorting of non-unique files thus identified
|
|
||||||
this.modFiles = modFilesByFirstId.entrySet().stream()
|
|
||||||
.map(this::selectNewestModInfo)
|
|
||||||
.map(Map.Entry::getValue)
|
|
||||||
.map(ModFile.class::cast)
|
|
||||||
.collect(toList());
|
|
||||||
|
|
||||||
// Transform to the full mod id list
|
|
||||||
final Map<String, List<ModInfo>> modIds = modFiles.stream()
|
|
||||||
.map(ModFile::getModInfos)
|
|
||||||
.flatMap(Collection::stream)
|
|
||||||
.map(ModInfo.class::cast)
|
|
||||||
.collect(groupingBy(IModInfo::getModId));
|
|
||||||
|
|
||||||
// Its theoretically possible that some mod has somehow moved an id to a secondary place, thus causing a dupe.
|
|
||||||
// We can't handle this
|
|
||||||
final List<ModInfo> dupedMods = modIds.values().stream()
|
|
||||||
.filter(modInfos -> modInfos.size() > 1)
|
|
||||||
.map(modInfos -> modInfos.get(0))
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
if (!dupedMods.isEmpty()) {
|
|
||||||
final List<EarlyLoadingException.ExceptionData> duplicateModErrors = dupedMods.stream()
|
|
||||||
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedmod",
|
|
||||||
dm, Objects.toString(dm))).toList();
|
|
||||||
throw new EarlyLoadingException("Duplicate mods found", null, duplicateModErrors);
|
|
||||||
}
|
|
||||||
|
|
||||||
modIdNameLookup = modIds.entrySet().stream()
|
|
||||||
.collect(toMap(Map.Entry::getKey, e -> e.getValue().get(0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map.Entry<String, IModFile> selectNewestModInfo(Map.Entry<String, List<IModFile>> fullList) {
|
|
||||||
List<IModFile> modInfoList = fullList.getValue();
|
|
||||||
if (modInfoList.size() > 1) {
|
|
||||||
LOGGER.debug("Found {} mods for first modid {}, selecting most recent based on version data", modInfoList.size(), fullList.getKey());
|
|
||||||
modInfoList.sort(Comparator.<IModFile, ArtifactVersion>comparing(mf -> mf.getModInfos().get(0).getVersion()).reversed());
|
|
||||||
LOGGER.debug("Selected file {} for modid {} with version {}", modInfoList.get(0).getFileName(), fullList.getKey(), modInfoList.get(0).getModInfos().get(0).getVersion());
|
|
||||||
}
|
|
||||||
return Map.entry(fullList.getKey(), modInfoList.get(0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<EarlyLoadingException.ExceptionData> verifyDependencyVersions()
|
private List<EarlyLoadingException.ExceptionData> verifyDependencyVersions()
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Forge Development LLC and contributors
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.minecraftforge.fml.loading;
|
||||||
|
|
||||||
|
import com.mojang.logging.LogUtils;
|
||||||
|
import net.minecraftforge.fml.loading.moddiscovery.ModFile;
|
||||||
|
import net.minecraftforge.forgespi.language.IModInfo;
|
||||||
|
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static java.util.stream.Collectors.*;
|
||||||
|
|
||||||
|
public class UniqueModListBuilder
|
||||||
|
{
|
||||||
|
private final static Logger LOGGER = LogUtils.getLogger();
|
||||||
|
|
||||||
|
private final List<ModFile> modFiles;
|
||||||
|
|
||||||
|
public UniqueModListBuilder(final List<ModFile> modFiles) {this.modFiles = modFiles;}
|
||||||
|
|
||||||
|
public UniqueModListData buildUniqueList()
|
||||||
|
{
|
||||||
|
List<ModFile> uniqueModList;
|
||||||
|
List<ModFile> uniqueLibListWithVersion;
|
||||||
|
|
||||||
|
// Collect mod files by module name. This will be used for deduping purposes
|
||||||
|
final Map<String, List<ModFile>> modFilesByFirstId = modFiles.stream()
|
||||||
|
.filter(mf -> mf.getModFileInfo() != null)
|
||||||
|
.collect(groupingBy(UniqueModListBuilder::getModId));
|
||||||
|
|
||||||
|
final Map<String, List<ModFile>> libFilesWithVersionByModuleName = modFiles.stream()
|
||||||
|
.filter(mf -> mf.getModFileInfo() == null)
|
||||||
|
.collect(groupingBy(UniqueModListBuilder::getModId));
|
||||||
|
|
||||||
|
// Select the newest by artifact version sorting of non-unique files thus identified
|
||||||
|
uniqueModList = modFilesByFirstId.entrySet().stream()
|
||||||
|
.map(this::selectNewestModInfo)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
// Select the newest by artifact version sorting of non-unique files thus identified
|
||||||
|
uniqueLibListWithVersion = libFilesWithVersionByModuleName.entrySet().stream()
|
||||||
|
.map(this::selectNewestModInfo)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
// Transform to the full mod id list
|
||||||
|
final Map<String, List<IModInfo>> modIds = uniqueModList.stream()
|
||||||
|
.filter(mf -> mf.getModFileInfo() != null) //Filter out non-mod files, we don't care about those for now.....
|
||||||
|
.map(ModFile::getModInfos)
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.collect(groupingBy(IModInfo::getModId));
|
||||||
|
|
||||||
|
// Transform to the full lib id list
|
||||||
|
final Map<String, List<ModFile>> versionedLibIds = uniqueLibListWithVersion.stream()
|
||||||
|
.map(UniqueModListBuilder::getModId)
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
Function.identity(),
|
||||||
|
libFilesWithVersionByModuleName::get
|
||||||
|
));
|
||||||
|
|
||||||
|
// Its theoretically possible that some mod has somehow moved an id to a secondary place, thus causing a dupe.
|
||||||
|
// We can't handle this
|
||||||
|
final List<IModInfo> dupedMods = modIds.values().stream()
|
||||||
|
.filter(modInfos -> modInfos.size() > 1)
|
||||||
|
.map(modInfos -> modInfos.get(0))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if (!dupedMods.isEmpty()) {
|
||||||
|
final List<EarlyLoadingException.ExceptionData> duplicateModErrors = dupedMods.stream()
|
||||||
|
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedmod", dm, Objects.toString(dm)))
|
||||||
|
.toList();
|
||||||
|
throw new EarlyLoadingException("Duplicate mods found", null, duplicateModErrors);
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<ModFile> dupedLibs = versionedLibIds.values().stream()
|
||||||
|
.filter(modFiles -> modFiles.size() > 1)
|
||||||
|
.map(modFiles -> modFiles.get(0))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
if (!dupedLibs.isEmpty()) {
|
||||||
|
final List<EarlyLoadingException.ExceptionData> duplicateLibErrors = dupedLibs.stream()
|
||||||
|
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedlib.versioned", dm, Objects.toString(dm)))
|
||||||
|
.toList();
|
||||||
|
throw new EarlyLoadingException("Duplicate plugins or libraries found", null, duplicateLibErrors);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect unique mod files by module name. This will be used for deduping purposes
|
||||||
|
final Map<String, List<ModFile>> uniqueModFilesByFirstId = uniqueModList.stream()
|
||||||
|
.collect(groupingBy(UniqueModListBuilder::getModId));
|
||||||
|
|
||||||
|
final List<ModFile> loadedList = new ArrayList<>();
|
||||||
|
loadedList.addAll(uniqueModList);
|
||||||
|
loadedList.addAll(uniqueLibListWithVersion);
|
||||||
|
|
||||||
|
return new UniqueModListData(loadedList, uniqueModFilesByFirstId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ModFile selectNewestModInfo(Map.Entry<String, List<ModFile>> fullList) {
|
||||||
|
List<ModFile> modInfoList = fullList.getValue();
|
||||||
|
if (modInfoList.size() > 1) {
|
||||||
|
LOGGER.debug("Found {} mods for first modid {}, selecting most recent based on version data", modInfoList.size(), fullList.getKey());
|
||||||
|
modInfoList.sort(Comparator.comparing(this::getVersion).reversed());
|
||||||
|
LOGGER.debug("Selected file {} for modid {} with version {}", modInfoList.get(0).getFileName(), fullList.getKey(), modInfoList.get(0).getModInfos().get(0).getVersion());
|
||||||
|
}
|
||||||
|
return modInfoList.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArtifactVersion getVersion(final ModFile mf)
|
||||||
|
{
|
||||||
|
if (mf.getModFileInfo() == null) {
|
||||||
|
return mf.getJarVersion();
|
||||||
|
}
|
||||||
|
return mf.getModInfos().get(0).getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getModId(ModFile modFile) {
|
||||||
|
if (modFile.getModFileInfo() == null || modFile.getModFileInfo().getMods().isEmpty()) {
|
||||||
|
return modFile.getSecureJar().name();
|
||||||
|
}
|
||||||
|
|
||||||
|
return modFile.getModFileInfo().moduleName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public record UniqueModListData(List<ModFile> modFiles, Map<String, List<ModFile>> modFilesByFirstId) {}
|
||||||
|
|
||||||
|
}
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Forge Development LLC and contributors
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.minecraftforge.fml.loading.moddiscovery;
|
||||||
|
|
||||||
|
import com.mojang.logging.LogUtils;
|
||||||
|
import net.minecraftforge.forgespi.locating.IDependencyLocator;
|
||||||
|
import net.minecraftforge.forgespi.locating.IModFile;
|
||||||
|
import net.minecraftforge.forgespi.locating.ModFileLoadingException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public abstract class AbstractJarFileDependencyLocator extends AbstractJarFileModProvider implements IDependencyLocator
|
||||||
|
{
|
||||||
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
|
||||||
|
protected Optional<InputStream> loadResourceFromModFile(final IModFile modFile, final Path path) {
|
||||||
|
try {
|
||||||
|
return Optional.of(Files.newInputStream(modFile.findResource(path.toString())));
|
||||||
|
}
|
||||||
|
catch (final FileNotFoundException e) {
|
||||||
|
LOGGER.debug("Failed to load resource {} from {}, it does not contain dependency information.", path, modFile.getFileName());
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
catch (final Exception e) {
|
||||||
|
LOGGER.error("Failed to load resource {} from mod {}, cause {}", path, modFile.getFileName(), e);
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Optional<IModFile> loadModFileFrom(final IModFile file, final Path path) {
|
||||||
|
try {
|
||||||
|
final Path pathInModFile = file.findResource(path.toString());
|
||||||
|
return Optional.of(createMod(pathInModFile).file());
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
LOGGER.error("Failed to load mod file {} from {}", path, file.getFileName());
|
||||||
|
throw new ModFileLoadingException("Failed to load mod file "+file.getFileName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String identifyMod(final IModFile modFile) {
|
||||||
|
return modFile.getFileName();
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Forge Development LLC and contributors
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.minecraftforge.fml.loading.moddiscovery;
|
||||||
|
|
||||||
|
import net.minecraftforge.forgespi.locating.IModLocator;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public abstract class AbstractJarFileModLocator extends AbstractJarFileModProvider implements IModLocator
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public List<IModLocator.ModFileOrException> scanMods()
|
||||||
|
{
|
||||||
|
return scanCandidates().map(this::createMod).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Stream<Path> scanCandidates();
|
||||||
|
}
|
||||||
+9
-21
@@ -7,20 +7,19 @@ package net.minecraftforge.fml.loading.moddiscovery;
|
|||||||
|
|
||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
import cpw.mods.jarhandling.SecureJar;
|
import cpw.mods.jarhandling.SecureJar;
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import net.minecraftforge.fml.loading.LogMarkers;
|
import net.minecraftforge.fml.loading.LogMarkers;
|
||||||
import net.minecraftforge.forgespi.locating.IModFile;
|
import net.minecraftforge.forgespi.locating.IModFile;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
public abstract class AbstractJarFileLocator extends AbstractModLocator {
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public abstract class AbstractJarFileModProvider extends AbstractModProvider
|
||||||
|
{
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -34,15 +33,4 @@ public abstract class AbstractJarFileLocator extends AbstractModLocator {
|
|||||||
}
|
}
|
||||||
LOGGER.debug(LogMarkers.SCAN,"Scan finished: {}", file);
|
LOGGER.debug(LogMarkers.SCAN,"Scan finished: {}", file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<IModFile> scanMods() {
|
|
||||||
return scanCandidates()
|
|
||||||
.map(this::createMod)
|
|
||||||
.filter(Optional::isPresent)
|
|
||||||
.map(Optional::get)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract Stream<Path> scanCandidates();
|
|
||||||
}
|
}
|
||||||
-96
@@ -1,96 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Forge Development LLC and contributors
|
|
||||||
* SPDX-License-Identifier: LGPL-2.1-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraftforge.fml.loading.moddiscovery;
|
|
||||||
|
|
||||||
import com.mojang.logging.LogUtils;
|
|
||||||
import cpw.mods.jarhandling.JarMetadata;
|
|
||||||
import cpw.mods.jarhandling.SecureJar;
|
|
||||||
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.slf4j.Logger;
|
|
||||||
|
|
||||||
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.Function;
|
|
||||||
import java.util.jar.Manifest;
|
|
||||||
|
|
||||||
public abstract class AbstractModLocator implements IModLocator {
|
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
|
||||||
protected static final String MODS_TOML = "META-INF/mods.toml";
|
|
||||||
protected static final String MANIFEST = "META-INF/MANIFEST.MF";
|
|
||||||
|
|
||||||
protected 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;
|
|
||||||
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.of(mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected 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() + ")";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValid(final IModFile modFile) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+123
@@ -0,0 +1,123 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Forge Development LLC and contributors
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.minecraftforge.fml.loading.moddiscovery;
|
||||||
|
|
||||||
|
import com.mojang.logging.LogUtils;
|
||||||
|
import cpw.mods.jarhandling.JarMetadata;
|
||||||
|
import cpw.mods.jarhandling.SecureJar;
|
||||||
|
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 net.minecraftforge.forgespi.locating.IModProvider;
|
||||||
|
import net.minecraftforge.forgespi.locating.ModFileLoadingException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.jar.Manifest;
|
||||||
|
|
||||||
|
public abstract class AbstractModProvider implements IModProvider
|
||||||
|
{
|
||||||
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
protected static final String MODS_TOML = "META-INF/mods.toml";
|
||||||
|
protected static final String MANIFEST = "META-INF/MANIFEST.MF";
|
||||||
|
|
||||||
|
protected IModLocator.ModFileOrException createMod(Path... path) {
|
||||||
|
var mjm = new ModJarMetadata();
|
||||||
|
var sj = SecureJar.from(
|
||||||
|
Manifest::new,
|
||||||
|
jar -> jar.moduleDataProvider().findFile(MODS_TOML).isPresent() ? mjm : JarMetadata.from(jar, path),
|
||||||
|
(root, p) -> true,
|
||||||
|
path
|
||||||
|
);
|
||||||
|
|
||||||
|
IModFile mod;
|
||||||
|
var type = sj.moduleDataProvider().getManifest().getMainAttributes().getValue(ModFile.TYPE);
|
||||||
|
if (type == null) {
|
||||||
|
type = getDefaultJarModType();
|
||||||
|
}
|
||||||
|
if (sj.moduleDataProvider().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, type);
|
||||||
|
} else {
|
||||||
|
return new IModLocator.ModFileOrException(null, new ModFileLoadingException("Invalid mod file found "+ Arrays.toString(path)));
|
||||||
|
}
|
||||||
|
|
||||||
|
mjm.setModFile(mod);
|
||||||
|
return new IModLocator.ModFileOrException(mod, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IModFileInfo manifestParser(final IModFile mod) {
|
||||||
|
Function<String, Optional<String>> cfg = name -> Optional.ofNullable(mod.getSecureJar().moduleDataProvider().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 DefaultModFileInfo(mod, license, dummy);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValid(final IModFile modFile) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getDefaultJarModType() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private record DefaultModFileInfo(IModFile mod, String license, IConfigurable configurable) implements IModFileInfo, IConfigurable {
|
||||||
|
@Override
|
||||||
|
public <T> Optional<T> getConfigElement(final String... strings)
|
||||||
|
{
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<? extends IConfigurable> getConfigList(final String... strings)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 configurable; }
|
||||||
|
|
||||||
|
// 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() + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.moddiscovery;
|
package net.minecraftforge.fml.loading.moddiscovery;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.loading.ClasspathLocatorUtils;
|
||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
import net.minecraftforge.fml.loading.LogMarkers;
|
import net.minecraftforge.fml.loading.LogMarkers;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -24,7 +25,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class ClasspathLocator extends AbstractJarFileLocator {
|
public class ClasspathLocator extends AbstractJarFileModLocator
|
||||||
|
{
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
private final List<Path> legacyClasspath = Arrays.stream(System.getProperty("legacyClassPath", "").split(File.pathSeparator)).map(Path::of).toList();
|
private final List<Path> legacyClasspath = Arrays.stream(System.getProperty("legacyClassPath", "").split(File.pathSeparator)).map(Path::of).toList();
|
||||||
private boolean enabled = false;
|
private boolean enabled = false;
|
||||||
@@ -58,7 +60,7 @@ public class ClasspathLocator extends AbstractJarFileLocator {
|
|||||||
final Enumeration<URL> resources = ClassLoader.getSystemClassLoader().getResources(resource);
|
final Enumeration<URL> resources = ClassLoader.getSystemClassLoader().getResources(resource);
|
||||||
while (resources.hasMoreElements()) {
|
while (resources.hasMoreElements()) {
|
||||||
URL url = resources.nextElement();
|
URL url = resources.nextElement();
|
||||||
Path path = findJarPathFor(resource, resource, url);
|
Path path = ClasspathLocatorUtils.findJarPathFor(resource, resource, url);
|
||||||
if (claimed.stream().anyMatch(path::equals) || !Files.exists(path) || Files.isDirectory(path))
|
if (claimed.stream().anyMatch(path::equals) || !Files.exists(path) || Files.isDirectory(path))
|
||||||
continue;
|
continue;
|
||||||
ret.add(path);
|
ret.add(path);
|
||||||
|
|||||||
+3
-3
@@ -30,14 +30,14 @@ public class ExplodedDirectoryLocator implements IModLocator {
|
|||||||
private final Map<ExplodedMod, IModFile> mods = new HashMap<>();
|
private final Map<ExplodedMod, IModFile> mods = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IModFile> scanMods() {
|
public List<IModLocator.ModFileOrException> scanMods() {
|
||||||
explodedMods.forEach(explodedMod ->
|
explodedMods.forEach(explodedMod ->
|
||||||
ModJarMetadata.buildFile(this,
|
ModJarMetadata.buildFile(this,
|
||||||
jar->jar.findFile("/META-INF/mods.toml").isPresent(),
|
jar->jar.moduleDataProvider().findFile("/META-INF/mods.toml").isPresent(),
|
||||||
(a,b) -> true,
|
(a,b) -> true,
|
||||||
explodedMod.paths().toArray(Path[]::new))
|
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())));
|
.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());
|
return mods.values().stream().map(mf->new IModLocator.ModFileOrException(mf, null)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+8
-2
@@ -6,16 +6,22 @@
|
|||||||
package net.minecraftforge.fml.loading.moddiscovery;
|
package net.minecraftforge.fml.loading.moddiscovery;
|
||||||
|
|
||||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||||
|
import net.minecraftforge.forgespi.locating.ModFileLoadingException;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class InvalidModFileException extends RuntimeException
|
public class InvalidModFileException extends ModFileLoadingException
|
||||||
{
|
{
|
||||||
private final IModFileInfo modFileInfo;
|
private final IModFileInfo modFileInfo;
|
||||||
|
|
||||||
public InvalidModFileException(String message, IModFileInfo modFileInfo)
|
public InvalidModFileException(String message, IModFileInfo modFileInfo)
|
||||||
{
|
{
|
||||||
super(String.format(Locale.ENGLISH, "%s (%s)", message, ((ModFileInfo)modFileInfo).getFile().getFileName()));
|
super(String.format(Locale.ROOT, "%s (%s)", message, Optional.ofNullable(modFileInfo).map(mf->mf.getFile().getFileName()).orElse("MISSING FILE NAME")));
|
||||||
this.modFileInfo = modFileInfo;
|
this.modFileInfo = modFileInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IModFileInfo getBrokenFile() {
|
||||||
|
return modFileInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+158
@@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Forge Development LLC and contributors
|
||||||
|
* SPDX-License-Identifier: LGPL-2.1-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.minecraftforge.fml.loading.moddiscovery;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.mojang.logging.LogUtils;
|
||||||
|
import net.minecraftforge.fml.loading.EarlyLoadingException;
|
||||||
|
import net.minecraftforge.forgespi.language.IModInfo;
|
||||||
|
import net.minecraftforge.forgespi.locating.IModFile;
|
||||||
|
import net.minecraftforge.forgespi.locating.ModFileLoadingException;
|
||||||
|
import net.minecraftforge.jarjar.selection.JarSelector;
|
||||||
|
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||||
|
import org.apache.maven.artifact.versioning.VersionRange;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.nio.file.FileSystem;
|
||||||
|
import java.nio.file.FileSystems;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class JarInJarDependencyLocator extends AbstractJarFileDependencyLocator
|
||||||
|
{
|
||||||
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String name()
|
||||||
|
{
|
||||||
|
return "JarInJar";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IModFile> scanMods(final Iterable<IModFile> loadedMods)
|
||||||
|
{
|
||||||
|
final List<IModFile> sources = Lists.newArrayList();
|
||||||
|
loadedMods.forEach(sources::add);
|
||||||
|
|
||||||
|
final List<IModFile> dependenciesToLoad = JarSelector.detectAndSelect(sources, this::loadResourceFromModFile, this::loadModFileFrom, this::identifyMod, this::exception);
|
||||||
|
|
||||||
|
if (dependenciesToLoad.isEmpty())
|
||||||
|
{
|
||||||
|
LOGGER.info("No dependencies to load found. Skipping!");
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.info("Found {} dependencies adding them to mods collection", dependenciesToLoad.size());
|
||||||
|
return dependenciesToLoad;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initArguments(final Map<String, ?> arguments)
|
||||||
|
{
|
||||||
|
// NO-OP, for now
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getDefaultJarModType()
|
||||||
|
{
|
||||||
|
return IModFile.Type.GAMELIBRARY.name();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
|
@Override
|
||||||
|
protected Optional<IModFile> loadModFileFrom(final IModFile file, final Path path)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final Path pathInModFile = file.findResource(path.toString());
|
||||||
|
final URI filePathUri = new URI("jij:" + (pathInModFile.toAbsolutePath().toUri().getRawSchemeSpecificPart())).normalize();
|
||||||
|
final Map<String, ?> outerFsArgs = ImmutableMap.of("packagePath", pathInModFile);
|
||||||
|
final FileSystem zipFS = FileSystems.newFileSystem(filePathUri, outerFsArgs);
|
||||||
|
final Path pathInFS = zipFS.getPath("/");
|
||||||
|
return Optional.of(createMod(pathInFS).file());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.error("Failed to load mod file {} from {}", path, file.getFileName());
|
||||||
|
final RuntimeException exception = new ModFileLoadingException("Failed to load mod file " + file.getFileName());
|
||||||
|
exception.initCause(e);
|
||||||
|
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected EarlyLoadingException exception(Collection<JarSelector.ResolutionFailureInformation<IModFile>> failedDependencies)
|
||||||
|
{
|
||||||
|
|
||||||
|
final List<EarlyLoadingException.ExceptionData> errors = failedDependencies.stream()
|
||||||
|
.filter(entry -> !entry.sources().isEmpty()) //Should never be the case, but just to be sure
|
||||||
|
.map(this::buildExceptionData)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return new EarlyLoadingException(failedDependencies.size() + " Dependency restrictions were not met.", null, errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private EarlyLoadingException.ExceptionData buildExceptionData(final JarSelector.ResolutionFailureInformation<IModFile> entry)
|
||||||
|
{
|
||||||
|
return new EarlyLoadingException.ExceptionData(
|
||||||
|
getErrorTranslationKey(entry),
|
||||||
|
entry.identifier().group() + ":" + entry.identifier().artifact(),
|
||||||
|
entry.sources()
|
||||||
|
.stream()
|
||||||
|
.flatMap(this::getModWithVersionRangeStream)
|
||||||
|
.map(this::formatError)
|
||||||
|
.collect(Collectors.joining(", "))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private String getErrorTranslationKey(final JarSelector.ResolutionFailureInformation<IModFile> entry)
|
||||||
|
{
|
||||||
|
return entry.failureReason() == JarSelector.FailureReason.VERSION_RESOLUTION_FAILED ?
|
||||||
|
"fml.dependencyloading.conflictingdependencies" :
|
||||||
|
"fml.dependencyloading.mismatchedcontaineddependencies";
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Stream<ModWithVersionRange> getModWithVersionRangeStream(final JarSelector.SourceWithRequestedVersionRange<IModFile> file)
|
||||||
|
{
|
||||||
|
return file.sources()
|
||||||
|
.stream()
|
||||||
|
.map(IModFile::getModFileInfo)
|
||||||
|
.flatMap(modFileInfo -> modFileInfo.getMods().stream())
|
||||||
|
.map(modInfo -> new ModWithVersionRange(modInfo, file.requestedVersionRange(), file.includedVersion()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private String formatError(final ModWithVersionRange modWithVersionRange)
|
||||||
|
{
|
||||||
|
return "\u00a7e" + modWithVersionRange.modInfo().getModId() + "\u00a7r - \u00a74" + modWithVersionRange.versionRange().toString() + "\u00a74 - \u00a72" + modWithVersionRange.artifactVersion().toString() + "\u00a72";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String identifyMod(final IModFile modFile)
|
||||||
|
{
|
||||||
|
if (modFile.getModFileInfo() == null || modFile.getModInfos().isEmpty())
|
||||||
|
{
|
||||||
|
return modFile.getFileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
return modFile.getModInfos().stream().map(IModInfo::getModId).collect(Collectors.joining());
|
||||||
|
}
|
||||||
|
|
||||||
|
private record ModWithVersionRange(IModInfo modInfo, VersionRange versionRange, ArtifactVersion artifactVersion)
|
||||||
|
{}
|
||||||
|
}
|
||||||
+2
-1
@@ -15,7 +15,8 @@ import java.util.Map;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class MavenDirectoryLocator extends AbstractJarFileLocator {
|
public class MavenDirectoryLocator extends AbstractJarFileModLocator
|
||||||
|
{
|
||||||
private List<Path> modCoords;
|
private List<Path> modCoords;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+13
-9
@@ -12,21 +12,26 @@ import net.minecraftforge.fml.loading.FMLLoader;
|
|||||||
import net.minecraftforge.fml.loading.LogMarkers;
|
import net.minecraftforge.fml.loading.LogMarkers;
|
||||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||||
import net.minecraftforge.forgespi.locating.IModFile;
|
import net.minecraftforge.forgespi.locating.IModFile;
|
||||||
|
import net.minecraftforge.forgespi.locating.IModLocator;
|
||||||
import net.minecraftforge.forgespi.locating.ModFileFactory;
|
import net.minecraftforge.forgespi.locating.ModFileFactory;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.*;
|
import java.nio.file.Files;
|
||||||
import java.util.*;
|
import java.nio.file.Path;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class MinecraftLocator extends AbstractModLocator {
|
public class MinecraftLocator extends AbstractModProvider implements IModLocator
|
||||||
|
{
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IModFile> scanMods() {
|
public List<IModLocator.ModFileOrException> scanMods() {
|
||||||
final var launchHandler = FMLLoader.getLaunchHandler();
|
final var launchHandler = FMLLoader.getLaunchHandler();
|
||||||
var baseMC = launchHandler.getMinecraftPaths();
|
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 mcjar = ModJarMetadata.buildFile(j->ModFileFactory.FACTORY.build(j, this, this::buildMinecraftTOML), j->true, baseMC.minecraftFilter(), baseMC.minecraftPaths().toArray(Path[]::new)).orElseThrow();
|
||||||
@@ -35,12 +40,11 @@ public class MinecraftLocator extends AbstractModLocator {
|
|||||||
.map(sj -> new ModFile(sj, this, ModFileParser::modsTomlParser))
|
.map(sj -> new ModFile(sj, this, ModFileParser::modsTomlParser))
|
||||||
.collect(Collectors.<IModFile>toList());
|
.collect(Collectors.<IModFile>toList());
|
||||||
var othermods = baseMC.otherModPaths().stream()
|
var othermods = baseMC.otherModPaths().stream()
|
||||||
.map(p -> createMod(p.toArray(Path[]::new)).orElse(null))
|
.map(p -> createMod(p.toArray(Path[]::new)))
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull);
|
||||||
.toList();
|
|
||||||
artifacts.add(mcjar);
|
artifacts.add(mcjar);
|
||||||
artifacts.addAll(othermods);
|
|
||||||
return artifacts;
|
return Stream.concat(artifacts.stream().map(f -> new ModFileOrException(f, null)), othermods).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private IModFileInfo buildMinecraftTOML(final IModFile iModFile) {
|
private IModFileInfo buildMinecraftTOML(final IModFile iModFile) {
|
||||||
|
|||||||
+132
-27
@@ -5,13 +5,19 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.moddiscovery;
|
package net.minecraftforge.fml.loading.moddiscovery;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
import cpw.mods.modlauncher.Launcher;
|
import cpw.mods.modlauncher.Launcher;
|
||||||
import cpw.mods.modlauncher.api.IModuleLayerManager;
|
import cpw.mods.modlauncher.api.IModuleLayerManager;
|
||||||
import cpw.mods.modlauncher.util.ServiceLoaderUtils;
|
import cpw.mods.modlauncher.util.ServiceLoaderUtils;
|
||||||
|
import net.minecraftforge.fml.loading.EarlyLoadingException;
|
||||||
import net.minecraftforge.fml.loading.LogMarkers;
|
import net.minecraftforge.fml.loading.LogMarkers;
|
||||||
|
import net.minecraftforge.fml.loading.UniqueModListBuilder;
|
||||||
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
||||||
import net.minecraftforge.forgespi.Environment;
|
import net.minecraftforge.forgespi.Environment;
|
||||||
|
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||||
|
import net.minecraftforge.forgespi.locating.IDependencyLocator;
|
||||||
import net.minecraftforge.forgespi.locating.IModFile;
|
import net.minecraftforge.forgespi.locating.IModFile;
|
||||||
import net.minecraftforge.forgespi.locating.IModLocator;
|
import net.minecraftforge.forgespi.locating.IModLocator;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -19,52 +25,151 @@ import org.slf4j.Logger;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class ModDiscoverer {
|
public class ModDiscoverer {
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
private final ServiceLoader<IModLocator> locators;
|
private final ServiceLoader<IModLocator> modLocators;
|
||||||
private final List<IModLocator> locatorList;
|
private final ServiceLoader<IDependencyLocator> dependencyLocators;
|
||||||
|
private final List<IModLocator> modLocatorList;
|
||||||
|
private final List<IDependencyLocator> dependencyLocatorList;
|
||||||
|
|
||||||
public ModDiscoverer(Map<String, ?> arguments) {
|
public ModDiscoverer(Map<String, ?> arguments) {
|
||||||
Launcher.INSTANCE.environment().computePropertyIfAbsent(Environment.Keys.MODDIRECTORYFACTORY.get(), v->ModsFolderLocator::new);
|
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();
|
final var moduleLayerManager = Launcher.INSTANCE.environment().findModuleLayerManager().orElseThrow();
|
||||||
locators = ServiceLoader.load(moduleLayerManager.getLayer(IModuleLayerManager.Layer.SERVICE).orElseThrow(), IModLocator.class);
|
modLocators = 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());
|
dependencyLocators = ServiceLoader.load(moduleLayerManager.getLayer(IModuleLayerManager.Layer.SERVICE).orElseThrow(), IDependencyLocator.class);
|
||||||
locatorList.forEach(l->l.initArguments(arguments));
|
modLocatorList = ServiceLoaderUtils.streamServiceLoader(()-> modLocators, sce->LOGGER.error("Failed to load mod locator list", sce)).collect(Collectors.toList());
|
||||||
|
modLocatorList.forEach(l->l.initArguments(arguments));
|
||||||
|
dependencyLocatorList = ServiceLoaderUtils.streamServiceLoader(()-> dependencyLocators, sce->LOGGER.error("Failed to load dependency locator list", sce)).collect(Collectors.toList());
|
||||||
|
dependencyLocatorList.forEach(l->l.initArguments(arguments));
|
||||||
if (LOGGER.isDebugEnabled(LogMarkers.CORE))
|
if (LOGGER.isDebugEnabled(LogMarkers.CORE))
|
||||||
{
|
{
|
||||||
LOGGER.debug(LogMarkers.CORE, "Found Mod Locators : {}", locatorList.stream()
|
LOGGER.debug(LogMarkers.CORE, "Found Mod Locators : {}", modLocatorList.stream()
|
||||||
.map(iModLocator -> "(" + iModLocator.name() + ":" + iModLocator.getClass().getPackage().getImplementationVersion() + ")").collect(Collectors.joining(",")));
|
.map(modLocator -> "(%s:%s)".formatted(modLocator.name(),
|
||||||
|
modLocator.getClass().getPackage().getImplementationVersion())).collect(Collectors.joining(",")));
|
||||||
|
}
|
||||||
|
if (LOGGER.isDebugEnabled(LogMarkers.CORE))
|
||||||
|
{
|
||||||
|
LOGGER.debug(LogMarkers.CORE, "Found Dependency Locators : {}", dependencyLocatorList.stream()
|
||||||
|
.map(dependencyLocator -> "(%s:%s)".formatted(dependencyLocator.name(),
|
||||||
|
dependencyLocator.getClass().getPackage().getImplementationVersion())).collect(Collectors.joining(",")));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ModDiscoverer(List<IModLocator> locatorList) {
|
|
||||||
this.locatorList = locatorList;
|
|
||||||
this.locators = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModValidator discoverMods() {
|
public ModValidator discoverMods() {
|
||||||
LOGGER.debug(LogMarkers.SCAN,"Scanning for mods and other resources to load. We know {} ways to find mods", locatorList.size());
|
LOGGER.debug(LogMarkers.SCAN,"Scanning for mods and other resources to load. We know {} ways to find mods", modLocatorList.size());
|
||||||
var loadedFiles = new ArrayList<>();
|
List<ModFile> loadedFiles = new ArrayList<>();
|
||||||
for (IModLocator locator : locatorList) {
|
List<EarlyLoadingException.ExceptionData> discoveryErrorData = new ArrayList<>();
|
||||||
LOGGER.debug(LogMarkers.SCAN,"Trying locator {}", locator);
|
boolean successfullyLoadedMods = true;
|
||||||
var modFiles = locator.scanMods();
|
List<IModFileInfo> brokenFiles = new ArrayList<>();
|
||||||
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(modFilesMap);
|
//Loop all mod locators to get the prime mods to load from.
|
||||||
|
for (IModLocator locator : modLocatorList) {
|
||||||
|
try {
|
||||||
|
LOGGER.debug(LogMarkers.SCAN, "Trying locator {}", locator);
|
||||||
|
var candidates = locator.scanMods();
|
||||||
|
LOGGER.debug(LogMarkers.SCAN, "Locator {} found {} candidates or errors", locator, candidates.size());
|
||||||
|
var exceptions = candidates.stream().map(IModLocator.ModFileOrException::ex).filter(Objects::nonNull).toList();
|
||||||
|
if (!exceptions.isEmpty()) {
|
||||||
|
LOGGER.debug(LogMarkers.SCAN, "Locator {} found {} invalid mod files", locator, exceptions.size());
|
||||||
|
brokenFiles.addAll(exceptions.stream().map(e->e instanceof InvalidModFileException ime ? ime.getBrokenFile() : null).filter(Objects::nonNull).toList());
|
||||||
|
}
|
||||||
|
var locatedFiles = candidates.stream().map(IModLocator.ModFileOrException::file).filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
|
|
||||||
|
var badModFiles = locatedFiles.stream().filter(file -> !(file instanceof ModFile)).toList();
|
||||||
|
if (!badModFiles.isEmpty()) {
|
||||||
|
LOGGER.error(LogMarkers.SCAN, "Locator {} returned {} files which is are not ModFile instances! They will be skipped!", locator, badModFiles.size());
|
||||||
|
brokenFiles.addAll(badModFiles.stream().map(IModFile::getModFileInfo).toList());
|
||||||
|
}
|
||||||
|
locatedFiles.removeAll(badModFiles);
|
||||||
|
LOGGER.debug(LogMarkers.SCAN, "Locator {} found {} valid mod files", locator, locatedFiles.size());
|
||||||
|
handleLocatedFiles(loadedFiles, locatedFiles);
|
||||||
|
} catch (InvalidModFileException imfe) {
|
||||||
|
// We don't generally expect this exception, since it should come from the candidates stream above and be handled in the Locator, but just in case.
|
||||||
|
LOGGER.error(LogMarkers.SCAN, "Locator {} found an invalid mod file {}", locator, imfe.getBrokenFile(), imfe);
|
||||||
|
brokenFiles.add(imfe.getBrokenFile());
|
||||||
|
} catch (EarlyLoadingException exception) {
|
||||||
|
LOGGER.error(LogMarkers.SCAN, "Failed to load mods with locator {}", locator, exception);
|
||||||
|
discoveryErrorData.addAll(exception.getAllData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//First processing run of the mod list. Any duplicates will cause resolution failure and dependency loading will be skipped.
|
||||||
|
Map<IModFile.Type, List<ModFile>> modFilesMap = Maps.newHashMap();
|
||||||
|
try {
|
||||||
|
final UniqueModListBuilder modsUniqueListBuilder = new UniqueModListBuilder(loadedFiles);
|
||||||
|
final UniqueModListBuilder.UniqueModListData uniqueModsData = modsUniqueListBuilder.buildUniqueList();
|
||||||
|
|
||||||
|
//Grab the temporary results.
|
||||||
|
//This allows loading to continue to a base state, in case dependency loading fails.
|
||||||
|
modFilesMap = uniqueModsData.modFiles().stream()
|
||||||
|
.collect(Collectors.groupingBy(IModFile::getType));
|
||||||
|
loadedFiles = uniqueModsData.modFiles();
|
||||||
|
}
|
||||||
|
catch (EarlyLoadingException exception) {
|
||||||
|
LOGGER.error(LogMarkers.SCAN, "Failed to build unique mod list after mod discovery.", exception);
|
||||||
|
discoveryErrorData.addAll(exception.getAllData());
|
||||||
|
successfullyLoadedMods = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//We can continue loading if prime mods loaded successfully.
|
||||||
|
if (successfullyLoadedMods) {
|
||||||
|
LOGGER.debug(LogMarkers.SCAN, "Successfully Loaded {} mods. Attempting to load dependencies...", loadedFiles.size());
|
||||||
|
for (IDependencyLocator locator : dependencyLocatorList) {
|
||||||
|
try {
|
||||||
|
LOGGER.debug(LogMarkers.SCAN,"Trying locator {}", locator);
|
||||||
|
final List<IModFile> locatedMods = ImmutableList.copyOf(loadedFiles);
|
||||||
|
|
||||||
|
var locatedFiles = locator.scanMods(locatedMods);
|
||||||
|
if (locatedFiles.stream().anyMatch(file -> !(file instanceof ModFile))) {
|
||||||
|
LOGGER.error(LogMarkers.SCAN, "A dependency locator returned a file which is not a ModFile instance!. They will be skipped!");
|
||||||
|
}
|
||||||
|
|
||||||
|
handleLocatedFiles(loadedFiles, locatedFiles);
|
||||||
|
}
|
||||||
|
catch (EarlyLoadingException exception) {
|
||||||
|
LOGGER.error(LogMarkers.SCAN, "Failed to load dependencies with locator {}", locator, exception);
|
||||||
|
discoveryErrorData.addAll(exception.getAllData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Second processing run of the mod list. Any duplicates will cause resolution failure and only the mods list will be loaded.
|
||||||
|
try {
|
||||||
|
final UniqueModListBuilder modsAndDependenciesUniqueListBuilder = new UniqueModListBuilder(loadedFiles);
|
||||||
|
final UniqueModListBuilder.UniqueModListData uniqueModsAndDependenciesData = modsAndDependenciesUniqueListBuilder.buildUniqueList();
|
||||||
|
|
||||||
|
//We now only need the mod files map, not the list.
|
||||||
|
modFilesMap = uniqueModsAndDependenciesData.modFiles().stream()
|
||||||
|
.collect(Collectors.groupingBy(IModFile::getType));
|
||||||
|
} catch (EarlyLoadingException exception) {
|
||||||
|
LOGGER.error(LogMarkers.SCAN, "Failed to build unique mod list after dependency discovery.", exception);
|
||||||
|
discoveryErrorData.addAll(exception.getAllData());
|
||||||
|
modFilesMap = loadedFiles.stream().collect(Collectors.groupingBy(IModFile::getType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//Failure notify the listeners.
|
||||||
|
LOGGER.error(LogMarkers.SCAN, "Mod Discovery failed. Skipping dependency discovery.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Validate the loading. With a deduplicated list, we can now successfully process the artifacts and load
|
||||||
|
//transformer plugins.
|
||||||
|
var validator = new ModValidator(modFilesMap, brokenFiles, discoveryErrorData);
|
||||||
validator.stage1Validation();
|
validator.stage1Validation();
|
||||||
return validator;
|
return validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleLocatedFiles(final List<ModFile> loadedFiles, final List<IModFile> locatedFiles)
|
||||||
|
{
|
||||||
|
var locatedModFiles = locatedFiles.stream().filter(ModFile.class::isInstance).map(ModFile.class::cast).toList();
|
||||||
|
for (IModFile mf : locatedModFiles) {
|
||||||
|
LOGGER.info(LogMarkers.SCAN, "Found mod file {} of type {} with provider {}", mf.getFileName(), mf.getType(), mf.getProvider());
|
||||||
|
StartupMessageManager.modLoaderConsumer().ifPresent(c->c.accept("Found mod file "+mf.getFileName()+" of type "+mf.getType()));
|
||||||
|
}
|
||||||
|
loadedFiles.addAll(locatedModFiles);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -16,8 +16,10 @@ import net.minecraftforge.forgespi.language.IModInfo;
|
|||||||
import net.minecraftforge.forgespi.language.IModLanguageProvider;
|
import net.minecraftforge.forgespi.language.IModLanguageProvider;
|
||||||
import net.minecraftforge.forgespi.language.ModFileScanData;
|
import net.minecraftforge.forgespi.language.ModFileScanData;
|
||||||
import net.minecraftforge.forgespi.locating.IModFile;
|
import net.minecraftforge.forgespi.locating.IModFile;
|
||||||
import net.minecraftforge.forgespi.locating.IModLocator;
|
import net.minecraftforge.forgespi.locating.IModProvider;
|
||||||
import net.minecraftforge.forgespi.locating.ModFileFactory;
|
import net.minecraftforge.forgespi.locating.ModFileFactory;
|
||||||
|
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||||
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@@ -51,9 +53,9 @@ public class ModFile implements IModFile {
|
|||||||
private Throwable scanError;
|
private Throwable scanError;
|
||||||
private final SecureJar jar;
|
private final SecureJar jar;
|
||||||
private final Type modFileType;
|
private final Type modFileType;
|
||||||
private final Manifest manifest;
|
private final Manifest manifest;
|
||||||
private final IModLocator locator;
|
private final IModProvider provider;
|
||||||
private IModFileInfo modFileInfo;
|
private IModFileInfo modFileInfo;
|
||||||
private ModFileScanData fileModFileScanData;
|
private ModFileScanData fileModFileScanData;
|
||||||
private CompletableFuture<ModFileScanData> futureScanResult;
|
private CompletableFuture<ModFileScanData> futureScanResult;
|
||||||
private List<CoreModFile> coreMods;
|
private List<CoreModFile> coreMods;
|
||||||
@@ -62,15 +64,19 @@ public class ModFile implements IModFile {
|
|||||||
static final Attributes.Name TYPE = new Attributes.Name("FMLModType");
|
static final Attributes.Name TYPE = new Attributes.Name("FMLModType");
|
||||||
private SecureJar.Status securityStatus;
|
private SecureJar.Status securityStatus;
|
||||||
|
|
||||||
public ModFile(final SecureJar jar, final IModLocator locator, final ModFileFactory.ModFileInfoParser parser) {
|
public ModFile(final SecureJar jar, final IModProvider provider, final ModFileFactory.ModFileInfoParser parser) {
|
||||||
this.locator = locator;
|
this(jar, provider, parser, parseType(jar));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModFile(final SecureJar jar, final IModProvider provider, final ModFileFactory.ModFileInfoParser parser, String type) {
|
||||||
|
this.provider = provider;
|
||||||
this.jar = jar;
|
this.jar = jar;
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
|
|
||||||
manifest = this.jar.getManifest();
|
manifest = this.jar.moduleDataProvider().getManifest();
|
||||||
final Optional<String> value = Optional.ofNullable(manifest.getMainAttributes().getValue(TYPE));
|
modFileType = Type.valueOf(type);
|
||||||
modFileType = Type.valueOf(value.orElse("MOD"));
|
|
||||||
jarVersion = Optional.ofNullable(manifest.getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION)).orElse("0.0NONE");
|
jarVersion = Optional.ofNullable(manifest.getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION)).orElse("0.0NONE");
|
||||||
|
this.modFileInfo = ModFileParser.readModList(this, this.parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -123,7 +129,7 @@ public class ModFile implements IModFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void scanFile(Consumer<Path> pathConsumer) {
|
public void scanFile(Consumer<Path> pathConsumer) {
|
||||||
locator.scanFile(this, pathConsumer);
|
provider.scanFile(this, pathConsumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFutureScanResult(CompletableFuture<ModFileScanData> future) {
|
public void setFutureScanResult(CompletableFuture<ModFileScanData> future) {
|
||||||
@@ -188,8 +194,8 @@ public class ModFile implements IModFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IModLocator getLocator() {
|
public IModProvider getProvider() {
|
||||||
return locator;
|
return provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -201,4 +207,15 @@ public class ModFile implements IModFile {
|
|||||||
public void setSecurityStatus(final SecureJar.Status status) {
|
public void setSecurityStatus(final SecureJar.Status status) {
|
||||||
this.securityStatus = status;
|
this.securityStatus = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArtifactVersion getJarVersion()
|
||||||
|
{
|
||||||
|
return new DefaultArtifactVersion(this.jarVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String parseType(final SecureJar jar) {
|
||||||
|
final Manifest m = jar.moduleDataProvider().getManifest();
|
||||||
|
final Optional<String> value = Optional.ofNullable(m.getMainAttributes().getValue(TYPE));
|
||||||
|
return value.orElse("MOD");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -11,12 +11,11 @@ import net.minecraftforge.fml.loading.StringUtils;
|
|||||||
import net.minecraftforge.forgespi.language.IConfigurable;
|
import net.minecraftforge.forgespi.language.IConfigurable;
|
||||||
import net.minecraftforge.forgespi.language.IModInfo;
|
import net.minecraftforge.forgespi.language.IModInfo;
|
||||||
import net.minecraftforge.forgespi.language.MavenVersionAdapter;
|
import net.minecraftforge.forgespi.language.MavenVersionAdapter;
|
||||||
|
import net.minecraftforge.forgespi.locating.ForgeFeature;
|
||||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||||
import org.apache.maven.artifact.versioning.VersionRange;
|
import org.apache.maven.artifact.versioning.VersionRange;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.Marker;
|
|
||||||
import org.slf4j.MarkerFactory;
|
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -32,6 +31,7 @@ public class ModInfo implements IModInfo, IConfigurable
|
|||||||
private static final DefaultArtifactVersion DEFAULT_VERSION = new DefaultArtifactVersion("1");
|
private static final DefaultArtifactVersion DEFAULT_VERSION = new DefaultArtifactVersion("1");
|
||||||
private static final Pattern VALID_MODID = Pattern.compile("^[a-z][a-z0-9_]{1,63}$");
|
private static final Pattern VALID_MODID = Pattern.compile("^[a-z][a-z0-9_]{1,63}$");
|
||||||
private static final Pattern VALID_NAMESPACE = Pattern.compile("^[a-z][a-z0-9_.-]{1,63}$");
|
private static final Pattern VALID_NAMESPACE = Pattern.compile("^[a-z][a-z0-9_.-]{1,63}$");
|
||||||
|
private static final Pattern VALID_VERSION = Pattern.compile("^\\d+.*");
|
||||||
|
|
||||||
private final ModFileInfo owningFile;
|
private final ModFileInfo owningFile;
|
||||||
private final String modId;
|
private final String modId;
|
||||||
@@ -43,8 +43,11 @@ public class ModInfo implements IModInfo, IConfigurable
|
|||||||
private final boolean logoBlur;
|
private final boolean logoBlur;
|
||||||
private final Optional<URL> updateJSONURL;
|
private final Optional<URL> updateJSONURL;
|
||||||
private final List<? extends IModInfo.ModVersion> dependencies;
|
private final List<? extends IModInfo.ModVersion> dependencies;
|
||||||
|
|
||||||
|
private final List<ForgeFeature.Bound> features;
|
||||||
private final Map<String,Object> properties;
|
private final Map<String,Object> properties;
|
||||||
private final IConfigurable config;
|
private final IConfigurable config;
|
||||||
|
private final Optional<URL> modUrl;
|
||||||
|
|
||||||
public ModInfo(final ModFileInfo owningFile, final IConfigurable config)
|
public ModInfo(final ModFileInfo owningFile, final IConfigurable config)
|
||||||
{
|
{
|
||||||
@@ -83,9 +86,23 @@ public class ModInfo implements IModInfo, IConfigurable
|
|||||||
.collect(Collectors.toList()))
|
.collect(Collectors.toList()))
|
||||||
.orElse(Collections.emptyList());
|
.orElse(Collections.emptyList());
|
||||||
|
|
||||||
|
this.features = ownFile.map(mfi -> mfi.<Map<String, String>>getConfigElement("features", this.modId)
|
||||||
|
.stream()
|
||||||
|
.flatMap(m->m.entrySet().stream())
|
||||||
|
.map(e->new ForgeFeature.Bound(e.getKey(), e.getValue(), this))
|
||||||
|
.collect(Collectors.toList())).orElse(Collections.emptyList());
|
||||||
|
|
||||||
this.properties = ownFile.map(mfi -> mfi.<Map<String, Object>>getConfigElement("modproperties", this.modId)
|
this.properties = ownFile.map(mfi -> mfi.<Map<String, Object>>getConfigElement("modproperties", this.modId)
|
||||||
.orElse(Collections.emptyMap()))
|
.orElse(Collections.emptyMap()))
|
||||||
.orElse(Collections.emptyMap());
|
.orElse(Collections.emptyMap());
|
||||||
|
|
||||||
|
this.modUrl = config.<String>getConfigElement("modUrl")
|
||||||
|
.map(StringUtils::toURL);
|
||||||
|
|
||||||
|
// verify we have a valid mod version otherwise throw an exception
|
||||||
|
if (!VALID_VERSION.matcher(this.version.toString()).matches()) {
|
||||||
|
throw new InvalidModFileException("Illegal version number specified "+this.version, this.getOwningFile());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -152,6 +169,11 @@ public class ModInfo implements IModInfo, IConfigurable
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<? extends ForgeFeature.Bound> getForgeFeatures() {
|
||||||
|
return this.features;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> Optional<T> getConfigElement(final String... key) {
|
public <T> Optional<T> getConfigElement(final String... key) {
|
||||||
return this.config.getConfigElement(key);
|
return this.config.getConfigElement(key);
|
||||||
@@ -162,6 +184,11 @@ public class ModInfo implements IModInfo, IConfigurable
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<URL> getModURL() {
|
||||||
|
return modUrl;
|
||||||
|
}
|
||||||
|
|
||||||
class ModVersion implements net.minecraftforge.forgespi.language.IModInfo.ModVersion {
|
class ModVersion implements net.minecraftforge.forgespi.language.IModInfo.ModVersion {
|
||||||
private IModInfo owner;
|
private IModInfo owner;
|
||||||
private final String modId;
|
private final String modId;
|
||||||
@@ -169,6 +196,7 @@ public class ModInfo implements IModInfo, IConfigurable
|
|||||||
private final boolean mandatory;
|
private final boolean mandatory;
|
||||||
private final Ordering ordering;
|
private final Ordering ordering;
|
||||||
private final DependencySide side;
|
private final DependencySide side;
|
||||||
|
private Optional<URL> referralUrl;
|
||||||
|
|
||||||
public ModVersion(final IModInfo owner, final IConfigurable config) {
|
public ModVersion(final IModInfo owner, final IConfigurable config) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
@@ -185,6 +213,8 @@ public class ModInfo implements IModInfo, IConfigurable
|
|||||||
this.side = config.<String>getConfigElement("side")
|
this.side = config.<String>getConfigElement("side")
|
||||||
.map(DependencySide::valueOf)
|
.map(DependencySide::valueOf)
|
||||||
.orElse(DependencySide.BOTH);
|
.orElse(DependencySide.BOTH);
|
||||||
|
this.referralUrl = config.<String>getConfigElement("referralUrl")
|
||||||
|
.map(StringUtils::toURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -229,6 +259,11 @@ public class ModInfo implements IModInfo, IConfigurable
|
|||||||
{
|
{
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<URL> getReferralURL() {
|
||||||
|
return referralUrl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+23
-11
@@ -13,11 +13,16 @@ import net.minecraftforge.fml.loading.LoadingModList;
|
|||||||
import net.minecraftforge.fml.loading.LogMarkers;
|
import net.minecraftforge.fml.loading.LogMarkers;
|
||||||
import net.minecraftforge.fml.loading.ModSorter;
|
import net.minecraftforge.fml.loading.ModSorter;
|
||||||
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
import net.minecraftforge.fml.loading.progress.StartupMessageManager;
|
||||||
|
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||||
import net.minecraftforge.forgespi.locating.IModFile;
|
import net.minecraftforge.forgespi.locating.IModFile;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class ModValidator {
|
public class ModValidator {
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
@@ -25,14 +30,17 @@ public class ModValidator {
|
|||||||
private final List<ModFile> candidatePlugins;
|
private final List<ModFile> candidatePlugins;
|
||||||
private final List<ModFile> candidateMods;
|
private final List<ModFile> candidateMods;
|
||||||
private LoadingModList loadingModList;
|
private LoadingModList loadingModList;
|
||||||
private List<ModFile> brokenFiles;
|
private List<IModFile> brokenFiles;
|
||||||
|
private final List<EarlyLoadingException.ExceptionData> discoveryErrorData;
|
||||||
|
|
||||||
public ModValidator(final Map<IModFile.Type, List<ModFile>> modFiles) {
|
public ModValidator(final Map<IModFile.Type, List<ModFile>> modFiles, final List<IModFileInfo> brokenFiles, final List<EarlyLoadingException.ExceptionData> discoveryErrorData) {
|
||||||
this.modFiles = modFiles;
|
this.modFiles = modFiles;
|
||||||
this.candidateMods = lst(modFiles.get(IModFile.Type.MOD));
|
this.candidateMods = lst(modFiles.get(IModFile.Type.MOD));
|
||||||
this.candidateMods.addAll(lst(modFiles.get(IModFile.Type.GAMELIBRARY)));
|
this.candidateMods.addAll(lst(modFiles.get(IModFile.Type.GAMELIBRARY)));
|
||||||
this.candidatePlugins = lst(modFiles.get(IModFile.Type.LANGPROVIDER));
|
this.candidatePlugins = lst(modFiles.get(IModFile.Type.LANGPROVIDER));
|
||||||
this.candidatePlugins.addAll(lst(modFiles.get(IModFile.Type.LIBRARY)));
|
this.candidatePlugins.addAll(lst(modFiles.get(IModFile.Type.LIBRARY)));
|
||||||
|
this.discoveryErrorData = discoveryErrorData;
|
||||||
|
this.brokenFiles = brokenFiles.stream().map(IModFileInfo::getFile).collect(Collectors.toList()); // mutable list
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ModFile> lst(List<ModFile> files) {
|
private static List<ModFile> lst(List<ModFile> files) {
|
||||||
@@ -40,7 +48,7 @@ public class ModValidator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void stage1Validation() {
|
public void stage1Validation() {
|
||||||
brokenFiles = validateFiles(candidateMods);
|
brokenFiles.addAll(validateFiles(candidateMods));
|
||||||
if (LOGGER.isDebugEnabled(LogMarkers.SCAN)) {
|
if (LOGGER.isDebugEnabled(LogMarkers.SCAN)) {
|
||||||
LOGGER.debug(LogMarkers.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());
|
||||||
}
|
}
|
||||||
@@ -52,22 +60,22 @@ public class ModValidator {
|
|||||||
final List<ModFile> brokenFiles = new ArrayList<>();
|
final List<ModFile> brokenFiles = new ArrayList<>();
|
||||||
for (Iterator<ModFile> iterator = mods.iterator(); iterator.hasNext(); )
|
for (Iterator<ModFile> iterator = mods.iterator(); iterator.hasNext(); )
|
||||||
{
|
{
|
||||||
ModFile mod = iterator.next();
|
ModFile modFile = iterator.next();
|
||||||
if (!mod.getLocator().isValid(mod) || !mod.identifyMods()) {
|
if (!modFile.getProvider().isValid(modFile) || !modFile.identifyMods()) {
|
||||||
LOGGER.warn(LogMarkers.SCAN, "File {} has been ignored - it is invalid", mod.getFilePath());
|
LOGGER.warn(LogMarkers.SCAN, "File {} has been ignored - it is invalid", modFile.getFilePath());
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
brokenFiles.add(mod);
|
brokenFiles.add(modFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return brokenFiles;
|
return brokenFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITransformationService.Resource getPluginResources() {
|
public ITransformationService.Resource getPluginResources() {
|
||||||
return new ITransformationService.Resource(IModuleLayerManager.Layer.PLUGIN, this.candidatePlugins.stream().map(ModFile::getSecureJar).toList());
|
return new ITransformationService.Resource(IModuleLayerManager.Layer.PLUGIN, this.candidatePlugins.stream().map(IModFile::getSecureJar).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITransformationService.Resource getModResources() {
|
public ITransformationService.Resource getModResources() {
|
||||||
return new ITransformationService.Resource(IModuleLayerManager.Layer.GAME, this.candidateMods.stream().map(ModFile::getSecureJar).toList());
|
return new ITransformationService.Resource(IModuleLayerManager.Layer.GAME, this.candidateMods.stream().map(IModFile::getSecureJar).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<EarlyLoadingException.ExceptionData> validateLanguages() {
|
private List<EarlyLoadingException.ExceptionData> validateLanguages() {
|
||||||
@@ -86,7 +94,11 @@ public class ModValidator {
|
|||||||
|
|
||||||
public BackgroundScanHandler stage2Validation() {
|
public BackgroundScanHandler stage2Validation() {
|
||||||
var errors = validateLanguages();
|
var errors = validateLanguages();
|
||||||
loadingModList = ModSorter.sort(candidateMods, errors);
|
|
||||||
|
var allErrors = new ArrayList<>(errors);
|
||||||
|
allErrors.addAll(this.discoveryErrorData);
|
||||||
|
|
||||||
|
loadingModList = ModSorter.sort(candidateMods, allErrors);
|
||||||
loadingModList.addCoreMods();
|
loadingModList.addCoreMods();
|
||||||
loadingModList.addAccessTransformers();
|
loadingModList.addAccessTransformers();
|
||||||
loadingModList.setBrokenFiles(brokenFiles);
|
loadingModList.setBrokenFiles(brokenFiles);
|
||||||
|
|||||||
+2
-1
@@ -23,7 +23,8 @@ import static cpw.mods.modlauncher.api.LamdbaExceptionUtils.uncheck;
|
|||||||
/**
|
/**
|
||||||
* Support loading mods located in JAR files in the mods folder
|
* Support loading mods located in JAR files in the mods folder
|
||||||
*/
|
*/
|
||||||
public class ModsFolderLocator extends AbstractJarFileLocator {
|
public class ModsFolderLocator extends AbstractJarFileModLocator
|
||||||
|
{
|
||||||
private static final String SUFFIX = ".jar";
|
private static final String SUFFIX = ".jar";
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
private final Path modFolder;
|
private final Path modFolder;
|
||||||
|
|||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.fml.loading.FMLLoader;
|
import net.minecraftforge.fml.loading.FMLLoader;
|
||||||
import net.minecraftforge.fml.loading.LibraryFinder;
|
import net.minecraftforge.fml.loading.LibraryFinder;
|
||||||
import net.minecraftforge.fml.loading.VersionInfo;
|
import net.minecraftforge.fml.loading.VersionInfo;
|
||||||
@@ -21,10 +22,9 @@ public abstract class CommonClientLaunchHandler extends CommonLaunchHandler {
|
|||||||
@Override public boolean isProduction() { return true; }
|
@Override public boolean isProduction() { return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.client.main.Main").getMethod("main", String[].class).invoke(null, (Object)arguments);
|
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.client.main.Main").getMethod("main", String[].class).invoke(null, (Object)arguments);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-17
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import cpw.mods.jarhandling.SecureJar;
|
import cpw.mods.jarhandling.SecureJar;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -50,8 +49,6 @@ public abstract class CommonDevLaunchHandler extends CommonLaunchHandler {
|
|||||||
if (getDist().isDedicatedServer())
|
if (getDist().isDedicatedServer())
|
||||||
return arguments;
|
return arguments;
|
||||||
|
|
||||||
fixNatives();
|
|
||||||
|
|
||||||
if (isData())
|
if (isData())
|
||||||
return arguments;
|
return arguments;
|
||||||
|
|
||||||
@@ -119,18 +116,4 @@ public abstract class CommonDevLaunchHandler extends CommonLaunchHandler {
|
|||||||
// Generate a time-based random number, to mimic how n.m.client.Main works
|
// Generate a time-based random number, to mimic how n.m.client.Main works
|
||||||
return Long.toString(System.nanoTime() % (int) Math.pow(10, length));
|
return Long.toString(System.nanoTime() % (int) Math.pow(10, length));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fixNatives() {
|
|
||||||
String paths = System.getProperty("java.library.path");
|
|
||||||
String nativesDir = System.getProperty("nativesDirectory");
|
|
||||||
if (nativesDir == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (Strings.isNullOrEmpty(paths))
|
|
||||||
paths = nativesDir;
|
|
||||||
else
|
|
||||||
paths += File.pathSeparator + nativesDir;
|
|
||||||
|
|
||||||
System.setProperty("java.library.path", paths);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+2
-2
@@ -6,6 +6,7 @@
|
|||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
import cpw.mods.jarhandling.SecureJar;
|
import cpw.mods.jarhandling.SecureJar;
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.fml.loading.FMLLoader;
|
import net.minecraftforge.fml.loading.FMLLoader;
|
||||||
import net.minecraftforge.fml.loading.LibraryFinder;
|
import net.minecraftforge.fml.loading.LibraryFinder;
|
||||||
import net.minecraftforge.fml.loading.VersionInfo;
|
import net.minecraftforge.fml.loading.VersionInfo;
|
||||||
@@ -23,10 +24,9 @@ public abstract class CommonServerLaunchHandler extends CommonLaunchHandler {
|
|||||||
@Override public boolean isProduction() { return true; }
|
@Override public boolean isProduction() { return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.server.Main").getMethod("main", String[].class).invoke(null, (Object)arguments);
|
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.server.Main").getMethod("main", String[].class).invoke(null, (Object)arguments);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
@@ -13,12 +14,11 @@ public class FMLClientDevLaunchHandler extends CommonDevLaunchHandler {
|
|||||||
@Override public Dist getDist() { return Dist.CLIENT; }
|
@Override public Dist getDist() { return Dist.CLIENT; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
var args = preLaunch(arguments, layer);
|
var args = preLaunch(arguments, layer);
|
||||||
|
|
||||||
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.client.main.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.client.main.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@@ -17,12 +18,11 @@ public class FMLClientUserdevLaunchHandler extends FMLUserdevLaunchHandler {
|
|||||||
public Dist getDist() { return Dist.CLIENT; }
|
public Dist getDist() { return Dist.CLIENT; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
var args = preLaunch(arguments, layer);
|
var args = preLaunch(arguments, layer);
|
||||||
|
|
||||||
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.client.main.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.client.main.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@@ -20,12 +21,11 @@ public class FMLDataUserdevLaunchHandler extends FMLUserdevLaunchHandler {
|
|||||||
public boolean isData() { return true; }
|
public boolean isData() { return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
var args = preLaunch(arguments, layer);
|
var args = preLaunch(arguments, layer);
|
||||||
|
|
||||||
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.data.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.data.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
@@ -13,12 +14,11 @@ public class FMLServerDevLaunchHandler extends CommonDevLaunchHandler {
|
|||||||
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
var args = preLaunch(arguments, layer);
|
var args = preLaunch(arguments, layer);
|
||||||
|
|
||||||
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.server.Main").getMethod("main", String[].class).invoke(null, (Object)args);
|
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.server.Main").getMethod("main", String[].class).invoke(null, (Object)args);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@@ -14,12 +15,11 @@ public class FMLServerUserdevLaunchHandler extends FMLUserdevLaunchHandler {
|
|||||||
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
var args = preLaunch(arguments, layer);
|
var args = preLaunch(arguments, layer);
|
||||||
|
|
||||||
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.server.Main").getMethod("main", String[].class).invoke(null, (Object)args);
|
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.server.Main").getMethod("main", String[].class).invoke(null, (Object)args);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
@@ -13,12 +14,11 @@ public class ForgeClientDevLaunchHandler extends CommonDevLaunchHandler {
|
|||||||
@Override public Dist getDist() { return Dist.CLIENT; }
|
@Override public Dist getDist() { return Dist.CLIENT; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
var args = preLaunch(arguments, layer);
|
var args = preLaunch(arguments, layer);
|
||||||
|
|
||||||
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.client.main.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.client.main.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@@ -17,12 +18,11 @@ public class ForgeClientUserdevLaunchHandler extends ForgeUserdevLaunchHandler {
|
|||||||
public Dist getDist() { return Dist.CLIENT; }
|
public Dist getDist() { return Dist.CLIENT; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
var args = preLaunch(arguments, layer);
|
var args = preLaunch(arguments, layer);
|
||||||
|
|
||||||
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.client.main.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.client.main.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@@ -15,12 +16,11 @@ public class ForgeDataDevLaunchHandler extends CommonDevLaunchHandler {
|
|||||||
@Override public boolean isData() { return true; }
|
@Override public boolean isData() { return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
var args = preLaunch(arguments, layer);
|
var args = preLaunch(arguments, layer);
|
||||||
|
|
||||||
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.data.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.data.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@@ -20,12 +21,11 @@ public class ForgeDataUserdevLaunchHandler extends ForgeUserdevLaunchHandler {
|
|||||||
public boolean isData() { return true; }
|
public boolean isData() { return true; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
var args = preLaunch(arguments, layer);
|
var args = preLaunch(arguments, layer);
|
||||||
|
|
||||||
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.data.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
Class.forName(layer.findModule("minecraft").orElseThrow(), "net.minecraft.data.Main").getMethod("main", String[].class).invoke(null, (Object) args);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@@ -14,12 +15,11 @@ public class ForgeGametestDevLaunchHandler extends CommonDevLaunchHandler {
|
|||||||
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
var args = preLaunch(arguments, layer);
|
var args = preLaunch(arguments, layer);
|
||||||
|
|
||||||
Class.forName(layer.findModule("forge").orElseThrow(), "net.minecraftforge.gametest.GameTestMain").getMethod("main", String[].class).invoke(null, (Object)args);
|
Class.forName(layer.findModule("forge").orElseThrow(), "net.minecraftforge.gametest.GameTestMain").getMethod("main", String[].class).invoke(null, (Object)args);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@@ -14,12 +15,11 @@ public class ForgeGametestUserdevLaunchHandler extends ForgeUserdevLaunchHandler
|
|||||||
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
var args = preLaunch(arguments, layer);
|
var args = preLaunch(arguments, layer);
|
||||||
|
|
||||||
Class.forName(layer.findModule("forge").orElseThrow(), "net.minecraftforge.gametest.GameTestMain").getMethod("main", String[].class).invoke(null, (Object)args);
|
Class.forName(layer.findModule("forge").orElseThrow(), "net.minecraftforge.gametest.GameTestMain").getMethod("main", String[].class).invoke(null, (Object)args);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
@@ -13,12 +14,11 @@ public class ForgeServerDevLaunchHandler extends CommonDevLaunchHandler {
|
|||||||
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
var args = preLaunch(arguments, layer);
|
var args = preLaunch(arguments, layer);
|
||||||
|
|
||||||
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.server.Main").getMethod("main", String[].class).invoke(null, (Object)args);
|
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.server.Main").getMethod("main", String[].class).invoke(null, (Object)args);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package net.minecraftforge.fml.loading.targets;
|
package net.minecraftforge.fml.loading.targets;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.ServiceRunner;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@@ -14,12 +15,11 @@ public class ForgeServerUserdevLaunchHandler extends ForgeUserdevLaunchHandler {
|
|||||||
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Callable<Void> launchService(String[] arguments, ModuleLayer layer) {
|
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
|
||||||
return () -> {
|
return () -> {
|
||||||
var args = preLaunch(arguments, layer);
|
var args = preLaunch(arguments, layer);
|
||||||
|
|
||||||
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.server.Main").getMethod("main", String[].class).invoke(null, (Object)args);
|
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.server.Main").getMethod("main", String[].class).invoke(null, (Object)args);
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,3 +4,5 @@ splashscreen = true
|
|||||||
maxThreads = -1
|
maxThreads = -1
|
||||||
# Enable forge global version checking
|
# Enable forge global version checking
|
||||||
versionCheck = true
|
versionCheck = true
|
||||||
|
# Disables Optimized DFU client-side.
|
||||||
|
disableOptimizedDFU = true
|
||||||
+2
-1
@@ -1 +1,2 @@
|
|||||||
net.minecraftforge.fml.loading.ModDirTransformerDiscoverer
|
net.minecraftforge.fml.loading.ModDirTransformerDiscoverer
|
||||||
|
net.minecraftforge.fml.loading.ClasspathTransformerDiscoverer
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator
|
||||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -205,6 +205,12 @@ set -- \
|
|||||||
org.gradle.wrapper.GradleWrapperMain \
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
|||||||
Vendored
+8
-6
@@ -14,7 +14,7 @@
|
|||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
|||||||
java.withSourcesJar()
|
java.withSourcesJar()
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly('org.jetbrains:annotations:21.0.1')
|
compileOnly("org.jetbrains:annotations:${JETBRAINS_ANNOTATIONS_VERSION}")
|
||||||
|
|
||||||
implementation(project(':fmlloader'))
|
implementation(project(':fmlloader'))
|
||||||
implementation(project(':fmlcore'))
|
implementation(project(':fmlcore'))
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -40,7 +40,7 @@ https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
|||||||
|
|
||||||
Additional Resources:
|
Additional Resources:
|
||||||
=========================
|
=========================
|
||||||
Community Documentation: http://mcforge.readthedocs.io/en/latest/gettingstarted/
|
Community Documentation: https://mcforge.readthedocs.io/en/latest/gettingstarted/
|
||||||
LexManos' Install Video: https://www.youtube.com/watch?v=8VEdtQLuLO0
|
LexManos' Install Video: https://www.youtube.com/watch?v=8VEdtQLuLO0
|
||||||
Forge Forum: https://forums.minecraftforge.net/
|
Forge Forum: https://forums.minecraftforge.net/
|
||||||
Forge Discord: https://discord.gg/UvedJ9m
|
Forge Discord: https://discord.gg/UvedJ9m
|
||||||
+1
-11
@@ -1,7 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'eclipse'
|
id 'eclipse'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
id 'net.minecraftforge.gradle' version '5.+'
|
id 'net.minecraftforge.gradle' version '5.1.+'
|
||||||
}
|
}
|
||||||
|
|
||||||
version = '1.0'
|
version = '1.0'
|
||||||
@@ -65,7 +65,6 @@ minecraft {
|
|||||||
|
|
||||||
property 'forge.logging.console.level', 'debug'
|
property 'forge.logging.console.level', 'debug'
|
||||||
|
|
||||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
|
||||||
property 'forge.enabledGameTestNamespaces', 'examplemod'
|
property 'forge.enabledGameTestNamespaces', 'examplemod'
|
||||||
|
|
||||||
mods {
|
mods {
|
||||||
@@ -81,19 +80,10 @@ minecraft {
|
|||||||
gameTestServer {
|
gameTestServer {
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run')
|
||||||
|
|
||||||
// Recommended logging data for a userdev environment
|
|
||||||
// The markers can be added/remove as needed separated by commas.
|
|
||||||
// "SCAN": For mods scan.
|
|
||||||
// "REGISTRIES": For firing of registry events.
|
|
||||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
|
||||||
property 'forge.logging.markers', 'REGISTRIES'
|
property 'forge.logging.markers', 'REGISTRIES'
|
||||||
|
|
||||||
// Recommended logging level for the console
|
|
||||||
// You can set various levels here.
|
|
||||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
|
||||||
property 'forge.logging.console.level', 'debug'
|
property 'forge.logging.console.level', 'debug'
|
||||||
|
|
||||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
|
||||||
property 'forge.enabledGameTestNamespaces', 'examplemod'
|
property 'forge.enabledGameTestNamespaces', 'examplemod'
|
||||||
|
|
||||||
mods {
|
mods {
|
||||||
|
|||||||
@@ -1,61 +1,69 @@
|
|||||||
package com.example.examplemod;
|
package com.example.examplemod;
|
||||||
|
|
||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.world.item.BlockItem;
|
||||||
|
import net.minecraft.world.item.CreativeModeTab;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
|
import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.RegistryEvent;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.InterModComms;
|
import net.minecraftforge.fml.InterModComms;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
|
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
|
||||||
import net.minecraftforge.event.server.ServerStartingEvent;
|
import net.minecraftforge.event.server.ServerStartingEvent;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
// The value here should match an entry in the META-INF/mods.toml file
|
// The value here should match an entry in the META-INF/mods.toml file
|
||||||
@Mod("examplemod")
|
@Mod(ExampleMod.MODID)
|
||||||
public class ExampleMod
|
public class ExampleMod
|
||||||
{
|
{
|
||||||
|
// Define mod id in a common place for everything to reference
|
||||||
|
public static final String MODID = "examplemod";
|
||||||
// Directly reference a slf4j logger
|
// Directly reference a slf4j logger
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
// Create a Deferred Register to hold Blocks which will all be registered under the "examplemod" namespace
|
||||||
|
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);
|
||||||
|
// Create a Deferred Register to hold Items which will all be registered under the "examplemod" namespace
|
||||||
|
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
|
||||||
|
|
||||||
|
// Creates a new Block with the id "examplemod:example_block", combining the namespace and path
|
||||||
|
public static final RegistryObject<Block> EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE)));
|
||||||
|
// Creates a new BlockItem with the id "examplemod:example_block", combining the namespace and path
|
||||||
|
public static final RegistryObject<Item> EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_BUILDING_BLOCKS)));
|
||||||
|
|
||||||
public ExampleMod()
|
public ExampleMod()
|
||||||
{
|
{
|
||||||
// Register the setup method for modloading
|
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
|
|
||||||
// Register the enqueueIMC method for modloading
|
// Register the commonSetup method for modloading
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC);
|
modEventBus.addListener(this::commonSetup);
|
||||||
// Register the processIMC method for modloading
|
|
||||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC);
|
// Register the Deferred Register to the mod event bus so blocks get registered
|
||||||
|
BLOCKS.register(modEventBus);
|
||||||
|
// Register the Deferred Register to the mod event bus so items get registered
|
||||||
|
ITEMS.register(modEventBus);
|
||||||
|
|
||||||
// Register ourselves for server and other game events we are interested in
|
// Register ourselves for server and other game events we are interested in
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setup(final FMLCommonSetupEvent event)
|
private void commonSetup(final FMLCommonSetupEvent event)
|
||||||
{
|
{
|
||||||
// some preinit code
|
// Some common setup code
|
||||||
LOGGER.info("HELLO FROM PREINIT");
|
LOGGER.info("HELLO FROM COMMON SETUP");
|
||||||
LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
|
LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT));
|
||||||
}
|
|
||||||
|
|
||||||
private void enqueueIMC(final InterModEnqueueEvent event)
|
|
||||||
{
|
|
||||||
// Some example code to dispatch IMC to another mod
|
|
||||||
InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processIMC(final InterModProcessEvent event)
|
|
||||||
{
|
|
||||||
// Some example code to receive and process InterModComms from other mods
|
|
||||||
LOGGER.info("Got IMC {}", event.getIMCStream().
|
|
||||||
map(m->m.messageSupplier().get()).
|
|
||||||
collect(Collectors.toList()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// You can use SubscribeEvent and let the Event Bus discover methods to call
|
// You can use SubscribeEvent and let the Event Bus discover methods to call
|
||||||
@@ -66,16 +74,16 @@ public class ExampleMod
|
|||||||
LOGGER.info("HELLO from server starting");
|
LOGGER.info("HELLO from server starting");
|
||||||
}
|
}
|
||||||
|
|
||||||
// You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD
|
// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
|
||||||
// Event bus for receiving Registry Events)
|
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
public static class ClientModEvents
|
||||||
public static class RegistryEvents
|
|
||||||
{
|
{
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent)
|
public static void onClientSetup(FMLClientSetupEvent event)
|
||||||
{
|
{
|
||||||
// Register a new block here
|
// Some client setup code
|
||||||
LOGGER.info("HELLO from Register Block");
|
LOGGER.info("HELLO FROM CLIENT SETUP");
|
||||||
|
LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,6 +32,14 @@ logoFile="examplemod.png" #optional
|
|||||||
credits="Thanks for this example mod goes to Java" #optional
|
credits="Thanks for this example mod goes to Java" #optional
|
||||||
# A text field displayed in the mod UI
|
# A text field displayed in the mod UI
|
||||||
authors="Love, Cheese and small house plants" #optional
|
authors="Love, Cheese and small house plants" #optional
|
||||||
|
# Display Test controls the display for your mod in the server connection screen
|
||||||
|
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
|
||||||
|
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
|
||||||
|
# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component.
|
||||||
|
# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value.
|
||||||
|
# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself.
|
||||||
|
#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional)
|
||||||
|
|
||||||
# The description text for the mod (multi line!) (#mandatory)
|
# The description text for the mod (multi line!) (#mandatory)
|
||||||
description='''
|
description='''
|
||||||
This is a long form description of the mod. You can write whatever you want here
|
This is a long form description of the mod. You can write whatever you want here
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/com/mojang/blaze3d/platform/Window.java
|
--- a/com/mojang/blaze3d/platform/Window.java
|
||||||
+++ b/com/mojang/blaze3d/platform/Window.java
|
+++ b/com/mojang/blaze3d/platform/Window.java
|
||||||
@@ -80,7 +_,7 @@
|
@@ -82,7 +_,7 @@
|
||||||
GLFW.glfwWindowHint(139267, 2);
|
GLFW.glfwWindowHint(139267, 2);
|
||||||
GLFW.glfwWindowHint(139272, 204801);
|
GLFW.glfwWindowHint(139272, 204801);
|
||||||
GLFW.glfwWindowHint(139270, 1);
|
GLFW.glfwWindowHint(139270, 1);
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
if (monitor != null) {
|
if (monitor != null) {
|
||||||
VideoMode videomode = monitor.m_84948_(this.f_85355_ ? this.f_85354_ : Optional.empty());
|
VideoMode videomode = monitor.m_84948_(this.f_85355_ ? this.f_85354_ : Optional.empty());
|
||||||
this.f_85350_ = this.f_85357_ = monitor.m_84951_() + videomode.m_85332_() / 2 - this.f_85359_ / 2;
|
this.f_85350_ = this.f_85357_ = monitor.m_84951_() + videomode.m_85332_() / 2 - this.f_85359_ / 2;
|
||||||
@@ -298,6 +_,7 @@
|
@@ -303,6 +_,7 @@
|
||||||
GLFW.glfwGetFramebufferSize(this.f_85349_, aint, aint1);
|
GLFW.glfwGetFramebufferSize(this.f_85349_, aint, aint1);
|
||||||
this.f_85361_ = aint[0] > 0 ? aint[0] : 1;
|
this.f_85361_ = aint[0] > 0 ? aint[0] : 1;
|
||||||
this.f_85362_ = aint1[0] > 0 ? aint1[0] : 1;
|
this.f_85362_ = aint1[0] > 0 ? aint1[0] : 1;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/com/mojang/blaze3d/vertex/BufferBuilder.java
|
--- a/com/mojang/blaze3d/vertex/BufferBuilder.java
|
||||||
+++ b/com/mojang/blaze3d/vertex/BufferBuilder.java
|
+++ b/com/mojang/blaze3d/vertex/BufferBuilder.java
|
||||||
@@ -486,4 +_,15 @@
|
@@ -486,4 +_,14 @@
|
||||||
this.f_166822_ = p_166829_;
|
this.f_166822_ = p_166829_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,11 +8,10 @@
|
|||||||
+ // Forge start
|
+ // Forge start
|
||||||
+ public void putBulkData(ByteBuffer buffer) {
|
+ public void putBulkData(ByteBuffer buffer) {
|
||||||
+ m_85722_(buffer.limit() + this.f_85658_.m_86020_());
|
+ m_85722_(buffer.limit() + this.f_85658_.m_86020_());
|
||||||
+ this.f_85648_.position(this.f_85654_ * this.f_85658_.m_86020_());
|
+ this.f_85648_.position(this.f_85652_);
|
||||||
+ this.f_85648_.put(buffer);
|
+ this.f_85648_.put(buffer);
|
||||||
|
+ this.f_85648_.position(0);
|
||||||
+ this.f_85654_ += buffer.limit() / this.f_85658_.m_86020_();
|
+ this.f_85654_ += buffer.limit() / this.f_85658_.m_86020_();
|
||||||
+ this.f_85652_ += buffer.limit();
|
+ this.f_85652_ += buffer.limit();
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
+ public VertexFormat getVertexFormat() { return this.f_85658_; }
|
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,18 @@
|
|||||||
VertexConsumer m_5483_(double p_85945_, double p_85946_, double p_85947_);
|
VertexConsumer m_5483_(double p_85945_, double p_85946_, double p_85947_);
|
||||||
|
|
||||||
VertexConsumer m_6122_(int p_85973_, int p_85974_, int p_85975_, int p_85976_);
|
VertexConsumer m_6122_(int p_85973_, int p_85974_, int p_85975_, int p_85976_);
|
||||||
@@ -101,11 +_,12 @@
|
@@ -64,6 +_,10 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
default void m_85995_(PoseStack.Pose p_85996_, BakedQuad p_85997_, float[] p_85998_, float p_85999_, float p_86000_, float p_86001_, int[] p_86002_, int p_86003_, boolean p_86004_) {
|
||||||
|
+ putBulkData(p_85996_, p_85997_, p_85998_, p_85999_, p_86000_, p_86001_, 1, p_86002_, p_86003_, p_86004_);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ default void putBulkData(PoseStack.Pose p_85996_, BakedQuad p_85997_, float[] p_85998_, float p_85999_, float p_86000_, float p_86001_, float alpha, int[] p_86002_, int p_86003_, boolean p_86004_) {
|
||||||
|
float[] afloat = new float[]{p_85998_[0], p_85998_[1], p_85998_[2], p_85998_[3]};
|
||||||
|
int[] aint = new int[]{p_86002_[0], p_86002_[1], p_86002_[2], p_86002_[3]};
|
||||||
|
int[] aint1 = p_85997_.m_111303_();
|
||||||
|
@@ -101,12 +_,14 @@
|
||||||
f5 = afloat[k] * p_86001_;
|
f5 = afloat[k] * p_86001_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,7 +30,10 @@
|
|||||||
float f10 = bytebuffer.getFloat(20);
|
float f10 = bytebuffer.getFloat(20);
|
||||||
Vector4f vector4f = new Vector4f(f, f1, f2, 1.0F);
|
Vector4f vector4f = new Vector4f(f, f1, f2, 1.0F);
|
||||||
vector4f.m_123607_(matrix4f);
|
vector4f.m_123607_(matrix4f);
|
||||||
|
- this.m_5954_(vector4f.m_123601_(), vector4f.m_123615_(), vector4f.m_123616_(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.m_122239_(), vector3f.m_122260_(), vector3f.m_122269_());
|
||||||
+ applyBakedNormals(vector3f, bytebuffer, p_85996_.m_85864_());
|
+ applyBakedNormals(vector3f, bytebuffer, p_85996_.m_85864_());
|
||||||
this.m_5954_(vector4f.m_123601_(), vector4f.m_123615_(), vector4f.m_123616_(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.m_122239_(), vector3f.m_122260_(), vector3f.m_122269_());
|
+ float vertexAlpha = p_86004_ ? alpha * (float) (bytebuffer.get(15) & 255) / 255.0F : alpha;
|
||||||
|
+ this.m_5954_(vector4f.m_123601_(), vector4f.m_123615_(), vector4f.m_123616_(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.m_122239_(), vector3f.m_122260_(), vector3f.m_122269_());
|
||||||
}
|
}
|
||||||
} catch (Throwable throwable1) {
|
} catch (Throwable throwable1) {
|
||||||
|
if (memorystack != null) {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/CrashReport.java
|
--- a/net/minecraft/CrashReport.java
|
||||||
+++ b/net/minecraft/CrashReport.java
|
+++ b/net/minecraft/CrashReport.java
|
||||||
@@ -55,14 +_,8 @@
|
@@ -57,14 +_,8 @@
|
||||||
if (this.f_127506_ != null && this.f_127506_.length > 0) {
|
if (this.f_127506_ != null && this.f_127506_.length > 0) {
|
||||||
p_127520_.append("-- Head --\n");
|
p_127520_.append("-- Head --\n");
|
||||||
p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
|
p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(CrashReportCategory crashreportcategory : this.f_127503_) {
|
for(CrashReportCategory crashreportcategory : this.f_127503_) {
|
||||||
@@ -70,6 +_,7 @@
|
@@ -72,6 +_,7 @@
|
||||||
p_127520_.append("\n\n");
|
p_127520_.append("\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
this.f_178624_.m_143525_(p_127520_);
|
this.f_178624_.m_143525_(p_127520_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,23 +_,13 @@
|
@@ -91,23 +_,13 @@
|
||||||
throwable.setStackTrace(this.f_127501_.getStackTrace());
|
throwable.setStackTrace(this.f_127501_.getStackTrace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/SharedConstants.java
|
--- a/net/minecraft/SharedConstants.java
|
||||||
+++ b/net/minecraft/SharedConstants.java
|
+++ b/net/minecraft/SharedConstants.java
|
||||||
@@ -203,6 +_,7 @@
|
@@ -211,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
--- a/net/minecraft/Util.java
|
--- a/net/minecraft/Util.java
|
||||||
+++ b/net/minecraft/Util.java
|
+++ b/net/minecraft/Util.java
|
||||||
@@ -164,6 +_,11 @@
|
@@ -170,6 +_,11 @@
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // We add these inner classes to compensate for Mojang's missing inner classes and shift the anonymous class index.
|
+ // We add these inner classes to compensate for Mojang's missing inner classes and shift the anonymous class index.
|
||||||
+ // This allows us to obfuscate subsequent anonymous inner classes correctly.
|
+ // This allows us to obfuscate subsequent anonymous inner classes correctly.
|
||||||
+ @SuppressWarnings("unused") private static LongSupplier INNER_CLASS_SHIFT1 = new LongSupplier() { public long getAsLong() { return 0; } };
|
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT1 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
|
||||||
+ @SuppressWarnings("unused") private static LongSupplier INNER_CLASS_SHIFT2 = new LongSupplier() { public long getAsLong() { return 0; } };
|
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT2 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
|
||||||
+
|
+
|
||||||
public static ExecutorService m_183988_() {
|
public static ExecutorService m_183988_() {
|
||||||
return f_137443_;
|
return f_137443_;
|
||||||
}
|
}
|
||||||
@@ -242,7 +_,7 @@
|
@@ -248,7 +_,7 @@
|
||||||
try {
|
try {
|
||||||
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().getWorldVersion())).getChoiceType(p_137552_, p_137553_);
|
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().getWorldVersion())).getChoiceType(p_137552_, p_137553_);
|
||||||
} catch (IllegalArgumentException illegalargumentexception) {
|
} catch (IllegalArgumentException illegalargumentexception) {
|
||||||
|
|||||||
@@ -9,6 +9,15 @@
|
|||||||
public static final ItemPredicate f_45028_ = new ItemPredicate();
|
public static final ItemPredicate f_45028_ = new ItemPredicate();
|
||||||
@Nullable
|
@Nullable
|
||||||
private final TagKey<Item> f_45029_;
|
private final TagKey<Item> f_45029_;
|
||||||
|
@@ -80,7 +_,7 @@
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
if (this.f_45033_.length > 0) {
|
||||||
|
- Map<Enchantment, Integer> map = EnchantmentHelper.m_44882_(p_45050_.m_41785_());
|
||||||
|
+ Map<Enchantment, Integer> map = p_45050_.getAllEnchantments();
|
||||||
|
|
||||||
|
for(EnchantmentPredicate enchantmentpredicate : this.f_45033_) {
|
||||||
|
if (!enchantmentpredicate.m_30476_(map)) {
|
||||||
@@ -107,6 +_,11 @@
|
@@ -107,6 +_,11 @@
|
||||||
public static ItemPredicate m_45051_(@Nullable JsonElement p_45052_) {
|
public static ItemPredicate m_45051_(@Nullable JsonElement p_45052_) {
|
||||||
if (p_45052_ != null && !p_45052_.isJsonNull()) {
|
if (p_45052_ != null && !p_45052_.isJsonNull()) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
} else if (recipetype == RecipeType.f_44113_) {
|
} else if (recipetype == RecipeType.f_44113_) {
|
||||||
return RecipeBookCategories.SMITHING;
|
return RecipeBookCategories.SMITHING;
|
||||||
} else {
|
} else {
|
||||||
+ RecipeBookCategories categories = net.minecraftforge.client.RecipeBookRegistry.findCategories(recipetype, p_90647_);
|
+ RecipeBookCategories categories = net.minecraftforge.client.RecipeBookManager.findCategories((RecipeType) recipetype, p_90647_);
|
||||||
+ if (categories != null) return categories;
|
+ if (categories != null) return categories;
|
||||||
f_90618_.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> {
|
f_90618_.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> {
|
||||||
return Registry.f_122864_.m_7981_(p_90647_.m_6671_());
|
return Registry.f_122864_.m_7981_(p_90647_.m_6671_());
|
||||||
|
|||||||
@@ -8,48 +8,20 @@
|
|||||||
+public class KeyMapping implements Comparable<KeyMapping>, net.minecraftforge.client.extensions.IForgeKeyMapping {
|
+public class KeyMapping implements Comparable<KeyMapping>, net.minecraftforge.client.extensions.IForgeKeyMapping {
|
||||||
private static final Map<String, KeyMapping> f_90809_ = Maps.newHashMap();
|
private static final Map<String, KeyMapping> f_90809_ = Maps.newHashMap();
|
||||||
- private static final Map<InputConstants.Key, KeyMapping> f_90810_ = Maps.newHashMap();
|
- private static final Map<InputConstants.Key, KeyMapping> f_90810_ = Maps.newHashMap();
|
||||||
+ private static final net.minecraftforge.client.settings.KeyBindingMap f_90810_ = new net.minecraftforge.client.settings.KeyBindingMap();
|
+ private static final net.minecraftforge.client.settings.KeyMappingLookup f_90810_ = new net.minecraftforge.client.settings.KeyMappingLookup();
|
||||||
private static final Set<String> f_90811_ = Sets.newHashSet();
|
private static final Set<String> f_90811_ = Sets.newHashSet();
|
||||||
public static final String f_167805_ = "key.categories.movement";
|
public static final String f_167805_ = "key.categories.movement";
|
||||||
public static final String f_167806_ = "key.categories.misc";
|
public static final String f_167806_ = "key.categories.misc";
|
||||||
@@ -41,7 +_,7 @@
|
|
||||||
private int f_90818_;
|
|
||||||
|
|
||||||
public static void m_90835_(InputConstants.Key p_90836_) {
|
|
||||||
- KeyMapping keymapping = f_90810_.get(p_90836_);
|
|
||||||
+ KeyMapping keymapping = f_90810_.lookupActive(p_90836_);
|
|
||||||
if (keymapping != null) {
|
|
||||||
++keymapping.f_90818_;
|
|
||||||
}
|
|
||||||
@@ -49,7 +_,7 @@
|
@@ -49,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void m_90837_(InputConstants.Key p_90838_, boolean p_90839_) {
|
public static void m_90837_(InputConstants.Key p_90838_, boolean p_90839_) {
|
||||||
- KeyMapping keymapping = f_90810_.get(p_90838_);
|
- KeyMapping keymapping = f_90810_.get(p_90838_);
|
||||||
+ for (KeyMapping keymapping : f_90810_.lookupAll(p_90838_))
|
+ for (KeyMapping keymapping : f_90810_.getAll(p_90838_))
|
||||||
if (keymapping != null) {
|
if (keymapping != null) {
|
||||||
keymapping.m_7249_(p_90839_);
|
keymapping.m_7249_(p_90839_);
|
||||||
}
|
}
|
||||||
@@ -73,10 +_,10 @@
|
@@ -96,7 +_,7 @@
|
||||||
}
|
|
||||||
|
|
||||||
public static void m_90854_() {
|
|
||||||
- f_90810_.clear();
|
|
||||||
+ f_90810_.clearMap();
|
|
||||||
|
|
||||||
for(KeyMapping keymapping : f_90809_.values()) {
|
|
||||||
- f_90810_.put(keymapping.f_90816_, keymapping);
|
|
||||||
+ f_90810_.addKey(keymapping.f_90816_, keymapping);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -91,12 +_,12 @@
|
|
||||||
this.f_90814_ = this.f_90816_;
|
|
||||||
this.f_90815_ = p_90828_;
|
|
||||||
f_90809_.put(p_90825_, this);
|
|
||||||
- f_90810_.put(this.f_90816_, this);
|
|
||||||
+ f_90810_.addKey(this.f_90816_, this);
|
|
||||||
f_90811_.add(p_90828_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean m_90857_() {
|
public boolean m_90857_() {
|
||||||
@@ -154,7 +126,7 @@
|
|||||||
+ if (this.keyModifier.matches(keyCode))
|
+ if (this.keyModifier.matches(keyCode))
|
||||||
+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||||
+ f_90809_.put(description, this);
|
+ f_90809_.put(description, this);
|
||||||
+ f_90810_.addKey(keyCode, this);
|
+ f_90810_.put(keyCode, this);
|
||||||
+ f_90811_.add(category);
|
+ f_90811_.add(category);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@@ -188,9 +160,9 @@
|
|||||||
+ this.f_90816_ = keyCode;
|
+ this.f_90816_ = keyCode;
|
||||||
+ if (keyModifier.matches(keyCode))
|
+ if (keyModifier.matches(keyCode))
|
||||||
+ keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
+ keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||||
+ f_90810_.removeKey(this);
|
+ f_90810_.remove(this);
|
||||||
+ this.keyModifier = keyModifier;
|
+ this.keyModifier = keyModifier;
|
||||||
+ f_90810_.addKey(keyCode, this);
|
+ f_90810_.put(keyCode, this);
|
||||||
+ }
|
+ }
|
||||||
+ /****************** Forge End *****************************/
|
+ /****************** Forge End *****************************/
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/KeyboardHandler.java
|
--- a/net/minecraft/client/KeyboardHandler.java
|
||||||
+++ b/net/minecraft/client/KeyboardHandler.java
|
+++ b/net/minecraft/client/KeyboardHandler.java
|
||||||
@@ -300,7 +_,9 @@
|
@@ -299,7 +_,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
Screen screen = this.f_90867_.f_91080_;
|
Screen screen = this.f_90867_.f_91080_;
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
if (this.f_90867_.f_91066_.f_92105_.m_90832_(p_90895_, p_90896_)) {
|
if (this.f_90867_.f_91066_.f_92105_.m_90832_(p_90895_, p_90896_)) {
|
||||||
this.f_90867_.m_91268_().m_85438_();
|
this.f_90867_.m_91268_().m_85438_();
|
||||||
this.f_90867_.f_91066_.m_231829_().m_231514_(this.f_90867_.m_91268_().m_85440_());
|
this.f_90867_.f_91066_.m_231829_().m_231514_(this.f_90867_.m_91268_().m_85440_());
|
||||||
@@ -318,6 +_,8 @@
|
@@ -317,6 +_,8 @@
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
+ ((KeyBindsScreen)this.f_90867_.f_91080_).f_193975_ = null; //Forge: Unset pure modifiers.
|
+ ((KeyBindsScreen)this.f_90867_.f_91080_).f_193975_ = null; //Forge: Unset pure modifiers.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NarratorChatListener.f_93311_.m_93316_()) {
|
if (this.f_90867_.m_240477_().m_93316_()) {
|
||||||
@@ -340,11 +_,15 @@
|
@@ -339,11 +_,15 @@
|
||||||
Screen.m_96579_(() -> {
|
Screen.m_96579_(() -> {
|
||||||
if (p_90897_ != 1 && (p_90897_ != 2 || !this.f_90868_)) {
|
if (p_90897_ != 1 && (p_90897_ != 2 || !this.f_90868_)) {
|
||||||
if (p_90897_ == 0) {
|
if (p_90897_ == 0) {
|
||||||
@@ -38,12 +38,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}, "keyPressed event handler", screen.getClass().getCanonicalName());
|
}, "keyPressed event handler", screen.getClass().getCanonicalName());
|
||||||
@@ -397,22 +_,26 @@
|
@@ -396,22 +_,26 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
-
|
-
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.fireKeyInput(p_90895_, p_90896_, p_90897_, p_90898_);
|
+ net.minecraftforge.client.ForgeHooksClient.onKeyInput(p_90895_, p_90896_, p_90897_, p_90898_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/Minecraft.java
|
--- a/net/minecraft/client/Minecraft.java
|
||||||
+++ b/net/minecraft/client/Minecraft.java
|
+++ b/net/minecraft/client/Minecraft.java
|
||||||
@@ -236,7 +_,7 @@
|
@@ -244,7 +_,7 @@
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
static Minecraft f_90981_;
|
static Minecraft f_90981_;
|
||||||
private static final Logger f_90982_ = LogUtils.getLogger();
|
private static final Logger f_90982_ = LogUtils.getLogger();
|
||||||
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
|
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
|
||||||
@@ -385,7 +_,7 @@
|
@@ -398,7 +_,7 @@
|
||||||
this.f_91029_ = p_91084_.f_101908_.f_101928_;
|
this.f_91029_ = p_91084_.f_101908_.f_101928_;
|
||||||
this.f_90986_ = p_91084_.f_101905_.f_101944_;
|
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_());
|
this.f_91037_ = new ClientPackSource(new File(this.f_91069_, "server-resource-packs"), p_91084_.f_101907_.m_101925_());
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
this.f_91030_ = p_91084_.f_101905_.f_101945_;
|
this.f_91030_ = p_91084_.f_101905_.f_101945_;
|
||||||
this.f_231338_ = new YggdrasilAuthenticationService(this.f_91030_);
|
this.f_231338_ = new YggdrasilAuthenticationService(this.f_91030_);
|
||||||
this.f_91048_ = this.f_231338_.createMinecraftSessionService();
|
this.f_91048_ = this.f_231338_.createMinecraftSessionService();
|
||||||
@@ -393,7 +_,6 @@
|
@@ -406,7 +_,6 @@
|
||||||
this.f_231339_ = SignatureValidator.m_216358_(this.f_231338_.getServicesKey());
|
this.f_231339_ = SignatureValidator.m_216358_(this.f_231338_.getServicesKey());
|
||||||
this.f_90998_ = p_91084_.f_101905_.f_101942_;
|
this.f_90998_ = p_91084_.f_101905_.f_101942_;
|
||||||
f_90982_.info("Setting user: {}", (Object)this.f_90998_.m_92546_());
|
f_90982_.info("Setting user: {}", (Object)this.f_90998_.m_92546_());
|
||||||
@@ -26,23 +26,16 @@
|
|||||||
this.f_91033_ = p_91084_.f_101908_.f_101926_;
|
this.f_91033_ = p_91084_.f_101908_.f_101926_;
|
||||||
this.f_91034_ = !p_91084_.f_101908_.f_101929_;
|
this.f_91034_ = !p_91084_.f_101908_.f_101929_;
|
||||||
this.f_91035_ = !p_91084_.f_101908_.f_101930_;
|
this.f_91035_ = !p_91084_.f_101908_.f_101930_;
|
||||||
@@ -426,6 +_,7 @@
|
@@ -458,7 +_,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);
|
|
||||||
@@ -445,7 +_,6 @@
|
|
||||||
|
|
||||||
this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_());
|
this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_());
|
||||||
this.f_91067_ = new MouseHandler(this);
|
this.f_91067_ = new MouseHandler(this);
|
||||||
- this.f_91067_.m_91524_(this.f_90990_.m_85439_());
|
- this.f_91067_.m_91524_(this.f_90990_.m_85439_());
|
||||||
|
+ // FORGE: Move mouse handler setup further below
|
||||||
this.f_91068_ = new KeyboardHandler(this);
|
this.f_91068_ = new KeyboardHandler(this);
|
||||||
this.f_91068_.m_90887_(this.f_90990_.m_85439_());
|
this.f_91068_.m_90887_(this.f_90990_.m_85439_());
|
||||||
RenderSystem.m_69580_(this.f_91066_.f_92035_, false);
|
RenderSystem.m_69580_(this.f_91066_.f_92035_, false);
|
||||||
@@ -453,6 +_,7 @@
|
@@ -466,6 +_,7 @@
|
||||||
this.f_91042_.m_83931_(0.0F, 0.0F, 0.0F, 0.0F);
|
this.f_91042_.m_83931_(0.0F, 0.0F, 0.0F, 0.0F);
|
||||||
this.f_91042_.m_83954_(f_91002_);
|
this.f_91042_.m_83954_(f_91002_);
|
||||||
this.f_91036_ = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
this.f_91036_ = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
||||||
@@ -50,25 +43,31 @@
|
|||||||
this.f_91038_.m_10506_();
|
this.f_91038_.m_10506_();
|
||||||
this.f_91066_.m_92145_(this.f_91038_);
|
this.f_91066_.m_92145_(this.f_91038_);
|
||||||
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_);
|
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_);
|
||||||
@@ -500,6 +_,7 @@
|
@@ -510,10 +_,12 @@
|
||||||
|
this.f_91063_ = new GameRenderer(this, this.f_90994_.m_234586_(), this.f_91036_, this.f_90993_);
|
||||||
|
this.f_91036_.m_7217_(this.f_91063_);
|
||||||
|
this.f_91060_ = new LevelRenderer(this, this.f_90994_, this.f_167845_, this.f_90993_);
|
||||||
|
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RenderLevelStageEvent.RegisterStageEvent());
|
||||||
|
this.f_91036_.m_7217_(this.f_91060_);
|
||||||
this.m_91271_();
|
this.m_91271_();
|
||||||
this.f_91036_.m_7217_(this.f_90997_);
|
this.f_91036_.m_7217_(this.f_90997_);
|
||||||
this.f_91061_ = new ParticleEngine(this.f_91073_, this.f_90987_);
|
this.f_91061_ = new ParticleEngine(this.f_91073_, this.f_90987_);
|
||||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.ParticleFactoryRegisterEvent());
|
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(f_91061_);
|
||||||
this.f_91036_.m_7217_(this.f_91061_);
|
this.f_91036_.m_7217_(this.f_91061_);
|
||||||
this.f_91053_ = new PaintingTextureManager(this.f_90987_);
|
this.f_91053_ = new PaintingTextureManager(this.f_90987_);
|
||||||
this.f_91036_.m_7217_(this.f_91053_);
|
this.f_91036_.m_7217_(this.f_91053_);
|
||||||
@@ -508,7 +_,8 @@
|
@@ -522,7 +_,9 @@
|
||||||
this.f_91047_ = new GpuWarnlistManager();
|
this.f_91047_ = new GpuWarnlistManager();
|
||||||
this.f_91036_.m_7217_(this.f_91047_);
|
this.f_91036_.m_7217_(this.f_91047_);
|
||||||
this.f_91036_.m_7217_(this.f_205120_);
|
this.f_91036_.m_7217_(this.f_205120_);
|
||||||
- this.f_91065_ = new Gui(this, this.f_90995_);
|
- this.f_91065_ = new Gui(this, this.f_90995_);
|
||||||
+ this.f_91065_ = new net.minecraftforge.client.gui.ForgeIngameGui(this);
|
+ this.f_91065_ = new net.minecraftforge.client.gui.overlay.ForgeGui(this);
|
||||||
+ this.f_91067_.m_91524_(this.f_90990_.m_85439_()); //Forge: Moved below ingameGUI setting to prevent NPEs in handeler.
|
+ // FORGE: Moved mouse handler setup below ingame gui creation to prevent NPEs in mouse handler.
|
||||||
|
+ this.f_91067_.m_91524_(this.f_90990_.m_85439_());
|
||||||
this.f_91064_ = new DebugRenderer(this);
|
this.f_91064_ = new DebugRenderer(this);
|
||||||
|
this.f_238717_ = new RealmsDataFetcher(RealmsClient.m_239151_(this));
|
||||||
RenderSystem.m_69900_(this::m_91113_);
|
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_()) {
|
@@ -541,6 +_,19 @@
|
||||||
@@ -526,6 +_,11 @@
|
|
||||||
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
|
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,33 +75,58 @@
|
|||||||
+ 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.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.RegisterLayerDefinitions());
|
||||||
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.EntityRenderersEvent.RegisterRenderers());
|
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.EntityRenderersEvent.RegisterRenderers());
|
||||||
|
+ net.minecraftforge.client.textures.TextureAtlasSpriteLoaderManager.init();
|
||||||
|
+ net.minecraftforge.client.gui.ClientTooltipComponentManager.init();
|
||||||
|
+ net.minecraftforge.client.EntitySpectatorShaderManager.init();
|
||||||
|
+ net.minecraftforge.client.ForgeHooksClient.onRegisterKeyMappings(f_91066_);
|
||||||
|
+ net.minecraftforge.client.RecipeBookManager.init();
|
||||||
|
+ net.minecraftforge.client.gui.overlay.GuiOverlayManager.init();
|
||||||
|
+ net.minecraftforge.client.DimensionSpecialEffectsManager.init();
|
||||||
|
+ net.minecraftforge.client.NamedRenderTypeManager.init();
|
||||||
+
|
+
|
||||||
this.f_90990_.m_85409_(this.f_91066_.m_231817_().m_231551_());
|
this.f_90990_.m_85409_(this.f_91066_.m_231817_().m_231551_());
|
||||||
this.f_90990_.m_85424_(this.f_91066_.m_232123_().m_231551_());
|
this.f_90990_.m_85424_(this.f_91066_.m_232123_().m_231551_());
|
||||||
this.f_90990_.m_85426_();
|
this.f_90990_.m_85426_();
|
||||||
@@ -543,13 +_,16 @@
|
@@ -563,23 +_,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.f_167847_.m_168556_();
|
this.f_167847_.m_168556_();
|
||||||
+ if (net.minecraftforge.client.loading.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.
|
+ // FORGE: Move opening initial screen to after startup and events are enabled.
|
||||||
+ // Also Fixes MC-145102
|
|
||||||
+ if (s != null) {
|
+ if (s != null) {
|
||||||
+ ConnectScreen.m_169267_(new TitleScreen(), this, new ServerAddress(s, i), (ServerData)null);
|
+ ConnectScreen.m_169267_(new TitleScreen(), this, new ServerAddress(s, i), (ServerData)null);
|
||||||
|
+ } else if (this.m_239929_()) {
|
||||||
|
+ this.m_91152_(BanNoticeScreen.m_239967_((p_238185_) -> {
|
||||||
|
+ if (p_238185_) {
|
||||||
|
+ Util.m_137581_().m_137646_("https://aka.ms/mcjavamoderation");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ this.m_91152_(new TitleScreen(true));
|
||||||
|
+ }, this.m_239210_()));
|
||||||
+ } else {
|
+ } else {
|
||||||
+ this.m_91152_(new TitleScreen(true));
|
+ this.m_91152_(new TitleScreen(true));
|
||||||
+ }
|
+ }
|
||||||
});
|
});
|
||||||
}, false));
|
}, false));
|
||||||
- if (s != null) {
|
- if (s != null) {
|
||||||
- ConnectScreen.m_169267_(new TitleScreen(), this, new ServerAddress(s, i), (ServerData)null);
|
- reloadinstance.m_7237_().thenRunAsync(() -> {
|
||||||
|
- ConnectScreen.m_169267_(new TitleScreen(), this, new ServerAddress(s, i), (ServerData)null);
|
||||||
|
- }, this);
|
||||||
|
- } else if (this.m_239929_()) {
|
||||||
|
- this.m_91152_(BanNoticeScreen.m_239967_((p_238185_) -> {
|
||||||
|
- if (p_238185_) {
|
||||||
|
- Util.m_137581_().m_137646_("https://aka.ms/mcjavamoderation");
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- this.m_91152_(new TitleScreen(true));
|
||||||
|
- }, this.m_239210_()));
|
||||||
- } else {
|
- } else {
|
||||||
- this.m_91152_(new TitleScreen(true));
|
- this.m_91152_(new TitleScreen(true));
|
||||||
- }
|
- }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,6 +_,8 @@
|
@@ -622,6 +_,8 @@
|
||||||
|
|
||||||
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
||||||
try {
|
try {
|
||||||
@@ -111,7 +135,7 @@
|
|||||||
return p_193586_.createUserApiService(p_193587_.f_101905_.f_101942_.m_92547_());
|
return p_193586_.createUserApiService(p_193587_.f_101905_.f_101942_.m_92547_());
|
||||||
} catch (AuthenticationException authenticationexception) {
|
} catch (AuthenticationException authenticationexception) {
|
||||||
f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception);
|
f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception);
|
||||||
@@ -604,7 +_,7 @@
|
@@ -634,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void m_91239_(Throwable p_91240_) {
|
private void m_91239_(Throwable p_91240_) {
|
||||||
@@ -120,7 +144,7 @@
|
|||||||
this.m_91241_(p_91240_, (Component)null);
|
this.m_91241_(p_91240_, (Component)null);
|
||||||
} else {
|
} else {
|
||||||
Util.m_137559_(p_91240_);
|
Util.m_137559_(p_91240_);
|
||||||
@@ -762,13 +_,13 @@
|
@@ -792,13 +_,13 @@
|
||||||
Bootstrap.m_135875_(p_91333_.m_127526_());
|
Bootstrap.m_135875_(p_91333_.m_127526_());
|
||||||
if (p_91333_.m_127527_() != null) {
|
if (p_91333_.m_127527_() != null) {
|
||||||
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + p_91333_.m_127527_());
|
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + p_91333_.m_127527_());
|
||||||
@@ -137,7 +161,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -892,10 +_,6 @@
|
@@ -922,10 +_,6 @@
|
||||||
f_90982_.error("setScreen called from non-game thread");
|
f_90982_.error("setScreen called from non-game thread");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,37 +172,42 @@
|
|||||||
if (p_91153_ == null && this.f_91073_ == null) {
|
if (p_91153_ == null && this.f_91073_ == null) {
|
||||||
p_91153_ = new TitleScreen();
|
p_91153_ = new TitleScreen();
|
||||||
} else if (p_91153_ == null && this.f_91074_.m_21224_()) {
|
} else if (p_91153_ == null && this.f_91074_.m_21224_()) {
|
||||||
@@ -906,6 +_,15 @@
|
@@ -936,6 +_,19 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
|
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
|
||||||
+ Screen old = this.f_91080_;
|
+ Screen old = this.f_91080_;
|
||||||
+ net.minecraftforge.client.event.ScreenOpenEvent event = new net.minecraftforge.client.event.ScreenOpenEvent(p_91153_);
|
+ if (p_91153_ != null) {
|
||||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
|
+ var event = new net.minecraftforge.client.event.ScreenEvent.Opening(old, p_91153_);
|
||||||
|
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
|
||||||
|
+ p_91153_ = event.getNewScreen();
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ p_91153_ = event.getScreen();
|
+ if (old != null && p_91153_ != old) {
|
||||||
+ if (old != null && p_91153_ != old)
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Closing(old));
|
||||||
+ old.m_7861_();
|
+ old.m_7861_();
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
this.f_91080_ = p_91153_;
|
this.f_91080_ = p_91153_;
|
||||||
BufferUploader.m_166835_();
|
BufferUploader.m_166835_();
|
||||||
if (p_91153_ != null) {
|
if (p_91153_ != null) {
|
||||||
@@ -1049,11 +_,13 @@
|
@@ -1079,11 +_,14 @@
|
||||||
RenderSystem.m_69481_();
|
RenderSystem.m_69481_();
|
||||||
this.f_91026_.m_7238_();
|
this.f_91026_.m_7238_();
|
||||||
if (!this.f_91079_) {
|
if (!this.f_91079_) {
|
||||||
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_);
|
+ this.realPartialTick = this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_; // Cache this since pause is volatile
|
||||||
|
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.realPartialTick);
|
||||||
this.f_91026_.m_6182_("gameRenderer");
|
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_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_91026_.m_6182_("toasts");
|
||||||
this.f_91003_.m_94920_(new PoseStack());
|
this.f_91003_.m_94920_(new PoseStack());
|
||||||
this.f_91026_.m_7238_();
|
this.f_91026_.m_7238_();
|
||||||
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_);
|
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.realPartialTick);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.f_91056_ != null) {
|
if (this.f_91056_ != null) {
|
||||||
@@ -1180,10 +_,12 @@
|
@@ -1210,10 +_,12 @@
|
||||||
this.f_90990_.m_85378_((double)i);
|
this.f_90990_.m_85378_((double)i);
|
||||||
if (this.f_91080_ != null) {
|
if (this.f_91080_ != null) {
|
||||||
this.f_91080_.m_6574_(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_());
|
this.f_91080_.m_6574_(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_());
|
||||||
@@ -191,7 +220,7 @@
|
|||||||
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
|
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
|
||||||
this.f_91067_.m_91599_();
|
this.f_91067_.m_91599_();
|
||||||
}
|
}
|
||||||
@@ -1461,6 +_,7 @@
|
@@ -1491,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_91395_() {
|
public void m_91395_() {
|
||||||
@@ -199,13 +228,13 @@
|
|||||||
this.f_91019_ = false;
|
this.f_91019_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1490,10 +_,18 @@
|
@@ -1520,10 +_,18 @@
|
||||||
if (p_91387_ && this.f_91077_ != null && this.f_91077_.m_6662_() == HitResult.Type.BLOCK) {
|
if (p_91387_ && this.f_91077_ != null && this.f_91077_.m_6662_() == HitResult.Type.BLOCK) {
|
||||||
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
||||||
BlockPos blockpos = blockhitresult.m_82425_();
|
BlockPos blockpos = blockhitresult.m_82425_();
|
||||||
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
||||||
+ if (!this.f_91073_.m_46859_(blockpos)) {
|
+ if (!this.f_91073_.m_46859_(blockpos)) {
|
||||||
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
|
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
|
||||||
+ if (inputEvent.isCanceled()) {
|
+ if (inputEvent.isCanceled()) {
|
||||||
+ if (inputEvent.shouldSwingHand()) {
|
+ if (inputEvent.shouldSwingHand()) {
|
||||||
+ this.f_91061_.addBlockHitEffects(blockpos, blockhitresult);
|
+ this.f_91061_.addBlockHitEffects(blockpos, blockhitresult);
|
||||||
@@ -221,12 +250,12 @@
|
|||||||
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1518,14 +_,20 @@
|
@@ -1548,14 +_,20 @@
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
- switch (this.f_91077_.m_6662_()) {
|
- switch (this.f_91077_.m_6662_()) {
|
||||||
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
|
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
|
||||||
+ HitResult.Type hitType = this.f_91077_.m_6662_();
|
+ HitResult.Type hitType = this.f_91077_.m_6662_();
|
||||||
+ if(this.f_91077_ instanceof EntityHitResult entityHit) { // Forge: Perform attack range checks here, instead of in GameRenderer#pick, so extended-reach interactions work.
|
+ if(this.f_91077_ instanceof EntityHitResult entityHit) { // Forge: Perform attack range checks here, instead of in GameRenderer#pick, so extended-reach interactions work.
|
||||||
+ if(!f_91074_.canHit(entityHit.m_82443_(), 0)) hitType = HitResult.Type.MISS; // No padding in client code.
|
+ if(!f_91074_.canHit(entityHit.m_82443_(), 0)) hitType = HitResult.Type.MISS; // No padding in client code.
|
||||||
@@ -240,26 +269,26 @@
|
|||||||
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
||||||
BlockPos blockpos = blockhitresult.m_82425_();
|
BlockPos blockpos = blockhitresult.m_82425_();
|
||||||
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
||||||
+ if (!this.f_91073_.m_46859_(blockpos)) {
|
+ if (!this.f_91073_.m_46859_(blockpos)) {
|
||||||
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_());
|
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_());
|
||||||
if (this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
if (this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
||||||
flag = true;
|
flag = true;
|
||||||
@@ -1538,8 +_,10 @@
|
@@ -1568,8 +_,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.f_91074_.m_36334_();
|
this.f_91074_.m_36334_();
|
||||||
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_);
|
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if (inputEvent.shouldSwingHand())
|
+ if (inputEvent.shouldSwingHand())
|
||||||
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
@@ -1554,6 +_,11 @@
|
@@ -1584,6 +_,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
for(InteractionHand interactionhand : InteractionHand.values()) {
|
for(InteractionHand interactionhand : InteractionHand.values()) {
|
||||||
+ net.minecraftforge.client.event.InputEvent.ClickInputEvent inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.f_91066_.f_92095_, interactionhand);
|
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.f_91066_.f_92095_, interactionhand);
|
||||||
+ if (inputEvent.isCanceled()) {
|
+ if (inputEvent.isCanceled()) {
|
||||||
+ if (inputEvent.shouldSwingHand()) this.f_91074_.m_6674_(interactionhand);
|
+ if (inputEvent.shouldSwingHand()) this.f_91074_.m_6674_(interactionhand);
|
||||||
+ return;
|
+ return;
|
||||||
@@ -267,31 +296,32 @@
|
|||||||
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
|
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
|
||||||
if (this.f_91077_ != null) {
|
if (this.f_91077_ != null) {
|
||||||
switch (this.f_91077_.m_6662_()) {
|
switch (this.f_91077_.m_6662_()) {
|
||||||
@@ -1564,6 +_,7 @@
|
@@ -1594,13 +_,14 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if(!this.f_91074_.canInteractWith(entityhitresult.m_82443_(), 0)) return; //Forge: Entity may be traced via attack range, but the player may not have sufficient reach. No padding in client code.
|
+ if(!this.f_91074_.canInteractWith(entityhitresult.m_82443_(), 0)) return; //Forge: Entity may be traced via attack range, but the player may not have sufficient reach. No padding in client code.
|
||||||
InteractionResult interactionresult = this.f_91072_.m_105230_(this.f_91074_, entity, entityhitresult, interactionhand);
|
InteractionResult interactionresult = this.f_91072_.m_105230_(this.f_91074_, entity, entityhitresult, interactionhand);
|
||||||
if (!interactionresult.m_19077_()) {
|
if (!interactionresult.m_19077_()) {
|
||||||
interactionresult = this.f_91072_.m_105226_(this.f_91074_, entity, interactionhand);
|
interactionresult = this.f_91072_.m_105226_(this.f_91074_, entity, interactionhand);
|
||||||
@@ -1571,6 +_,7 @@
|
}
|
||||||
|
|
||||||
if (interactionresult.m_19077_()) {
|
if (interactionresult.m_19077_()) {
|
||||||
if (interactionresult.m_19080_()) {
|
- if (interactionresult.m_19080_()) {
|
||||||
+ if (inputEvent.shouldSwingHand())
|
+ if (interactionresult.m_19080_() && inputEvent.shouldSwingHand()) {
|
||||||
this.f_91074_.m_6674_(interactionhand);
|
this.f_91074_.m_6674_(interactionhand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1583,6 +_,7 @@
|
@@ -1612,7 +_,7 @@
|
||||||
|
int i = itemstack.m_41613_();
|
||||||
InteractionResult interactionresult1 = this.f_91072_.m_233732_(this.f_91074_, interactionhand, blockhitresult);
|
InteractionResult interactionresult1 = this.f_91072_.m_233732_(this.f_91074_, interactionhand, blockhitresult);
|
||||||
if (interactionresult1.m_19077_()) {
|
if (interactionresult1.m_19077_()) {
|
||||||
if (interactionresult1.m_19080_()) {
|
- if (interactionresult1.m_19080_()) {
|
||||||
+ if (inputEvent.shouldSwingHand())
|
+ if (interactionresult1.m_19080_() && inputEvent.shouldSwingHand()) {
|
||||||
this.f_91074_.m_6674_(interactionhand);
|
this.f_91074_.m_6674_(interactionhand);
|
||||||
if (!itemstack.m_41619_() && (itemstack.m_41613_() != i || this.f_91072_.m_105290_())) {
|
if (!itemstack.m_41619_() && (itemstack.m_41613_() != i || this.f_91072_.m_105290_())) {
|
||||||
this.f_91063_.f_109055_.m_109320_(interactionhand);
|
this.f_91063_.f_109055_.m_109320_(interactionhand);
|
||||||
@@ -1598,6 +_,9 @@
|
@@ -1628,6 +_,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,16 +331,16 @@
|
|||||||
if (!itemstack.m_41619_()) {
|
if (!itemstack.m_41619_()) {
|
||||||
InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand);
|
InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand);
|
||||||
if (interactionresult2.m_19077_()) {
|
if (interactionresult2.m_19077_()) {
|
||||||
@@ -1624,6 +_,8 @@
|
@@ -1654,6 +_,8 @@
|
||||||
--this.f_91011_;
|
--this.f_91011_;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
|
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
|
||||||
+
|
+
|
||||||
this.f_91026_.m_6180_("gui");
|
this.f_91026_.m_6180_("gui");
|
||||||
|
this.f_240378_.m_240688_();
|
||||||
this.f_91065_.m_193832_(this.f_91012_);
|
this.f_91065_.m_193832_(this.f_91012_);
|
||||||
this.f_91026_.m_7238_();
|
@@ -1783,6 +_,8 @@
|
||||||
@@ -1752,6 +_,8 @@
|
|
||||||
this.f_91026_.m_6182_("keyboard");
|
this.f_91026_.m_6182_("keyboard");
|
||||||
this.f_91068_.m_90931_();
|
this.f_91068_.m_90931_();
|
||||||
this.f_91026_.m_7238_();
|
this.f_91026_.m_7238_();
|
||||||
@@ -319,39 +349,28 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean m_91278_() {
|
private boolean m_91278_() {
|
||||||
@@ -1894,8 +_,8 @@
|
@@ -1978,6 +_,7 @@
|
||||||
SkullBlockEntity.m_222885_(services, this);
|
|
||||||
GameProfileCache.m_11004_(false);
|
|
||||||
this.f_91007_ = MinecraftServer.m_129872_((p_231361_) -> {
|
|
||||||
- return new IntegratedServer(p_231361_, this, p_231382_, p_231383_, p_231384_, services, (p_231447_) -> {
|
|
||||||
- StoringChunkProgressListener storingchunkprogresslistener = new StoringChunkProgressListener(p_231447_ + 0);
|
|
||||||
+ return new IntegratedServer(p_231361_, this, p_231382_, p_231383_, p_231384_, services, (p_210795_) -> { //TODO-PATCHING: Handle the registry freeze delay again.
|
|
||||||
+ StoringChunkProgressListener storingchunkprogresslistener = new StoringChunkProgressListener(p_210795_ + 0);
|
|
||||||
this.f_90999_.set(storingchunkprogresslistener);
|
|
||||||
return ProcessorChunkProgressListener.m_143583_(storingchunkprogresslistener, this.f_91023_::add);
|
|
||||||
});
|
|
||||||
@@ -1945,6 +_,7 @@
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_91156_(ClientLevel p_91157_) {
|
public void m_91156_(ClientLevel p_91157_) {
|
||||||
+ if (f_91073_ != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(f_91073_));
|
+ if (f_91073_ != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(f_91073_));
|
||||||
ProgressScreen progressscreen = new ProgressScreen(true);
|
ProgressScreen progressscreen = new ProgressScreen(true);
|
||||||
progressscreen.m_6309_(Component.m_237115_("connect.joining"));
|
progressscreen.m_6309_(Component.m_237115_("connect.joining"));
|
||||||
this.m_91362_(progressscreen);
|
this.m_91362_(progressscreen);
|
||||||
@@ -1978,10 +_,12 @@
|
@@ -2011,10 +_,12 @@
|
||||||
IntegratedServer integratedserver = this.f_91007_;
|
IntegratedServer integratedserver = this.f_91007_;
|
||||||
this.f_91007_ = null;
|
this.f_91007_ = null;
|
||||||
this.f_91063_.m_109150_();
|
this.f_91063_.m_109150_();
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.firePlayerLogout(this.f_91072_, this.f_91074_);
|
+ net.minecraftforge.client.ForgeHooksClient.firePlayerLogout(this.f_91072_, this.f_91074_);
|
||||||
this.f_91072_ = null;
|
this.f_91072_ = null;
|
||||||
NarratorChatListener.f_93311_.m_93328_();
|
this.f_240365_.m_93328_();
|
||||||
this.m_91362_(p_91321_);
|
this.m_91362_(p_91321_);
|
||||||
if (this.f_91073_ != null) {
|
if (this.f_91073_ != null) {
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(f_91073_));
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(f_91073_));
|
||||||
if (integratedserver != null) {
|
if (integratedserver != null) {
|
||||||
this.f_91026_.m_6180_("waitForServer");
|
this.f_91026_.m_6180_("waitForServer");
|
||||||
|
|
||||||
@@ -1996,6 +_,7 @@
|
@@ -2029,6 +_,7 @@
|
||||||
this.f_91065_.m_93089_();
|
this.f_91065_.m_93089_();
|
||||||
this.f_91008_ = null;
|
this.f_91008_ = null;
|
||||||
this.f_91010_ = false;
|
this.f_91010_ = false;
|
||||||
@@ -359,77 +378,36 @@
|
|||||||
this.f_91004_.m_90740_();
|
this.f_91004_.m_90740_();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2082,66 +_,9 @@
|
@@ -2124,6 +_,7 @@
|
||||||
|
|
||||||
private void m_91280_() {
|
private void m_91280_() {
|
||||||
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
|
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
|
||||||
- boolean flag = this.f_91074_.m_150110_().f_35937_;
|
+ if (net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.f_91066_.f_92097_, InteractionHand.MAIN_HAND).isCanceled()) return;
|
||||||
- BlockEntity blockentity = null;
|
boolean flag = this.f_91074_.m_150110_().f_35937_;
|
||||||
- HitResult.Type hitresult$type = this.f_91077_.m_6662_();
|
BlockEntity blockentity = null;
|
||||||
- ItemStack itemstack;
|
HitResult.Type hitresult$type = this.f_91077_.m_6662_();
|
||||||
- if (hitresult$type == HitResult.Type.BLOCK) {
|
@@ -2136,10 +_,7 @@
|
||||||
- BlockPos blockpos = ((BlockHitResult)this.f_91077_).m_82425_();
|
}
|
||||||
- BlockState blockstate = this.f_91073_.m_8055_(blockpos);
|
|
||||||
- if (blockstate.m_60795_()) {
|
Block block = blockstate.m_60734_();
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- Block block = blockstate.m_60734_();
|
|
||||||
- itemstack = block.m_7397_(this.f_91073_, blockpos, blockstate);
|
- itemstack = block.m_7397_(this.f_91073_, blockpos, blockstate);
|
||||||
- if (itemstack.m_41619_()) {
|
- if (itemstack.m_41619_()) {
|
||||||
- return;
|
- return;
|
||||||
- }
|
- }
|
||||||
-
|
+ itemstack = blockstate.getCloneItemStack(this.f_91077_, this.f_91073_, blockpos, this.f_91074_);
|
||||||
- if (flag && Screen.m_96637_() && blockstate.m_155947_()) {
|
|
||||||
- blockentity = this.f_91073_.m_7702_(blockpos);
|
|
||||||
- }
|
|
||||||
- } else {
|
|
||||||
- if (hitresult$type != HitResult.Type.ENTITY || !flag) {
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- Entity entity = ((EntityHitResult)this.f_91077_).m_82443_();
|
|
||||||
- itemstack = entity.m_142340_();
|
|
||||||
- if (itemstack == null) {
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (itemstack.m_41619_()) {
|
|
||||||
- String s = "";
|
|
||||||
- if (hitresult$type == HitResult.Type.BLOCK) {
|
|
||||||
- s = Registry.f_122824_.m_7981_(this.f_91073_.m_8055_(((BlockHitResult)this.f_91077_).m_82425_()).m_60734_()).toString();
|
|
||||||
- } else if (hitresult$type == HitResult.Type.ENTITY) {
|
|
||||||
- s = Registry.f_122826_.m_7981_(((EntityHitResult)this.f_91077_).m_82443_().m_6095_()).toString();
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- f_90982_.warn("Picking on: [{}] {} gave null item", hitresult$type, s);
|
|
||||||
- } else {
|
|
||||||
- Inventory inventory = this.f_91074_.m_150109_();
|
|
||||||
- if (blockentity != null) {
|
|
||||||
- this.m_91122_(itemstack, blockentity);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- int i = inventory.m_36030_(itemstack);
|
|
||||||
- if (flag) {
|
|
||||||
- inventory.m_36012_(itemstack);
|
|
||||||
- this.f_91072_.m_105241_(this.f_91074_.m_21120_(InteractionHand.MAIN_HAND), 36 + inventory.f_35977_);
|
|
||||||
- } else if (i != -1) {
|
|
||||||
- if (Inventory.m_36045_(i)) {
|
|
||||||
- inventory.f_35977_ = i;
|
|
||||||
- } else {
|
|
||||||
- this.f_91072_.m_105206_(i);
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- }
|
|
||||||
+ if (!net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.f_91066_.f_92097_, InteractionHand.MAIN_HAND).isCanceled())
|
|
||||||
+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.f_91077_, this.f_91074_, this.f_91073_);
|
|
||||||
+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -2632,8 +_,8 @@
|
if (flag && Screen.m_96637_() && blockstate.m_155947_()) {
|
||||||
|
blockentity = this.f_91073_.m_7702_(blockpos);
|
||||||
|
@@ -2150,7 +_,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity entity = ((EntityHitResult)this.f_91077_).m_82443_();
|
||||||
|
- itemstack = entity.m_142340_();
|
||||||
|
+ itemstack = entity.getPickedResult(this.f_91077_);
|
||||||
|
if (itemstack == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@@ -2688,8 +_,8 @@
|
||||||
return this.f_90993_;
|
return this.f_90993_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,7 +418,7 @@
|
|||||||
Supplier<PackResources> supplier = p_167937_;
|
Supplier<PackResources> supplier = p_167937_;
|
||||||
if (i <= 3) {
|
if (i <= 3) {
|
||||||
supplier = m_91330_(p_167937_);
|
supplier = m_91330_(p_167937_);
|
||||||
@@ -2643,7 +_,7 @@
|
@@ -2699,7 +_,7 @@
|
||||||
supplier = m_91352_(supplier);
|
supplier = m_91352_(supplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +427,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Supplier<PackResources> m_91330_(Supplier<PackResources> p_91331_) {
|
private static Supplier<PackResources> m_91330_(Supplier<PackResources> p_91331_) {
|
||||||
@@ -2660,6 +_,14 @@
|
@@ -2716,6 +_,19 @@
|
||||||
|
|
||||||
public void m_91312_(int p_91313_) {
|
public void m_91312_(int p_91313_) {
|
||||||
this.f_91051_.m_119410_(p_91313_);
|
this.f_91051_.m_119410_(p_91313_);
|
||||||
@@ -461,6 +439,11 @@
|
|||||||
+
|
+
|
||||||
+ public SearchRegistry getSearchTreeManager() {
|
+ public SearchRegistry getSearchTreeManager() {
|
||||||
+ return this.f_90997_;
|
+ return this.f_90997_;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private float realPartialTick;
|
||||||
|
+ public float getPartialTick() {
|
||||||
|
+ return realPartialTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityModelSet m_167973_() {
|
public EntityModelSet m_167973_() {
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
this.f_91510_ = -1;
|
this.f_91510_ = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ if (net.minecraftforge.client.ForgeHooksClient.onRawMouseClicked(p_91532_, p_91533_, p_91534_)) return;
|
+ if (net.minecraftforge.client.ForgeHooksClient.onMouseButtonPre(p_91532_, p_91533_, p_91534_)) return;
|
||||||
boolean[] aboolean = new boolean[]{false};
|
boolean[] aboolean = new boolean[]{false};
|
||||||
if (this.f_91503_.m_91265_() == null) {
|
if (this.f_91503_.m_91265_() == null) {
|
||||||
if (this.f_91503_.f_91080_ == null) {
|
if (this.f_91503_.f_91080_ == null) {
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
-
|
-
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.fireMouseInput(p_91532_, p_91533_, p_91534_);
|
+ net.minecraftforge.client.ForgeHooksClient.onMouseButtonPost(p_91532_, p_91533_, p_91534_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,16 @@
|
|||||||
--- a/net/minecraft/client/Options.java
|
--- a/net/minecraft/client/Options.java
|
||||||
+++ b/net/minecraft/client/Options.java
|
+++ b/net/minecraft/client/Options.java
|
||||||
@@ -772,6 +_,7 @@
|
@@ -539,7 +_,8 @@
|
||||||
|
}, new OptionInstance.LazyEnum<>(() -> {
|
||||||
|
return Stream.concat(Stream.of(""), Minecraft.m_91087_().m_91106_().m_194525_().stream()).toList();
|
||||||
|
}, (p_232011_) -> {
|
||||||
|
- return Minecraft.m_91087_().m_91396_() && p_232011_ != "" && !Minecraft.m_91087_().m_91106_().m_194525_().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_);
|
||||||
|
+ // FORGE: fix incorrect string comparison - PR #8767
|
||||||
|
+ return Minecraft.m_91087_().m_91396_() && (p_232011_ == null || !p_232011_.isEmpty()) && !Minecraft.m_91087_().m_91106_().m_194525_().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_);
|
||||||
|
}, Codec.STRING), "", (p_231994_) -> {
|
||||||
|
SoundManager soundmanager = Minecraft.m_91087_().m_91106_();
|
||||||
|
soundmanager.m_194526_();
|
||||||
|
@@ -796,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public Options(Minecraft p_92138_, File p_92139_) {
|
public Options(Minecraft p_92138_, File p_92139_) {
|
||||||
@@ -8,9 +18,15 @@
|
|||||||
this.f_92060_ = p_92138_;
|
this.f_92060_ = p_92138_;
|
||||||
this.f_92110_ = new File(p_92139_, "options.txt");
|
this.f_92110_ = new File(p_92139_, "options.txt");
|
||||||
boolean flag = p_92138_.m_91103_();
|
boolean flag = p_92138_.m_91103_();
|
||||||
@@ -887,10 +_,14 @@
|
@@ -910,11 +_,20 @@
|
||||||
|
p_168428_.m_213982_("chatPreview", this.f_231796_);
|
||||||
p_168428_.m_213982_("onlyShowSecureChat", this.f_231798_);
|
p_168428_.m_213982_("onlyShowSecureChat", this.f_231798_);
|
||||||
|
|
||||||
|
+ processOptionsForge(p_168428_);
|
||||||
|
+ }
|
||||||
|
+ // FORGE: split off to allow reloading options after mod loading is done
|
||||||
|
+ private void processOptionsForge(Options.FieldAccess p_168428_)
|
||||||
|
+ {
|
||||||
for(KeyMapping keymapping : this.f_92059_) {
|
for(KeyMapping keymapping : this.f_92059_) {
|
||||||
- String s = keymapping.m_90865_();
|
- String s = keymapping.m_90865_();
|
||||||
+ String s = keymapping.m_90865_() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : "");
|
+ String s = keymapping.m_90865_() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : "");
|
||||||
@@ -25,7 +41,27 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1058,6 +_,7 @@
|
@@ -935,6 +_,9 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
public void m_92140_() {
|
||||||
|
+ this.load(false);
|
||||||
|
+ }
|
||||||
|
+ public void load(boolean limited) {
|
||||||
|
try {
|
||||||
|
if (!this.f_92110_.exists()) {
|
||||||
|
return;
|
||||||
|
@@ -979,7 +_,8 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- this.m_168427_(new Options.FieldAccess() {
|
||||||
|
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsForge : this::m_168427_;
|
||||||
|
+ processor.accept(new Options.FieldAccess() {
|
||||||
|
@Nullable
|
||||||
|
private String m_168458_(String p_168459_) {
|
||||||
|
return compoundtag1.m_128441_(p_168459_) ? compoundtag1.m_128461_(p_168459_) : null;
|
||||||
|
@@ -1082,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_92169_() {
|
public void m_92169_() {
|
||||||
@@ -33,7 +69,7 @@
|
|||||||
try {
|
try {
|
||||||
final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.f_92110_), StandardCharsets.UTF_8));
|
final PrintWriter printwriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(this.f_92110_), StandardCharsets.UTF_8));
|
||||||
|
|
||||||
@@ -1205,6 +_,23 @@
|
@@ -1229,6 +_,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
p_92146_.m_10509_(set);
|
p_92146_.m_10509_(set);
|
||||||
|
|||||||
@@ -14,17 +14,16 @@
|
|||||||
public static final List<RecipeBookCategories> f_92258_ = ImmutableList.of(FURNACE_SEARCH, FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC);
|
public static final List<RecipeBookCategories> f_92258_ = ImmutableList.of(FURNACE_SEARCH, FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC);
|
||||||
public static final List<RecipeBookCategories> f_92259_ = ImmutableList.of(CRAFTING_SEARCH, CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE);
|
public static final List<RecipeBookCategories> f_92259_ = ImmutableList.of(CRAFTING_SEARCH, CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE);
|
||||||
- public static final Map<RecipeBookCategories, List<RecipeBookCategories>> f_92260_ = ImmutableMap.of(CRAFTING_SEARCH, ImmutableList.of(CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE), FURNACE_SEARCH, ImmutableList.of(FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC), BLAST_FURNACE_SEARCH, ImmutableList.of(BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC), SMOKER_SEARCH, ImmutableList.of(SMOKER_FOOD));
|
- public static final Map<RecipeBookCategories, List<RecipeBookCategories>> f_92260_ = ImmutableMap.of(CRAFTING_SEARCH, ImmutableList.of(CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE), FURNACE_SEARCH, ImmutableList.of(FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC), BLAST_FURNACE_SEARCH, ImmutableList.of(BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC), SMOKER_SEARCH, ImmutableList.of(SMOKER_FOOD));
|
||||||
+ public static final Map<RecipeBookCategories, List<RecipeBookCategories>> f_92260_ = net.minecraftforge.client.RecipeBookRegistry.AGGREGATE_CATEGORIES_VIEW;
|
+ public static final Map<RecipeBookCategories, List<RecipeBookCategories>> f_92260_ = net.minecraftforge.client.RecipeBookManager.getAggregateCategories();
|
||||||
private final List<ItemStack> f_92261_;
|
private final List<ItemStack> f_92261_;
|
||||||
|
|
||||||
private RecipeBookCategories(ItemStack... p_92267_) {
|
private RecipeBookCategories(ItemStack... p_92267_) {
|
||||||
@@ -54,11 +_,17 @@
|
@@ -54,11 +_,15 @@
|
||||||
case SMOKER:
|
case SMOKER:
|
||||||
return f_92256_;
|
return f_92256_;
|
||||||
default:
|
default:
|
||||||
+ if (net.minecraftforge.client.RecipeBookRegistry.TYPE_TO_CATEGORIES_VIEW.containsKey(p_92270_))
|
- return ImmutableList.of();
|
||||||
+ return net.minecraftforge.client.RecipeBookRegistry.TYPE_TO_CATEGORIES_VIEW.get(p_92270_);
|
+ return net.minecraftforge.client.RecipeBookManager.getCustomCategoriesOrEmpty(p_92270_);
|
||||||
return ImmutableList.of();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/Screenshot.java
|
--- a/net/minecraft/client/Screenshot.java
|
||||||
+++ b/net/minecraft/client/Screenshot.java
|
+++ b/net/minecraft/client/Screenshot.java
|
||||||
@@ -59,13 +_,23 @@
|
@@ -55,13 +_,23 @@
|
||||||
file2 = new File(file1, p_92307_);
|
file2 = new File(file1, p_92307_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,19 +23,10 @@
|
|||||||
this.f_92535_ = p_193799_;
|
this.f_92535_ = p_193799_;
|
||||||
this.f_92536_ = p_193800_;
|
this.f_92536_ = p_193800_;
|
||||||
this.f_92537_ = p_193801_;
|
this.f_92537_ = p_193801_;
|
||||||
@@ -58,10 +_,22 @@
|
@@ -64,8 +_,22 @@
|
||||||
public GameProfile m_92548_() {
|
|
||||||
try {
|
|
||||||
UUID uuid = UUIDTypeAdapter.fromString(this.m_92545_());
|
|
||||||
- return new GameProfile(uuid, this.m_92546_());
|
|
||||||
+ GameProfile ret = new GameProfile(uuid, this.m_92546_()); //Forge: Adds cached GameProfile properties to returned GameProfile.
|
|
||||||
+ if (properties != null) ret.getProperties().putAll(properties); // Helps to cut down on calls to the session service,
|
|
||||||
+ return ret; // which helps to fix MC-52974.
|
|
||||||
} catch (IllegalArgumentException illegalargumentexception) {
|
|
||||||
return new GameProfile((UUID)null, this.m_92546_());
|
|
||||||
}
|
}
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
+ //For internal use only. Modders should never need to use this.
|
+ //For internal use only. Modders should never need to use this.
|
||||||
+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) {
|
+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) {
|
||||||
+ if (this.properties == null)
|
+ if (this.properties == null)
|
||||||
@@ -44,6 +35,15 @@
|
|||||||
+
|
+
|
||||||
+ public boolean hasCachedProperties() {
|
+ public boolean hasCachedProperties() {
|
||||||
+ return properties != null;
|
+ return properties != null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public GameProfile m_92548_() {
|
||||||
|
- return new GameProfile(this.m_240411_(), this.m_92546_());
|
||||||
|
+ // FORGE: Add cached GameProfile properties to returned GameProfile. This helps to cut down on calls to the session service.
|
||||||
|
+ GameProfile ret = new GameProfile(this.m_240411_(), this.m_92546_());
|
||||||
|
+ if (this.properties != null)
|
||||||
|
+ ret.getProperties().putAll(this.properties);
|
||||||
|
+ return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User.Type m_168638_() {
|
public User.Type m_168638_() {
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
if (blockcolor != null) {
|
if (blockcolor != null) {
|
||||||
return blockcolor.m_92566_(p_92583_, (BlockAndTintGetter)null, (BlockPos)null, 0);
|
return blockcolor.m_92566_(p_92583_, (BlockAndTintGetter)null, (BlockPos)null, 0);
|
||||||
} else {
|
} else {
|
||||||
@@ -87,13 +_,13 @@
|
@@ -87,13 +_,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public int m_92577_(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) {
|
public int m_92577_(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) {
|
||||||
@@ -33,6 +33,8 @@
|
|||||||
return blockcolor == null ? -1 : blockcolor.m_92566_(p_92578_, p_92579_, p_92580_, p_92581_);
|
return blockcolor == null ? -1 : blockcolor.m_92566_(p_92578_, p_92579_, p_92580_, p_92581_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Block} */
|
||||||
|
+ @Deprecated
|
||||||
public void m_92589_(BlockColor p_92590_, Block... p_92591_) {
|
public void m_92589_(BlockColor p_92590_, Block... p_92591_) {
|
||||||
for(Block block : p_92591_) {
|
for(Block block : p_92591_) {
|
||||||
- this.f_92571_.m_122664_(p_92590_, Registry.f_122824_.m_7447_(block));
|
- this.f_92571_.m_122664_(p_92590_, Registry.f_122824_.m_7447_(block));
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
public static ItemColors m_92683_(BlockColors p_92684_) {
|
public static ItemColors m_92683_(BlockColors p_92684_) {
|
||||||
ItemColors itemcolors = new ItemColors();
|
ItemColors itemcolors = new ItemColors();
|
||||||
@@ -88,17 +_,18 @@
|
@@ -88,17 +_,20 @@
|
||||||
itemcolors.m_92689_((p_232352_, p_232353_) -> {
|
itemcolors.m_92689_((p_232352_, p_232353_) -> {
|
||||||
return p_232353_ == 0 ? -1 : MapItem.m_42918_(p_232352_);
|
return p_232353_ == 0 ? -1 : MapItem.m_42918_(p_232352_);
|
||||||
}, Items.f_42573_);
|
}, Items.f_42573_);
|
||||||
@@ -24,6 +24,8 @@
|
|||||||
return itemcolor == null ? -1 : itemcolor.m_92671_(p_92677_, p_92678_);
|
return itemcolor == null ? -1 : itemcolor.m_92671_(p_92677_, p_92678_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Item} */
|
||||||
|
+ @Deprecated
|
||||||
public void m_92689_(ItemColor p_92690_, ItemLike... p_92691_) {
|
public void m_92689_(ItemColor p_92690_, ItemLike... p_92691_) {
|
||||||
for(ItemLike itemlike : p_92691_) {
|
for(ItemLike itemlike : p_92691_) {
|
||||||
- this.f_92674_.m_122664_(p_92690_, Item.m_41393_(itemlike.m_5456_()));
|
- this.f_92674_.m_122664_(p_92690_, Item.m_41393_(itemlike.m_5456_()));
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/gui/Gui.java
|
--- a/net/minecraft/client/gui/Gui.java
|
||||||
+++ b/net/minecraft/client/gui/Gui.java
|
+++ b/net/minecraft/client/gui/Gui.java
|
||||||
@@ -400,6 +_,7 @@
|
@@ -389,6 +_,7 @@
|
||||||
if (this.f_92986_.f_91076_ != null && this.f_92986_.f_91076_ instanceof LivingEntity && f >= 1.0F) {
|
if (this.f_92986_.f_91076_ != null && this.f_92986_.f_91076_ instanceof LivingEntity && f >= 1.0F) {
|
||||||
flag = this.f_92986_.f_91074_.m_36333_() > 5.0F;
|
flag = this.f_92986_.f_91074_.m_36333_() > 5.0F;
|
||||||
flag &= this.f_92986_.f_91076_.m_6084_();
|
flag &= this.f_92986_.f_91076_.m_6084_();
|
||||||
@@ -8,26 +8,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
int j = this.f_92978_ / 2 - 7 + 16;
|
int j = this.f_92978_ / 2 - 7 + 16;
|
||||||
@@ -452,6 +_,10 @@
|
@@ -441,6 +_,10 @@
|
||||||
|
|
||||||
for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
|
for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
|
||||||
MobEffect mobeffect = mobeffectinstance.m_19544_();
|
MobEffect mobeffect = mobeffectinstance.m_19544_();
|
||||||
+ net.minecraftforge.client.EffectRenderer renderer = net.minecraftforge.client.RenderProperties.getEffectRenderer(mobeffectinstance);
|
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
|
||||||
+ if (!renderer.shouldRenderHUD(mobeffectinstance)) continue;
|
+ if (!renderer.isVisibleInGui(mobeffectinstance)) continue;
|
||||||
+ // Rebind in case previous renderHUDEffect changed texture
|
+ // Rebind in case previous renderHUDEffect changed texture
|
||||||
+ RenderSystem.m_157456_(0, AbstractContainerScreen.f_97725_);
|
+ RenderSystem.m_157456_(0, AbstractContainerScreen.f_97725_);
|
||||||
if (mobeffectinstance.m_19575_()) {
|
if (mobeffectinstance.m_19575_()) {
|
||||||
int i = this.f_92977_;
|
int i = this.f_92977_;
|
||||||
int j = 1;
|
int j = 1;
|
||||||
@@ -489,6 +_,7 @@
|
@@ -469,6 +_,7 @@
|
||||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, f1);
|
}
|
||||||
m_93200_(p_93029_, l + 3, i1 + 3, this.m_93252_(), 18, 18, textureatlassprite);
|
}
|
||||||
});
|
|
||||||
+ renderer.renderHUDEffect(mobeffectinstance,this, p_93029_, i, j, this.m_93252_(), f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -609,12 +_,13 @@
|
+ if (renderer.renderGuiIcon(mobeffectinstance, this, p_93029_, i, j, this.m_93252_(), f)) continue;
|
||||||
|
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
|
||||||
|
int l = i;
|
||||||
|
int i1 = j;
|
||||||
|
@@ -598,12 +_,13 @@
|
||||||
public void m_93069_(PoseStack p_93070_) {
|
public void m_93069_(PoseStack p_93070_) {
|
||||||
this.f_92986_.m_91307_().m_6180_("selectedItemName");
|
this.f_92986_.m_91307_().m_6180_("selectedItemName");
|
||||||
if (this.f_92993_ > 0 && !this.f_92994_.m_41619_()) {
|
if (this.f_92993_ > 0 && !this.f_92994_.m_41619_()) {
|
||||||
@@ -43,12 +43,12 @@
|
|||||||
int j = (this.f_92977_ - i) / 2;
|
int j = (this.f_92977_ - i) / 2;
|
||||||
int k = this.f_92978_ - 59;
|
int k = this.f_92978_ - 59;
|
||||||
if (!this.f_92986_.f_91072_.m_105205_()) {
|
if (!this.f_92986_.f_91072_.m_105205_()) {
|
||||||
@@ -630,7 +_,13 @@
|
@@ -619,7 +_,13 @@
|
||||||
RenderSystem.m_69478_();
|
RenderSystem.m_69478_();
|
||||||
RenderSystem.m_69453_();
|
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));
|
m_93172_(p_93070_, j - 2, k - 2, j + i + 2, k + 9 + 2, this.f_92986_.f_91066_.m_92143_(0));
|
||||||
- this.m_93082_().m_92763_(p_93070_, mutablecomponent, (float)j, (float)k, 16777215 + (l << 24));
|
- this.m_93082_().m_92763_(p_93070_, mutablecomponent, (float)j, (float)k, 16777215 + (l << 24));
|
||||||
+ Font font = net.minecraftforge.client.RenderProperties.get(f_92994_).getFont(f_92994_);
|
+ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(f_92994_).getFont(f_92994_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME);
|
||||||
+ if (font == null) {
|
+ if (font == null) {
|
||||||
+ this.m_93082_().m_92763_(p_93070_, highlightTip, (float)j, (float)k, 16777215 + (l << 24));
|
+ this.m_93082_().m_92763_(p_93070_, highlightTip, (float)j, (float)k, 16777215 + (l << 24));
|
||||||
+ } else {
|
+ } else {
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
RenderSystem.m_69461_();
|
RenderSystem.m_69461_();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1144,7 +_,7 @@
|
@@ -1133,7 +_,7 @@
|
||||||
ItemStack itemstack = this.f_92986_.f_91074_.m_150109_().m_36056_();
|
ItemStack itemstack = this.f_92986_.f_91074_.m_150109_().m_36056_();
|
||||||
if (itemstack.m_41619_()) {
|
if (itemstack.m_41619_()) {
|
||||||
this.f_92993_ = 0;
|
this.f_92993_ = 0;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/gui/components/AbstractSelectionList.java
|
--- a/net/minecraft/client/gui/components/AbstractSelectionList.java
|
||||||
+++ b/net/minecraft/client/gui/components/AbstractSelectionList.java
|
+++ b/net/minecraft/client/gui/components/AbstractSelectionList.java
|
||||||
@@ -532,6 +_,13 @@
|
@@ -536,6 +_,13 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,21 @@
|
|||||||
--- a/net/minecraft/client/gui/components/BossHealthOverlay.java
|
--- a/net/minecraft/client/gui/components/BossHealthOverlay.java
|
||||||
+++ b/net/minecraft/client/gui/components/BossHealthOverlay.java
|
+++ b/net/minecraft/client/gui/components/BossHealthOverlay.java
|
||||||
@@ -34,6 +_,9 @@
|
@@ -34,6 +_,8 @@
|
||||||
|
|
||||||
for(LerpingBossEvent lerpingbossevent : this.f_93699_.values()) {
|
for(LerpingBossEvent lerpingbossevent : this.f_93699_.values()) {
|
||||||
int k = i / 2 - 91;
|
int k = i / 2 - 91;
|
||||||
+ net.minecraftforge.client.event.RenderGameOverlayEvent.BossInfo event =
|
+ var event = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(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()) {
|
+ if (!event.isCanceled()) {
|
||||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
RenderSystem.m_157456_(0, f_93697_);
|
RenderSystem.m_157456_(0, f_93697_);
|
||||||
this.m_93706_(p_93705_, k, j, lerpingbossevent);
|
this.m_93706_(p_93705_, k, j, lerpingbossevent);
|
||||||
@@ -42,7 +_,9 @@
|
@@ -42,7 +_,8 @@
|
||||||
int i1 = i / 2 - l / 2;
|
int i1 = i / 2 - l / 2;
|
||||||
int j1 = j - 9;
|
int j1 = j - 9;
|
||||||
this.f_93698_.f_91062_.m_92763_(p_93705_, component, (float)i1, (float)j1, 16777215);
|
this.f_93698_.f_91062_.m_92763_(p_93705_, component, (float)i1, (float)j1, 16777215);
|
||||||
- j += 10 + 9;
|
- j += 10 + 9;
|
||||||
+ }
|
+ }
|
||||||
+ j += event.getIncrement();
|
+ j += event.getIncrement();
|
||||||
+ net.minecraftforge.client.ForgeHooksClient.renderBossEventPost(p_93705_, this.f_93698_.m_91268_());
|
|
||||||
if (j >= this.f_93698_.m_91268_().m_85446_() / 3) {
|
if (j >= this.f_93698_.m_91268_().m_85446_() / 3) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
if (j2 + i > this.f_96543_) {
|
if (j2 + i > this.f_96543_) {
|
||||||
j2 -= 28 + i;
|
j2 -= 28 + i;
|
||||||
}
|
}
|
||||||
@@ -231,15 +_,16 @@
|
@@ -227,15 +_,16 @@
|
||||||
RenderSystem.m_157427_(GameRenderer::m_172811_);
|
RenderSystem.m_157427_(GameRenderer::m_172811_);
|
||||||
bufferbuilder.m_166779_(VertexFormat.Mode.QUADS, DefaultVertexFormat.f_85815_);
|
bufferbuilder.m_166779_(VertexFormat.Mode.QUADS, DefaultVertexFormat.f_85815_);
|
||||||
Matrix4f matrix4f = p_169384_.m_85850_().m_85861_();
|
Matrix4f matrix4f = p_169384_.m_85850_().m_85861_();
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
RenderSystem.m_69482_();
|
RenderSystem.m_69482_();
|
||||||
RenderSystem.m_69472_();
|
RenderSystem.m_69472_();
|
||||||
RenderSystem.m_69478_();
|
RenderSystem.m_69478_();
|
||||||
@@ -253,7 +_,7 @@
|
@@ -249,7 +_,7 @@
|
||||||
|
|
||||||
for(int i2 = 0; i2 < p_169385_.size(); ++i2) {
|
for(int i2 = 0; i2 < p_169385_.size(); ++i2) {
|
||||||
ClientTooltipComponent clienttooltipcomponent1 = p_169385_.get(i2);
|
ClientTooltipComponent clienttooltipcomponent1 = p_169385_.get(i2);
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
l1 += clienttooltipcomponent1.m_142103_() + (i2 == 0 ? 2 : 0);
|
l1 += clienttooltipcomponent1.m_142103_() + (i2 == 0 ? 2 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +_,7 @@
|
@@ -259,7 +_,7 @@
|
||||||
|
|
||||||
for(int l2 = 0; l2 < p_169385_.size(); ++l2) {
|
for(int l2 = 0; l2 < p_169385_.size(); ++l2) {
|
||||||
ClientTooltipComponent clienttooltipcomponent2 = p_169385_.get(l2);
|
ClientTooltipComponent clienttooltipcomponent2 = p_169385_.get(l2);
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
l1 += clienttooltipcomponent2.m_142103_() + (l2 == 0 ? 2 : 0);
|
l1 += clienttooltipcomponent2.m_142103_() + (l2 == 0 ? 2 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,9 +_,19 @@
|
@@ -361,9 +_,19 @@
|
||||||
this.f_96547_ = p_96607_.f_91062_;
|
this.f_96547_ = p_96607_.f_91062_;
|
||||||
this.f_96543_ = p_96608_;
|
this.f_96543_ = p_96608_;
|
||||||
this.f_96544_ = p_96609_;
|
this.f_96544_ = p_96609_;
|
||||||
@@ -156,32 +156,32 @@
|
|||||||
+ this.f_169368_.add(ne);
|
+ this.f_169368_.add(ne);
|
||||||
+ f_96540_.add(b);
|
+ f_96540_.add(b);
|
||||||
+ };
|
+ };
|
||||||
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.InitScreenEvent.Pre(this, this.f_96540_, add, this::m_169411_))) {
|
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.f_96540_, add, this::m_169411_))) {
|
||||||
this.m_232761_();
|
this.m_232761_();
|
||||||
this.m_169407_(false);
|
this.m_169407_(false);
|
||||||
this.m_169378_(f_169370_);
|
this.m_169378_(f_169370_);
|
||||||
+ }
|
+ }
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.InitScreenEvent.Post(this, this.f_96540_, add, this::m_169411_));
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.f_96540_, add, this::m_169411_));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void m_232761_() {
|
protected void m_232761_() {
|
||||||
@@ -394,6 +_,7 @@
|
@@ -392,6 +_,7 @@
|
||||||
public void m_96558_(PoseStack p_96559_, int p_96560_) {
|
public void m_96558_(PoseStack p_96559_, int p_96560_) {
|
||||||
if (this.f_96541_.f_91073_ != null) {
|
if (this.f_96541_.f_91073_ != null) {
|
||||||
this.m_93179_(p_96559_, 0, 0, this.f_96543_, this.f_96544_, -1072689136, -804253680);
|
this.m_93179_(p_96559_, 0, 0, this.f_96543_, this.f_96544_, -1072689136, -804253680);
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundDrawnEvent(this, p_96559_));
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, p_96559_));
|
||||||
} else {
|
} else {
|
||||||
this.m_96626_(p_96560_);
|
this.m_96626_(p_96560_);
|
||||||
}
|
}
|
||||||
@@ -413,6 +_,7 @@
|
@@ -411,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_((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_();
|
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_();
|
tesselator.m_85914_();
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundDrawnEvent(this, new PoseStack()));
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, new PoseStack()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean m_7043_() {
|
public boolean m_7043_() {
|
||||||
@@ -498,6 +_,10 @@
|
@@ -496,6 +_,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_7400_(List<Path> p_96591_) {
|
public void m_7400_(List<Path> p_96591_) {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/TitleScreen.java
|
--- a/net/minecraft/client/gui/screens/TitleScreen.java
|
||||||
+++ b/net/minecraft/client/gui/screens/TitleScreen.java
|
+++ b/net/minecraft/client/gui/screens/TitleScreen.java
|
||||||
@@ -66,6 +_,7 @@
|
@@ -68,6 +_,7 @@
|
||||||
private long f_96715_;
|
private long f_96715_;
|
||||||
@Nullable
|
@Nullable
|
||||||
private TitleScreen.WarningLabel f_232768_;
|
private TitleScreen.WarningLabel f_232768_;
|
||||||
+ private net.minecraftforge.client.gui.NotificationModUpdateScreen modUpdateNotification;
|
+ private net.minecraftforge.client.gui.TitleScreenModUpdateIndicator modUpdateNotification;
|
||||||
|
|
||||||
public TitleScreen() {
|
public TitleScreen() {
|
||||||
this(false);
|
this(false);
|
||||||
@@ -110,11 +_,16 @@
|
@@ -112,11 +_,16 @@
|
||||||
int j = this.f_96543_ - i - 2;
|
int j = this.f_96543_ - i - 2;
|
||||||
int k = 24;
|
int k = 24;
|
||||||
int l = this.f_96544_ / 4 + 48;
|
int l = this.f_96544_ / 4 + 48;
|
||||||
@@ -21,11 +21,11 @@
|
|||||||
+ this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this));
|
+ this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this));
|
||||||
+ }));
|
+ }));
|
||||||
}
|
}
|
||||||
+ modUpdateNotification = net.minecraftforge.client.gui.NotificationModUpdateScreen.init(this, modButton);
|
+ modUpdateNotification = net.minecraftforge.client.gui.TitleScreenModUpdateIndicator.init(this, modButton);
|
||||||
|
|
||||||
this.m_142416_(new ImageButton(this.f_96543_ / 2 - 124, l + 72 + 12, 20, 20, 0, 106, 20, Button.f_93617_, 256, 256, (p_96791_) -> {
|
this.m_142416_(new ImageButton(this.f_96543_ / 2 - 124, l + 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_()));
|
this.f_96541_.m_91152_(new LanguageSelectScreen(this, this.f_96541_.f_91066_, this.f_96541_.m_91102_()));
|
||||||
@@ -169,7 +_,7 @@
|
@@ -167,7 +_,7 @@
|
||||||
Screen screen = (Screen)(this.f_96541_.f_91066_.f_92083_ ? new JoinMultiplayerScreen(this) : new SafetyScreen(this));
|
Screen screen = (Screen)(this.f_96541_.f_91066_.f_92083_ ? new JoinMultiplayerScreen(this) : new SafetyScreen(this));
|
||||||
this.f_96541_.m_91152_(screen);
|
this.f_96541_.m_91152_(screen);
|
||||||
}, button$ontooltip))).f_93623_ = flag;
|
}, button$ontooltip))).f_93623_ = flag;
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
this.m_96793_();
|
this.m_96793_();
|
||||||
}, button$ontooltip))).f_93623_ = flag;
|
}, button$ontooltip))).f_93623_ = flag;
|
||||||
}
|
}
|
||||||
@@ -298,6 +_,7 @@
|
@@ -310,6 +_,7 @@
|
||||||
this.f_232768_.m_232790_(p_96739_, l);
|
this.f_232768_.m_232790_(p_96739_, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
if (this.f_96721_ != null) {
|
if (this.f_96721_ != null) {
|
||||||
p_96739_.m_85836_();
|
p_96739_.m_85836_();
|
||||||
p_96739_.m_85837_((double)(this.f_96543_ / 2 + 90), 70.0D, 0.0D);
|
p_96739_.m_85837_((double)(this.f_96543_ / 2 + 90), 70.0D, 0.0D);
|
||||||
@@ -320,7 +_,14 @@
|
@@ -332,7 +_,14 @@
|
||||||
s = s + I18n.m_118938_("menu.modded");
|
s = s + I18n.m_118938_("menu.modded");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,8 +58,8 @@
|
|||||||
|
|
||||||
for(GuiEventListener guieventlistener : this.m_6702_()) {
|
for(GuiEventListener guieventlistener : this.m_6702_()) {
|
||||||
if (guieventlistener instanceof AbstractWidget) {
|
if (guieventlistener instanceof AbstractWidget) {
|
||||||
@@ -332,6 +_,7 @@
|
@@ -345,6 +_,7 @@
|
||||||
if (this.m_96789_() && f1 >= 1.0F) {
|
RenderSystem.m_69482_();
|
||||||
this.f_96726_.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_);
|
this.f_96726_.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_);
|
||||||
}
|
}
|
||||||
+ if (f1 >= 1.0f) modUpdateNotification.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_);
|
+ if (f1 >= 1.0f) modUpdateNotification.m_6305_(p_96739_, p_96740_, p_96741_, p_96742_);
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
+ private static int tabPage, maxPages;
|
+ private static int tabPage, maxPages;
|
||||||
|
|
||||||
public AdvancementsScreen(ClientAdvancements p_97340_) {
|
public AdvancementsScreen(ClientAdvancements p_97340_) {
|
||||||
super(NarratorChatListener.f_93310_);
|
super(GameNarrator.f_93310_);
|
||||||
@@ -57,7 +_,13 @@
|
@@ -57,7 +_,13 @@
|
||||||
} else {
|
} else {
|
||||||
this.f_97334_.m_104401_(this.f_97336_ == null ? null : this.f_97336_.m_97182_(), true);
|
this.f_97334_.m_104401_(this.f_97336_ == null ? null : this.f_97336_.m_97182_(), true);
|
||||||
|
|||||||
+3
-3
@@ -4,7 +4,7 @@
|
|||||||
int i = this.f_97735_;
|
int i = this.f_97735_;
|
||||||
int j = this.f_97736_;
|
int j = this.f_97736_;
|
||||||
this.m_7286_(p_97795_, p_97798_, p_97796_, p_97797_);
|
this.m_7286_(p_97795_, p_97798_, p_97796_, p_97797_);
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.DrawBackground(this, p_97795_, p_97796_, p_97797_));
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.Render.Background(this, p_97795_, p_97796_, p_97797_));
|
||||||
RenderSystem.m_69465_();
|
RenderSystem.m_69465_();
|
||||||
super.m_6305_(p_97795_, p_97796_, p_97797_, p_97798_);
|
super.m_6305_(p_97795_, p_97796_, p_97797_, p_97798_);
|
||||||
PoseStack posestack = RenderSystem.m_157191_();
|
PoseStack posestack = RenderSystem.m_157191_();
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.m_7027_(p_97795_, p_97796_, p_97797_);
|
this.m_7027_(p_97795_, p_97796_, p_97797_);
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.DrawForeground(this, p_97795_, p_97796_, p_97797_));
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.Render.Foreground(this, p_97795_, p_97796_, p_97797_));
|
||||||
ItemStack itemstack = this.f_97711_.m_41619_() ? this.f_97732_.m_142621_() : this.f_97711_;
|
ItemStack itemstack = this.f_97711_.m_41619_() ? this.f_97732_.m_142621_() : this.f_97711_;
|
||||||
if (!itemstack.m_41619_()) {
|
if (!itemstack.m_41619_()) {
|
||||||
int l1 = 8;
|
int l1 = 8;
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
RenderSystem.m_157182_();
|
RenderSystem.m_157182_();
|
||||||
this.m_93250_(200);
|
this.m_93250_(200);
|
||||||
this.f_96542_.f_115093_ = 200.0F;
|
this.f_96542_.f_115093_ = 200.0F;
|
||||||
+ net.minecraft.client.gui.Font font = net.minecraftforge.client.RenderProperties.get(p_97783_).getFont(p_97783_);
|
+ var font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_97783_).getFont(p_97783_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.ITEM_COUNT);
|
||||||
+ if (font == null) font = this.f_96547_;
|
+ if (font == null) font = this.f_96547_;
|
||||||
this.f_96542_.m_115203_(p_97783_, p_97784_, p_97785_);
|
this.f_96542_.m_115203_(p_97783_, p_97784_, p_97785_);
|
||||||
- this.f_96542_.m_115174_(this.f_96547_, p_97783_, p_97784_, p_97785_ - (this.f_97711_.m_41619_() ? 0 : 8), p_97786_);
|
- this.f_96542_.m_115174_(this.f_96547_, p_97783_, p_97784_, p_97785_ - (this.f_97711_.m_41619_() ? 0 : 8), p_97786_);
|
||||||
|
|||||||
+1
-1
@@ -251,7 +251,7 @@
|
|||||||
this.m_93228_(p_98582_, l, i1, j, k, 28, 32);
|
this.m_93228_(p_98582_, l, i1, j, k, 28, 32);
|
||||||
this.f_96542_.f_115093_ = 100.0F;
|
this.f_96542_.f_115093_ = 100.0F;
|
||||||
l += 6;
|
l += 6;
|
||||||
@@ -907,6 +_,22 @@
|
@@ -909,6 +_,22 @@
|
||||||
|
|
||||||
public boolean m_8010_(Player p_98665_) {
|
public boolean m_8010_(Player p_98665_) {
|
||||||
return this.f_98655_.m_8010_(p_98665_);
|
return this.f_98655_.m_8010_(p_98665_);
|
||||||
|
|||||||
+19
-7
@@ -1,11 +1,12 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
--- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
||||||
+++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
+++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
|
||||||
@@ -42,12 +_,15 @@
|
@@ -42,12 +_,16 @@
|
||||||
if (!collection.isEmpty() && j >= 32) {
|
if (!collection.isEmpty() && j >= 32) {
|
||||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
boolean flag = j >= 120;
|
boolean flag = j >= 120;
|
||||||
+ var event = net.minecraftforge.client.ForgeHooksClient.onScreenPotionSize(this);
|
+ var event = net.minecraftforge.client.ForgeHooksClient.onScreenPotionSize(this, j, !flag);
|
||||||
+ if (event != net.minecraftforge.eventbus.api.Event.Result.DEFAULT) flag = event == net.minecraftforge.eventbus.api.Event.Result.DENY; // true means classic mode
|
+ if (event == 0) return; // 0 = cancel rendering
|
||||||
|
+ flag = event == 2; // 2 = full-size / 1 = compact
|
||||||
int k = 33;
|
int k = 33;
|
||||||
if (collection.size() > 5) {
|
if (collection.size() > 5) {
|
||||||
k = 132 / (collection.size() - 1);
|
k = 132 / (collection.size() - 1);
|
||||||
@@ -17,13 +18,24 @@
|
|||||||
this.m_194002_(p_194015_, i, k, iterable, flag);
|
this.m_194002_(p_194015_, i, k, iterable, flag);
|
||||||
this.m_194008_(p_194015_, i, k, iterable, flag);
|
this.m_194008_(p_194015_, i, k, iterable, flag);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
@@ -108,6 +_,12 @@
|
@@ -95,6 +_,11 @@
|
||||||
|
int i = this.f_97736_;
|
||||||
|
|
||||||
|
for(MobEffectInstance mobeffectinstance : p_194012_) {
|
||||||
|
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
|
||||||
|
+ if (renderer.renderInventoryIcon(mobeffectinstance, this, p_194009_, p_194010_ + (p_194013_ ? 6 : 7), i, this.m_93252_())) {
|
||||||
|
+ i += p_194011_;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
MobEffect mobeffect = mobeffectinstance.m_19544_();
|
||||||
|
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
|
||||||
|
RenderSystem.m_157456_(0, textureatlassprite.m_118414_().m_118330_());
|
||||||
|
@@ -108,6 +_,11 @@
|
||||||
int i = this.f_97736_;
|
int i = this.f_97736_;
|
||||||
|
|
||||||
for(MobEffectInstance mobeffectinstance : p_98726_) {
|
for(MobEffectInstance mobeffectinstance : p_98726_) {
|
||||||
+ net.minecraftforge.client.EffectRenderer renderer = net.minecraftforge.client.RenderProperties.getEffectRenderer(mobeffectinstance);
|
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
|
||||||
+ renderer.renderInventoryEffect(mobeffectinstance, this, p_98723_, p_98724_, i, this.m_93252_());
|
+ if (renderer.renderInventoryText(mobeffectinstance, this, p_98723_, p_98724_, i, this.m_93252_())) {
|
||||||
+ if (!renderer.shouldRenderInvText(mobeffectinstance)) {
|
|
||||||
+ i += p_98725_;
|
+ i += p_98725_;
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
--- a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
|
||||||
|
+++ b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
|
||||||
|
@@ -240,7 +_,12 @@
|
||||||
|
this.f_96542_.m_115169_(this.f_96547_, p_99164_, p_99166_, p_99167_);
|
||||||
|
} else {
|
||||||
|
this.f_96542_.m_115174_(this.f_96547_, p_99165_, p_99166_, p_99167_, p_99165_.m_41613_() == 1 ? "1" : null);
|
||||||
|
- this.f_96542_.m_115174_(this.f_96547_, p_99164_, p_99166_ + 14, p_99167_, p_99164_.m_41613_() == 1 ? "1" : null);
|
||||||
|
+ // Forge: fixes Forge-8806, code for count rendering taken from ItemRenderer#renderGuiItemDecorations
|
||||||
|
+ PoseStack posestack = new PoseStack();
|
||||||
|
+ posestack.m_85837_(0.0D, 0.0D, (f_96542_.f_115093_ + 200.0F));
|
||||||
|
+ net.minecraft.client.renderer.MultiBufferSource.BufferSource bufferSource = net.minecraft.client.renderer.MultiBufferSource.m_109898_(com.mojang.blaze3d.vertex.Tesselator.m_85913_().m_85915_());
|
||||||
|
+ f_96547_.m_92811_(String.valueOf(p_99164_.m_41613_()), (p_99166_ + 14) + 19 - 2 - f_96547_.m_92895_(String.valueOf(p_99164_.m_41613_())), p_99167_ + 6 + 3, 0xFFFFFF, true, posestack.m_85850_().m_85861_(), bufferSource, false, 0, 15728880);
|
||||||
|
+ bufferSource.m_109911_();
|
||||||
|
RenderSystem.m_157427_(GameRenderer::m_172817_);
|
||||||
|
RenderSystem.m_157456_(0, f_99113_);
|
||||||
|
this.m_93250_(this.m_93252_() + 300);
|
||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
if (p_169951_ instanceof BundleTooltip) {
|
if (p_169951_ instanceof BundleTooltip) {
|
||||||
return new ClientBundleTooltip((BundleTooltip)p_169951_);
|
return new ClientBundleTooltip((BundleTooltip)p_169951_);
|
||||||
} else {
|
} else {
|
||||||
+ ClientTooltipComponent result = net.minecraftforge.client.MinecraftForgeClient.getClientTooltipComponent(p_169951_);
|
+ ClientTooltipComponent result = net.minecraftforge.client.gui.ClientTooltipComponentManager.createClientTooltipComponent(p_169951_);
|
||||||
+ if (result != null) return result;
|
+ if (result != null) return result;
|
||||||
throw new IllegalArgumentException("Unknown TooltipComponent");
|
throw new IllegalArgumentException("Unknown TooltipComponent");
|
||||||
}
|
}
|
||||||
|
|||||||
+30
@@ -1,5 +1,35 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||||
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
|
||||||
|
@@ -112,7 +_,7 @@
|
||||||
|
public static void m_232896_(Minecraft p_232897_, @Nullable Screen p_232898_) {
|
||||||
|
m_232899_(p_232897_, f_232866_);
|
||||||
|
PackRepository packrepository = new PackRepository(PackType.SERVER_DATA, new ServerPacksSource());
|
||||||
|
- WorldLoader.InitConfig worldloader$initconfig = m_232872_(packrepository, DataPackConfig.f_45842_);
|
||||||
|
+ WorldLoader.InitConfig worldloader$initconfig = m_232872_(packrepository, new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of())); // FORGE: Load vanilla fallback with vanilla datapacks.
|
||||||
|
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.m_214362_(worldloader$initconfig, (p_232935_, p_232936_) -> {
|
||||||
|
RegistryAccess.Frozen registryaccess$frozen = RegistryAccess.m_206197_().m_203557_();
|
||||||
|
WorldGenSettings worldgensettings = WorldPresets.m_226449_(registryaccess$frozen);
|
||||||
|
@@ -122,7 +_,10 @@
|
||||||
|
return new WorldCreationContext(p_232884_, Lifecycle.stable(), p_232883_, p_232882_);
|
||||||
|
}, Util.m_183991_(), p_232897_);
|
||||||
|
p_232897_.m_18701_(completablefuture::isDone);
|
||||||
|
- p_232897_.m_91152_(new CreateWorldScreen(p_232898_, DataPackConfig.f_45842_, new WorldGenSettingsComponent(completablefuture.join(), Optional.of(WorldPresets.f_226437_), OptionalLong.empty())));
|
||||||
|
+ // FORGE: Force load mods' datapacks after setting screen and ensure datapack selection reverts to vanilla if invalid.
|
||||||
|
+ CreateWorldScreen createWorldScreen = new CreateWorldScreen(p_232898_, new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), new WorldGenSettingsComponent(completablefuture.join(), Optional.of(WorldPresets.f_226437_), OptionalLong.empty()));
|
||||||
|
+ p_232897_.m_91152_(createWorldScreen);
|
||||||
|
+ createWorldScreen.m_100878_(packrepository);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CreateWorldScreen m_205426_(@Nullable Screen p_205427_, WorldStem p_205428_, @Nullable Path p_205429_) {
|
||||||
|
@@ -478,7 +_,7 @@
|
||||||
|
if (p_232949_) {
|
||||||
|
this.m_100975_();
|
||||||
|
} else {
|
||||||
|
- this.f_100846_ = DataPackConfig.f_45842_;
|
||||||
|
+ this.f_100846_ = new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()); // FORGE: Revert to *actual* vanilla data
|
||||||
|
this.f_96541_.m_91152_(this);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -653,6 +_,7 @@
|
@@ -653,6 +_,7 @@
|
||||||
File file1 = path.toFile();
|
File file1 = path.toFile();
|
||||||
if (this.f_100832_ == null) {
|
if (this.f_100832_ == null) {
|
||||||
|
|||||||
+22
-6
@@ -1,13 +1,29 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
|
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
|
||||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
|
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
|
||||||
@@ -66,6 +_,7 @@
|
@@ -132,13 +_,23 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
private void m_233145_(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_) {
|
||||||
|
+ // FORGE: Patch in overload to reduce further patching
|
||||||
|
+ this.doLoadLevel(p_233146_, p_233147_, p_233148_, p_233149_, false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // FORGE: Patch in confirmExperimentalWarning which confirms the experimental warning when true
|
||||||
|
+ private void doLoadLevel(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_, boolean confirmExperimentalWarning) {
|
||||||
|
LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = this.m_233155_(p_233147_);
|
||||||
|
if (levelstoragesource$levelstorageaccess != null) {
|
||||||
|
PackRepository packrepository = m_233105_(levelstoragesource$levelstorageaccess);
|
||||||
|
|
||||||
|
WorldStem worldstem;
|
||||||
try {
|
try {
|
||||||
WorldLoader.PackConfig worldloader$packconfig = new WorldLoader.PackConfig(packrepository, datapackconfig, false);
|
|
||||||
+ levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData(); // Read extra (e.g. modded) data from the world before creating it
|
+ levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData(); // Read extra (e.g. modded) data from the world before creating it
|
||||||
WorldStem worldstem = this.m_233096_(worldloader$packconfig, (p_233103_, p_233104_) -> {
|
worldstem = this.m_233122_(levelstoragesource$levelstorageaccess, p_233148_, packrepository);
|
||||||
return Pair.of(new PrimaryLevelData(p_233159_, p_233161_, Lifecycle.stable()), p_233160_.m_203557_());
|
+ if (confirmExperimentalWarning && worldstem.f_206895_() instanceof PrimaryLevelData pld) {
|
||||||
});
|
+ pld.withConfirmedWarning(true);
|
||||||
|
+ }
|
||||||
|
} catch (Exception exception) {
|
||||||
|
f_233088_.warn("Failed to load datapacks, can't proceed with server load", (Throwable)exception);
|
||||||
|
this.f_233089_.m_91152_(new DatapackLoadFailureScreen(() -> {
|
||||||
@@ -151,7 +_,9 @@
|
@@ -151,7 +_,9 @@
|
||||||
WorldData worlddata = worldstem.f_206895_();
|
WorldData worlddata = worldstem.f_206895_();
|
||||||
boolean flag = worlddata.m_5961_().m_64670_();
|
boolean flag = worlddata.m_5961_().m_64670_();
|
||||||
@@ -27,7 +43,7 @@
|
|||||||
this.m_233140_(p_233146_, p_233147_, flag, () -> {
|
this.m_233140_(p_233146_, p_233147_, flag, () -> {
|
||||||
this.m_233145_(p_233146_, p_233147_, p_233148_, false);
|
this.m_233145_(p_233146_, p_233147_, p_233148_, false);
|
||||||
});
|
});
|
||||||
+ else net.minecraftforge.client.ForgeHooksClient.createWorldConfirmationScreen(p_233147_, levelstoragesource$levelstorageaccess, packrepository, worldstem);
|
+ else net.minecraftforge.client.ForgeHooksClient.createWorldConfirmationScreen(() -> this.doLoadLevel(p_233146_, p_233147_, p_233148_, false, true));
|
||||||
worldstem.close();
|
worldstem.close();
|
||||||
m_233116_(levelstoragesource$levelstorageaccess, p_233147_);
|
m_233116_(levelstoragesource$levelstorageaccess, p_233147_);
|
||||||
}
|
}
|
||||||
+6
-4
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
|
--- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
|
||||||
+++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
|
+++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
|
||||||
@@ -68,6 +_,7 @@
|
@@ -65,6 +_,7 @@
|
||||||
static final DateFormat f_101646_ = new SimpleDateFormat();
|
static final DateFormat f_101646_ = new SimpleDateFormat();
|
||||||
static final ResourceLocation f_101647_ = new ResourceLocation("textures/misc/unknown_server.png");
|
static final ResourceLocation f_101647_ = new ResourceLocation("textures/misc/unknown_server.png");
|
||||||
static final ResourceLocation f_101648_ = new ResourceLocation("textures/gui/world_selection.png");
|
static final ResourceLocation f_101648_ = new ResourceLocation("textures/gui/world_selection.png");
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
static final Component f_101649_ = Component.m_237115_("selectWorld.tooltip.fromNewerVersion1").m_130940_(ChatFormatting.RED);
|
static final Component f_101649_ = Component.m_237115_("selectWorld.tooltip.fromNewerVersion1").m_130940_(ChatFormatting.RED);
|
||||||
static final Component f_101650_ = Component.m_237115_("selectWorld.tooltip.fromNewerVersion2").m_130940_(ChatFormatting.RED);
|
static final Component f_101650_ = Component.m_237115_("selectWorld.tooltip.fromNewerVersion2").m_130940_(ChatFormatting.RED);
|
||||||
static final Component f_101651_ = Component.m_237115_("selectWorld.tooltip.snapshot1").m_130940_(ChatFormatting.GOLD);
|
static final Component f_101651_ = Component.m_237115_("selectWorld.tooltip.snapshot1").m_130940_(ChatFormatting.GOLD);
|
||||||
@@ -326,6 +_,7 @@
|
@@ -325,6 +_,7 @@
|
||||||
RenderSystem.m_69478_();
|
RenderSystem.m_69478_();
|
||||||
GuiComponent.m_93133_(p_101721_, p_101724_, p_101723_, 0.0F, 0.0F, 32, 32, 32, 32);
|
GuiComponent.m_93133_(p_101721_, p_101724_, p_101723_, 0.0F, 0.0F, 32, 32, 32, 32);
|
||||||
RenderSystem.m_69461_();
|
RenderSystem.m_69461_();
|
||||||
@@ -16,17 +16,19 @@
|
|||||||
if (this.f_101693_.f_91066_.m_231828_().m_231551_() || p_101729_) {
|
if (this.f_101693_.f_91066_.m_231828_().m_231551_() || p_101729_) {
|
||||||
RenderSystem.m_157456_(0, WorldSelectionList.f_101648_);
|
RenderSystem.m_157456_(0, WorldSelectionList.f_101648_);
|
||||||
GuiComponent.m_93172_(p_101721_, p_101724_, p_101723_, p_101724_ + 32, p_101723_ + 32, -1601138544);
|
GuiComponent.m_93172_(p_101721_, p_101724_, p_101723_, p_101724_ + 32, p_101723_ + 32, -1601138544);
|
||||||
@@ -647,6 +_,19 @@
|
@@ -646,6 +_,21 @@
|
||||||
|
|
||||||
public boolean m_214209_() {
|
public boolean m_214209_() {
|
||||||
return !this.f_101695_.m_164916_();
|
return !this.f_101695_.m_164916_();
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ // FORGE: Patch in experimental warning icon for worlds in the world selection screen
|
||||||
+ private void renderExperimentalWarning(PoseStack stack, int mouseX, int mouseY, int top, int left) {
|
+ private void renderExperimentalWarning(PoseStack stack, int mouseX, int mouseY, int top, int left) {
|
||||||
+ if (this.f_101695_.isExperimental()) {
|
+ if (this.f_101695_.isExperimental()) {
|
||||||
+ int leftStart = left + WorldSelectionList.this.m_5759_();
|
+ int leftStart = left + WorldSelectionList.this.m_5759_();
|
||||||
+ RenderSystem.m_157456_(0, WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON);
|
+ RenderSystem.m_157456_(0, WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON);
|
||||||
+ GuiComponent.m_93133_(stack, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32);
|
+ GuiComponent.m_93133_(stack, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32);
|
||||||
+ //Reset texture to what it was before
|
+ // Reset texture to what it was before
|
||||||
+ RenderSystem.m_157456_(0, this.f_101698_ != null ? this.f_101696_ : WorldSelectionList.f_101647_);
|
+ RenderSystem.m_157456_(0, this.f_101698_ != null ? this.f_101696_ : WorldSelectionList.f_101647_);
|
||||||
+ if (WorldSelectionList.this.m_93412_(mouseX, mouseY) == this && mouseX > leftStart - 36 && mouseX < leftStart) {
|
+ if (WorldSelectionList.this.m_93412_(mouseX, mouseY) == this && mouseX > leftStart - 36 && mouseX < leftStart) {
|
||||||
+ List<net.minecraft.util.FormattedCharSequence> tooltip = Minecraft.m_91087_().f_91062_.m_92923_(Component.m_237115_("forge.experimentalsettings.tooltip"), 200);
|
+ List<net.minecraft.util.FormattedCharSequence> tooltip = Minecraft.m_91087_().f_91062_.m_92923_(Component.m_237115_("forge.experimentalsettings.tooltip"), 200);
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
--- a/net/minecraft/client/main/Main.java
|
--- a/net/minecraft/client/main/Main.java
|
||||||
+++ b/net/minecraft/client/main/Main.java
|
+++ b/net/minecraft/client/main/Main.java
|
||||||
@@ -135,7 +_,7 @@
|
@@ -48,7 +_,7 @@
|
||||||
|
|
||||||
|
@DontObfuscate
|
||||||
|
public static void main(String[] p_129642_) {
|
||||||
|
- m_239872_(p_129642_, true);
|
||||||
|
+ m_239872_(p_129642_, !net.minecraftforge.fml.loading.FMLConfig.isOptimizedDFUDisabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void m_239872_(String[] p_239873_, boolean p_239874_) {
|
||||||
|
@@ -142,7 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
CrashReport.m_127529_();
|
CrashReport.m_127529_();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
int i = this.f_104410_.m_104481_(p_104456_, p_104457_);
|
int i = this.f_104410_.m_104481_(p_104456_, p_104457_);
|
||||||
LevelChunk levelchunk = this.f_104410_.m_104479_(i);
|
LevelChunk levelchunk = this.f_104410_.m_104479_(i);
|
||||||
if (m_104438_(levelchunk, p_104456_, p_104457_)) {
|
if (m_104438_(levelchunk, p_104456_, p_104457_)) {
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Unload(levelchunk));
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.ChunkEvent.Unload(levelchunk));
|
||||||
this.f_104410_.m_104487_(i, levelchunk, (LevelChunk)null);
|
this.f_104410_.m_104487_(i, levelchunk, (LevelChunk)null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.f_104411_.m_171649_(chunkpos);
|
this.f_104411_.m_171649_(chunkpos);
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(levelchunk));
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(levelchunk));
|
||||||
return levelchunk;
|
return levelchunk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
||||||
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
|
||||||
@@ -126,6 +_,7 @@
|
@@ -130,6 +_,7 @@
|
||||||
this.f_104521_.accept(Component.m_237115_("connect.joining"));
|
this.f_104521_.accept(Component.m_237115_("connect.joining"));
|
||||||
this.f_104523_ = p_104547_.m_134774_();
|
this.f_104523_ = p_104547_.m_134774_();
|
||||||
this.f_104522_.m_129498_(ConnectionProtocol.PLAY);
|
this.f_104522_.m_129498_(ConnectionProtocol.PLAY);
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
this.f_104522_.m_129505_(new ClientPacketListener(this.f_104519_, this.f_104520_, this.f_104522_, this.f_104523_, this.f_104519_.m_193590_()));
|
this.f_104522_.m_129505_(new ClientPacketListener(this.f_104519_, this.f_104520_, this.f_104522_, this.f_104523_, this.f_104519_.m_193590_()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +_,7 @@
|
@@ -137,7 +_,7 @@
|
||||||
if (this.f_104520_ != null && this.f_104520_ instanceof RealmsScreen) {
|
if (this.f_104520_ != null && this.f_104520_ instanceof RealmsScreen) {
|
||||||
this.f_104519_.m_91152_(new DisconnectedRealmsScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_));
|
this.f_104519_.m_91152_(new DisconnectedRealmsScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_));
|
||||||
} else {
|
} else {
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -154,6 +_,7 @@
|
@@ -158,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_7254_(ClientboundCustomQueryPacket p_104545_) {
|
public void m_7254_(ClientboundCustomQueryPacket p_104545_) {
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
--- a/net/minecraft/client/multiplayer/ClientLevel.java
|
--- a/net/minecraft/client/multiplayer/ClientLevel.java
|
||||||
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
|
+++ b/net/minecraft/client/multiplayer/ClientLevel.java
|
||||||
@@ -121,6 +_,7 @@
|
@@ -121,6 +_,8 @@
|
||||||
private int f_194123_;
|
private int f_194123_;
|
||||||
private final BlockStatePredictionHandler f_233599_ = new BlockStatePredictionHandler();
|
private final BlockStatePredictionHandler f_233599_ = new BlockStatePredictionHandler();
|
||||||
private static final Set<Item> f_194124_ = Set.of(Items.f_42127_, Items.f_151033_);
|
private static final Set<Item> f_194124_ = Set.of(Items.f_42127_, Items.f_151033_);
|
||||||
+ private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<net.minecraftforge.entity.PartEntity<?>> partEntities = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>();
|
+ private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<net.minecraftforge.entity.PartEntity<?>> partEntities = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>();
|
||||||
|
+ private final net.minecraftforge.client.model.data.ModelDataManager modelDataManager = new net.minecraftforge.client.model.data.ModelDataManager(this);
|
||||||
|
|
||||||
public void m_233651_(int p_233652_) {
|
public void m_233651_(int p_233652_) {
|
||||||
this.f_233599_.m_233856_(p_233652_, this);
|
this.f_233599_.m_233856_(p_233652_, this);
|
||||||
@@ -13,7 +14,7 @@
|
|||||||
this.m_46465_();
|
this.m_46465_();
|
||||||
this.m_46466_();
|
this.m_46466_();
|
||||||
+ this.gatherCapabilities();
|
+ this.gatherCapabilities();
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this));
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Load(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_194171_(Runnable p_194172_) {
|
public void m_194171_(Runnable p_194172_) {
|
||||||
@@ -29,7 +30,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void m_104739_(int p_104740_, Entity p_104741_) {
|
private void m_104739_(int p_104740_, Entity p_104741_) {
|
||||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(p_104741_, this))) return;
|
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinLevelEvent(p_104741_, this))) return;
|
||||||
this.m_171642_(p_104740_, Entity.RemovalReason.DISCARDED);
|
this.m_171642_(p_104740_, Entity.RemovalReason.DISCARDED);
|
||||||
this.f_171631_.m_157653_(p_104741_);
|
this.f_171631_.m_157653_(p_104741_);
|
||||||
+ p_104741_.onAddedToWorld();
|
+ p_104741_.onAddedToWorld();
|
||||||
@@ -53,7 +54,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void m_213890_(@Nullable Player p_233631_, Entity p_233632_, SoundEvent p_233633_, SoundSource p_233634_, float p_233635_, float p_233636_, long p_233637_) {
|
public void m_213890_(@Nullable Player p_233631_, Entity p_233632_, SoundEvent p_233633_, SoundSource p_233634_, float p_233635_, float p_233636_, long p_233637_) {
|
||||||
+ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_233631_, p_233633_, p_233634_, p_233635_, p_233636_);
|
+ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_233632_, p_233633_, p_233634_, p_233635_, p_233636_);
|
||||||
+ if (event.isCanceled() || event.getSound() == null) return;
|
+ if (event.isCanceled() || event.getSound() == null) return;
|
||||||
+ p_233633_ = event.getSound();
|
+ p_233633_ = event.getSound();
|
||||||
+ p_233634_ = event.getSource();
|
+ p_233634_ = event.getSource();
|
||||||
@@ -70,7 +71,7 @@
|
|||||||
this.f_104840_ = p_104852_;
|
this.f_104840_ = p_104852_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -939,14 +_,33 @@
|
@@ -939,14 +_,46 @@
|
||||||
ClientLevel.this.f_104566_.add((AbstractClientPlayer)p_171712_);
|
ClientLevel.this.f_104566_.add((AbstractClientPlayer)p_171712_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,8 +86,8 @@
|
|||||||
p_171716_.m_19877_();
|
p_171716_.m_19877_();
|
||||||
ClientLevel.this.f_104566_.remove(p_171716_);
|
ClientLevel.this.f_104566_.remove(p_171716_);
|
||||||
+
|
+
|
||||||
+ p_171716_.onRemovedFromWorld();
|
+ p_171716_.onRemovedFromWorld();
|
||||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityLeaveWorldEvent(p_171716_, ClientLevel.this));
|
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityLeaveLevelEvent(p_171716_, ClientLevel.this));
|
||||||
+
|
+
|
||||||
+ if (p_171716_.isMultipartEntity()) {
|
+ if (p_171716_.isMultipartEntity()) {
|
||||||
+ for (net.minecraftforge.entity.PartEntity<?> part : p_171716_.getParts()) {
|
+ for (net.minecraftforge.entity.PartEntity<?> part : p_171716_.getParts()) {
|
||||||
@@ -102,5 +103,18 @@
|
|||||||
+ @Override
|
+ @Override
|
||||||
+ public java.util.Collection<net.minecraftforge.entity.PartEntity<?>> getPartEntities() {
|
+ public java.util.Collection<net.minecraftforge.entity.PartEntity<?>> getPartEntities() {
|
||||||
+ return this.partEntities.values();
|
+ return this.partEntities.values();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public net.minecraftforge.client.model.data.ModelDataManager getModelDataManager() {
|
||||||
|
+ return modelDataManager;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public float getShade(float normalX, float normalY, float normalZ, boolean shade) {
|
||||||
|
+ boolean constantAmbientLight = this.m_104583_().m_108885_();
|
||||||
|
+ if (!shade)
|
||||||
|
+ return constantAmbientLight ? 0.9F : 1.0F;
|
||||||
|
+ return net.minecraftforge.client.model.lighting.QuadLighter.calculateShade(normalX, normalY, normalZ, constantAmbientLight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+21
-20
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
|
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
|
||||||
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
|
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
|
||||||
@@ -361,6 +_,7 @@
|
@@ -375,6 +_,7 @@
|
||||||
|
|
||||||
this.f_104888_.f_91064_.m_113434_();
|
this.f_104888_.f_91064_.m_113434_();
|
||||||
this.f_104888_.f_91074_.m_172530_();
|
this.f_104888_.f_91074_.m_172530_();
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
int i = p_105030_.f_132360_();
|
int i = p_105030_.f_132360_();
|
||||||
this.f_104888_.f_91074_.m_20234_(i);
|
this.f_104888_.f_91074_.m_20234_(i);
|
||||||
this.f_104889_.m_104630_(i, this.f_104888_.f_91074_);
|
this.f_104889_.m_104630_(i, this.f_104888_.f_91074_);
|
||||||
@@ -373,6 +_,7 @@
|
@@ -387,6 +_,7 @@
|
||||||
this.f_104888_.f_91074_.m_219749_(p_105030_.f_238174_());
|
this.f_104888_.f_91074_.m_219749_(p_105030_.f_238174_());
|
||||||
this.f_104888_.f_91072_.m_171805_(p_105030_.f_132363_(), p_105030_.f_132364_());
|
this.f_104888_.f_91072_.m_171805_(p_105030_.f_132363_(), p_105030_.f_132364_());
|
||||||
this.f_104888_.f_91066_.m_193770_(p_105030_.f_132370_());
|
this.f_104888_.f_91066_.m_193770_(p_105030_.f_132370_());
|
||||||
@@ -16,16 +16,7 @@
|
|||||||
this.f_104888_.f_91066_.m_92172_();
|
this.f_104888_.f_91066_.m_92172_();
|
||||||
this.f_104885_.m_129512_(new ServerboundCustomPayloadPacket(ServerboundCustomPayloadPacket.f_133979_, (new FriendlyByteBuf(Unpooled.buffer())).m_130070_(ClientBrandRetriever.m_129629_())));
|
this.f_104885_.m_129512_(new ServerboundCustomPayloadPacket(ServerboundCustomPayloadPacket.f_133979_, (new FriendlyByteBuf(Unpooled.buffer())).m_130070_(ClientBrandRetriever.m_129629_())));
|
||||||
this.f_104888_.m_91309_().m_90739_();
|
this.f_104888_.m_91309_().m_90739_();
|
||||||
@@ -768,6 +_,8 @@
|
@@ -941,8 +_,10 @@
|
||||||
}
|
|
||||||
|
|
||||||
Component component = flag ? p_233693_.f_237213_() : p_233693_.m_237220_();
|
|
||||||
+ component = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_233692_, component, p_233694_);
|
|
||||||
+ if (component == null) return;
|
|
||||||
this.f_104888_.f_91065_.m_232360_(p_233692_, component, p_233694_);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -931,8 +_,10 @@
|
|
||||||
localplayer1.m_21204_().m_22159_(localplayer.m_21204_());
|
localplayer1.m_21204_().m_22159_(localplayer.m_21204_());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +27,7 @@
|
|||||||
this.f_104889_.m_104630_(i, localplayer1);
|
this.f_104889_.m_104630_(i, localplayer1);
|
||||||
localplayer1.m_146922_(-180.0F);
|
localplayer1.m_146922_(-180.0F);
|
||||||
localplayer1.f_108618_ = new KeyboardInput(this.f_104888_.f_91066_);
|
localplayer1.f_108618_ = new KeyboardInput(this.f_104888_.f_91066_);
|
||||||
@@ -1036,10 +_,7 @@
|
@@ -1046,10 +_,7 @@
|
||||||
PacketUtils.m_131363_(p_104976_, this, this.f_104888_);
|
PacketUtils.m_131363_(p_104976_, this, this.f_104888_);
|
||||||
BlockPos blockpos = p_104976_.m_131704_();
|
BlockPos blockpos = p_104976_.m_131704_();
|
||||||
this.f_104888_.f_91073_.m_141902_(blockpos, p_104976_.m_195645_()).ifPresent((p_205557_) -> {
|
this.f_104888_.f_91073_.m_141902_(blockpos, p_104976_.m_195645_()).ifPresent((p_205557_) -> {
|
||||||
@@ -48,15 +39,18 @@
|
|||||||
|
|
||||||
if (p_205557_ instanceof CommandBlockEntity && this.f_104888_.f_91080_ instanceof CommandBlockEditScreen) {
|
if (p_205557_ instanceof CommandBlockEntity && this.f_104888_.f_91080_ instanceof CommandBlockEditScreen) {
|
||||||
((CommandBlockEditScreen)this.f_104888_.f_91080_).m_98398_();
|
((CommandBlockEditScreen)this.f_104888_.f_91080_).m_98398_();
|
||||||
@@ -1185,6 +_,7 @@
|
@@ -1194,7 +_,9 @@
|
||||||
|
|
||||||
public void m_7443_(ClientboundCommandsPacket p_104990_) {
|
public void m_7443_(ClientboundCommandsPacket p_104990_) {
|
||||||
PacketUtils.m_131363_(p_104990_, this, this.f_104888_);
|
PacketUtils.m_131363_(p_104990_, this, this.f_104888_);
|
||||||
this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(new CommandBuildContext(this.f_104903_)));
|
- this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(new CommandBuildContext(this.f_104903_)));
|
||||||
+ this.f_104899_ = net.minecraftforge.client.ClientCommandHandler.mergeServerCommands(this.f_104899_);
|
+ var context = new CommandBuildContext(this.f_104903_);
|
||||||
|
+ this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(context));
|
||||||
|
+ this.f_104899_ = net.minecraftforge.client.ClientCommandHandler.mergeServerCommands(this.f_104899_, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void m_7183_(ClientboundStopSoundPacket p_105116_) {
|
public void m_7183_(ClientboundStopSoundPacket p_105116_) {
|
||||||
@@ -1203,6 +_,7 @@
|
@@ -1213,6 +_,7 @@
|
||||||
ClientRecipeBook clientrecipebook = this.f_104888_.f_91074_.m_108631_();
|
ClientRecipeBook clientrecipebook = this.f_104888_.f_91074_.m_108631_();
|
||||||
clientrecipebook.m_90625_(this.f_104900_.m_44051_());
|
clientrecipebook.m_90625_(this.f_104900_.m_44051_());
|
||||||
this.f_104888_.m_231374_(SearchRegistry.f_119943_, clientrecipebook.m_90639_());
|
this.f_104888_.m_231374_(SearchRegistry.f_119943_, clientrecipebook.m_90639_());
|
||||||
@@ -64,7 +58,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void m_7244_(ClientboundPlayerLookAtPacket p_105054_) {
|
public void m_7244_(ClientboundPlayerLookAtPacket p_105054_) {
|
||||||
@@ -1304,6 +_,7 @@
|
@@ -1314,6 +_,7 @@
|
||||||
|
|
||||||
this.f_104888_.m_231374_(SearchRegistry.f_119941_, nonnulllist);
|
this.f_104888_.m_231374_(SearchRegistry.f_119941_, nonnulllist);
|
||||||
this.f_104888_.m_231374_(SearchRegistry.f_119942_, nonnulllist);
|
this.f_104888_.m_231374_(SearchRegistry.f_119942_, nonnulllist);
|
||||||
@@ -72,12 +66,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private <T> void m_205560_(ResourceKey<? extends Registry<? extends T>> p_205561_, TagNetworkSerialization.NetworkPayload p_205562_) {
|
private <T> void m_205560_(ResourceKey<? extends Registry<? extends T>> p_205561_, TagNetworkSerialization.NetworkPayload p_205562_) {
|
||||||
@@ -1843,7 +_,8 @@
|
@@ -1666,6 +_,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
public void m_7413_(ClientboundCustomPayloadPacket p_105004_) {
|
||||||
|
+ if (!f_104888_.m_18695_() && net.minecraftforge.network.NetworkHooks.onCustomPayload(p_105004_, this.f_104885_)) return;
|
||||||
|
PacketUtils.m_131363_(p_105004_, this, this.f_104888_);
|
||||||
|
ResourceLocation resourcelocation = p_105004_.m_132042_();
|
||||||
|
FriendlyByteBuf friendlybytebuf = null;
|
||||||
|
@@ -1863,7 +_,7 @@
|
||||||
int j5 = friendlybytebuf.m_130242_();
|
int j5 = friendlybytebuf.m_130242_();
|
||||||
this.f_104888_.f_91064_.f_173815_.m_173830_(positionsource, j5);
|
this.f_104888_.f_91064_.f_173815_.m_173830_(positionsource, j5);
|
||||||
} else {
|
} else {
|
||||||
- f_104883_.warn("Unknown custom packed identifier: {}", (Object)resourcelocation);
|
- f_104883_.warn("Unknown custom packed identifier: {}", (Object)resourcelocation);
|
||||||
+ if (!net.minecraftforge.network.NetworkHooks.onCustomPayload(p_105004_, this.f_104885_))
|
|
||||||
+ f_104883_.warn("Unknown custom packet identifier: {}", (Object)resourcelocation);
|
+ f_104883_.warn("Unknown custom packet identifier: {}", (Object)resourcelocation);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/client/multiplayer/PlayerInfo.java
|
--- a/net/minecraft/client/multiplayer/PlayerInfo.java
|
||||||
+++ b/net/minecraft/client/multiplayer/PlayerInfo.java
|
+++ b/net/minecraft/client/multiplayer/PlayerInfo.java
|
||||||
@@ -77,6 +_,7 @@
|
@@ -82,6 +_,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void m_105317_(GameType p_105318_) {
|
protected void m_105317_(GameType p_105318_) {
|
||||||
|
|||||||
Loaded 100 of 737 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user