mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1f057278d | ||
|
|
6bbe2c64a9 | ||
|
|
684cd96e32 | ||
|
|
1f4e13fce0 | ||
|
|
55ad9e6d7d | ||
|
|
5c8d1618bc | ||
|
|
a6f5057840 | ||
|
|
1b0360928f | ||
|
|
921771bd11 | ||
|
|
089bb1fc84 | ||
|
|
602f1ef947 | ||
|
|
3b18e003f6 | ||
|
|
c33f2d1be6 | ||
|
|
022116141c | ||
|
|
a8b243c0cd | ||
|
|
c22355cc45 | ||
|
|
74bc36307e | ||
|
|
88d2dc6c8f | ||
|
|
de13ba8ab8 | ||
|
|
4f838a87d4 | ||
|
|
70d700e630 | ||
|
|
78fffcf45a | ||
|
|
cdba403ab6 | ||
|
|
6821d7b1cc | ||
|
|
9524ce4580 | ||
|
|
f2bbeab3b9 | ||
|
|
4a8adf5465 | ||
|
|
f5fa2f2a57 | ||
|
|
b33e168969 | ||
|
|
1f6e1ff257 | ||
|
|
7f8897141e | ||
|
|
b9a097c9e1 | ||
|
|
62f00266c5 | ||
|
|
6986cd7ab3 | ||
|
|
e7051b3484 | ||
|
|
f667d25d0b | ||
|
|
48d72fb7c6 | ||
|
|
2fb2bbeed0 |
No files matched your search
@@ -21,6 +21,3 @@ src/generated/**/*.json text eol=lf
|
||||
src/generated_test/**/.cache/cache text eol=lf
|
||||
src/generated_test/**/*.json text eol=lf
|
||||
|
||||
# We force eclipse to use unix line endings
|
||||
ide/eclipse/template/.settings/*.prefs text eol=lf
|
||||
|
||||
+1
-3
@@ -13,9 +13,6 @@
|
||||
/classes
|
||||
*.iml
|
||||
|
||||
# We however WANT the ide folder as it has tempaltes/configs for developing Forge.
|
||||
!ide/**
|
||||
|
||||
#gradle
|
||||
/build
|
||||
/.gradle
|
||||
@@ -26,6 +23,7 @@
|
||||
/projects/mcp/
|
||||
/projects/clean/
|
||||
/projects/forge/
|
||||
/projects/fmlonly/
|
||||
#/patches/*
|
||||
|
||||
#occupational hazards
|
||||
|
||||
Vendored
+17
-2
@@ -36,8 +36,8 @@ project {
|
||||
buildType(PullRequestCompatibility)
|
||||
|
||||
params {
|
||||
text("docker_jdk_version", "17", label = "Gradle version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("docker_gradle_version", "7.5.1", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("docker_jdk_version", "21", label = "Gradle version", description = "The version of the JDK to use during execution of tasks in a JDK.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("docker_gradle_version", "8.8", label = "Gradle version", description = "The version of Gradle to use during execution of Gradle tasks.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("git_main_branch", "1.20.x", label = "Git Main Branch", description = "The git main or default branch to use in VCS operations.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("git_branch_spec", """
|
||||
+:refs/heads/(main*)
|
||||
@@ -47,6 +47,8 @@ project {
|
||||
""".trimIndent(), label = "The branch specification of the repository", description = "By default all main branches are build by the configuration. Modify this value to adapt the branches build.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
|
||||
text("github_repository_name", "MinecraftForge", label = "The github repository name. Used to connect to it in VCS Roots.", description = "This is the repository slug on github. So for example `MinecraftForge` or `MinecraftForge`. It is interpolated into the global VCS Roots.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
|
||||
text("env.PUBLISHED_JAVA_ARTIFACT_ID", "forge", label = "Published artifact id", description = "The maven coordinate artifact id that has been published by this build. Can not be empty.", allowEmpty = false)
|
||||
text("env.PUBLISHED_JAVA_FML_ARTIFACT_ID", "fmlonly", label = "Published fmlonly artifact id", description = "The maven coordinate artifact id for fml only that has been published by this build. Can not be empty.", allowEmpty = false)
|
||||
text("env.PUBLISHED_JAVA_FML_ARTIFACT_VERSION", "0.0.0-SNAPSHOT", label = "Published fmlonly artifact version", description = "The version for fml only that has been published by this build. Can not be empty.", allowEmpty = false)
|
||||
text("env.PUBLISHED_JAVA_GROUP", "net.minecraftforge", label = "Published group", description = "The maven coordinate group that has been published by this build. Can not be empty.", allowEmpty = false)
|
||||
//These are references and not actually keys
|
||||
password("env.CROWDIN_KEY", "credentialsJSON:a3102dbe-805d-4177-9f54-3d2c2eb08fd5", display = ParameterDisplay.HIDDEN)
|
||||
@@ -74,6 +76,19 @@ object Build : BuildType({
|
||||
id("MinecraftForge_MinecraftForge__Build")
|
||||
name = "Build"
|
||||
description = "Builds and Publishes the main branches of the project."
|
||||
|
||||
features {
|
||||
feature {
|
||||
id = "trigger_fml_only_files_generator"
|
||||
type = "triggerBuildFeature"
|
||||
param("triggers", "MinecraftForge_FilesGenerator_GeneratePages")
|
||||
param("parameters", """
|
||||
env.PUBLISHED_JAVA_FML_ARTIFACT_ID~env.PUBLISHED_JAVA_ARTIFACT_ID
|
||||
env.PUBLISHED_JAVA_FML_ARTIFACT_VERSION~env.PUBLISHED_JAVA_ARTIFACT_VERSION
|
||||
env.PUBLISHED_JAVA_GROUP
|
||||
""".trimIndent())
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
object BuildSecondaryBranches : BuildType({
|
||||
|
||||
+388
-108
@@ -1,3 +1,4 @@
|
||||
import de.undercouch.gradle.tasks.download.Download
|
||||
import groovy.json.JsonBuilder
|
||||
import net.minecraftforge.forge.tasks.checks.CheckATs
|
||||
import net.minecraftforge.forge.tasks.checks.CheckExcs
|
||||
@@ -16,7 +17,6 @@ import net.minecraftforge.gradle.common.tasks.CheckJarCompatibility
|
||||
import net.minecraftforge.gradle.common.tasks.DownloadMavenArtifact
|
||||
import net.minecraftforge.gradle.common.tasks.ExtractInheritance
|
||||
import net.minecraftforge.gradle.common.tasks.SignJar
|
||||
import net.minecraftforge.gradle.patcher.tasks.GeneratePatches
|
||||
import net.minecraftforge.gradle.userdev.tasks.RenameJar
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
import org.gradle.plugins.ide.eclipse.model.SourceFolder
|
||||
@@ -25,11 +25,11 @@ import org.objectweb.asm.Opcodes
|
||||
plugins {
|
||||
id 'org.cadixdev.licenser' version '0.6.1'
|
||||
id 'com.github.ben-manes.versions' version '0.46.0'
|
||||
id 'net.minecraftforge.gradleutils' version '2.+'
|
||||
id 'net.minecraftforge.gradleutils' version '[2.2,2.3)'
|
||||
id 'eclipse'
|
||||
id 'de.undercouch.download' version '5.4.0'
|
||||
id 'net.minecraftforge.gradle.patcher' version '[6.0.13,6.2)' apply false
|
||||
id 'net.minecraftforge.gradle.mcp' version '[6.0.13,6.2)' apply false
|
||||
id 'net.minecraftforge.gradle.patcher' version '[6.0.11,6.2)' apply false
|
||||
id 'net.minecraftforge.gradle.mcp' version '[6.0.11,6.2)' apply false
|
||||
}
|
||||
|
||||
Util.init() //Init all our extension methods!
|
||||
@@ -44,22 +44,22 @@ ext {
|
||||
]
|
||||
}
|
||||
MAPPING_CHANNEL = 'official'
|
||||
MC_VERSION = '1.20.2'
|
||||
MAPPING_VERSION = MC_VERSION
|
||||
MAPPING_VERSION = '1.20.1'
|
||||
MC_VERSION = '1.20.1'
|
||||
MC_NEXT_VERSION = '1.21'
|
||||
MCP_VERSION = '20230921.100330'
|
||||
MCP_VERSION = '20230612.114412'
|
||||
SNAPSHOT = false
|
||||
|
||||
SPI_VERSION = '7.0.1'
|
||||
MERGETOOL_VERSION = '1.1.5'
|
||||
ACCESSTRANSFORMERS_VERSION = '8.0.4'
|
||||
COREMODS_VERSION = '5.0.1'
|
||||
COREMODS_VERSION = '5.1.6'
|
||||
EVENTBUS_VERSION = '6.0.5'
|
||||
MODLAUNCHER_VERSION = '10.0.9'
|
||||
SECUREJARHANDLER_VERSION = '2.1.10'
|
||||
BOOTSTRAPLAUNCHER_VERSION = '1.1.2'
|
||||
ASM_VERSION = '9.5'
|
||||
INSTALLER_VERSION = '2.1.+'
|
||||
ASM_VERSION = '9.7'
|
||||
INSTALLER_VERSION = '2.2.+'
|
||||
MIXIN_VERSION = '0.8.5'
|
||||
TERMINALCONSOLEAPPENDER_VERSION = '1.2.0'
|
||||
JLINE_VERSION = '3.12.+'
|
||||
@@ -73,11 +73,11 @@ ext {
|
||||
// To use a version newer than the version manifest JSON, the dependency must be added to the installer configuration
|
||||
MOJANG_LOGGING_VERSION = '1.1.1'
|
||||
LOG4J_VERSION = '2.19.0'
|
||||
GUAVA_VERSION = '32.1.2-jre'
|
||||
GSON_VERSION = '2.10.1'
|
||||
GUAVA_VERSION = '31.1-jre'
|
||||
GSON_VERSION = '2.10'
|
||||
APACHE_COMMONS_LANG3_VERSION = '3.12.0'
|
||||
JOPT_SIMPLE_VERSION = '5.0.4'
|
||||
COMMONS_IO_VERSION = '2.13.0'
|
||||
COMMONS_IO_VERSION = '2.11.0'
|
||||
|
||||
GIT_INFO = gradleutils.gitInfo
|
||||
VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION)
|
||||
@@ -85,10 +85,10 @@ ext {
|
||||
FORGE_VERSION = VERSION.substring(MC_VERSION.length() + 1)
|
||||
|
||||
BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.1.1:fatjar'
|
||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0'
|
||||
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.4.1'
|
||||
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
|
||||
FART = 'net.minecraftforge:ForgeAutoRenamingTool:1.0.5:all'
|
||||
MIN_TAG_FOR_CHANGELOG = '47.999'
|
||||
FART = 'net.minecraftforge:ForgeAutoRenamingTool:0.1.22:all'
|
||||
MIN_TAG_FOR_CHANGELOG = '41.0'
|
||||
}
|
||||
|
||||
println('Version: ' + VERSION +
|
||||
@@ -166,9 +166,9 @@ subprojects {
|
||||
|
||||
tasks.withType(Javadoc).configureEach {
|
||||
options.tags = [
|
||||
'apiNote:a:<em>API Note:</em>',
|
||||
'implSpec:a:<em>Implementation Requirements:</em>',
|
||||
'implNote:a:<em>Implementation Note:</em>'
|
||||
'apiNote:a:<em>API Note:</em>',
|
||||
'implSpec:a:<em>Implementation Requirements:</em>',
|
||||
'implNote:a:<em>Implementation Note:</em>'
|
||||
]
|
||||
options.addStringOption('Xdoclint:all,-missing', '-public')
|
||||
}
|
||||
@@ -249,7 +249,7 @@ project(':clean') {
|
||||
ideaModule "${rootProject.name}.${project.name}.main"
|
||||
|
||||
main 'net.minecraft.client.main.Main'
|
||||
workingDirectory project.file('run/client')
|
||||
workingDirectory project.file('run')
|
||||
|
||||
args '--gameDir', '.'
|
||||
args '--version', MC_VERSION
|
||||
@@ -264,15 +264,10 @@ project(':clean') {
|
||||
ideaModule "${rootProject.name}.${project.name}.main"
|
||||
|
||||
main 'net.minecraft.server.Main'
|
||||
workingDirectory project.file('run/server')
|
||||
workingDirectory project.file('run')
|
||||
}
|
||||
}
|
||||
}
|
||||
eclipse.classpath.file.whenMerged {
|
||||
// Disable optional warnings on the minecraft decompiled source code. It just muddies the warning window and hides warnings in our own codebase
|
||||
def src = entries.find { it.path == 'src/main/java' }
|
||||
src.entryAttributes['ignore_optional_problems'] = 'true'
|
||||
}
|
||||
}
|
||||
|
||||
def sharedDeps = {
|
||||
@@ -360,7 +355,7 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
}
|
||||
|
||||
prj.task([type: DownloadMavenArtifact], 'downloadInstaller') {
|
||||
artifact = "net.minecraftforge:installer:${INSTALLER_VERSION}:shrunk"
|
||||
artifact = "net.minecraftforge:installer:${INSTALLER_VERSION}:fatjar"
|
||||
changing = true
|
||||
}
|
||||
|
||||
@@ -482,6 +477,7 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
}
|
||||
for (def run : prj.patcher.runs) {
|
||||
if (run.parents) continue // We already added this to the parent run config
|
||||
run.workingDirectory prj.file('run')
|
||||
|
||||
if (run.name.contains('client') || run.name.contains('data')) {
|
||||
// Natives are loaded from the classpath now in all cases
|
||||
@@ -494,7 +490,7 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
run.property 'org.lwjgl.system.SharedLibraryExtractDirectory', 'lwjgl_dll'
|
||||
run.args '--username', 'Dev'
|
||||
run.args '--version', prj.name
|
||||
//run.args '--uuid', '0'
|
||||
run.args '--uuid', '0'
|
||||
run.args '--accessToken', '0'
|
||||
run.args '--userType', 'mojang'
|
||||
run.args '--versionType', 'release'
|
||||
@@ -567,6 +563,329 @@ def sharedFmlonlyForge = { Project prj ->
|
||||
}
|
||||
}
|
||||
|
||||
def symlink = file("$rootDir/fmlonly/src/fmlcommon")
|
||||
def symlinkValid = symlink.exists() && symlink.directory
|
||||
|
||||
if (symlinkValid)
|
||||
project(':fmlonly') {
|
||||
evaluationDependsOn(':mcp')
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'net.minecraftforge.gradle.patcher'
|
||||
|
||||
ext {
|
||||
MCP_ARTIFACT = project(':mcp').mcp.config.get()
|
||||
PACKED_DEPS = [':fmlcore:jar', ':fmlloader:jar', ':fmlearlydisplay:jar', ':javafmllanguage:jar', ':lowcodelanguage:jar', ':mclanguage:jar']
|
||||
MAVEN_PATH = "${group.replace('.', '/')}/${project.name}/${VERSION}"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs = ["$rootDir/fmlonly/src/fmlcommon/java", "$rootDir/fmlonly/src/main/java"]
|
||||
}
|
||||
resources {
|
||||
srcDirs = ["$rootDir/fmlonly/src/fmlcommon/resources", "$rootDir/fmlonly/src/main/resources"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
moduleonly
|
||||
installer {
|
||||
// Don't pull all libraries, if we're missing something, add it to the installer list so the installer knows to download it.
|
||||
transitive = false
|
||||
}
|
||||
api.extendsFrom(installer)
|
||||
}
|
||||
|
||||
// TODO: Better coordination between project dependencies and the installer.
|
||||
dependencies {
|
||||
implementation project(':fmlcore')
|
||||
implementation project(':fmlloader')
|
||||
implementation project(':fmlearlydisplay')
|
||||
implementation project(':javafmllanguage')
|
||||
implementation project(':lowcodelanguage')
|
||||
implementation project(':mclanguage')
|
||||
runtimeOnly "cpw.mods:bootstraplauncher:${BOOTSTRAPLAUNCHER_VERSION}"
|
||||
}
|
||||
dependencies sharedDeps
|
||||
|
||||
patcher {
|
||||
parent = project(':mcp')
|
||||
mcVersion = MC_VERSION
|
||||
patchedSrc = file('src/main/java')
|
||||
|
||||
mappings channel: MAPPING_CHANNEL, version: MAPPING_VERSION
|
||||
runs {
|
||||
fmlonly_client {
|
||||
args '--launchTarget', 'fmlclientdev'
|
||||
ideaModule "${rootProject.name}.${project.name}.main"
|
||||
|
||||
mods {
|
||||
minecraft { source sourceSets.main }
|
||||
}
|
||||
}
|
||||
fmlonly_server {
|
||||
args '--launchTarget', 'fmlserverdev'
|
||||
ideaModule "${rootProject.name}.${project.name}.main"
|
||||
|
||||
mods {
|
||||
minecraft { source sourceSets.main }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sharedFmlonlyForge.call(project)
|
||||
|
||||
task launcherJson(type: LauncherJson) {
|
||||
packedDependencies = [':fmlloader:jar',':fmlearlydisplay:jar']
|
||||
doFirst {
|
||||
def fmlonly_client = project(':fmlonly').patcher.runs.fmlonly_client
|
||||
json = [
|
||||
_comment_: comment,
|
||||
id: id,
|
||||
time: timestamp,
|
||||
releaseTime: timestamp,
|
||||
type: 'release',
|
||||
mainClass: 'cpw.mods.bootstraplauncher.BootstrapLauncher',
|
||||
inheritsFrom: MC_VERSION,
|
||||
logging: {},
|
||||
arguments: [
|
||||
game: ['--launchTarget', 'fmlclient',
|
||||
'--fml.forgeVersion', FORGE_VERSION,
|
||||
'--fml.mcVersion', MC_VERSION,
|
||||
'--fml.forgeGroup', project.group,
|
||||
'--fml.mcpVersion', MCP_VERSION],
|
||||
jvm: ["-DignoreList=${fmlonly_client.properties.ignoreList},\${version_name}.jar",
|
||||
"-DmergeModules=${fmlonly_client.properties.mergeModules}",
|
||||
'-DlibraryDirectory=${library_directory}',
|
||||
'-p', Util.getArtifacts(project, configurations.moduleonly, false).values().collect{"\${library_directory}/${it.downloads.artifact.path}"}.join('${classpath_separator}'),
|
||||
'--add-modules', 'ALL-MODULE-PATH',
|
||||
// Additions to these JVM module args should be mirrored to server_files/args.txt and other similar blocks in the buildscript
|
||||
'--add-opens', 'java.base/java.util.jar=cpw.mods.securejarhandler',
|
||||
'--add-opens', 'java.base/java.lang.invoke=cpw.mods.securejarhandler',
|
||||
'--add-exports', 'java.base/sun.security.util=cpw.mods.securejarhandler',
|
||||
'--add-exports', 'jdk.naming.dns/com.sun.jndi.dns=java.naming'
|
||||
]
|
||||
],
|
||||
libraries: []
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
task installerJson(type: InstallerJson, dependsOn: 'signUniversalJar') {
|
||||
icon = rootProject.file('icon.ico')
|
||||
packedDependencies = PACKED_DEPS
|
||||
|
||||
doFirst {
|
||||
def libs = libraries
|
||||
json = [
|
||||
_comment_: launcherJson.comment,
|
||||
spec: 1,
|
||||
profile: project.name,
|
||||
version: launcherJson.id,
|
||||
path: null,
|
||||
minecraft: MC_VERSION,
|
||||
serverJarPath: '{LIBRARY_DIR}/net/minecraft/server/{MINECRAFT_VERSION}/server-{MINECRAFT_VERSION}.jar',
|
||||
welcome: "Welcome to the simple FML installer.",
|
||||
data: [
|
||||
MAPPINGS: [
|
||||
client: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings@txt]",
|
||||
server: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings@txt]"
|
||||
],
|
||||
MOJMAPS: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:mappings@txt]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:mappings@txt]"
|
||||
],
|
||||
MERGED_MAPPINGS: [
|
||||
client: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings-merged@txt]",
|
||||
server: "[${MCP_ARTIFACT.group}:${MCP_ARTIFACT.name}:${MCP_ARTIFACT.version}:mappings-merged@txt]"
|
||||
],
|
||||
MC_UNPACKED: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:unpacked]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:unpacked]"
|
||||
],
|
||||
MC_SLIM: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:slim]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:slim]"
|
||||
],
|
||||
MC_SLIM_SHA: [
|
||||
client: "'${downloadClientSlim.output.get().asFile.sha1()}'",
|
||||
server: "'${downloadServerSlim.output.get().asFile.sha1()}'"
|
||||
],
|
||||
MC_EXTRA: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:extra]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:extra]"
|
||||
],
|
||||
MC_EXTRA_SHA: [
|
||||
client: "'${downloadClientExtra.output.get().asFile.sha1()}'",
|
||||
server: "'${downloadServerExtra.output.get().asFile.sha1()}'"
|
||||
],
|
||||
MC_SRG: [
|
||||
client: "[net.minecraft:client:${MC_VERSION}-${MCP_VERSION}:srg]",
|
||||
server: "[net.minecraft:server:${MC_VERSION}-${MCP_VERSION}:srg]"
|
||||
],
|
||||
/*MC_SRG_SHA: [
|
||||
client: "'${createClientSRG.output.sha1()}'",
|
||||
server: "'${createServerSRG.output.sha1()}'"
|
||||
],*/
|
||||
MCP_VERSION: [
|
||||
client: "'${MCP_VERSION}'",
|
||||
server: "'${MCP_VERSION}'"
|
||||
]
|
||||
],
|
||||
processors: [
|
||||
[
|
||||
sides: ['server'],
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'EXTRACT_FILES',
|
||||
'--archive', '{INSTALLER}',
|
||||
|
||||
'--from', 'data/run.sh',
|
||||
'--to', '{ROOT}/run.sh',
|
||||
'--exec', '{ROOT}/run.sh',
|
||||
//'--from', "data/run_fml_${VERSION.replace('-', '_').sh",
|
||||
//'--to', '{ROOT}/run_fml_${VERSION.replace('-', '_').sh',
|
||||
//'--exec', '{ROOT}/run_fml_${VERSION.replace('-', '_').sh',
|
||||
|
||||
'--from', 'data/run.bat',
|
||||
'--to', '{ROOT}/run.bat',
|
||||
//'--from', 'data/run_fml_${VERSION.replace('-', '_').bat',
|
||||
//'--to', '{ROOT}/run_fml_${VERSION.replace('-', '_').bat',
|
||||
|
||||
'--from', 'data/user_jvm_args.txt',
|
||||
'--to', '{ROOT}/user_jvm_args.txt',
|
||||
'--optional', '{ROOT}/user_jvm_args.txt',
|
||||
|
||||
'--from', 'data/win_args.txt',
|
||||
'--to', "{ROOT}/libraries/${MAVEN_PATH}/win_args.txt",
|
||||
|
||||
'--from', 'data/unix_args.txt',
|
||||
'--to', "{ROOT}/libraries/${MAVEN_PATH}/unix_args.txt"
|
||||
]
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'BUNDLER_EXTRACT',
|
||||
'--input', '{MINECRAFT_JAR}',
|
||||
'--output', '{ROOT}/libraries/',
|
||||
'--libraries'
|
||||
]
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'BUNDLER_EXTRACT',
|
||||
'--input', '{MINECRAFT_JAR}',
|
||||
'--output', '{MC_UNPACKED}',
|
||||
'--jar-only'
|
||||
]
|
||||
], [
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'MCP_DATA',
|
||||
'--input', "[${MCP_ARTIFACT.descriptor}]",
|
||||
'--output', '{MAPPINGS}',
|
||||
'--key', 'mappings'
|
||||
]
|
||||
], [
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'DOWNLOAD_MOJMAPS',
|
||||
'--version', MC_VERSION,
|
||||
'--side', '{SIDE}',
|
||||
'--output', '{MOJMAPS}'
|
||||
]
|
||||
], [
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'MERGE_MAPPING',
|
||||
'--left', '{MAPPINGS}',
|
||||
'--right', '{MOJMAPS}',
|
||||
'--output', '{MERGED_MAPPINGS}',
|
||||
'--classes', '--reverse-right'
|
||||
]
|
||||
], [
|
||||
sides: ['client'],
|
||||
jar: JAR_SPLITTER,
|
||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
||||
args: [
|
||||
'--input', '{MINECRAFT_JAR}',
|
||||
'--slim', '{MC_SLIM}',
|
||||
'--extra', '{MC_EXTRA}',
|
||||
'--srg', '{MERGED_MAPPINGS}'
|
||||
],
|
||||
outputs: [
|
||||
'{MC_SLIM}': '{MC_SLIM_SHA}',
|
||||
'{MC_EXTRA}': '{MC_EXTRA_SHA}'
|
||||
]
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: JAR_SPLITTER,
|
||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
||||
args: [
|
||||
'--input', '{MC_UNPACKED}',
|
||||
'--slim', '{MC_SLIM}',
|
||||
'--extra', '{MC_EXTRA}',
|
||||
'--srg', '{MERGED_MAPPINGS}'
|
||||
],
|
||||
outputs: [
|
||||
'{MC_SLIM}': '{MC_SLIM_SHA}',
|
||||
'{MC_EXTRA}': '{MC_EXTRA_SHA}'
|
||||
]
|
||||
], [
|
||||
jar: FART,
|
||||
classpath: getClasspath(project, libs, FART),
|
||||
args: [
|
||||
'--input', '{MC_SLIM}',
|
||||
'--output', '{MC_SRG}',
|
||||
'--names', '{MERGED_MAPPINGS}',
|
||||
'--ann-fix', '--ids-fix', '--src-fix', '--record-fix'
|
||||
]/*,
|
||||
outputs: [
|
||||
'{MC_SRG}': '{MC_SRG_SHA}'
|
||||
]
|
||||
*/
|
||||
]
|
||||
]
|
||||
]
|
||||
getClasspath(project, libs, MCP_ARTIFACT.descriptor) //Tell it to download mcp_config
|
||||
}
|
||||
}
|
||||
|
||||
task installerJar(type: InstallerJar) {
|
||||
packedDependencies = PACKED_DEPS
|
||||
from(extraTxts)
|
||||
//TODO: make FML installer logo?
|
||||
from(rootProject.file('/forge_installer_logo.png')) {
|
||||
rename { 'big_logo.png' }
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifact universalJar
|
||||
artifact installerJar
|
||||
artifact userdevJar
|
||||
artifact sourcesJar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Since we need the modules in the bootstrap, we need to make sure they are compiled before we do each run
|
||||
afterEvaluate { prepareRuns.dependsOn(PACKED_DEPS) }
|
||||
}
|
||||
|
||||
project(':forge') {
|
||||
evaluationDependsOn(':clean')
|
||||
apply plugin: 'java-library'
|
||||
@@ -608,12 +927,8 @@ project(':forge') {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eclipse.classpath.file.whenMerged {
|
||||
// Disable optional warnings on the minecraft decompiled source code. It just muddies the warning window and hides warnings in our own codebase
|
||||
def src = entries.find { it.path == 'src/main/java' }
|
||||
src.entryAttributes['ignore_optional_problems'] = 'true'
|
||||
}
|
||||
//Eclipse adds the sourcesets twice, once where we tell it to, once in the projects folder. No idea why. So delete them
|
||||
eclipse.classpath.file.whenMerged { cls -> cls.entries.removeIf { e -> e instanceof SourceFolder && e.path.startsWith('src/') && !e.path.startsWith('src/main/') } }
|
||||
|
||||
ext {
|
||||
SPEC_VERSION = gradleutils.gitInfo.tag
|
||||
@@ -655,13 +970,12 @@ project(':forge') {
|
||||
parent = project(':clean')
|
||||
patches = file("$rootDir/patches/minecraft")
|
||||
patchedSrc = file('src/main/java')
|
||||
srgPatches = false
|
||||
srgPatches = true
|
||||
accessTransformers.from file("$rootDir/src/main/resources/META-INF/accesstransformer.cfg")
|
||||
sideAnnotationStrippers.from file("$rootDir/src/main/resources/forge.sas")
|
||||
|
||||
runs {
|
||||
forge_client {
|
||||
workingDirectory file('run/client')
|
||||
property 'eventbus.checkTypesOnDispatch', 'true'
|
||||
args '--launchTarget', 'forgeclientdev'
|
||||
ideaModule "${rootProject.name}.${project.name}.main"
|
||||
@@ -671,7 +985,6 @@ project(':forge') {
|
||||
}
|
||||
|
||||
forge_test_client {
|
||||
workingDirectory file('run/client_test')
|
||||
parent runs.forge_client
|
||||
taskName 'forge_test_client'
|
||||
|
||||
@@ -686,7 +999,6 @@ project(':forge') {
|
||||
}
|
||||
|
||||
forge_server {
|
||||
workingDirectory file('run/server')
|
||||
args '--launchTarget', 'forgeserverdev'
|
||||
ideaModule "${rootProject.name}.${project.name}.main"
|
||||
|
||||
@@ -696,7 +1008,6 @@ project(':forge') {
|
||||
}
|
||||
|
||||
forge_test_server {
|
||||
workingDirectory file('run/server_test')
|
||||
parent runs.forge_server
|
||||
taskName 'forge_test_server'
|
||||
|
||||
@@ -769,20 +1080,19 @@ project(':forge') {
|
||||
}
|
||||
|
||||
args '--flat', '--all', '--validate',
|
||||
'--mod', 'empty',
|
||||
//'--mod', 'data_gen_test',
|
||||
//'--mod', 'piston_event_test',
|
||||
'--mod', 'data_gen_test',
|
||||
'--mod', 'piston_event_test',
|
||||
'--mod', 'global_loot_test',
|
||||
//'--mod', 'scaffolding_test',
|
||||
//'--mod', 'custom_tag_types_test',
|
||||
//'--mod', 'new_model_loader_test',
|
||||
//'--mod', 'remove_tag_datagen_test',
|
||||
//'--mod', 'tag_based_tool_types',
|
||||
//'--mod', 'custom_transformtype_test',
|
||||
//'--mod', 'data_pack_registries_test',
|
||||
//'--mod', 'biome_modifiers_test',
|
||||
//'--mod', 'structure_modifiers_test',
|
||||
//'--mod', 'custom_preset_editor_test',
|
||||
'--mod', 'scaffolding_test',
|
||||
'--mod', 'custom_tag_types_test',
|
||||
'--mod', 'new_model_loader_test',
|
||||
'--mod', 'remove_tag_datagen_test',
|
||||
'--mod', 'tag_based_tool_types',
|
||||
'--mod', 'custom_transformtype_test',
|
||||
'--mod', 'data_pack_registries_test',
|
||||
'--mod', 'biome_modifiers_test',
|
||||
'--mod', 'structure_modifiers_test',
|
||||
'--mod', 'custom_preset_editor_test',
|
||||
'--output', rootProject.file('src/generated_test/resources/'),
|
||||
'--existing', sourceSets.main.resources.srcDirs[0],
|
||||
'--existing', sourceSets.test.resources.srcDirs[0]
|
||||
@@ -816,33 +1126,6 @@ project(':forge') {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
if (!patcher.srgPatches) {
|
||||
srg2mcpClean {
|
||||
dependsOn = []
|
||||
input = project(':mcp').setupMCP.output
|
||||
}
|
||||
userdevJar {
|
||||
onlyIf = { t -> true }
|
||||
}
|
||||
def patches = project.file('build/genPatchesForUserdev/output/')
|
||||
patches.mkdirs()
|
||||
def genPatchesForUserdev = tasks.register('genPatchesForUserdev', GeneratePatches){
|
||||
base = project(':mcp').setupMCP.output
|
||||
modified = applyRangeMapBase.output
|
||||
originalPrefix = genPatches.originalPrefix
|
||||
modifiedPrefix = genPatches.modifiedPrefix
|
||||
output = patches
|
||||
autoHeader true
|
||||
lineEnding = '\n'
|
||||
}
|
||||
bakePatches {
|
||||
dependsOn = []
|
||||
input = genPatchesForUserdev.get().output
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
MANIFESTS = [
|
||||
@@ -895,9 +1178,12 @@ project(':forge') {
|
||||
]
|
||||
}
|
||||
|
||||
task crowdin(type: Crowdin) {
|
||||
key = project.hasProperty('crowdinKey') ? project.crowdinKey : null
|
||||
//TODO: Merge our english.json?
|
||||
tasks.register('downloadCrowdin', Download) {
|
||||
src 'https://files.minecraftforge.net/crowdin.zip'
|
||||
dest file('build/crowdin.zip')
|
||||
useETag 'all'
|
||||
onlyIfModified true
|
||||
quiet true
|
||||
}
|
||||
|
||||
sharedFmlonlyForge.call(project)
|
||||
@@ -1099,8 +1385,6 @@ project(':forge') {
|
||||
|
||||
doFirst {
|
||||
def libs = libraries
|
||||
def INSTALLER_TOOLS_CLASSPATH = getClasspath(project, libs, INSTALLER_TOOLS)
|
||||
def JAR_SPLITTER_CLASSPATH = getClasspath(project, libs, JAR_SPLITTER)
|
||||
json = [
|
||||
_comment_: launcherJson.comment,
|
||||
spec: 1,
|
||||
@@ -1171,7 +1455,7 @@ project(':forge') {
|
||||
[
|
||||
sides: ['server'],
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'EXTRACT_FILES',
|
||||
'--archive', '{INSTALLER}',
|
||||
@@ -1201,7 +1485,7 @@ project(':forge') {
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'BUNDLER_EXTRACT',
|
||||
'--input', '{MINECRAFT_JAR}',
|
||||
@@ -1211,7 +1495,7 @@ project(':forge') {
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'BUNDLER_EXTRACT',
|
||||
'--input', '{MINECRAFT_JAR}',
|
||||
@@ -1220,7 +1504,7 @@ project(':forge') {
|
||||
]
|
||||
], [
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'MCP_DATA',
|
||||
'--input', "[${MCP_ARTIFACT.descriptor}]",
|
||||
@@ -1229,7 +1513,7 @@ project(':forge') {
|
||||
]
|
||||
], [
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'DOWNLOAD_MOJMAPS',
|
||||
'--version', MC_VERSION,
|
||||
@@ -1238,7 +1522,7 @@ project(':forge') {
|
||||
]
|
||||
], [
|
||||
jar: INSTALLER_TOOLS,
|
||||
classpath: INSTALLER_TOOLS_CLASSPATH,
|
||||
classpath: getClasspath(project, libs, INSTALLER_TOOLS),
|
||||
args: [
|
||||
'--task', 'MERGE_MAPPING',
|
||||
'--left', '{MAPPINGS}',
|
||||
@@ -1249,7 +1533,7 @@ project(':forge') {
|
||||
], [
|
||||
sides: ['client'],
|
||||
jar: JAR_SPLITTER,
|
||||
classpath: JAR_SPLITTER_CLASSPATH,
|
||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
||||
args: [
|
||||
'--input', '{MINECRAFT_JAR}',
|
||||
'--slim', '{MC_SLIM}',
|
||||
@@ -1263,7 +1547,7 @@ project(':forge') {
|
||||
], [
|
||||
sides: ['server'],
|
||||
jar: JAR_SPLITTER,
|
||||
classpath: JAR_SPLITTER_CLASSPATH,
|
||||
classpath: getClasspath(project, libs, JAR_SPLITTER),
|
||||
args: [
|
||||
'--input', '{MC_UNPACKED}',
|
||||
'--slim', '{MC_SLIM}',
|
||||
@@ -1310,9 +1594,12 @@ project(':forge') {
|
||||
from extraTxts
|
||||
|
||||
// add crowdin locales
|
||||
from { crowdin.output.present && crowdin.output.get().asFile.exists() ? zipTree(crowdin.output) : null}
|
||||
dependsOn crowdin
|
||||
duplicatesStrategy = 'exclude'
|
||||
from zipTree(downloadCrowdin.dest).matching {
|
||||
include 'assets/forge/lang/*.json'
|
||||
}
|
||||
|
||||
dependsOn downloadCrowdin
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
doFirst {
|
||||
MANIFESTS.each{ pkg, values ->
|
||||
@@ -1508,6 +1795,8 @@ project(':forge') {
|
||||
//evaluationDependsOnChildren()
|
||||
task setup() { //These must be strings so that we can do lazy resolution. Else we need evaluationDependsOnChildren above
|
||||
dependsOn ':clean:extractMapped'
|
||||
if (symlinkValid)
|
||||
dependsOn ':fmlonly:extractMapped'
|
||||
dependsOn ':forge:extractMapped'
|
||||
}
|
||||
|
||||
@@ -1516,27 +1805,18 @@ task doChecks {
|
||||
dependsOn ':forge:publish'
|
||||
}
|
||||
|
||||
if (symlinkValid)
|
||||
project.gradle.startParameter.excludedTaskNames.add(':fmlonly:genPatches')
|
||||
project.gradle.startParameter.excludedTaskNames.add(':clean:genPatches')
|
||||
|
||||
//Also output FMLOnly when building a version.
|
||||
if (System.env.TEAMCITY_VERSION) {
|
||||
//Only setup the CI environment if and only if the environment variables are set.
|
||||
tasks.configureTeamCity {
|
||||
doLast {
|
||||
println "##teamcity[buildNumber '${project(':forge').version}']"
|
||||
println "##teamcity[setParameter name='env.PUBLISHED_JAVA_ARTIFACT_VERSION' value='${project(':forge').version}']"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allprojects { prj ->
|
||||
prj.tasks.eclipse.doFirst {
|
||||
rootProject.fileTree('ide/eclipse/template/.settings/').matching { include '**/*.prefs' }.each { file ->
|
||||
def target = project.file('.settings/' + file.name)
|
||||
def temp = new CleanProperties().load(file)
|
||||
def exst = new CleanProperties().load(target)
|
||||
exst.put('eclipse.preferences.version', '1')
|
||||
temp.forEach(exst::put)
|
||||
exst.store(target)
|
||||
println "##teamcity[setParameter name='env.PUBLISHED_JAVA_FML_ARTIFACT_VERSION' value='${project(':fmlonly').version}']"
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -27,6 +27,6 @@ abstract class BytecodePredicateFinder extends BytecodeFinder {
|
||||
@Internal
|
||||
@Override
|
||||
protected Object getData() {
|
||||
return matches.toSorted(Comparator.naturalOrder()) ?: {throw new RuntimeException('Failed to find any targets, please ensure that method names and descriptors are correct.')}()
|
||||
return matches.stream().sorted().toList() ?: {throw new RuntimeException('Failed to find any targets, please ensure that method names and descriptors are correct.')}()
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
package net.minecraftforge.forge.tasks;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Eclipse config files are literally just java properties, with the header cleaned up.
|
||||
* https://github.com/eclipse/buildship/blob/5b2c7fca7fa86cd74d71b3c099c7b1559eba038e/org.eclipse.buildship.core/src/main/java/org/eclipse/buildship/core/internal/configuration/PreferenceStore.java#L238
|
||||
*
|
||||
* This does the same thing, as well as sorting alphabetically.
|
||||
* It also ignores all comments. We can add them latter if someone cares.
|
||||
*/
|
||||
public class CleanProperties extends Properties {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String LINE_SEP = System.getProperty("line.separator");
|
||||
private static final String UNIX_LINE_SEP = "\n";
|
||||
private static final Charset ENCODING = StandardCharsets.UTF_8;
|
||||
|
||||
public CleanProperties load(File input) throws IOException {
|
||||
if (input.exists()) {
|
||||
try (Reader is = new InputStreamReader(new FileInputStream(input), ENCODING)) {
|
||||
super.load(is);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void store(File out) throws IOException {
|
||||
if (!out.getParentFile().exists())
|
||||
out.getParentFile().mkdirs();
|
||||
|
||||
try (OutputStream os = new FileOutputStream(out)) {
|
||||
store(os, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Enumeration<Object> keys() {
|
||||
Set<Object> ret = new TreeSet<>();
|
||||
for (Enumeration<?> e = super.keys(); e.hasMoreElements();)
|
||||
ret.add(e.nextElement());
|
||||
return Collections.enumeration(ret);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Map.Entry<Object, Object>> entrySet() {
|
||||
Set<Map.Entry<Object, Object>> ret = new TreeSet<>((l, r) -> ((String)l.getKey()).compareTo((String)r.getKey()));
|
||||
ret.addAll(super.entrySet());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void store(OutputStream out, String comments) throws IOException {
|
||||
out.write(clean().getBytes(ENCODING));
|
||||
out.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void store(Writer out, String comments) throws IOException {
|
||||
out.write(clean());
|
||||
out.flush();
|
||||
}
|
||||
|
||||
private String clean() throws IOException {
|
||||
ByteArrayOutputStream tmp = new ByteArrayOutputStream();
|
||||
try {
|
||||
super.store(tmp, null);
|
||||
} finally {
|
||||
tmp.close();
|
||||
}
|
||||
|
||||
String ret = tmp.toString(ENCODING).replace(LINE_SEP, UNIX_LINE_SEP);
|
||||
ret = ret.substring(ret.indexOf(UNIX_LINE_SEP) + 1);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -2,7 +2,7 @@
|
||||
|
||||
MinecraftForge
|
||||
=============
|
||||
[][Download]
|
||||
[][Download]
|
||||
[][Download] [][Discord] [][Patreon]
|
||||
|
||||
@@ -27,7 +27,7 @@ You can download the installer for the *Recommended Build* or the
|
||||
*Latest build* there. Latest builds may have newer features but may be
|
||||
more unstable as a result. The installer will attempt to install Forge
|
||||
into your vanilla launcher environment, where you can then create a new
|
||||
profile using that version and play the game!
|
||||
profile using that version and play the game!
|
||||
|
||||
For support and questions, visit [the Support Forum][Support-Forum] or [the Forge Discord server][Discord].
|
||||
|
||||
@@ -68,9 +68,9 @@ Please ensure you have a valid email address associated with your GitHub account
|
||||
|
||||
[Discord]: https://discord.minecraftforge.net/
|
||||
|
||||
[Documentation]: https://docs.minecraftforge.net/
|
||||
[Getting-Started]: https://docs.minecraftforge.net/en/latest/gettingstarted/
|
||||
[ForgeDev]: https://docs.minecraftforge.net/en/latest/forgedev/
|
||||
[Pull-Requests]: https://docs.minecraftforge.net/en/latest/forgedev/#making-changes-and-pull-requests
|
||||
[Documentation]: https://docs.minecraftforge.net/en/1.20.1/
|
||||
[Getting-Started]: https://docs.minecraftforge.net/en/1.20.1/gettingstarted/
|
||||
[ForgeDev]: https://docs.minecraftforge.net/en/1.20.1/forgedev/
|
||||
[Pull-Requests]: https://docs.minecraftforge.net/en/1.20.1/forgedev/#making-changes-and-pull-requests
|
||||
|
||||
[Patreon]: https://www.patreon.com/MinecraftForge
|
||||
[Patreon]: https://www.patreon.com/LexManos
|
||||
@@ -2,9 +2,10 @@ plugins {
|
||||
id 'com.github.ben-manes.versions'
|
||||
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
||||
id 'org.cadixdev.licenser'
|
||||
id 'java-library'
|
||||
id 'jacoco'
|
||||
}
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'jacoco'
|
||||
apply plugin: 'org.javamodularity.moduleplugin'
|
||||
|
||||
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.function.Supplier;
|
||||
* @param <T> the type of the record which is held by the extension point
|
||||
*/
|
||||
@SuppressWarnings("unused") // Type parameter T
|
||||
// TODO: Complete re-write, this hasnt actually be used in a generic way by mods and we could make it a lot simpler.
|
||||
public interface IExtensionPoint<T extends Record>
|
||||
{
|
||||
/**
|
||||
@@ -41,7 +40,7 @@ public interface IExtensionPoint<T extends Record>
|
||||
* where {@code true} means it is from the server and {@code false} means it is from the world save. The return
|
||||
* value of the predicate determines whether the remote version is "compatible" for the purposes of the display test.</p>
|
||||
*
|
||||
* <p>The local compatibility version may be of the value {@link DisplayTest#IGNORESERVERONLY},
|
||||
* <p>The local compatibility version may be of the value {@link net.minecraftforge.network.NetworkConstants#IGNORESERVERONLY},
|
||||
* in which case clients will ignore the mod's presence if it is present on the server but not on the client.
|
||||
* However, the remote version test predicate must still accept this value as a remote version in order to display
|
||||
* as compatible if the mod is present on the client.</p>
|
||||
@@ -95,6 +94,25 @@ public interface IExtensionPoint<T extends Record>
|
||||
*/
|
||||
@SuppressWarnings("JavadocReference") // reference to NetworkConstants, ForgeHooksClient
|
||||
record DisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) implements IExtensionPoint<DisplayTest> {
|
||||
public static final String IGNORESERVERONLY = "SERVER_ONLY";
|
||||
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";
|
||||
|
||||
/**
|
||||
* Ignores any version information coming from the server - use for server only mods
|
||||
*/
|
||||
public static final Supplier<DisplayTest> IGNORE_SERVER_VERSION = () -> new DisplayTest(IGNORESERVERONLY, (remoteVersion, isFromServer) -> true);
|
||||
|
||||
/**
|
||||
* Ignores all information and provides no information
|
||||
*/
|
||||
public static final Supplier<DisplayTest> IGNORE_ALL_VERSION = () -> new DisplayTest("", (remoteVersion, isFromServer) -> true);
|
||||
|
||||
/**
|
||||
* An optional alternative to {@link #DisplayTest(Supplier, BiPredicate)} which accepts a constant version string
|
||||
* instead of a {@link Supplier}.
|
||||
* <p>Internally, the provided version string is wrapped in a Supplier for you.</p>
|
||||
*/
|
||||
public DisplayTest(String version, BiPredicate<String, Boolean> remoteVersionTest) {
|
||||
this(() -> version, remoteVersionTest);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -64,9 +65,9 @@ public abstract class ModContainer
|
||||
() -> 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);
|
||||
IExtensionPoint.DisplayTest.IGNORE_SERVER_VERSION;
|
||||
case "IGNORE_ALL_VERSION" -> // Ignores all information and provides no information
|
||||
() -> new IExtensionPoint.DisplayTest(() -> "", (incoming, isNetwork) -> true);
|
||||
IExtensionPoint.DisplayTest.IGNORE_ALL_VERSION;
|
||||
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");
|
||||
@@ -145,6 +146,22 @@ public abstract class ModContainer
|
||||
extensionPoints.put(point, extension);
|
||||
}
|
||||
|
||||
public void registerDisplayTest(IExtensionPoint.DisplayTest displayTest) {
|
||||
registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> displayTest);
|
||||
}
|
||||
|
||||
public void registerDisplayTest(Supplier<IExtensionPoint.DisplayTest> displayTest) {
|
||||
registerExtensionPoint(IExtensionPoint.DisplayTest.class, displayTest);
|
||||
}
|
||||
|
||||
public void registerDisplayTest(String version, BiPredicate<String, Boolean> remoteVersionTest) {
|
||||
registerDisplayTest(new IExtensionPoint.DisplayTest(version, remoteVersionTest));
|
||||
}
|
||||
|
||||
public void registerDisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) {
|
||||
registerDisplayTest(new IExtensionPoint.DisplayTest(suppliedVersion, remoteVersionTest));
|
||||
}
|
||||
|
||||
public void addConfig(final ModConfig modConfig) {
|
||||
configs.put(modConfig.getType(), modConfig);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ModLoadingContext
|
||||
@@ -50,6 +51,44 @@ public class ModLoadingContext
|
||||
getActiveContainer().registerExtensionPoint(point, extension);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a {@link IExtensionPoint.DisplayTest} with the mod container.
|
||||
* <p>A shorthand for registering a DisplayTest with {@link #registerExtensionPoint(Class, Supplier)}.</p>
|
||||
* @param displayTest The {@link IExtensionPoint.DisplayTest} to register
|
||||
*/
|
||||
public void registerDisplayTest(IExtensionPoint.DisplayTest displayTest) {
|
||||
getActiveContainer().registerDisplayTest(() -> displayTest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a {@link IExtensionPoint.DisplayTest} with the mod container.
|
||||
* <p>A shorthand for registering a DisplayTest supplier with {@link #registerExtensionPoint(Class, Supplier)}.</p>
|
||||
* @param displayTest The {@link Supplier<IExtensionPoint.DisplayTest>} to register
|
||||
*/
|
||||
public void registerDisplayTest(Supplier<IExtensionPoint.DisplayTest> displayTest) {
|
||||
getActiveContainer().registerDisplayTest(displayTest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a {@link IExtensionPoint.DisplayTest} with the mod container.
|
||||
* <p>A shorthand for registering a DisplayTest with {@link #registerExtensionPoint(Class, Supplier)} that also
|
||||
* creates the DisplayTest instance for you using the provided parameters.</p>
|
||||
* @see IExtensionPoint.DisplayTest#DisplayTest(String, BiPredicate)
|
||||
*/
|
||||
public void registerDisplayTest(String version, BiPredicate<String, Boolean> remoteVersionTest) {
|
||||
getActiveContainer().registerDisplayTest(new IExtensionPoint.DisplayTest(version, remoteVersionTest));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a {@link IExtensionPoint.DisplayTest} with the mod container.
|
||||
* <p>A shorthand for registering a DisplayTest with {@link #registerExtensionPoint(Class, Supplier)} that also
|
||||
* creates the DisplayTest instance for you using the provided parameters.</p>
|
||||
* @see IExtensionPoint.DisplayTest#DisplayTest(Supplier, BiPredicate)
|
||||
*/
|
||||
public void registerDisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) {
|
||||
getActiveContainer().registerDisplayTest(new IExtensionPoint.DisplayTest(suppliedVersion, remoteVersionTest));
|
||||
}
|
||||
|
||||
public void registerConfig(ModConfig.Type type, IConfigSpec<?> spec) {
|
||||
if (spec.isEmpty())
|
||||
{
|
||||
|
||||
@@ -2,9 +2,10 @@ plugins {
|
||||
id 'com.github.ben-manes.versions'
|
||||
id 'org.javamodularity.moduleplugin' version '1.8.7' apply false
|
||||
id 'org.cadixdev.licenser'
|
||||
id 'java-library'
|
||||
id 'jacoco'
|
||||
}
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'jacoco'
|
||||
apply plugin: 'org.javamodularity.moduleplugin'
|
||||
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
|
||||
+29
-15
@@ -32,7 +32,7 @@ import java.lang.reflect.Modifier;
|
||||
import java.net.URI;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
@@ -40,15 +40,16 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.IntConsumer;
|
||||
import java.util.function.IntSupplier;
|
||||
import java.util.function.LongSupplier;
|
||||
@@ -78,7 +79,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger("EARLYDISPLAY");
|
||||
private final AtomicBoolean animationTimerTrigger = new AtomicBoolean(true);
|
||||
|
||||
private ColourScheme colourScheme;
|
||||
private ColourScheme colourScheme = ColourScheme.RED;
|
||||
private ElementShader elementShader;
|
||||
|
||||
private RenderElement.DisplayContext context;
|
||||
@@ -86,6 +87,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
private int framecount;
|
||||
private EarlyFramebuffer framebuffer;
|
||||
private ScheduledFuture<?> windowTick;
|
||||
private ScheduledFuture<?> initializationFuture;
|
||||
|
||||
private PerformanceInfo performanceInfo;
|
||||
private ScheduledFuture<?> performanceTick;
|
||||
@@ -134,13 +136,17 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
this.colourScheme = ColourScheme.BLACK;
|
||||
} else {
|
||||
try {
|
||||
var optionLines = Files.readAllLines(FMLPaths.GAMEDIR.get().resolve(Paths.get("options.txt")));
|
||||
var options = optionLines.stream().map(l -> l.split(":")).filter(a -> a.length == 2).collect(Collectors.toMap(a -> a[0], a -> a[1]));
|
||||
var colourScheme = Boolean.parseBoolean(options.getOrDefault("darkMojangStudiosBackground", "false"));
|
||||
this.colourScheme = colourScheme ? ColourScheme.BLACK : ColourScheme.RED;
|
||||
} catch (IOException ioe) {
|
||||
// No options
|
||||
this.colourScheme = ColourScheme.RED; // default to red colourscheme
|
||||
// check the options file for the colour scheme
|
||||
var optionLines = Files.readAllLines(FMLPaths.GAMEDIR.get().resolve(Path.of("options.txt")));
|
||||
var keyName = "darkMojangStudiosBackground:";
|
||||
for (String line : optionLines) {
|
||||
if (line.startsWith(keyName)) {
|
||||
this.colourScheme = line.startsWith("true", keyName.length()) ? ColourScheme.BLACK : ColourScheme.RED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
this.colourScheme = ColourScheme.RED; // fallback to red colourScheme
|
||||
}
|
||||
}
|
||||
this.maximized = parsed.has(maximizedopt) || FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_MAXIMIZED);
|
||||
@@ -225,7 +231,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
LOGGER.error("Crash during font initialization", t);
|
||||
crashElegantly("An error occurred initializing a font for rendering. "+t.getMessage());
|
||||
}
|
||||
this.elements = new ArrayList<>(Arrays.asList(
|
||||
this.elements = new ArrayList<>(List.of(
|
||||
RenderElement.anvil(font),
|
||||
RenderElement.logMessageOverlay(font),
|
||||
RenderElement.forgeVersionOverlay(font, mcVersion+"-"+forgeVersion.split("-")[0]),
|
||||
@@ -264,7 +270,6 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
public void render(int alpha) {
|
||||
var currentVAO = glGetInteger(GL_VERTEX_ARRAY_BINDING);
|
||||
var currentFB = glGetInteger(GL_READ_FRAMEBUFFER_BINDING);
|
||||
glfwSwapInterval(0);
|
||||
glViewport(0, 0, this.context.scaledWidth(), this.context.scaledHeight());
|
||||
RenderElement.globalAlpha = alpha;
|
||||
framebuffer.activate();
|
||||
@@ -287,7 +292,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
return thread;
|
||||
});
|
||||
initWindow(mcVersion);
|
||||
renderScheduler.schedule(() -> initRender(mcVersion, forgeVersion), 1, TimeUnit.MILLISECONDS);
|
||||
this.initializationFuture = renderScheduler.schedule(() -> initRender(mcVersion, forgeVersion), 1, TimeUnit.MILLISECONDS);
|
||||
return this::periodicTick;
|
||||
}
|
||||
|
||||
@@ -518,6 +523,16 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
* @return the Window we own.
|
||||
*/
|
||||
public long setupMinecraftWindow(final IntSupplier width, final IntSupplier height, final Supplier<String> title, final LongSupplier monitorSupplier) {
|
||||
// wait for the window to actually be initialized
|
||||
try {
|
||||
this.initializationFuture.get(30, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (TimeoutException e) {
|
||||
Thread.dumpStack();
|
||||
crashElegantly("We seem to be having trouble initializing the window, waited for 30 seconds");
|
||||
}
|
||||
|
||||
// we have to spin wait for the window ticker
|
||||
ImmediateWindowHandler.updateProgress("Initializing Game Graphics");
|
||||
while (!this.windowTick.isDone()) {
|
||||
@@ -584,8 +599,7 @@ public class DisplayWindow implements ImmediateWindowProvider {
|
||||
var fm = layer.findModule("forge").orElseThrow();
|
||||
getClass().getModule().addReads(fm);
|
||||
var clz = FMLLoader.getGameLayer().findModule("forge").map(l->Class.forName(l, "net.minecraftforge.client.loading.ForgeLoadingOverlay")).orElseThrow();
|
||||
var methods = Arrays.stream(clz.getMethods()).filter(m-> Modifier.isStatic(m.getModifiers())).collect(Collectors.toMap(Method::getName, Function.identity()));
|
||||
loadingOverlay = methods.get("newInstance");
|
||||
loadingOverlay = Arrays.stream(clz.getMethods()).filter(m-> Modifier.isStatic(m.getModifiers()) && m.getName().equals("newInstance")).findFirst().orElseThrow();
|
||||
}
|
||||
|
||||
public int getFramebufferTextureId() {
|
||||
|
||||
+14
-4
@@ -6,6 +6,7 @@
|
||||
package net.minecraftforge.fml.earlydisplay;
|
||||
|
||||
import com.sun.management.OperatingSystemMXBean;
|
||||
import net.minecraftforge.fml.loading.FMLConfig;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.MemoryMXBean;
|
||||
@@ -13,28 +14,37 @@ import java.lang.management.MemoryUsage;
|
||||
|
||||
public class PerformanceInfo {
|
||||
|
||||
private final boolean showCPUUsage;
|
||||
private final OperatingSystemMXBean osBean;
|
||||
private final MemoryMXBean memoryBean;
|
||||
|
||||
float memory;
|
||||
private String text;
|
||||
|
||||
PerformanceInfo() {
|
||||
osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
|
||||
showCPUUsage = FMLConfig.getBoolConfigValue(FMLConfig.ConfigValue.EARLY_WINDOW_SHOW_CPU);
|
||||
osBean = showCPUUsage ? ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class) : null;
|
||||
memoryBean = ManagementFactory.getMemoryMXBean();
|
||||
}
|
||||
|
||||
void update() {
|
||||
final MemoryUsage heapusage = memoryBean.getHeapMemoryUsage();
|
||||
memory = (float) heapusage.getUsed() / heapusage.getMax();
|
||||
|
||||
if (!showCPUUsage) {
|
||||
text = "Heap: %d/%d MB (%.1f%%) OffHeap: %d MB".formatted(heapusage.getUsed() >> 20, heapusage.getMax() >> 20, memory * 100.0, memoryBean.getNonHeapMemoryUsage().getUsed() >> 20);
|
||||
return;
|
||||
}
|
||||
|
||||
var cpuLoad = osBean.getProcessCpuLoad();
|
||||
String cpuText;
|
||||
if (cpuLoad == -1) {
|
||||
cpuText = String.format("*CPU: %.1f%%", osBean.getCpuLoad() * 100f);
|
||||
cpuText = "*CPU: %.1f%%".formatted(osBean.getCpuLoad() * 100f);
|
||||
} else {
|
||||
cpuText = String.format("CPU: %.1f%%", cpuLoad * 100f);
|
||||
cpuText = "CPU: %.1f%%".formatted(cpuLoad * 100f);
|
||||
}
|
||||
|
||||
text = String.format("Heap: %d/%d MB (%.1f%%) OffHeap: %d MB %s", heapusage.getUsed() >> 20, heapusage.getMax() >> 20, memory * 100.0, memoryBean.getNonHeapMemoryUsage().getUsed() >> 20, cpuText);
|
||||
text = "Heap: %d/%d MB (%.1f%%) OffHeap: %d MB %s".formatted(heapusage.getUsed() >> 20, heapusage.getMax() >> 20, memory * 100.0, memoryBean.getNonHeapMemoryUsage().getUsed() >> 20, cpuText);
|
||||
}
|
||||
|
||||
String text() {
|
||||
|
||||
+8
-2
@@ -34,11 +34,14 @@ public class RenderElement {
|
||||
};
|
||||
}
|
||||
}
|
||||
@FunctionalInterface
|
||||
interface TextureRenderer {
|
||||
void accept(SimpleBufferBuilder bb, DisplayContext context, int[] size, int frame);
|
||||
}
|
||||
@FunctionalInterface
|
||||
interface Initializer extends Supplier<Renderer> {}
|
||||
|
||||
@FunctionalInterface
|
||||
interface TextGenerator {
|
||||
void accept(SimpleBufferBuilder bb, SimpleFont fh, DisplayContext ctx);
|
||||
}
|
||||
@@ -201,14 +204,17 @@ public class RenderElement {
|
||||
bar.then(label).accept(buffer, context, frameNumber);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface ColourFunction {
|
||||
int colour(int frame);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface ProgressDisplay {
|
||||
float[] progress(int frame);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
interface BarPosition {
|
||||
int[] location(DisplayContext context);
|
||||
}
|
||||
@@ -280,7 +286,7 @@ public class RenderElement {
|
||||
if (num < min) {
|
||||
return min;
|
||||
} else {
|
||||
return num > max ? max : num;
|
||||
return Math.min(num, max);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,7 +294,7 @@ public class RenderElement {
|
||||
if (num < min) {
|
||||
return min;
|
||||
} else {
|
||||
return num > max ? max : num;
|
||||
return Math.min(num, max);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@ plugins {
|
||||
id 'com.github.ben-manes.versions'
|
||||
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
||||
id 'org.cadixdev.licenser'
|
||||
id 'java-library'
|
||||
id 'jacoco'
|
||||
}
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'jacoco'
|
||||
apply plugin: 'org.javamodularity.moduleplugin'
|
||||
|
||||
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
||||
configurations.forEach{ it.transitive = false }
|
||||
@@ -76,7 +77,7 @@ jar.doFirst {
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs << '-Xlint:unchecked'
|
||||
options.compilerArgs << '-Xlint:-unchecked'
|
||||
}
|
||||
|
||||
license {
|
||||
|
||||
@@ -36,7 +36,8 @@ public class FMLConfig
|
||||
EARLY_WINDOW_FBSCALE("earlyWindowFBScale", 1, "Early window framebuffer scale"),
|
||||
EARLY_WINDOW_MAXIMIZED("earlyWindowMaximized", Boolean.FALSE, "Early window starts maximized"),
|
||||
EARLY_WINDOW_SKIP_GL_VERSIONS("earlyWindowSkipGLVersions", List.of(), "Skip specific GL versions, may help with buggy graphics card drivers"),
|
||||
EARLY_WINDOW_SQUIR("earlyWindowSquir", Boolean.FALSE, "Squir?")
|
||||
EARLY_WINDOW_SQUIR("earlyWindowSquir", Boolean.FALSE, "Squir?"),
|
||||
EARLY_WINDOW_SHOW_CPU("earlyWindowShowCPU", Boolean.FALSE, "Whether to show CPU usage stats in early window"),
|
||||
;
|
||||
|
||||
private final String entry;
|
||||
|
||||
@@ -18,12 +18,15 @@ import java.util.function.BiPredicate;
|
||||
public class VersionSupportMatrix {
|
||||
private static final HashMap<String, List<ArtifactVersion>> overrideVersions = new HashMap<>();
|
||||
static {
|
||||
final ArtifactVersion version = new DefaultArtifactVersion(FMLLoader.versionInfo().mcVersion());
|
||||
if (MavenVersionAdapter.createFromVersionSpec("[1.19.2]").containsVersion(version)) {
|
||||
// 1.19.2 is Compatible with 1.19.1
|
||||
add("languageloader.javafml", "42");
|
||||
add("mod.minecraft", "1.19.1");
|
||||
add("mod.forge", "42.0.9");
|
||||
// final ArtifactVersion version = new DefaultArtifactVersion(FMLLoader.versionInfo().mcVersion());
|
||||
// if (MavenVersionAdapter.createFromVersionSpec("[1.19.2]").containsVersion(version)) {
|
||||
// // 1.19.2 is Compatible with 1.19.1
|
||||
// add("languageloader.javafml", "42");
|
||||
// add("mod.minecraft", "1.19.1");
|
||||
// add("mod.forge", "42.0.9");
|
||||
// }
|
||||
if (FMLLoader.versionInfo().mcVersion().equals("1.20.1")) {
|
||||
add("mod.forge", "47.1.79");
|
||||
}
|
||||
}
|
||||
private static void add(String key, String value) {
|
||||
|
||||
@@ -80,7 +80,8 @@ public class ModInfo implements IModInfo, IConfigurable
|
||||
this.displayName = config.<String>getConfigElement("displayName")
|
||||
.orElse(this.modId);
|
||||
this.description = config.<String>getConfigElement("description")
|
||||
.orElse("MISSING DESCRIPTION");
|
||||
.orElse("MISSING DESCRIPTION")
|
||||
.replace("\r\n", "\n").stripIndent();
|
||||
this.logoFile = Optional.ofNullable(config.<String>getConfigElement("logoFile")
|
||||
.orElseGet(() -> ownFile.flatMap(mf -> mf.<String>getConfigElement("logoFile"))
|
||||
.orElse(null)));
|
||||
@@ -205,7 +206,7 @@ public class ModInfo implements IModInfo, IConfigurable
|
||||
private final boolean mandatory;
|
||||
private final Ordering ordering;
|
||||
private final DependencySide side;
|
||||
private Optional<URL> referralUrl;
|
||||
private final Optional<URL> referralUrl;
|
||||
|
||||
public ModVersion(final IModInfo owner, final IConfigurable config) {
|
||||
this.owner = owner;
|
||||
|
||||
+26
-4
@@ -6,6 +6,7 @@
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.mojang.logging.LogUtils;
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import cpw.mods.modlauncher.api.IModuleLayerManager;
|
||||
import cpw.mods.modlauncher.api.ITransformationService;
|
||||
import net.minecraftforge.fml.loading.*;
|
||||
@@ -26,14 +27,17 @@ public class ModValidator {
|
||||
private final Map<IModFile.Type, List<ModFile>> modFiles;
|
||||
private final List<ModFile> candidatePlugins;
|
||||
private final List<ModFile> candidateMods;
|
||||
private final List<ModFile> gameLibraries;
|
||||
private LoadingModList loadingModList;
|
||||
private List<IModFile> brokenFiles;
|
||||
private final List<IModFile> brokenFiles;
|
||||
private final List<EarlyLoadingException.ExceptionData> discoveryErrorData;
|
||||
|
||||
public ModValidator(final Map<IModFile.Type, List<ModFile>> modFiles, final List<IModFileInfo> brokenFiles, final List<EarlyLoadingException.ExceptionData> discoveryErrorData) {
|
||||
this.modFiles = modFiles;
|
||||
this.candidateMods = lst(modFiles.get(IModFile.Type.MOD));
|
||||
this.candidateMods.addAll(lst(modFiles.get(IModFile.Type.GAMELIBRARY)));
|
||||
this.gameLibraries = lst(modFiles.get(IModFile.Type.GAMELIBRARY));
|
||||
this.candidateMods.addAll(this.gameLibraries);
|
||||
this.candidatePlugins = lst(modFiles.get(IModFile.Type.LANGPROVIDER));
|
||||
this.candidatePlugins.addAll(lst(modFiles.get(IModFile.Type.LIBRARY)));
|
||||
this.discoveryErrorData = discoveryErrorData;
|
||||
@@ -55,8 +59,7 @@ public class ModValidator {
|
||||
@NotNull
|
||||
private List<ModFile> validateFiles(final List<ModFile> mods) {
|
||||
final List<ModFile> brokenFiles = new ArrayList<>();
|
||||
for (Iterator<ModFile> iterator = mods.iterator(); iterator.hasNext(); )
|
||||
{
|
||||
for (Iterator<ModFile> iterator = mods.iterator(); iterator.hasNext();) {
|
||||
ModFile modFile = iterator.next();
|
||||
if (!modFile.getProvider().isValid(modFile) || !modFile.identifyMods()) {
|
||||
LOGGER.warn(LogMarkers.SCAN, "File {} has been ignored - it is invalid", modFile.getFilePath());
|
||||
@@ -72,7 +75,26 @@ public class ModValidator {
|
||||
}
|
||||
|
||||
public ITransformationService.Resource getModResources() {
|
||||
return new ITransformationService.Resource(IModuleLayerManager.Layer.GAME, this.candidateMods.stream().map(IModFile::getSecureJar).toList());
|
||||
var mods = new ArrayList<SecureJar>();
|
||||
// Add only the valid mods that we will be attempting to load.
|
||||
// If any detectable error happens during the sorting process {missing deps, duplicates,
|
||||
// This helps prevent coremods/mixins from screwing up us displaying the error screens that the sorting/validation is trying to display.
|
||||
// This won't fix them all as they are still loaded and will still apply but it might help
|
||||
for (var info : this.loadingModList.getModFiles())
|
||||
mods.add(info.getFile().getSecureJar());
|
||||
|
||||
// Add any game libraries, this *may* be duplicates, depending on the state of the sorting. But until I get around to re-writing
|
||||
// that clusterfuck of a system, have this simple de-duplication. Order of resource is important, but i'm unsure if duplication is
|
||||
// so might as well waste a few cycles on checking. Still faster then converting from a set to a list.
|
||||
// Ideally we would explicitly list out which mods to load {forge and MC being the only ones} but some coremods could require extra things.
|
||||
// So try game libraries as well
|
||||
for (var lib : this.gameLibraries) {
|
||||
var jar = lib.getSecureJar();
|
||||
if (!mods.contains(jar))
|
||||
mods.add(jar);
|
||||
}
|
||||
|
||||
return new ITransformationService.Resource(IModuleLayerManager.Layer.GAME, mods);
|
||||
}
|
||||
|
||||
private List<EarlyLoadingException.ExceptionData> validateLanguages() {
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
public final class ProgressMeter {
|
||||
private final String name;
|
||||
private final int steps;
|
||||
private AtomicInteger current;
|
||||
private final AtomicInteger current;
|
||||
private Message label;
|
||||
|
||||
public ProgressMeter(String name, int steps, int current, Message label) {
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
public class FMLClientDevLaunchHandler extends CommonDevLaunchHandler {
|
||||
@Override public String name() { return "fmlclientdev"; }
|
||||
@Override public Dist getDist() { return Dist.CLIENT; }
|
||||
|
||||
@Override
|
||||
public void devService(String[] arguments, ModuleLayer layer) throws Throwable {
|
||||
clientService(arguments, layer);
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import net.minecraftforge.fml.loading.LibraryFinder;
|
||||
import net.minecraftforge.fml.loading.VersionInfo;
|
||||
|
||||
public class FMLClientLaunchHandler extends CommonClientLaunchHandler {
|
||||
@Override public String name() { return "fmlclient"; }
|
||||
|
||||
@Override
|
||||
protected void processMCStream(VersionInfo versionInfo, Stream.Builder<Path> mc, Stream.Builder<List<Path>> mods) {
|
||||
var fmlonly = LibraryFinder.findPathForMaven(versionInfo.forgeGroup(), "fmlonly", "", "universal", versionInfo.mcAndForgeVersion());
|
||||
mods.add(List.of(fmlonly));
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
public class FMLClientUserdevLaunchHandler extends FMLUserdevLaunchHandler {
|
||||
@Override
|
||||
public String name() { return "fmlclientuserdev"; }
|
||||
|
||||
@Override
|
||||
public Dist getDist() { return Dist.CLIENT; }
|
||||
|
||||
@Override
|
||||
protected void devService(String[] arguments, ModuleLayer layer) throws Throwable {
|
||||
clientService(arguments, layer);
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
public class FMLDataUserdevLaunchHandler extends FMLUserdevLaunchHandler {
|
||||
@Override
|
||||
public String name() { return "fmldatauserdev"; }
|
||||
|
||||
@Override
|
||||
public Dist getDist() { return Dist.CLIENT; }
|
||||
|
||||
@Override
|
||||
public boolean isData() { return true; }
|
||||
|
||||
@Override
|
||||
public void devService(String[] arguments, ModuleLayer layer) throws Throwable {
|
||||
dataService(arguments, layer);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
public class FMLServerDevLaunchHandler extends CommonDevLaunchHandler {
|
||||
@Override public String name() { return "fmlserverdev"; }
|
||||
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
||||
|
||||
@Override
|
||||
public void devService(String[] arguments, ModuleLayer layer) throws Throwable {
|
||||
serverService(arguments, layer);
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import cpw.mods.modlauncher.api.ILaunchHandlerService;
|
||||
import net.minecraftforge.fml.loading.LibraryFinder;
|
||||
import net.minecraftforge.fml.loading.VersionInfo;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class FMLServerLaunchHandler extends CommonServerLaunchHandler implements ILaunchHandlerService {
|
||||
@Override public String name() { return "fmlserver"; }
|
||||
|
||||
@Override
|
||||
protected BiPredicate<String, String> processMCStream(VersionInfo versionInfo, Stream.Builder<Path> mc, BiPredicate<String, String> filter, Stream.Builder<List<Path>> mods) {
|
||||
var fmlonly = LibraryFinder.findPathForMaven(versionInfo.forgeGroup(), "fmlonly", "", "universal", versionInfo.mcAndForgeVersion());
|
||||
mods.add(List.of(fmlonly));
|
||||
return filter;
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
public class FMLServerUserdevLaunchHandler extends FMLUserdevLaunchHandler {
|
||||
@Override public String name() { return "fmlserveruserdev"; }
|
||||
@Override public Dist getDist() { return Dist.DEDICATED_SERVER; }
|
||||
|
||||
@Override
|
||||
public void devService(String[] arguments, ModuleLayer layer) throws Throwable {
|
||||
serverService(arguments, layer);
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.loading.targets;
|
||||
|
||||
import net.minecraftforge.fml.loading.VersionInfo;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public abstract class FMLUserdevLaunchHandler extends CommonUserdevLaunchHandler {
|
||||
@Override
|
||||
protected void processStreams(String[] classpath, VersionInfo versionInfo, Stream.Builder<Path> mc, Stream.Builder<List<Path>> mods) {
|
||||
var fmlonly = findJarOnClasspath(classpath, "fmlonly-" + versionInfo.mcAndForgeVersion());
|
||||
mc.add(fmlonly);
|
||||
}
|
||||
}
|
||||
+8
@@ -1,3 +1,11 @@
|
||||
net.minecraftforge.fml.loading.targets.FMLClientLaunchHandler
|
||||
net.minecraftforge.fml.loading.targets.FMLClientDevLaunchHandler
|
||||
net.minecraftforge.fml.loading.targets.FMLClientUserdevLaunchHandler
|
||||
net.minecraftforge.fml.loading.targets.FMLServerLaunchHandler
|
||||
net.minecraftforge.fml.loading.targets.FMLServerDevLaunchHandler
|
||||
net.minecraftforge.fml.loading.targets.FMLServerUserdevLaunchHandler
|
||||
net.minecraftforge.fml.loading.targets.FMLDataUserdevLaunchHandler
|
||||
|
||||
net.minecraftforge.fml.loading.targets.ForgeClientLaunchHandler
|
||||
net.minecraftforge.fml.loading.targets.ForgeClientDevLaunchHandler
|
||||
net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../src/fmlcommon/
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Minecraft Forge - Forge Development LLC
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fmlonly;
|
||||
|
||||
import net.minecraftforge.eventbus.api.BusBuilder;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.I18NParser;
|
||||
import net.minecraftforge.fml.IBindingsProvider;
|
||||
import net.minecraftforge.fml.config.IConfigEvent;
|
||||
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class FMLOnlyBindings implements IBindingsProvider {
|
||||
private static final IEventBus DUMMYFORGEBUS = BusBuilder.builder().build();
|
||||
|
||||
@Override
|
||||
public Supplier<IEventBus> getForgeBusSupplier() {
|
||||
return ()->DUMMYFORGEBUS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Supplier<I18NParser> getMessageParser() {
|
||||
return ()->new I18NParser() {
|
||||
@Override
|
||||
public String parseMessage(final String i18nMessage, final Object... args) {
|
||||
return i18nMessage + Arrays.stream(args).map(Objects::toString).collect(Collectors.joining(",", "[", "]"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String stripControlCodes(final String toStrip) {
|
||||
return toStrip;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Supplier<IConfigEvent.ConfigConfig> getConfigConfiguration() {
|
||||
return ()->new IConfigEvent.ConfigConfig(ModConfigEvent.Loading::new, ModConfigEvent.Reloading::new, ModConfigEvent.Unloading::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Minecraft Forge - Forge Development LLC
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fmlonly;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod("fmlonly")
|
||||
public class FMLOnlyMod {}
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Minecraft Forge - Forge Development LLC
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fmlonlyclient;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.ClientPackSource;
|
||||
import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraft.server.packs.resources.PreparableReloadListener;
|
||||
import net.minecraft.server.packs.resources.ReloadableResourceManager;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.LoadingFailedException;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
import net.minecraftforge.fml.ModWorkManager;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ClientModLoader
|
||||
{
|
||||
private static boolean loading;
|
||||
private static Minecraft mc;
|
||||
private static boolean loadingComplete;
|
||||
private static LoadingFailedException error;
|
||||
|
||||
public static void begin(final Minecraft minecraft, final PackRepository defaultResourcePacks, final ReloadableResourceManager mcResourceManager)
|
||||
{
|
||||
// force log4j to shutdown logging in a shutdown hook. This is because we disable default shutdown hook so the server properly logs it's shutdown
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(LogManager::shutdown));
|
||||
loading = true;
|
||||
ClientModLoader.mc = minecraft;
|
||||
createRunnableWithCatch(()->ModLoader.get().gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), ()->{})).run();
|
||||
mcResourceManager.registerReloadListener(ClientModLoader::onResourceReload);
|
||||
}
|
||||
|
||||
private static CompletableFuture<Void> onResourceReload(final PreparableReloadListener.PreparationBarrier stage, final ResourceManager resourceManager, final ProfilerFiller prepareProfiler, final ProfilerFiller executeProfiler, final Executor asyncExecutor, final Executor syncExecutor) {
|
||||
return CompletableFuture.runAsync(createRunnableWithCatch(() -> startModLoading(ModWorkManager.wrappedExecutor(syncExecutor), asyncExecutor)), ModWorkManager.parallelExecutor())
|
||||
.thenCompose(stage::wait)
|
||||
.thenRunAsync(() -> finishModLoading(ModWorkManager.wrappedExecutor(syncExecutor), asyncExecutor), ModWorkManager.parallelExecutor());
|
||||
}
|
||||
|
||||
private static Runnable createRunnableWithCatch(Runnable r) {
|
||||
return ()-> {
|
||||
if (loadingComplete) return;
|
||||
try {
|
||||
r.run();
|
||||
} catch (LoadingFailedException e) {
|
||||
if (error == null) error = e;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static void startModLoading(ModWorkManager.DrivenExecutor syncExecutor, Executor parallelExecutor) {
|
||||
if (error!=null) throw error;
|
||||
createRunnableWithCatch(() -> ModLoader.get().loadMods(syncExecutor, parallelExecutor, ()->{})).run();
|
||||
}
|
||||
|
||||
private static void finishModLoading(ModWorkManager.DrivenExecutor syncExecutor, Executor parallelExecutor)
|
||||
{
|
||||
if (error!=null) throw error;
|
||||
createRunnableWithCatch(() -> ModLoader.get().finishMods(syncExecutor, parallelExecutor, ()->{})).run();
|
||||
loading = false;
|
||||
loadingComplete = true;
|
||||
// reload game settings on main thread
|
||||
syncExecutor.execute(()->mc.options.load());
|
||||
}
|
||||
|
||||
public static boolean isLoading()
|
||||
{
|
||||
return loading;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Minecraft Forge - Forge Development LLC
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fmlonlyserver;
|
||||
|
||||
import joptsimple.OptionParser;
|
||||
import net.minecraftforge.fml.LoadingFailedException;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
import net.minecraftforge.fml.ModLoadingWarning;
|
||||
import net.minecraftforge.fml.ModWorkManager;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import static net.minecraftforge.fml.Logging.LOADING;
|
||||
|
||||
public class ServerModLoader
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static boolean hasErrors = false;
|
||||
|
||||
public static void addOptions(OptionParser parser)
|
||||
{
|
||||
// We consume this argument as we use it in the launcher and the client side.
|
||||
parser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File("."));
|
||||
}
|
||||
|
||||
public static void load()
|
||||
{
|
||||
try
|
||||
{
|
||||
ModLoader.get().gatherAndInitializeMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), () -> {});
|
||||
ModLoader.get().loadMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), () -> {});
|
||||
ModLoader.get().finishMods(ModWorkManager.syncExecutor(), ModWorkManager.parallelExecutor(), () -> {});
|
||||
} catch (LoadingFailedException error)
|
||||
{
|
||||
ServerModLoader.hasErrors = true;
|
||||
throw error;
|
||||
}
|
||||
List<ModLoadingWarning> warnings = ModLoader.get().getWarnings();
|
||||
if (!warnings.isEmpty())
|
||||
{
|
||||
LOGGER.warn(LOADING, "Mods loaded with {} warnings", warnings.size());
|
||||
warnings.forEach(warning -> LOGGER.warn(LOADING, warning.formatToString()));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasErrors()
|
||||
{
|
||||
return ServerModLoader.hasErrors;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"load_fml_client": "coremods/load_fml_client.js",
|
||||
"load_fml_server": "coremods/load_fml_server.js"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="[24,]"
|
||||
issueTrackerURL="https://www.minecraftforge.net/"
|
||||
license="LGPL v2.1"
|
||||
|
||||
[[mods]]
|
||||
modId="fmlonly"
|
||||
# We use the global forge version
|
||||
version="${global.forgeVersion}"
|
||||
updateJSONURL="https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json"
|
||||
displayName="Forge"
|
||||
credits="Anyone who has contributed on Github and supports our development"
|
||||
authors="LexManos,cpw"
|
||||
description='''
|
||||
Forge, a broad compatibility API.
|
||||
'''
|
||||
@@ -0,0 +1 @@
|
||||
net.minecraftforge.fmlonly.FMLOnlyBindings
|
||||
@@ -0,0 +1 @@
|
||||
net.minecraftforge.fml.core.ModStateProvider
|
||||
@@ -0,0 +1,36 @@
|
||||
var ASMAPI = Java.type('net.minecraftforge.coremod.api.ASMAPI')
|
||||
var Opcodes = Java.type('org.objectweb.asm.Opcodes')
|
||||
|
||||
function initializeCoreMod() {
|
||||
return {
|
||||
'minecraft': {
|
||||
'target': {
|
||||
'type': 'METHOD',
|
||||
'class': 'net.minecraft.client.Minecraft',
|
||||
'methodName': '<init>',
|
||||
'methodDesc': '(Lnet/minecraft/client/main/GameConfig;)V'
|
||||
},
|
||||
'transformer': function(methodNode) {
|
||||
//print(ASMAPI.methodNodeToString(methodNode))
|
||||
var meth = ASMAPI.getMethodNode();
|
||||
var resourcePackRepository = ASMAPI.mapField("f_91038_")
|
||||
var resourceManager = ASMAPI.mapField("f_91036_")
|
||||
|
||||
meth.visitVarInsn(Opcodes.ALOAD, 0);
|
||||
meth.visitVarInsn(Opcodes.ALOAD, 0);
|
||||
meth.visitFieldInsn(Opcodes.GETFIELD, "net/minecraft/client/Minecraft", resourcePackRepository, "Lnet/minecraft/server/packs/repository/PackRepository;");
|
||||
meth.visitVarInsn(Opcodes.ALOAD, 0);
|
||||
meth.visitFieldInsn(Opcodes.GETFIELD, "net/minecraft/client/Minecraft", resourceManager, "Lnet/minecraft/server/packs/resources/ReloadableResourceManager;");
|
||||
meth.visitMethodInsn(Opcodes.INVOKESTATIC, "net/minecraftforge/fmlonlyclient/ClientModLoader", "begin", "(Lnet/minecraft/client/Minecraft;Lnet/minecraft/server/packs/repository/PackRepository;Lnet/minecraft/server/packs/resources/ReloadableResourceManager;)V", false)
|
||||
for (var i=0; i<methodNode.instructions.size(); i++) {
|
||||
var ain = methodNode.instructions.get(i);
|
||||
if (ain.getOpcode() == Opcodes.PUTFIELD && ain.name.equals(resourceManager)) {
|
||||
methodNode.instructions.insert(ain, meth.instructions);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return methodNode;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
var ASMAPI = Java.type('net.minecraftforge.coremod.api.ASMAPI')
|
||||
var Opcodes = Java.type('org.objectweb.asm.Opcodes')
|
||||
|
||||
function initializeCoreMod() {
|
||||
return {
|
||||
'minecraft': {
|
||||
'target': {
|
||||
'type': 'METHOD',
|
||||
'class': 'net.minecraft.server.Main',
|
||||
'methodName': 'main',
|
||||
'methodDesc': '([Ljava/lang/String;)V'
|
||||
},
|
||||
'transformer': function(methodNode) {
|
||||
var meth = ASMAPI.getMethodNode();
|
||||
meth.visitMethodInsn(Opcodes.INVOKESTATIC, 'net/minecraftforge/fmlonlyserver/ServerModLoader', 'load', '()V', false)
|
||||
|
||||
var methOptions = ASMAPI.getMethodNode();
|
||||
methOptions.visitIntInsn(Opcodes.ALOAD, 1);
|
||||
methOptions.visitMethodInsn(Opcodes.INVOKESTATIC, 'net/minecraftforge/fmlonlyserver/ServerModLoader', 'addOptions', '(Ljoptsimple/OptionParser;)V', false)
|
||||
|
||||
for (var i=0; i<methodNode.instructions.size(); i++) {
|
||||
var ain = methodNode.instructions.get(i);
|
||||
if (ain.getOpcode() == Opcodes.INVOKESPECIAL && ain.owner == 'joptsimple/OptionParser' && ain.name == '<init>' && ain.desc == '()V') {
|
||||
// Inject after the STORE
|
||||
methodNode.instructions.insert(methodNode.instructions.get(i + 1), methOptions.instructions);
|
||||
} else if (ain.getOpcode() == Opcodes.INVOKESTATIC && ain.owner == 'net/minecraft/Util' && ain.name == ASMAPI.mapMethod('m_137584_') /* startTimerHackThread */ && ain.desc == '()V') {
|
||||
methodNode.instructions.insert(ain, meth.instructions);
|
||||
break; // By this point we've already reached the first injection point so break
|
||||
}
|
||||
}
|
||||
return methodNode;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -85,9 +85,6 @@ done
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
@@ -144,7 +141,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -152,7 +149,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
activeContentFilterList=*.makefile,makefile,*.Makefile,Makefile,Makefile.*,*.mk,MANIFEST.MF,.project,*.yml
|
||||
addNewLine=true
|
||||
convertActionOnSaave=AnyEdit.CnvrtTabToSpaces
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
fixLineDelimiters=false
|
||||
ignoreBlankLinesWhenTrimming=false
|
||||
inActiveContentFilterList=
|
||||
javaTabWidthForJava=true
|
||||
org.eclipse.jdt.ui.editor.tab.width=2
|
||||
projectPropsEnabled=true
|
||||
removeTrailingSpaces=true
|
||||
replaceAllSpaces=false
|
||||
replaceAllTabs=false
|
||||
saveAndAddLine=false
|
||||
saveAndConvert=true
|
||||
saveAndFixLineDelimiters=false
|
||||
saveAndTrim=true
|
||||
useModulo4Tabs=false
|
||||
@@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
@@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
line.separator=\n
|
||||
@@ -2,9 +2,10 @@ plugins {
|
||||
id 'com.github.ben-manes.versions'
|
||||
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
||||
id 'org.cadixdev.licenser'
|
||||
id 'java-library'
|
||||
id 'jacoco'
|
||||
}
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'jacoco'
|
||||
apply plugin: 'org.javamodularity.moduleplugin'
|
||||
|
||||
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
import org.apache.logging.log4j.MarkerManager;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
public class FMLModContainer extends ModContainer
|
||||
@@ -70,6 +72,11 @@ public class FMLModContainer extends ModContainer
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
// When a mod constructor throws an exception, it's wrapped in an InvocationTargetException which hides the
|
||||
// actual exception from the mod loading error screen.
|
||||
if (e instanceof InvocationTargetException wrapped)
|
||||
e = Objects.requireNonNullElse(wrapped.getCause(), e); // unwrap the exception
|
||||
|
||||
LOGGER.error(LOADING,"Failed to create mod instance. ModID: {}, class {}", getModId(), modClass.getName(), e);
|
||||
throw new ModLoadingException(modInfo, ModLoadingStage.CONSTRUCT, "fml.modloading.failedtoloadmod", e, modClass);
|
||||
}
|
||||
|
||||
@@ -2,9 +2,10 @@ plugins {
|
||||
id 'com.github.ben-manes.versions'
|
||||
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
||||
id 'org.cadixdev.licenser'
|
||||
id 'java-library'
|
||||
id 'jacoco'
|
||||
}
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'jacoco'
|
||||
apply plugin: 'org.javamodularity.moduleplugin'
|
||||
|
||||
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@ plugins {
|
||||
id 'com.github.ben-manes.versions'
|
||||
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
|
||||
id 'org.cadixdev.licenser'
|
||||
id 'java-library'
|
||||
id 'jacoco'
|
||||
}
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'jacoco'
|
||||
apply plugin: 'org.javamodularity.moduleplugin'
|
||||
|
||||
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
|
||||
|
||||
|
||||
+7
-7
@@ -16,19 +16,19 @@ Step 1: Open your command-line and browse to the folder where you extracted the
|
||||
|
||||
Step 2: You're left with a choice.
|
||||
If you prefer to use Eclipse:
|
||||
1. Run the following command: `gradlew genEclipseRuns` (`./gradlew genEclipseRuns` if you are on Mac/Linux)
|
||||
1. Run the following command: `./gradlew genEclipseRuns`
|
||||
2. Open Eclipse, Import > Existing Gradle Project > Select Folder
|
||||
or run `gradlew eclipse` to generate the project.
|
||||
|
||||
If you prefer to use IntelliJ:
|
||||
1. Open IDEA, and import project.
|
||||
2. Select your build.gradle file and have it import.
|
||||
3. Run the following command: `gradlew genIntellijRuns` (`./gradlew genIntellijRuns` if you are on Mac/Linux)
|
||||
3. Run the following command: `./gradlew genIntellijRuns`
|
||||
4. Refresh the Gradle Project in IDEA if required.
|
||||
|
||||
If at any point you are missing libraries in your IDE, or you've run into problems you can
|
||||
run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything
|
||||
{this does not affect your code} and then start the process again.
|
||||
(this does not affect your code) and then start the process again.
|
||||
|
||||
Mapping Names:
|
||||
=============================
|
||||
@@ -40,7 +40,7 @@ https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
|
||||
Additional Resources:
|
||||
=========================
|
||||
Community Documentation: https://mcforge.readthedocs.io/en/latest/gettingstarted/
|
||||
LexManos' Install Video: https://www.youtube.com/watch?v=8VEdtQLuLO0
|
||||
Forge Forum: https://forums.minecraftforge.net/
|
||||
Forge Discord: https://discord.gg/UvedJ9m
|
||||
Community Documentation: https://docs.minecraftforge.net/en/1.20.1/gettingstarted/
|
||||
LexManos' Install Video: https://youtu.be/8VEdtQLuLO0
|
||||
Forge Forums: https://forums.minecraftforge.net/
|
||||
Forge Discord: https://discord.minecraftforge.net/
|
||||
+1
-1
@@ -9,5 +9,5 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
|
||||
}
|
||||
@@ -5,30 +5,30 @@
|
||||
GlStateManager._texParameter(3553, 10242, 33071);
|
||||
GlStateManager._texParameter(3553, 10243, 33071);
|
||||
+ if (!stencilEnabled)
|
||||
GlStateManager._texImage2D(3553, 0, 6402, this.width, this.height, 0, 6402, 5126, (IntBuffer)null);
|
||||
GlStateManager._texImage2D(3553, 0, 6402, this.f_83915_, this.f_83916_, 0, 6402, 5126, (IntBuffer)null);
|
||||
+ else
|
||||
+ GlStateManager._texImage2D(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.width, this.height, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null);
|
||||
+ GlStateManager._texImage2D(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.f_83915_, this.f_83916_, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null);
|
||||
}
|
||||
|
||||
this.setFilterMode(9728);
|
||||
this.m_83936_(9728);
|
||||
@@ -124,7 +_,14 @@
|
||||
GlStateManager._glBindFramebuffer(36160, this.frameBufferId);
|
||||
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.colorTextureId, 0);
|
||||
if (this.useDepth) {
|
||||
GlStateManager._glBindFramebuffer(36160, this.f_83920_);
|
||||
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.f_83923_, 0);
|
||||
if (this.f_83919_) {
|
||||
+ if(!stencilEnabled)
|
||||
GlStateManager._glFramebufferTexture2D(36160, 36096, 3553, this.depthBufferId, 0);
|
||||
GlStateManager._glFramebufferTexture2D(36160, 36096, 3553, this.f_83924_, 0);
|
||||
+ else if(net.minecraftforge.common.ForgeConfig.CLIENT.useCombinedDepthStencilAttachment.get()) {
|
||||
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL_ATTACHMENT, 3553, this.depthBufferId, 0);
|
||||
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL_ATTACHMENT, 3553, this.f_83924_, 0);
|
||||
+ } else {
|
||||
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_ATTACHMENT, 3553, this.depthBufferId, 0);
|
||||
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, 3553, this.depthBufferId, 0);
|
||||
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_ATTACHMENT, 3553, this.f_83924_, 0);
|
||||
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, 3553, this.f_83924_, 0);
|
||||
+ }
|
||||
}
|
||||
|
||||
this.checkStatus();
|
||||
this.m_83949_();
|
||||
@@ -292,4 +_,27 @@
|
||||
public int getDepthTextureId() {
|
||||
return this.depthBufferId;
|
||||
public int m_83980_() {
|
||||
return this.f_83924_;
|
||||
}
|
||||
+
|
||||
+ /*================================ FORGE START ================================================*/
|
||||
@@ -42,7 +42,7 @@
|
||||
+ public void enableStencil() {
|
||||
+ if(stencilEnabled) return;
|
||||
+ stencilEnabled = true;
|
||||
+ this.resize(viewWidth, viewHeight, net.minecraft.client.Minecraft.ON_OSX);
|
||||
+ this.m_83941_(f_83917_, f_83918_, net.minecraft.client.Minecraft.f_91002_);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
--- a/com/mojang/blaze3d/platform/Window.java
|
||||
+++ b/com/mojang/blaze3d/platform/Window.java
|
||||
@@ -81,7 +_,8 @@
|
||||
@@ -83,7 +_,8 @@
|
||||
GLFW.glfwWindowHint(139267, 2);
|
||||
GLFW.glfwWindowHint(139272, 204801);
|
||||
GLFW.glfwWindowHint(139270, 1);
|
||||
- this.window = GLFW.glfwCreateWindow(this.width, this.height, p_85376_, this.fullscreen && monitor != null ? monitor.getMonitor() : 0L, 0L);
|
||||
+ this.window = net.minecraftforge.fml.loading.ImmediateWindowHandler.setupMinecraftWindow(()->this.width, ()->this.height, ()->p_85376_, ()->this.fullscreen && monitor != null ? monitor.getMonitor() : 0L);
|
||||
+ if (!net.minecraftforge.fml.loading.ImmediateWindowHandler.positionWindow(Optional.ofNullable(monitor), w->this.width = this.windowedWidth = w, h->this.height = this.windowedHeight = h, x->this.x = this.windowedX = x, y->this.y = this.windowedY = y)) {
|
||||
- this.f_85349_ = GLFW.glfwCreateWindow(this.f_85359_, this.f_85360_, p_85376_, this.f_85355_ && monitor != null ? monitor.m_84954_() : 0L, 0L);
|
||||
+ this.f_85349_ = net.minecraftforge.fml.loading.ImmediateWindowHandler.setupMinecraftWindow(()->this.f_85359_, ()->this.f_85360_, ()->p_85376_, ()->this.f_85355_ && monitor != null ? monitor.m_84954_() : 0L);
|
||||
+ if (!net.minecraftforge.fml.loading.ImmediateWindowHandler.positionWindow(Optional.ofNullable(monitor), w->this.f_85359_ = this.f_85352_ = w, h->this.f_85360_ = this.f_85353_ = h, x->this.f_85357_ = this.f_85350_ = x, y->this.f_85358_ = this.f_85351_ = y)) {
|
||||
if (monitor != null) {
|
||||
VideoMode videomode = monitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty());
|
||||
this.windowedX = this.x = monitor.getX() + videomode.getWidth() / 2 - this.width / 2;
|
||||
@@ -93,6 +_,7 @@
|
||||
this.windowedX = this.x = aint1[0];
|
||||
this.windowedY = this.y = aint[0];
|
||||
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;
|
||||
@@ -95,6 +_,7 @@
|
||||
this.f_85350_ = this.f_85357_ = aint1[0];
|
||||
this.f_85351_ = this.f_85358_ = aint[0];
|
||||
}
|
||||
+ }
|
||||
|
||||
GLFW.glfwMakeContextCurrent(this.window);
|
||||
GL.createCapabilities();
|
||||
@@ -242,6 +_,7 @@
|
||||
GLFW.glfwGetFramebufferSize(this.window, aint, aint1);
|
||||
this.framebufferWidth = aint[0] > 0 ? aint[0] : 1;
|
||||
this.framebufferHeight = aint1[0] > 0 ? aint1[0] : 1;
|
||||
+ if (this.framebufferHeight == 0 || this.framebufferWidth==0) net.minecraftforge.fml.loading.ImmediateWindowHandler.updateFBSize(w->this.framebufferWidth=w, h->this.framebufferHeight=h);
|
||||
GLFW.glfwMakeContextCurrent(this.f_85349_);
|
||||
Locale locale = Locale.getDefault(Category.FORMAT);
|
||||
@@ -238,6 +_,7 @@
|
||||
GLFW.glfwGetFramebufferSize(this.f_85349_, aint, aint1);
|
||||
this.f_85361_ = aint[0] > 0 ? aint[0] : 1;
|
||||
this.f_85362_ = aint1[0] > 0 ? aint1[0] : 1;
|
||||
+ if (this.f_85362_ == 0 || this.f_85361_==0) net.minecraftforge.fml.loading.ImmediateWindowHandler.updateFBSize(w->this.f_85361_=w, h->this.f_85362_=h);
|
||||
}
|
||||
|
||||
private void onResize(long p_85428_, int p_85429_, int p_85430_) {
|
||||
private void m_85427_(long p_85428_, int p_85429_, int p_85430_) {
|
||||
@@ -1,17 +1,17 @@
|
||||
--- a/com/mojang/blaze3d/vertex/BufferBuilder.java
|
||||
+++ b/com/mojang/blaze3d/vertex/BufferBuilder.java
|
||||
@@ -459,4 +_,14 @@
|
||||
this.sorting = p_277855_;
|
||||
this.f_276566_ = p_277855_;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Forge start
|
||||
+ public void putBulkData(ByteBuffer buffer) {
|
||||
+ ensureCapacity(buffer.limit() + this.format.getVertexSize());
|
||||
+ this.buffer.position(this.nextElementByte);
|
||||
+ this.buffer.put(buffer);
|
||||
+ this.buffer.position(0);
|
||||
+ this.vertices += buffer.limit() / this.format.getVertexSize();
|
||||
+ this.nextElementByte += buffer.limit();
|
||||
+ m_85722_(buffer.limit() + this.f_85658_.m_86020_());
|
||||
+ this.f_85648_.position(this.f_85652_);
|
||||
+ this.f_85648_.put(buffer);
|
||||
+ this.f_85648_.position(0);
|
||||
+ this.f_85654_ += buffer.limit() / this.f_85658_.m_86020_();
|
||||
+ this.f_85652_ += buffer.limit();
|
||||
+ }
|
||||
}
|
||||
@@ -6,6 +6,6 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class PoseStack {
|
||||
+public class PoseStack implements net.minecraftforge.client.extensions.IForgePoseStack {
|
||||
private final Deque<PoseStack.Pose> poseStack = Util.make(Queues.newArrayDeque(), (p_85848_) -> {
|
||||
private final Deque<PoseStack.Pose> f_85834_ = Util.m_137469_(Queues.newArrayDeque(), (p_85848_) -> {
|
||||
Matrix4f matrix4f = new Matrix4f();
|
||||
Matrix3f matrix3f = new Matrix3f();
|
||||
@@ -2,10 +2,10 @@
|
||||
+++ b/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java
|
||||
@@ -46,7 +_,7 @@
|
||||
|
||||
public void endVertex() {
|
||||
Vector3f vector3f = this.normalInversePose.transform(new Vector3f(this.nx, this.ny, this.nz));
|
||||
- Direction direction = Direction.getNearest(vector3f.x(), vector3f.y(), vector3f.z());
|
||||
public void m_5752_() {
|
||||
Vector3f vector3f = this.f_85869_.transform(new Vector3f(this.f_85876_, this.f_85877_, this.f_85878_));
|
||||
- Direction direction = Direction.m_122372_(vector3f.x(), vector3f.y(), vector3f.z());
|
||||
+ Direction direction = net.minecraftforge.client.ForgeHooksClient.getNearestStable(vector3f.x(), vector3f.y(), vector3f.z());
|
||||
Vector4f vector4f = this.cameraInversePose.transform(new Vector4f(this.x, this.y, this.z, 1.0F));
|
||||
Vector4f vector4f = this.f_85868_.transform(new Vector4f(this.f_85870_, this.f_85871_, this.f_85872_, 1.0F));
|
||||
vector4f.rotateY((float)Math.PI);
|
||||
vector4f.rotateX((-(float)Math.PI / 2F));
|
||||
@@ -6,20 +6,20 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public interface VertexConsumer {
|
||||
+public interface VertexConsumer extends net.minecraftforge.client.extensions.IForgeVertexConsumer {
|
||||
VertexConsumer vertex(double p_85945_, double p_85946_, double p_85947_);
|
||||
VertexConsumer m_5483_(double p_85945_, double p_85946_, double p_85947_);
|
||||
|
||||
VertexConsumer color(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_);
|
||||
@@ -64,6 +_,10 @@
|
||||
}
|
||||
|
||||
default void putBulkData(PoseStack.Pose p_85996_, BakedQuad p_85997_, float[] p_85998_, float p_85999_, float p_86000_, float p_86001_, int[] p_86002_, int p_86003_, boolean p_86004_) {
|
||||
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_.getVertices();
|
||||
int[] aint1 = p_85997_.m_111303_();
|
||||
@@ -99,11 +_,13 @@
|
||||
f5 = afloat[k] * p_86001_;
|
||||
}
|
||||
@@ -29,10 +29,10 @@
|
||||
float f9 = bytebuffer.getFloat(16);
|
||||
float f10 = bytebuffer.getFloat(20);
|
||||
Vector4f vector4f = matrix4f.transform(new Vector4f(f, f1, f2, 1.0F));
|
||||
- this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
|
||||
+ applyBakedNormals(vector3f, bytebuffer, p_85996_.normal());
|
||||
- this.m_5954_(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
|
||||
+ applyBakedNormals(vector3f, bytebuffer, p_85996_.m_252943_());
|
||||
+ float vertexAlpha = p_86004_ ? alpha * (float) (bytebuffer.get(15) & 255) / 255.0F : alpha;
|
||||
+ this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
|
||||
+ this.m_5954_(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public ImmutableMap<String, VertexFormatElement> getElementMapping() { return elementMapping; }
|
||||
+ public int getOffset(int index) { return offsets.getInt(index); }
|
||||
+ public boolean hasPosition() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.POSITION); }
|
||||
+ public boolean hasNormal() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.NORMAL); }
|
||||
+ public boolean hasColor() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.COLOR); }
|
||||
+ public boolean hasUV(int which) { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.UV && e.getIndex() == which); }
|
||||
+ public ImmutableMap<String, VertexFormatElement> getElementMapping() { return f_166905_; }
|
||||
+ public int getOffset(int index) { return f_86013_.getInt(index); }
|
||||
+ public boolean hasPosition() { return f_86012_.stream().anyMatch(e -> e.m_86048_() == VertexFormatElement.Usage.POSITION); }
|
||||
+ public boolean hasNormal() { return f_86012_.stream().anyMatch(e -> e.m_86048_() == VertexFormatElement.Usage.NORMAL); }
|
||||
+ public boolean hasColor() { return f_86012_.stream().anyMatch(e -> e.m_86048_() == VertexFormatElement.Usage.COLOR); }
|
||||
+ public boolean hasUV(int which) { return f_86012_.stream().anyMatch(e -> e.m_86048_() == VertexFormatElement.Usage.UV && e.m_86049_() == which); }
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/com/mojang/blaze3d/vertex/VertexFormatElement.java
|
||||
+++ b/com/mojang/blaze3d/vertex/VertexFormatElement.java
|
||||
@@ -90,6 +_,10 @@
|
||||
this.usage.clearBufferState(this.index, p_166964_);
|
||||
this.f_86031_.m_166978_(this.f_86032_, p_166964_);
|
||||
}
|
||||
|
||||
+ public int getElementCount() {
|
||||
+ return count;
|
||||
+ return f_86033_;
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
--- a/com/mojang/math/Transformation.java
|
||||
+++ b/com/mojang/math/Transformation.java
|
||||
@@ -13,7 +_,7 @@
|
||||
@@ -14,7 +_,7 @@
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector3fc;
|
||||
|
||||
-public final class Transformation {
|
||||
+public final class Transformation implements net.minecraftforge.common.extensions.IForgeTransformation {
|
||||
private final Matrix4f matrix;
|
||||
public static final Codec<Transformation> CODEC = RecordCodecBuilder.create((p_269604_) -> {
|
||||
return p_269604_.group(ExtraCodecs.VECTOR3F.fieldOf("translation").forGetter((p_269599_) -> {
|
||||
@@ -156,6 +_,19 @@
|
||||
private final Matrix4f f_121078_;
|
||||
public static final Codec<Transformation> f_268453_ = RecordCodecBuilder.create((p_269604_) -> {
|
||||
return p_269604_.group(ExtraCodecs.f_252432_.fieldOf("translation").forGetter((p_269599_) -> {
|
||||
@@ -163,6 +_,19 @@
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.matrix);
|
||||
return Objects.hash(this.f_121078_);
|
||||
}
|
||||
+
|
||||
+ private Matrix3f normalTransform = null;
|
||||
@@ -21,11 +21,11 @@
|
||||
+ }
|
||||
+ private void checkNormalTransform() {
|
||||
+ if (normalTransform == null) {
|
||||
+ normalTransform = new Matrix3f(matrix);
|
||||
+ normalTransform = new Matrix3f(f_121078_);
|
||||
+ normalTransform.invert();
|
||||
+ normalTransform.transpose();
|
||||
+ }
|
||||
+ }
|
||||
|
||||
public Transformation slerp(Transformation p_175938_, float p_175939_) {
|
||||
Vector3f vector3f = this.getTranslation();
|
||||
public Transformation m_175937_(Transformation p_175938_, float p_175939_) {
|
||||
Vector3f vector3f = this.m_252829_();
|
||||
+8
-8
@@ -1,18 +1,18 @@
|
||||
--- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
||||
+++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
|
||||
@@ -61,6 +_,15 @@
|
||||
return Component.empty().append(this.lines.title).append(": ").append(this.lines.detail);
|
||||
@@ -68,6 +_,15 @@
|
||||
return Component.m_237119_().m_7220_(this.f_200947_.f_287789_).m_130946_(": ").m_7220_(this.f_200947_.f_287787_);
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public boolean keyPressed(int key, int scanCode, int modifiers) {
|
||||
+ public boolean m_7933_(int key, int scanCode, int modifiers) {
|
||||
+ if (key == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) {
|
||||
+ minecraft.setScreen(this.nextScreen);
|
||||
+ f_96541_.m_91152_(this.f_88665_);
|
||||
+ return true;
|
||||
+ }
|
||||
+ return super.keyPressed(key, scanCode, modifiers);
|
||||
+ return super.m_7933_(key, scanCode, modifiers);
|
||||
+ }
|
||||
+
|
||||
public void render(GuiGraphics p_283497_, int p_88680_, int p_88681_, float p_88682_) {
|
||||
super.render(p_283497_, p_88680_, p_88681_, p_88682_);
|
||||
p_283497_.drawCenteredString(this.font, this.lines.title, this.width / 2, 80, -1);
|
||||
public void m_88315_(GuiGraphics p_283497_, int p_88680_, int p_88681_, float p_88682_) {
|
||||
this.m_280273_(p_283497_);
|
||||
p_283497_.m_280653_(this.f_96547_, this.f_200947_.f_287789_, this.f_96543_ / 2, 80, 16777215);
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
--- a/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java
|
||||
+++ b/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java
|
||||
@@ -45,9 +_,9 @@
|
||||
}
|
||||
};
|
||||
private final RealmsNotificationsScreen.DataFetcherConfiguration f_273849_ = new RealmsNotificationsScreen.DataFetcherConfiguration() {
|
||||
- public DataFetcher.Subscription m_274316_(RealmsDataFetcher p_275731_) {
|
||||
- DataFetcher.Subscription datafetcher$subscription = p_275731_.f_238549_.m_239139_();
|
||||
- RealmsNotificationsScreen.this.m_274585_(p_275731_, datafetcher$subscription);
|
||||
+ public DataFetcher.Subscription m_274316_(RealmsDataFetcher p_275318_) {
|
||||
+ DataFetcher.Subscription datafetcher$subscription = p_275318_.f_238549_.m_239139_();
|
||||
+ RealmsNotificationsScreen.this.m_274585_(p_275318_, datafetcher$subscription);
|
||||
return datafetcher$subscription;
|
||||
}
|
||||
|
||||
@@ -1,32 +1,33 @@
|
||||
--- a/net/minecraft/CrashReport.java
|
||||
+++ b/net/minecraft/CrashReport.java
|
||||
@@ -57,14 +_,8 @@
|
||||
if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) {
|
||||
@@ -57,14 +_,9 @@
|
||||
if (this.f_127506_ != null && this.f_127506_.length > 0) {
|
||||
p_127520_.append("-- Head --\n");
|
||||
p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
|
||||
- p_127520_.append("Stacktrace:\n");
|
||||
-
|
||||
- for(StackTraceElement stacktraceelement : this.uncategorizedStackTrace) {
|
||||
- for(StackTraceElement stacktraceelement : this.f_127506_) {
|
||||
- p_127520_.append("\t").append("at ").append((Object)stacktraceelement);
|
||||
- p_127520_.append("\n");
|
||||
- }
|
||||
-
|
||||
- p_127520_.append("\n");
|
||||
+ p_127520_.append(net.minecraftforge.logging.CrashReportAnalyser.appendSuspectedMods(this.f_127501_, this.f_127506_));
|
||||
+ p_127520_.append("Stacktrace:");
|
||||
+ p_127520_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.uncategorizedStackTrace));
|
||||
+ p_127520_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.f_127506_));
|
||||
}
|
||||
|
||||
for(CrashReportCategory crashreportcategory : this.details) {
|
||||
for(CrashReportCategory crashreportcategory : this.f_127503_) {
|
||||
@@ -72,6 +_,7 @@
|
||||
p_127520_.append("\n\n");
|
||||
}
|
||||
|
||||
+ net.minecraftforge.logging.CrashReportExtender.extendSystemReport(systemReport);
|
||||
this.systemReport.appendToCrashReportString(p_127520_);
|
||||
+ net.minecraftforge.logging.CrashReportExtender.extendSystemReport(f_178624_);
|
||||
this.f_178624_.m_143525_(p_127520_);
|
||||
}
|
||||
|
||||
@@ -91,23 +_,13 @@
|
||||
throwable.setStackTrace(this.exception.getStackTrace());
|
||||
throwable.setStackTrace(this.f_127501_.getStackTrace());
|
||||
}
|
||||
|
||||
- String s;
|
||||
@@ -44,10 +45,10 @@
|
||||
+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(throwable);
|
||||
}
|
||||
|
||||
public String getFriendlyReport() {
|
||||
public String m_127526_() {
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
stringbuilder.append("---- Minecraft Crash Report ----\n");
|
||||
+ net.minecraftforge.logging.CrashReportExtender.addCrashReportHeader(stringbuilder, this);
|
||||
stringbuilder.append("// ");
|
||||
stringbuilder.append(getErrorComment());
|
||||
stringbuilder.append(m_127531_());
|
||||
stringbuilder.append("\n\n");
|
||||
@@ -4,35 +4,35 @@
|
||||
if (astacktraceelement.length <= 0) {
|
||||
return 0;
|
||||
} else {
|
||||
- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - p_128149_];
|
||||
- System.arraycopy(astacktraceelement, 3 + p_128149_, this.stackTrace, 0, this.stackTrace.length);
|
||||
- this.f_128139_ = new StackTraceElement[astacktraceelement.length - 3 - p_128149_];
|
||||
- System.arraycopy(astacktraceelement, 3 + p_128149_, this.f_128139_, 0, this.f_128139_.length);
|
||||
+ int len = astacktraceelement.length - 3 - p_128149_;
|
||||
+ if (len <= 0) len = astacktraceelement.length;
|
||||
+ this.stackTrace = new StackTraceElement[len];
|
||||
+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length);
|
||||
return this.stackTrace.length;
|
||||
+ this.f_128139_ = new StackTraceElement[len];
|
||||
+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.f_128139_, 0, this.f_128139_.length);
|
||||
return this.f_128139_.length;
|
||||
}
|
||||
}
|
||||
@@ -147,17 +_,17 @@
|
||||
|
||||
if (this.stackTrace != null && this.stackTrace.length > 0) {
|
||||
if (this.f_128139_ != null && this.f_128139_.length > 0) {
|
||||
p_128169_.append("\nStacktrace:");
|
||||
-
|
||||
- for(StackTraceElement stacktraceelement : this.stackTrace) {
|
||||
- for(StackTraceElement stacktraceelement : this.f_128139_) {
|
||||
- p_128169_.append("\n\tat ");
|
||||
- p_128169_.append((Object)stacktraceelement);
|
||||
- }
|
||||
+ p_128169_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.stackTrace));
|
||||
+ p_128169_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.f_128139_));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public StackTraceElement[] getStacktrace() {
|
||||
return this.stackTrace;
|
||||
public StackTraceElement[] m_128143_() {
|
||||
return this.f_128139_;
|
||||
+ }
|
||||
+
|
||||
+ public void applyStackTrace(Throwable t) {
|
||||
+ this.stackTrace = t.getStackTrace();
|
||||
+ this.f_128139_ = t.getStackTrace();
|
||||
}
|
||||
|
||||
public static void populateBlockDetails(CrashReportCategory p_178951_, LevelHeightAccessor p_178952_, BlockPos p_178953_, @Nullable BlockState p_178954_) {
|
||||
public static void m_178950_(CrashReportCategory p_178951_, LevelHeightAccessor p_178952_, BlockPos p_178953_, @Nullable BlockState p_178954_) {
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/SharedConstants.java
|
||||
+++ b/net/minecraft/SharedConstants.java
|
||||
@@ -212,6 +_,7 @@
|
||||
@@ -210,6 +_,7 @@
|
||||
}
|
||||
|
||||
static {
|
||||
+ if (System.getProperty("io.netty.leakDetection.level") == null) // Forge: allow level to be manually specified
|
||||
ResourceLeakDetector.setLevel(NETTY_LEAK_DETECTION);
|
||||
ResourceLeakDetector.setLevel(f_136180_);
|
||||
CommandSyntaxException.ENABLE_COMMAND_STACK_TRACES = false;
|
||||
CommandSyntaxException.BUILT_IN_EXCEPTIONS = new BrigadierExceptions();
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/Util.java
|
||||
+++ b/net/minecraft/Util.java
|
||||
@@ -172,6 +_,11 @@
|
||||
@@ -171,6 +_,11 @@
|
||||
return 255;
|
||||
}
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT1 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
|
||||
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT2 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
|
||||
+
|
||||
public static ExecutorService backgroundExecutor() {
|
||||
return BACKGROUND_EXECUTOR;
|
||||
public static ExecutorService m_183991_() {
|
||||
return f_137444_;
|
||||
}
|
||||
@@ -240,7 +_,7 @@
|
||||
@@ -239,7 +_,7 @@
|
||||
try {
|
||||
type = DataFixers.getDataFixer().getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().getDataVersion().getVersion())).getChoiceType(p_137552_, p_137553_);
|
||||
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().m_183476_().m_193006_())).getChoiceType(p_137552_, p_137553_);
|
||||
} catch (IllegalArgumentException illegalargumentexception) {
|
||||
- LOGGER.error("No data fixer registered for {}", (Object)p_137553_);
|
||||
+ LOGGER.debug("No data fixer registered for {}", (Object)p_137553_);
|
||||
if (SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
- f_137446_.error("No data fixer registered for {}", (Object)p_137553_);
|
||||
+ f_137446_.debug("No data fixer registered for {}", (Object)p_137553_);
|
||||
if (SharedConstants.f_136183_) {
|
||||
throw illegalargumentexception;
|
||||
}
|
||||
@@ -1,30 +1,26 @@
|
||||
--- a/net/minecraft/advancements/Advancement.java
|
||||
+++ b/net/minecraft/advancements/Advancement.java
|
||||
@@ -62,7 +_,14 @@
|
||||
return jsonobject;
|
||||
@@ -150,7 +_,7 @@
|
||||
return this.f_138305_;
|
||||
}
|
||||
|
||||
+ /** @deprecated Forge: use {@linkplain #fromJson(JsonObject, DeserializationContext, net.minecraftforge.common.crafting.conditions.ICondition.IContext) overload with context}. */
|
||||
+ @Deprecated
|
||||
public static Advancement fromJson(JsonObject p_300691_, DeserializationContext p_300053_) {
|
||||
+ return fromJson(p_300691_, p_300053_, net.minecraftforge.common.crafting.conditions.ICondition.IContext.EMPTY);
|
||||
+ }
|
||||
+
|
||||
+ public static Advancement fromJson(JsonObject p_300691_, DeserializationContext p_300053_, net.minecraftforge.common.crafting.conditions.ICondition.IContext context) {
|
||||
+ //if ((p_300691_ = net.minecraftforge.common.crafting.ConditionalAdvancement.processConditional(p_300691_, context)) == null) return null;
|
||||
Optional<ResourceLocation> optional = p_300691_.has("parent") ? Optional.of(new ResourceLocation(GsonHelper.getAsString(p_300691_, "parent"))) : Optional.empty();
|
||||
Optional<DisplayInfo> optional1 = p_300691_.has("display") ? Optional.of(DisplayInfo.fromJson(GsonHelper.getAsJsonObject(p_300691_, "display"))) : Optional.empty();
|
||||
AdvancementRewards advancementrewards = p_300691_.has("rewards") ? AdvancementRewards.deserialize(GsonHelper.getAsJsonObject(p_300691_, "rewards")) : AdvancementRewards.EMPTY;
|
||||
@@ -182,7 +_,11 @@
|
||||
- public static class Builder {
|
||||
+ public static class Builder implements net.minecraftforge.common.extensions.IForgeAdvancementBuilder {
|
||||
@Nullable
|
||||
private ResourceLocation f_138332_;
|
||||
@Nullable
|
||||
@@ -340,7 +_,14 @@
|
||||
return "Task Advancement{parentId=" + this.f_138332_ + ", display=" + this.f_138334_ + ", rewards=" + this.f_138335_ + ", criteria=" + this.f_138336_ + ", requirements=" + Arrays.deepToString(this.f_138337_) + ", sends_telemetry_event=" + this.f_285655_ + "}";
|
||||
}
|
||||
|
||||
public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, String p_138391_) {
|
||||
- AdvancementHolder advancementholder = this.build(new ResourceLocation(p_138391_));
|
||||
+ return save(p_138390_, new ResourceLocation(p_138391_));
|
||||
+ /** @deprecated Forge: use {@linkplain #fromJson(JsonObject, DeserializationContext, net.minecraftforge.common.crafting.conditions.ICondition.IContext) overload with context}. */
|
||||
+ @Deprecated
|
||||
public static Advancement.Builder m_138380_(JsonObject p_138381_, DeserializationContext p_138382_) {
|
||||
+ return fromJson(p_138381_, p_138382_, net.minecraftforge.common.crafting.conditions.ICondition.IContext.EMPTY);
|
||||
+ }
|
||||
+
|
||||
+ public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, ResourceLocation id) {
|
||||
+ AdvancementHolder advancementholder = this.build(id);
|
||||
p_138390_.accept(advancementholder);
|
||||
return advancementholder;
|
||||
}
|
||||
+ public static Advancement.Builder fromJson(JsonObject p_138381_, DeserializationContext p_138382_, net.minecraftforge.common.crafting.conditions.ICondition.IContext context) {
|
||||
+ if ((p_138381_ = net.minecraftforge.common.crafting.ConditionalAdvancement.processConditional(p_138381_, context)) == null) return null;
|
||||
ResourceLocation resourcelocation = p_138381_.has("parent") ? new ResourceLocation(GsonHelper.m_13906_(p_138381_, "parent")) : null;
|
||||
DisplayInfo displayinfo = p_138381_.has("display") ? DisplayInfo.m_14981_(GsonHelper.m_13930_(p_138381_, "display")) : null;
|
||||
AdvancementRewards advancementrewards = p_138381_.has("rewards") ? AdvancementRewards.m_9991_(GsonHelper.m_13930_(p_138381_, "rewards")) : AdvancementRewards.f_9978_;
|
||||
@@ -2,10 +2,10 @@
|
||||
+++ b/net/minecraft/advancements/AdvancementRewards.java
|
||||
@@ -43,7 +_,7 @@
|
||||
|
||||
public void grant(ServerPlayer p_9990_) {
|
||||
p_9990_.giveExperiencePoints(this.experience);
|
||||
- LootParams lootparams = (new LootParams.Builder(p_9990_.serverLevel())).withParameter(LootContextParams.THIS_ENTITY, p_9990_).withParameter(LootContextParams.ORIGIN, p_9990_.position()).create(LootContextParamSets.ADVANCEMENT_REWARD);
|
||||
+ LootParams lootparams = (new LootParams.Builder(p_9990_.serverLevel())).withParameter(LootContextParams.THIS_ENTITY, p_9990_).withParameter(LootContextParams.ORIGIN, p_9990_.position()).withLuck(p_9990_.getLuck()).create(LootContextParamSets.ADVANCEMENT_REWARD); // Forge: Add luck to LootContext
|
||||
public void m_9989_(ServerPlayer p_9990_) {
|
||||
p_9990_.m_6756_(this.f_9979_);
|
||||
- LootParams lootparams = (new LootParams.Builder(p_9990_.m_284548_())).m_287286_(LootContextParams.f_81455_, p_9990_).m_287286_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_287235_(LootContextParamSets.f_81418_);
|
||||
+ LootParams lootparams = (new LootParams.Builder(p_9990_.m_284548_())).m_287286_(LootContextParams.f_81455_, p_9990_).m_287286_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_287239_(p_9990_.m_36336_()).m_287235_(LootContextParamSets.f_81418_); // Forge: Add luck to LootContext
|
||||
boolean flag = false;
|
||||
|
||||
for(ResourceLocation resourcelocation : this.loot) {
|
||||
for(ResourceLocation resourcelocation : this.f_9980_) {
|
||||
@@ -1,11 +1,47 @@
|
||||
--- a/net/minecraft/advancements/critereon/ItemPredicate.java
|
||||
+++ b/net/minecraft/advancements/critereon/ItemPredicate.java
|
||||
@@ -50,7 +_,7 @@
|
||||
@@ -29,6 +_,8 @@
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
|
||||
public class ItemPredicate {
|
||||
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> custom_predicates = new java.util.HashMap<>();
|
||||
+ private static final Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> unmod_predicates = java.util.Collections.unmodifiableMap(custom_predicates);
|
||||
public static final ItemPredicate f_45028_ = new ItemPredicate();
|
||||
@Nullable
|
||||
private final TagKey<Item> f_45029_;
|
||||
@@ -81,7 +_,7 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.enchantments.isEmpty()) {
|
||||
- Map<Enchantment, Integer> map = EnchantmentHelper.deserializeEnchantments(p_45050_.getEnchantmentTags());
|
||||
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.enchantments) {
|
||||
if (!enchantmentpredicate.containedIn(map)) {
|
||||
for(EnchantmentPredicate enchantmentpredicate : this.f_45033_) {
|
||||
if (!enchantmentpredicate.m_30476_(map)) {
|
||||
@@ -108,6 +_,11 @@
|
||||
public static ItemPredicate m_45051_(@Nullable JsonElement p_45052_) {
|
||||
if (p_45052_ != null && !p_45052_.isJsonNull()) {
|
||||
JsonObject jsonobject = GsonHelper.m_13918_(p_45052_, "item");
|
||||
+ if (jsonobject.has("type")) {
|
||||
+ final ResourceLocation rl = new ResourceLocation(GsonHelper.m_13906_(jsonobject, "type"));
|
||||
+ if (custom_predicates.containsKey(rl)) return custom_predicates.get(rl).apply(jsonobject);
|
||||
+ else throw new JsonSyntaxException("There is no ItemPredicate of type "+rl);
|
||||
+ }
|
||||
MinMaxBounds.Ints minmaxbounds$ints = MinMaxBounds.Ints.m_55373_(jsonobject.get("count"));
|
||||
MinMaxBounds.Ints minmaxbounds$ints1 = MinMaxBounds.Ints.m_55373_(jsonobject.get("durability"));
|
||||
if (jsonobject.has("data")) {
|
||||
@@ -215,6 +_,14 @@
|
||||
} else {
|
||||
return new ItemPredicate[0];
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ public static void register(ResourceLocation name, java.util.function.Function<JsonObject, ItemPredicate> deserializer) {
|
||||
+ custom_predicates.put(name, deserializer);
|
||||
+ }
|
||||
+
|
||||
+ public static Map<ResourceLocation, java.util.function.Function<JsonObject, ItemPredicate>> getPredicates() {
|
||||
+ return unmod_predicates;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
@@ -1,21 +1,21 @@
|
||||
--- a/net/minecraft/client/Camera.java
|
||||
+++ b/net/minecraft/client/Camera.java
|
||||
@@ -206,6 +_,18 @@
|
||||
this.initialized = false;
|
||||
this.f_90549_ = false;
|
||||
}
|
||||
|
||||
+ public void setAnglesInternal(float yaw, float pitch) {
|
||||
+ this.yRot = yaw;
|
||||
+ this.xRot = pitch;
|
||||
+ this.f_90558_ = yaw;
|
||||
+ this.f_90557_ = pitch;
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraft.world.level.block.state.BlockState getBlockAtCamera() {
|
||||
+ if (!this.initialized)
|
||||
+ return net.minecraft.world.level.block.Blocks.AIR.defaultBlockState();
|
||||
+ if (!this.f_90549_)
|
||||
+ return net.minecraft.world.level.block.Blocks.f_50016_.m_49966_();
|
||||
+ else
|
||||
+ return this.level.getBlockState(this.blockPosition).getStateAtViewpoint(this.level, this.blockPosition, this.position);
|
||||
+ return this.f_90550_.m_8055_(this.f_90553_).getStateAtViewpoint(this.f_90550_, this.f_90553_, this.f_90552_);
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class NearPlane {
|
||||
final Vec3 forward;
|
||||
final Vec3 f_167687_;
|
||||
@@ -1,20 +1,20 @@
|
||||
--- a/net/minecraft/client/ClientRecipeBook.java
|
||||
+++ b/net/minecraft/client/ClientRecipeBook.java
|
||||
@@ -56,7 +_,7 @@
|
||||
Recipe<?> recipe = recipeholder.value();
|
||||
if (!recipe.isSpecial() && !recipe.isIncomplete()) {
|
||||
RecipeBookCategories recipebookcategories = getCategory(recipeholder);
|
||||
- String s = recipe.getGroup();
|
||||
+ String s = recipe.getGroup().isEmpty() ? recipeholder.id().toString() : recipe.getGroup(); // FORGE: Group value defaults to the recipe's ID if the recipe's explicit group is empty.
|
||||
@@ -54,7 +_,7 @@
|
||||
for(Recipe<?> recipe : p_90643_) {
|
||||
if (!recipe.m_5598_() && !recipe.m_142505_()) {
|
||||
RecipeBookCategories recipebookcategories = m_90646_(recipe);
|
||||
- String s = recipe.m_6076_();
|
||||
+ String s = recipe.m_6076_().isEmpty() ? recipe.m_6423_().toString() : recipe.m_6076_(); // FORGE: Group value defaults to the recipe's ID if the recipe's explicit group is empty.
|
||||
if (s.isEmpty()) {
|
||||
map.computeIfAbsent(recipebookcategories, (p_90645_) -> {
|
||||
return Lists.newArrayList();
|
||||
@@ -144,6 +_,8 @@
|
||||
} else if (recipetype == RecipeType.SMITHING) {
|
||||
@@ -141,6 +_,8 @@
|
||||
} else if (recipetype == RecipeType.f_44113_) {
|
||||
return RecipeBookCategories.SMITHING;
|
||||
} else {
|
||||
+ RecipeBookCategories categories = net.minecraftforge.client.RecipeBookManager.findCategories((RecipeType) recipetype, p_299041_);
|
||||
+ RecipeBookCategories categories = net.minecraftforge.client.RecipeBookManager.findCategories((RecipeType) recipetype, p_90647_);
|
||||
+ if (categories != null) return categories;
|
||||
LOGGER.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> {
|
||||
return BuiltInRegistries.RECIPE_TYPE.getKey(recipe.getType());
|
||||
}), LogUtils.defer(p_299041_::id));
|
||||
f_90618_.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> {
|
||||
return BuiltInRegistries.f_256990_.m_7981_(p_90647_.m_6671_());
|
||||
}), LogUtils.defer(p_90647_::m_6423_));
|
||||
@@ -6,58 +6,58 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class KeyMapping implements Comparable<KeyMapping> {
|
||||
+public class KeyMapping implements Comparable<KeyMapping>, net.minecraftforge.client.extensions.IForgeKeyMapping {
|
||||
private static final Map<String, KeyMapping> ALL = Maps.newHashMap();
|
||||
- private static final Map<InputConstants.Key, KeyMapping> MAP = Maps.newHashMap();
|
||||
+ private static final net.minecraftforge.client.settings.KeyMappingLookup MAP = new net.minecraftforge.client.settings.KeyMappingLookup();
|
||||
private static final Set<String> CATEGORIES = Sets.newHashSet();
|
||||
public static final String CATEGORY_MOVEMENT = "key.categories.movement";
|
||||
public static final String CATEGORY_MISC = "key.categories.misc";
|
||||
private static final Map<String, KeyMapping> f_90809_ = Maps.newHashMap();
|
||||
- private static final Map<InputConstants.Key, KeyMapping> f_90810_ = Maps.newHashMap();
|
||||
+ 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();
|
||||
public static final String f_167805_ = "key.categories.movement";
|
||||
public static final String f_167806_ = "key.categories.misc";
|
||||
@@ -41,7 +_,7 @@
|
||||
private int clickCount;
|
||||
private int f_90818_;
|
||||
|
||||
public static void click(InputConstants.Key p_90836_) {
|
||||
- KeyMapping keymapping = MAP.get(p_90836_);
|
||||
+ for (KeyMapping keymapping : MAP.getAll(p_90836_))
|
||||
public static void m_90835_(InputConstants.Key p_90836_) {
|
||||
- KeyMapping keymapping = f_90810_.get(p_90836_);
|
||||
+ for (KeyMapping keymapping : f_90810_.getAll(p_90836_))
|
||||
if (keymapping != null) {
|
||||
++keymapping.clickCount;
|
||||
++keymapping.f_90818_;
|
||||
}
|
||||
@@ -49,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static void set(InputConstants.Key p_90838_, boolean p_90839_) {
|
||||
- KeyMapping keymapping = MAP.get(p_90838_);
|
||||
+ for (KeyMapping keymapping : MAP.getAll(p_90838_))
|
||||
public static void m_90837_(InputConstants.Key p_90838_, boolean p_90839_) {
|
||||
- KeyMapping keymapping = f_90810_.get(p_90838_);
|
||||
+ for (KeyMapping keymapping : f_90810_.getAll(p_90838_))
|
||||
if (keymapping != null) {
|
||||
keymapping.setDown(p_90839_);
|
||||
keymapping.m_7249_(p_90839_);
|
||||
}
|
||||
@@ -105,7 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean isDown() {
|
||||
- return this.isDown;
|
||||
+ return this.isDown && isConflictContextAndModifierActive();
|
||||
public boolean m_90857_() {
|
||||
- return this.f_90817_;
|
||||
+ return this.f_90817_ && isConflictContextAndModifierActive();
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
public String m_90858_() {
|
||||
@@ -139,7 +_,13 @@
|
||||
}
|
||||
|
||||
public int compareTo(KeyMapping p_90841_) {
|
||||
- return this.category.equals(p_90841_.category) ? I18n.get(this.name).compareTo(I18n.get(p_90841_.name)) : CATEGORY_SORT_ORDER.get(this.category).compareTo(CATEGORY_SORT_ORDER.get(p_90841_.category));
|
||||
+ if (this.category.equals(p_90841_.category)) return I18n.get(this.name).compareTo(I18n.get(p_90841_.name));
|
||||
+ Integer tCat = CATEGORY_SORT_ORDER.get(this.category);
|
||||
+ Integer oCat = CATEGORY_SORT_ORDER.get(p_90841_.category);
|
||||
- return this.f_90815_.equals(p_90841_.f_90815_) ? I18n.m_118938_(this.f_90813_).compareTo(I18n.m_118938_(p_90841_.f_90813_)) : f_90812_.get(this.f_90815_).compareTo(f_90812_.get(p_90841_.f_90815_));
|
||||
+ if (this.f_90815_.equals(p_90841_.f_90815_)) return I18n.m_118938_(this.f_90813_).compareTo(I18n.m_118938_(p_90841_.f_90813_));
|
||||
+ Integer tCat = f_90812_.get(this.f_90815_);
|
||||
+ Integer oCat = f_90812_.get(p_90841_.f_90815_);
|
||||
+ if (tCat == null && oCat != null) return 1;
|
||||
+ if (tCat != null && oCat == null) return -1;
|
||||
+ if (tCat == null && oCat == null) return I18n.get(this.category).compareTo(I18n.get(p_90841_.category));
|
||||
+ if (tCat == null && oCat == null) return I18n.m_118938_(this.f_90815_).compareTo(I18n.m_118938_(p_90841_.f_90815_));
|
||||
+ return tCat.compareTo(oCat);
|
||||
}
|
||||
|
||||
public static Supplier<Component> createNameSupplier(String p_90843_) {
|
||||
public static Supplier<Component> m_90842_(String p_90843_) {
|
||||
@@ -150,6 +_,20 @@
|
||||
}
|
||||
|
||||
public boolean same(KeyMapping p_90851_) {
|
||||
public boolean m_90850_(KeyMapping p_90851_) {
|
||||
+ if (getKeyConflictContext().conflicts(p_90851_.getKeyConflictContext()) || p_90851_.getKeyConflictContext().conflicts(getKeyConflictContext())) {
|
||||
+ net.minecraftforge.client.settings.KeyModifier keyModifier = getKeyModifier();
|
||||
+ net.minecraftforge.client.settings.KeyModifier otherKeyModifier = p_90851_.getKeyModifier();
|
||||
@@ -72,30 +72,30 @@
|
||||
+ (keyModifier == net.minecraftforge.client.settings.KeyModifier.NONE || otherKeyModifier == net.minecraftforge.client.settings.KeyModifier.NONE));
|
||||
+ }
|
||||
+ }
|
||||
return this.key.equals(p_90851_.key);
|
||||
return this.f_90816_.equals(p_90851_.f_90816_);
|
||||
}
|
||||
|
||||
@@ -170,11 +_,13 @@
|
||||
}
|
||||
|
||||
public Component getTranslatedKeyMessage() {
|
||||
+ return getKeyModifier().getCombinedName(key, () -> {
|
||||
return this.key.getDisplayName();
|
||||
public Component m_90863_() {
|
||||
+ return getKeyModifier().getCombinedName(f_90816_, () -> {
|
||||
return this.f_90816_.m_84875_();
|
||||
+ });
|
||||
}
|
||||
|
||||
public boolean isDefault() {
|
||||
- return this.key.equals(this.defaultKey);
|
||||
+ return this.key.equals(this.defaultKey) && getKeyModifier() == getDefaultKeyModifier();
|
||||
public boolean m_90864_() {
|
||||
- return this.f_90816_.equals(this.f_90814_);
|
||||
+ return this.f_90816_.equals(this.f_90814_) && getKeyModifier() == getDefaultKeyModifier();
|
||||
}
|
||||
|
||||
public String saveString() {
|
||||
@@ -184,4 +_,84 @@
|
||||
public void setDown(boolean p_90846_) {
|
||||
this.isDown = p_90846_;
|
||||
}
|
||||
public String m_90865_() {
|
||||
@@ -183,5 +_,88 @@
|
||||
|
||||
public void m_7249_(boolean p_90846_) {
|
||||
this.f_90817_ = p_90846_;
|
||||
+ }
|
||||
+
|
||||
+ /****************** Forge Start *****************************/
|
||||
+ private net.minecraftforge.client.settings.KeyModifier keyModifierDefault = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||
+ private net.minecraftforge.client.settings.KeyModifier keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||
+ private net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext = net.minecraftforge.client.settings.KeyConflictContext.UNIVERSAL;
|
||||
@@ -104,7 +104,7 @@
|
||||
+ * Convenience constructor for creating KeyBindings with keyConflictContext set.
|
||||
+ */
|
||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputConstants.Type inputType, final int keyCode, String category) {
|
||||
+ this(description, keyConflictContext, inputType.getOrCreate(keyCode), category);
|
||||
+ this(description, keyConflictContext, inputType.m_84895_(keyCode), category);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@@ -118,30 +118,30 @@
|
||||
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
|
||||
+ */
|
||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, final InputConstants.Type inputType, final int keyCode, String category) {
|
||||
+ this(description, keyConflictContext, keyModifier, inputType.getOrCreate(keyCode), category);
|
||||
+ this(description, keyConflictContext, keyModifier, inputType.m_84895_(keyCode), category);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
|
||||
+ */
|
||||
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode, String category) {
|
||||
+ this.name = description;
|
||||
+ this.key = keyCode;
|
||||
+ this.defaultKey = keyCode;
|
||||
+ this.category = category;
|
||||
+ this.f_90813_ = description;
|
||||
+ this.f_90816_ = keyCode;
|
||||
+ this.f_90814_ = keyCode;
|
||||
+ this.f_90815_ = category;
|
||||
+ this.keyConflictContext = keyConflictContext;
|
||||
+ this.keyModifier = keyModifier;
|
||||
+ this.keyModifierDefault = keyModifier;
|
||||
+ if (this.keyModifier.matches(keyCode))
|
||||
+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||
+ ALL.put(description, this);
|
||||
+ MAP.put(keyCode, this);
|
||||
+ CATEGORIES.add(category);
|
||||
+ f_90809_.put(description, this);
|
||||
+ f_90810_.put(keyCode, this);
|
||||
+ f_90811_.add(category);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public InputConstants.Key getKey() {
|
||||
+ return this.key;
|
||||
+ return this.f_90816_;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -165,13 +165,17 @@
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode) {
|
||||
+ this.key = keyCode;
|
||||
+ if (keyModifier.matches(keyCode))
|
||||
+ public void setKeyModifierAndCode(@org.jetbrains.annotations.Nullable net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode) {
|
||||
+ f_90810_.remove(this);
|
||||
+
|
||||
+ if (keyModifier == null)
|
||||
+ keyModifier = net.minecraftforge.client.settings.KeyModifier.getModifier(this.f_90816_);
|
||||
+ if (keyModifier == null || keyCode == InputConstants.f_84822_ || net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(keyCode))
|
||||
+ keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
|
||||
+ MAP.remove(this);
|
||||
+
|
||||
+ this.f_90816_ = keyCode;
|
||||
+ this.keyModifier = keyModifier;
|
||||
+ MAP.put(keyCode, this);
|
||||
+ }
|
||||
+ /****************** Forge End *****************************/
|
||||
+
|
||||
+ f_90810_.put(keyCode, this);
|
||||
}
|
||||
}
|
||||
@@ -1,45 +1,25 @@
|
||||
--- a/net/minecraft/client/KeyboardHandler.java
|
||||
+++ b/net/minecraft/client/KeyboardHandler.java
|
||||
@@ -340,7 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (p_90897_ == 1 && (!(this.minecraft.screen instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).lastKeySelection <= Util.getMillis() - 20L)) {
|
||||
+
|
||||
+ if ((!(this.minecraft.screen instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).lastKeySelection <= Util.getMillis() - 20L)) {
|
||||
+ if (p_90897_ == 1) {
|
||||
if (this.minecraft.options.keyFullscreen.matches(p_90895_, p_90896_)) {
|
||||
this.minecraft.getWindow().toggleFullScreen();
|
||||
this.minecraft.options.fullscreen().set(this.minecraft.getWindow().isFullscreen());
|
||||
@@ -358,6 +_,8 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
+ } else if (p_90897_ == 0 /*GLFW_RELEASE*/ && this.minecraft.screen instanceof KeyBindsScreen)
|
||||
+ ((KeyBindsScreen)this.minecraft.screen).selectedKey = null; //Forge: Unset pure modifiers.
|
||||
}
|
||||
|
||||
if (this.minecraft.getNarrator().isActive() && this.minecraft.options.narratorHotkey().get()) {
|
||||
@@ -380,11 +_,15 @@
|
||||
Screen.wrapScreenError(() -> {
|
||||
@@ -369,11 +_,15 @@
|
||||
Screen.m_96579_(() -> {
|
||||
if (p_90897_ != 1 && p_90897_ != 2) {
|
||||
if (p_90897_ == 0) {
|
||||
- aboolean[0] = screen.keyReleased(p_90895_, p_90896_, p_90898_);
|
||||
- aboolean[0] = screen.m_7920_(p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPre(screen, p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = screen.keyReleased(p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = screen.m_7920_(p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPost(screen, p_90895_, p_90896_, p_90898_);
|
||||
}
|
||||
} else {
|
||||
screen.afterKeyboardAction();
|
||||
- aboolean[0] = screen.keyPressed(p_90895_, p_90896_, p_90898_);
|
||||
screen.m_169416_();
|
||||
- aboolean[0] = screen.m_7933_(p_90895_, p_90896_, p_90898_);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPre(screen, p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = screen.keyPressed(p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = screen.m_7933_(p_90895_, p_90896_, p_90898_);
|
||||
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPost(screen, p_90895_, p_90896_, p_90898_);
|
||||
}
|
||||
|
||||
}, "keyPressed event handler", screen.getClass().getCanonicalName());
|
||||
@@ -443,22 +_,26 @@
|
||||
this.minecraft.debugFpsMeterKeyPress(p_90895_ - 48);
|
||||
@@ -424,22 +_,26 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
@@ -47,24 +27,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
private void charTyped(long p_90890_, int p_90891_, int p_90892_) {
|
||||
if (p_90890_ == this.minecraft.getWindow().getWindow()) {
|
||||
- GuiEventListener guieventlistener = this.minecraft.screen;
|
||||
+ Screen guieventlistener = this.minecraft.screen;
|
||||
if (guieventlistener != null && this.minecraft.getOverlay() == null) {
|
||||
private void m_90889_(long p_90890_, int p_90891_, int p_90892_) {
|
||||
if (p_90890_ == this.f_90867_.m_91268_().m_85439_()) {
|
||||
- GuiEventListener guieventlistener = this.f_90867_.f_91080_;
|
||||
+ Screen guieventlistener = this.f_90867_.f_91080_;
|
||||
if (guieventlistener != null && this.f_90867_.m_91265_() == null) {
|
||||
if (Character.charCount(p_90891_) == 1) {
|
||||
Screen.wrapScreenError(() -> {
|
||||
- guieventlistener.charTyped((char)p_90891_, p_90892_);
|
||||
Screen.m_96579_(() -> {
|
||||
- guieventlistener.m_5534_((char)p_90891_, p_90892_);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, (char)p_90891_, p_90892_)) return;
|
||||
+ if (guieventlistener.charTyped((char)p_90891_, p_90892_)) return;
|
||||
+ if (guieventlistener.m_5534_((char)p_90891_, p_90892_)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, (char)p_90891_, p_90892_);
|
||||
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
|
||||
} else {
|
||||
for(char c0 : Character.toChars(p_90891_)) {
|
||||
Screen.wrapScreenError(() -> {
|
||||
- guieventlistener.charTyped(c0, p_90892_);
|
||||
Screen.m_96579_(() -> {
|
||||
- guieventlistener.m_5534_(c0, p_90892_);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, c0, p_90892_)) return;
|
||||
+ if (guieventlistener.charTyped(c0, p_90892_)) return;
|
||||
+ if (guieventlistener.m_5534_(c0, p_90892_)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, c0, p_90892_);
|
||||
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
|
||||
}
|
||||
|
||||
@@ -1,421 +1,462 @@
|
||||
--- a/net/minecraft/client/Minecraft.java
|
||||
+++ b/net/minecraft/client/Minecraft.java
|
||||
@@ -252,7 +_,7 @@
|
||||
@@ -249,7 +_,7 @@
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler {
|
||||
+public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler, net.minecraftforge.client.extensions.IForgeMinecraft {
|
||||
static Minecraft instance;
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final boolean ON_OSX = Util.getPlatform() == Util.OS.OSX;
|
||||
@@ -422,7 +_,6 @@
|
||||
}, Util.ioPool());
|
||||
this.userApiService = this.createUserApiService(this.authenticationService, p_91084_);
|
||||
LOGGER.info("Setting user: {}", (Object)this.user.getName());
|
||||
- LOGGER.debug("(Session ID is {})", (Object)this.user.getSessionId());
|
||||
this.demo = p_91084_.game.demo;
|
||||
this.allowsMultiplayer = !p_91084_.game.disableMultiplayer;
|
||||
this.allowsChat = !p_91084_.game.disableChat;
|
||||
@@ -458,15 +_,15 @@
|
||||
static Minecraft f_90981_;
|
||||
private static final Logger f_90982_ = LogUtils.getLogger();
|
||||
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
|
||||
@@ -413,7 +_,6 @@
|
||||
this.f_193584_ = this.m_193585_(this.f_231338_, p_91084_);
|
||||
this.f_90998_ = p_91084_.f_101905_.f_101942_;
|
||||
f_90982_.info("Setting user: {}", (Object)this.f_90998_.m_92546_());
|
||||
- f_90982_.debug("(Session ID is {})", (Object)this.f_90998_.m_92544_());
|
||||
this.f_91033_ = p_91084_.f_101908_.f_101926_;
|
||||
this.f_91034_ = !p_91084_.f_101908_.f_101929_;
|
||||
this.f_91035_ = !p_91084_.f_101908_.f_101930_;
|
||||
@@ -449,15 +_,15 @@
|
||||
}
|
||||
|
||||
this.window.setFramerateLimit(this.options.framerateLimit().get());
|
||||
this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_());
|
||||
+ // FORGE: Move mouse and keyboard handler setup further below
|
||||
this.mouseHandler = new MouseHandler(this);
|
||||
- this.mouseHandler.setup(this.window.getWindow());
|
||||
this.keyboardHandler = new KeyboardHandler(this);
|
||||
- this.keyboardHandler.setup(this.window.getWindow());
|
||||
RenderSystem.initRenderer(this.options.glDebugVerbosity, false);
|
||||
this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight());
|
||||
this.mainRenderTarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F);
|
||||
this.mainRenderTarget.clear(ON_OSX);
|
||||
this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager);
|
||||
this.resourcePackRepository.reload();
|
||||
this.options.loadSelectedResourcePacks(this.resourcePackRepository);
|
||||
this.languageManager = new LanguageManager(this.options.languageCode);
|
||||
@@ -512,10 +_,13 @@
|
||||
this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.resourceManager, this.renderBuffers);
|
||||
this.resourceManager.registerReloadListener(this.gameRenderer.createReloadListener());
|
||||
this.levelRenderer = new LevelRenderer(this, this.entityRenderDispatcher, this.blockEntityRenderDispatcher, this.renderBuffers);
|
||||
this.f_91067_ = new MouseHandler(this);
|
||||
- this.f_91067_.m_91524_(this.f_90990_.m_85439_());
|
||||
this.f_91068_ = new KeyboardHandler(this);
|
||||
- this.f_91068_.m_90887_(this.f_90990_.m_85439_());
|
||||
RenderSystem.initRenderer(this.f_91066_.f_92035_, false);
|
||||
this.f_91042_ = new MainTarget(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
|
||||
this.f_91042_.m_83931_(0.0F, 0.0F, 0.0F, 0.0F);
|
||||
this.f_91042_.m_83954_(f_91002_);
|
||||
this.f_91036_ = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
||||
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.f_91038_, this.f_91036_);
|
||||
this.f_91038_.m_10506_();
|
||||
this.f_91066_.m_92145_(this.f_91038_);
|
||||
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_);
|
||||
@@ -504,10 +_,13 @@
|
||||
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_.m_247116_());
|
||||
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.resourceManager.registerReloadListener(this.levelRenderer);
|
||||
- this.createSearchTrees();
|
||||
this.f_91036_.m_7217_(this.f_91060_);
|
||||
- this.m_91271_();
|
||||
+ // Forge: We delay this to allow registration of modded creative mode tabs
|
||||
+ // this.createSearchTrees();
|
||||
this.resourceManager.registerReloadListener(this.searchRegistry);
|
||||
this.particleEngine = new ParticleEngine(this.level, this.textureManager);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(this.particleEngine);
|
||||
this.resourceManager.registerReloadListener(this.particleEngine);
|
||||
this.paintingTextures = new PaintingTextureManager(this.textureManager);
|
||||
this.resourceManager.registerReloadListener(this.paintingTextures);
|
||||
@@ -526,7 +_,10 @@
|
||||
this.gpuWarnlistManager = new GpuWarnlistManager();
|
||||
this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
|
||||
this.resourceManager.registerReloadListener(this.regionalCompliancies);
|
||||
- this.gui = new Gui(this, this.itemRenderer);
|
||||
+ this.gui = new net.minecraftforge.client.gui.overlay.ForgeGui(this);
|
||||
this.f_91036_.m_7217_(this.f_90997_);
|
||||
this.f_91061_ = new ParticleEngine(this.f_91073_, this.f_90987_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(this.f_91061_);
|
||||
this.f_91036_.m_7217_(this.f_91061_);
|
||||
this.f_91053_ = new PaintingTextureManager(this.f_90987_);
|
||||
this.f_91036_.m_7217_(this.f_91053_);
|
||||
@@ -516,7 +_,10 @@
|
||||
this.f_91047_ = new GpuWarnlistManager();
|
||||
this.f_91036_.m_7217_(this.f_91047_);
|
||||
this.f_91036_.m_7217_(this.f_205120_);
|
||||
- this.f_91065_ = new Gui(this, this.f_90995_);
|
||||
+ this.f_91065_ = new net.minecraftforge.client.gui.overlay.ForgeGui(this);
|
||||
+ // FORGE: Moved keyboard and mouse handler setup below ingame gui creation to prevent NPEs in them.
|
||||
+ this.mouseHandler.setup(this.window.getWindow());
|
||||
+ this.keyboardHandler.setup(this.window.getWindow());
|
||||
this.debugRenderer = new DebugRenderer(this);
|
||||
RealmsClient realmsclient = RealmsClient.create(this);
|
||||
this.realmsDataFetcher = new RealmsDataFetcher(realmsclient);
|
||||
@@ -546,6 +_,7 @@
|
||||
+ this.f_91067_.m_91524_(this.f_90990_.m_85439_());
|
||||
+ this.f_91068_.m_90887_(this.f_90990_.m_85439_());
|
||||
this.f_91064_ = new DebugRenderer(this);
|
||||
RealmsClient realmsclient = RealmsClient.m_239151_(this);
|
||||
this.f_238717_ = new RealmsDataFetcher(realmsclient);
|
||||
@@ -536,6 +_,7 @@
|
||||
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.resourceManager);
|
||||
this.window.updateVsync(this.options.enableVsync().get());
|
||||
this.window.updateRawMouseInput(this.options.rawMouseInput().get());
|
||||
this.window.setDefaultErrorCallback();
|
||||
@@ -565,7 +_,7 @@
|
||||
ReloadInstance reloadinstance = this.resourceManager.createReload(Util.backgroundExecutor(), this, RESOURCE_RELOAD_INITIAL_TASK, list);
|
||||
GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
|
||||
Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay);
|
||||
- this.setOverlay(new LoadingOverlay(this, reloadinstance, (p_296164_) -> {
|
||||
+ this.setOverlay(net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(() -> this, () -> reloadinstance, (p_296164_) -> {
|
||||
Util.ifElse(p_296164_, (p_296162_) -> {
|
||||
this.rollbackResourcePacks(p_296162_, minecraft$gameloadcookie);
|
||||
}, () -> {
|
||||
@@ -575,8 +_,10 @@
|
||||
+ net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.f_91036_);
|
||||
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_85426_();
|
||||
@@ -554,7 +_,7 @@
|
||||
this.f_167847_.m_168557_(ResourceLoadStateTracker.ReloadReason.INITIAL, list);
|
||||
ReloadInstance reloadinstance = this.f_91036_.m_142463_(Util.m_183991_(), this, f_90983_, list);
|
||||
GameLoadTimesEvent.f_285635_.m_285833_(TelemetryProperty.f_285629_);
|
||||
- this.m_91150_(new LoadingOverlay(this, reloadinstance, (p_210745_) -> {
|
||||
+ this.m_91150_(net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(()->this, ()->reloadinstance, (p_210745_) -> {
|
||||
Util.m_137521_(p_210745_, this::m_91239_, () -> {
|
||||
if (SharedConstants.f_136183_) {
|
||||
this.m_91273_();
|
||||
@@ -562,20 +_,23 @@
|
||||
|
||||
this.reloadStateTracker.finishReload();
|
||||
this.onResourceLoadFinished(minecraft$gameloadcookie);
|
||||
this.f_167847_.m_168556_();
|
||||
this.m_286052_();
|
||||
+ if (net.minecraftforge.client.loading.ClientModLoader.completeModLoading())
|
||||
+ return; // Do not overwrite the error screen if there are errors
|
||||
+ return; // Do not overwrite the error screen if there are errors
|
||||
+ // FORGE: Move opening initial screen to after startup and events are enabled
|
||||
+ if (this.m_239929_()) {
|
||||
+ this.m_91152_(BanNoticeScreen.m_239967_((p_278873_) -> {
|
||||
+ if (p_278873_) {
|
||||
+ Util.m_137581_().m_137646_("https://aka.ms/mcjavamoderation");
|
||||
+ }
|
||||
+
|
||||
+ this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
|
||||
+ }, this.m_239210_()));
|
||||
+ } else {
|
||||
+ this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
|
||||
+ }
|
||||
});
|
||||
- }, false));
|
||||
+ }, false).get());
|
||||
this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.path());
|
||||
this.f_278504_ = QuickPlayLog.m_278648_(p_91084_.f_278410_.f_278493_());
|
||||
- if (this.m_239929_()) {
|
||||
- this.m_91152_(BanNoticeScreen.m_239967_((p_278873_) -> {
|
||||
- if (p_278873_) {
|
||||
- Util.m_137581_().m_137646_("https://aka.ms/mcjavamoderation");
|
||||
- }
|
||||
-
|
||||
- this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
|
||||
- }, this.m_239210_()));
|
||||
- } else {
|
||||
- this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
|
||||
- }
|
||||
|
||||
}
|
||||
|
||||
@@ -674,7 +_,7 @@
|
||||
private String createTitle() {
|
||||
@@ -611,7 +_,7 @@
|
||||
private String m_91270_() {
|
||||
StringBuilder stringbuilder = new StringBuilder("Minecraft");
|
||||
if (checkModStatus().shouldReportAsModified()) {
|
||||
if (m_193589_().m_184597_()) {
|
||||
- stringbuilder.append("*");
|
||||
+ stringbuilder.append(' ').append(net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.BRANDING_NAME).append('*');
|
||||
}
|
||||
|
||||
stringbuilder.append(" ");
|
||||
@@ -699,6 +_,8 @@
|
||||
@@ -635,6 +_,8 @@
|
||||
|
||||
private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
||||
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
|
||||
try {
|
||||
+ if ("0".equals(p_193587_.user.user.getAccessToken())) // Forge: We use "0" in dev. Short circuit to stop exception spam.
|
||||
+ if ("0".equals(p_193587_.f_101905_.f_101942_.m_92547_())) // Forge: We use "0" in dev. Short circuit to stop exception spam.
|
||||
+ return UserApiService.OFFLINE;
|
||||
return p_193586_.createUserApiService(p_193587_.user.user.getAccessToken());
|
||||
return p_193586_.createUserApiService(p_193587_.f_101905_.f_101942_.m_92547_());
|
||||
} catch (AuthenticationException authenticationexception) {
|
||||
LOGGER.error("Failed to verify authentication", (Throwable)authenticationexception);
|
||||
@@ -711,7 +_,7 @@
|
||||
f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception);
|
||||
@@ -647,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_) {
|
||||
- if (this.resourcePackRepository.getSelectedIds().size() > 1) {
|
||||
+ if (this.resourcePackRepository.getSelectedPacks().stream().anyMatch(e -> !e.isRequired())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any.
|
||||
this.clearResourcePacksOnError(p_91240_, (Component)null, p_299515_);
|
||||
private void m_91239_(Throwable p_91240_) {
|
||||
- if (this.f_91038_.m_10523_().size() > 1) {
|
||||
+ if (this.f_91038_.m_10524_().stream().anyMatch(e -> !e.m_10449_())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any.
|
||||
this.m_91241_(p_91240_, (Component)null);
|
||||
} else {
|
||||
Util.throwAsRuntime(p_91240_);
|
||||
@@ -803,7 +_,10 @@
|
||||
Util.m_137559_(p_91240_);
|
||||
@@ -739,7 +_,10 @@
|
||||
}
|
||||
|
||||
public void createSearchTrees() {
|
||||
- this.searchRegistry.register(SearchRegistry.CREATIVE_NAMES, (p_231451_) -> {
|
||||
public void m_91271_() {
|
||||
- this.f_90997_.m_235232_(SearchRegistry.f_119941_, (p_231389_) -> {
|
||||
+ var nameSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys();
|
||||
+ var tagSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys();
|
||||
+ for (var nameSearchKey : nameSearchKeys.values())
|
||||
+ this.searchRegistry.register(nameSearchKey, (p_231451_) -> {
|
||||
+ this.f_90997_.m_235232_(nameSearchKey, (p_231389_) -> {
|
||||
return new FullTextSearchTree<>((p_210797_) -> {
|
||||
return p_210797_.getTooltipLines((Player)null, TooltipFlag.Default.NORMAL.asCreative()).stream().map((p_231455_) -> {
|
||||
return ChatFormatting.stripFormatting(p_231455_.getString()).trim();
|
||||
@@ -814,7 +_,8 @@
|
||||
return Stream.of(BuiltInRegistries.ITEM.getKey(p_91317_.getItem()));
|
||||
return p_210797_.m_41651_((Player)null, TooltipFlag.Default.f_256752_.m_257777_()).stream().map((p_210807_) -> {
|
||||
return ChatFormatting.m_126649_(p_210807_.getString()).trim();
|
||||
@@ -750,7 +_,8 @@
|
||||
return Stream.of(BuiltInRegistries.f_257033_.m_7981_(p_91317_.m_41720_()));
|
||||
}, p_231389_);
|
||||
});
|
||||
- this.f_90997_.m_235232_(SearchRegistry.f_119942_, (p_231430_) -> {
|
||||
+ for (var tagSearchKey : tagSearchKeys.values())
|
||||
+ this.f_90997_.m_235232_(tagSearchKey, (p_231430_) -> {
|
||||
return new IdSearchTree<>((p_231353_) -> {
|
||||
return p_231353_.m_204131_().map(TagKey::f_203868_);
|
||||
}, p_231430_);
|
||||
@@ -770,9 +_,12 @@
|
||||
});
|
||||
}, p_231451_);
|
||||
});
|
||||
- this.searchRegistry.register(SearchRegistry.CREATIVE_TAGS, (p_231430_) -> {
|
||||
+ for (var tagSearchKey : tagSearchKeys.values())
|
||||
+ this.searchRegistry.register(tagSearchKey, (p_231430_) -> {
|
||||
return new IdSearchTree<>((p_231353_) -> {
|
||||
return p_231353_.getTags().map(TagKey::location);
|
||||
}, p_231430_);
|
||||
@@ -834,9 +_,12 @@
|
||||
});
|
||||
}, p_301514_);
|
||||
});
|
||||
- CreativeModeTabs.searchTab().setSearchTreeBuilder((p_255439_) -> {
|
||||
- this.populateSearchTree(SearchRegistry.CREATIVE_NAMES, p_255439_);
|
||||
- this.populateSearchTree(SearchRegistry.CREATIVE_TAGS, p_255439_);
|
||||
- CreativeModeTabs.m_258007_().m_257882_((p_255439_) -> {
|
||||
- this.m_231374_(SearchRegistry.f_119941_, p_255439_);
|
||||
- this.m_231374_(SearchRegistry.f_119942_, p_255439_);
|
||||
+ nameSearchKeys.forEach((tab, nameSearchKey) -> {
|
||||
+ var tagSearchKey = tagSearchKeys.get(tab);
|
||||
+ tab.setSearchTreeBuilder(contents -> {
|
||||
+ this.populateSearchTree(nameSearchKey, contents);
|
||||
+ this.populateSearchTree(tagSearchKey, contents);
|
||||
+ tab.m_257882_(contents -> {
|
||||
+ this.m_231374_(nameSearchKey, contents);
|
||||
+ this.m_231374_(tagSearchKey, contents);
|
||||
+ });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1019,10 +_,6 @@
|
||||
LOGGER.error("setScreen called from non-game thread");
|
||||
@@ -824,13 +_,13 @@
|
||||
Bootstrap.m_135875_(p_91333_.m_127526_());
|
||||
if (p_91333_.m_127527_() != null) {
|
||||
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + p_91333_.m_127527_());
|
||||
- System.exit(-1);
|
||||
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-1);
|
||||
} else if (p_91333_.m_127512_(file2)) {
|
||||
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
|
||||
- System.exit(-1);
|
||||
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-1);
|
||||
} else {
|
||||
Bootstrap.m_135875_("#@?@# Game crashed! Crash report could not be saved. #@?@#");
|
||||
- System.exit(-2);
|
||||
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-2);
|
||||
}
|
||||
|
||||
- if (this.screen != null) {
|
||||
- this.screen.removed();
|
||||
}
|
||||
@@ -954,10 +_,6 @@
|
||||
f_90982_.error("setScreen called from non-game thread");
|
||||
}
|
||||
|
||||
- if (this.f_91080_ != null) {
|
||||
- this.f_91080_.m_7861_();
|
||||
- }
|
||||
-
|
||||
if (p_91153_ == null && this.level == null) {
|
||||
if (p_91153_ == null && this.f_91073_ == null) {
|
||||
p_91153_ = new TitleScreen();
|
||||
} else if (p_91153_ == null && this.player.isDeadOrDying()) {
|
||||
@@ -1033,6 +_,19 @@
|
||||
} else if (p_91153_ == null && this.f_91074_.m_21224_()) {
|
||||
@@ -968,6 +_,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
|
||||
+ Screen old = this.screen;
|
||||
+ Screen old = this.f_91080_;
|
||||
+ if (p_91153_ != null) {
|
||||
+ var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenOpening(old, p_91153_);
|
||||
+ if (event == null) return;
|
||||
+ p_91153_ = event;
|
||||
+ 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();
|
||||
+ }
|
||||
+
|
||||
+ if (old != null && p_91153_ != old) {
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenClose(old);
|
||||
+ old.removed();
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Closing(old));
|
||||
+ old.m_7861_();
|
||||
+ }
|
||||
+
|
||||
this.screen = p_91153_;
|
||||
if (this.screen != null) {
|
||||
this.screen.added();
|
||||
@@ -1179,9 +_,12 @@
|
||||
this.f_91080_ = p_91153_;
|
||||
if (this.f_91080_ != null) {
|
||||
this.f_91080_.m_274333_();
|
||||
@@ -1113,9 +_,12 @@
|
||||
RenderSystem.enableCull();
|
||||
this.profiler.pop();
|
||||
if (!this.noRender) {
|
||||
+ this.realPartialTick = this.pause ? this.pausePartialTick : this.timer.partialTick; // Cache this since pause is volatile
|
||||
this.f_91026_.m_7238_();
|
||||
if (!this.f_91079_) {
|
||||
+ 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.profiler.popPush("gameRenderer");
|
||||
this.gameRenderer.render(this.pause ? this.pausePartialTick : this.timer.partialTick, i, p_91384_);
|
||||
this.profiler.pop();
|
||||
this.f_91026_.m_6182_("gameRenderer");
|
||||
this.f_91063_.m_109093_(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_, i, p_91384_);
|
||||
this.f_91026_.m_7238_();
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.realPartialTick);
|
||||
}
|
||||
|
||||
if (this.fpsPieResults != null) {
|
||||
@@ -1302,10 +_,12 @@
|
||||
this.window.setGuiScale((double)i);
|
||||
if (this.screen != null) {
|
||||
this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
|
||||
if (this.f_91056_ != null) {
|
||||
@@ -1240,10 +_,12 @@
|
||||
this.f_90990_.m_85378_((double)i);
|
||||
if (this.f_91080_ != null) {
|
||||
this.f_91080_.m_6574_(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_());
|
||||
+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_());
|
||||
}
|
||||
|
||||
RenderTarget rendertarget = this.getMainRenderTarget();
|
||||
rendertarget.resize(this.window.getWidth(), this.window.getHeight(), ON_OSX);
|
||||
+ if (this.gameRenderer != null)
|
||||
this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight());
|
||||
this.mouseHandler.setIgnoreFirstMove();
|
||||
RenderTarget rendertarget = this.m_91385_();
|
||||
rendertarget.m_83941_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_(), f_91002_);
|
||||
+ if (this.f_91063_ != null)
|
||||
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
|
||||
this.f_91067_.m_91599_();
|
||||
}
|
||||
@@ -1579,6 +_,7 @@
|
||||
@@ -1517,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
+ if (this.isRunning()) net.minecraftforge.event.ForgeEventFactory.onGameShuttingDown();
|
||||
this.running = false;
|
||||
public void m_91395_() {
|
||||
+ if (this.m_91396_()) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.GameShuttingDownEvent());
|
||||
this.f_91019_ = false;
|
||||
}
|
||||
|
||||
@@ -1608,10 +_,18 @@
|
||||
if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
- if (!this.level.getBlockState(blockpos).isAir()) {
|
||||
+ if (!this.level.isEmptyBlock(blockpos)) {
|
||||
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
|
||||
@@ -1546,10 +_,18 @@
|
||||
if (p_91387_ && this.f_91077_ != null && this.f_91077_.m_6662_() == HitResult.Type.BLOCK) {
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
||||
BlockPos blockpos = blockhitresult.m_82425_();
|
||||
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
||||
+ if (!this.f_91073_.m_46859_(blockpos)) {
|
||||
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
|
||||
+ if (inputEvent.isCanceled()) {
|
||||
+ if (inputEvent.shouldSwingHand()) {
|
||||
+ this.particleEngine.addBlockHitEffects(blockpos, blockhitresult);
|
||||
+ this.player.swing(InteractionHand.MAIN_HAND);
|
||||
+ this.f_91061_.addBlockHitEffects(blockpos, blockhitresult);
|
||||
+ this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
Direction direction = blockhitresult.getDirection();
|
||||
- if (this.gameMode.continueDestroyBlock(blockpos, direction)) {
|
||||
- this.particleEngine.crack(blockpos, direction);
|
||||
+ if (this.gameMode.continueDestroyBlock(blockpos, direction) && inputEvent.shouldSwingHand()) {
|
||||
+ this.particleEngine.addBlockHitEffects(blockpos, blockhitresult);
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
Direction direction = blockhitresult.m_82434_();
|
||||
- if (this.f_91072_.m_105283_(blockpos, direction)) {
|
||||
- this.f_91061_.m_107367_(blockpos, direction);
|
||||
+ if (this.f_91072_.m_105283_(blockpos, direction) && inputEvent.shouldSwingHand()) {
|
||||
+ this.f_91061_.addBlockHitEffects(blockpos, blockhitresult);
|
||||
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
}
|
||||
@@ -1640,6 +_,8 @@
|
||||
@@ -1578,6 +_,8 @@
|
||||
return false;
|
||||
} else {
|
||||
boolean flag = false;
|
||||
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
|
||||
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND);
|
||||
+ if (!inputEvent.isCanceled())
|
||||
switch (this.hitResult.getType()) {
|
||||
switch (this.f_91077_.m_6662_()) {
|
||||
case ENTITY:
|
||||
this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity());
|
||||
@@ -1647,7 +_,7 @@
|
||||
this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_());
|
||||
@@ -1585,7 +_,7 @@
|
||||
case BLOCK:
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
|
||||
BlockPos blockpos = blockhitresult.getBlockPos();
|
||||
- if (!this.level.getBlockState(blockpos).isAir()) {
|
||||
+ if (!this.level.isEmptyBlock(blockpos)) {
|
||||
this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
|
||||
if (this.level.getBlockState(blockpos).isAir()) {
|
||||
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
|
||||
BlockPos blockpos = blockhitresult.m_82425_();
|
||||
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
||||
+ if (!this.f_91073_.m_46859_(blockpos)) {
|
||||
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_());
|
||||
if (this.f_91073_.m_8055_(blockpos).m_60795_()) {
|
||||
flag = true;
|
||||
@@ -1660,8 +_,10 @@
|
||||
@@ -1598,8 +_,10 @@
|
||||
}
|
||||
|
||||
this.player.resetAttackStrengthTicker();
|
||||
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.player);
|
||||
this.f_91074_.m_36334_();
|
||||
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_);
|
||||
}
|
||||
|
||||
+ if (inputEvent.shouldSwingHand())
|
||||
this.player.swing(InteractionHand.MAIN_HAND);
|
||||
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
|
||||
return flag;
|
||||
}
|
||||
@@ -1677,6 +_,11 @@
|
||||
@@ -1615,6 +_,11 @@
|
||||
}
|
||||
|
||||
for(InteractionHand interactionhand : InteractionHand.values()) {
|
||||
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.options.keyUse, interactionhand);
|
||||
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.f_91066_.f_92095_, interactionhand);
|
||||
+ if (inputEvent.isCanceled()) {
|
||||
+ if (inputEvent.shouldSwingHand()) this.player.swing(interactionhand);
|
||||
+ if (inputEvent.shouldSwingHand()) this.f_91074_.m_6674_(interactionhand);
|
||||
+ return;
|
||||
+ }
|
||||
ItemStack itemstack = this.player.getItemInHand(interactionhand);
|
||||
if (!itemstack.isItemEnabled(this.level.enabledFeatures())) {
|
||||
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
|
||||
if (!itemstack.m_246617_(this.f_91073_.m_246046_())) {
|
||||
return;
|
||||
@@ -1697,7 +_,7 @@
|
||||
@@ -1635,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (interactionresult.consumesAction()) {
|
||||
- if (interactionresult.shouldSwing()) {
|
||||
+ if (interactionresult.shouldSwing() && inputEvent.shouldSwingHand()) {
|
||||
this.player.swing(interactionhand);
|
||||
if (interactionresult.m_19077_()) {
|
||||
- if (interactionresult.m_19080_()) {
|
||||
+ if (interactionresult.m_19080_() && inputEvent.shouldSwingHand()) {
|
||||
this.f_91074_.m_6674_(interactionhand);
|
||||
}
|
||||
|
||||
@@ -1709,7 +_,7 @@
|
||||
int i = itemstack.getCount();
|
||||
InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult);
|
||||
if (interactionresult1.consumesAction()) {
|
||||
- if (interactionresult1.shouldSwing()) {
|
||||
+ if (interactionresult1.shouldSwing() && inputEvent.shouldSwingHand()) {
|
||||
this.player.swing(interactionhand);
|
||||
if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.gameMode.hasInfiniteItems())) {
|
||||
this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand);
|
||||
@@ -1725,6 +_,9 @@
|
||||
@@ -1647,7 +_,7 @@
|
||||
int i = itemstack.m_41613_();
|
||||
InteractionResult interactionresult1 = this.f_91072_.m_233732_(this.f_91074_, interactionhand, blockhitresult);
|
||||
if (interactionresult1.m_19077_()) {
|
||||
- if (interactionresult1.m_19080_()) {
|
||||
+ if (interactionresult1.m_19080_() && inputEvent.shouldSwingHand()) {
|
||||
this.f_91074_.m_6674_(interactionhand);
|
||||
if (!itemstack.m_41619_() && (itemstack.m_41613_() != i || this.f_91072_.m_105290_())) {
|
||||
this.f_91063_.f_109055_.m_109320_(interactionhand);
|
||||
@@ -1663,6 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ if (itemstack.isEmpty() && (this.hitResult == null || this.hitResult.getType() == HitResult.Type.MISS))
|
||||
+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.player, interactionhand);
|
||||
+ if (itemstack.m_41619_() && (this.f_91077_ == null || this.f_91077_.m_6662_() == HitResult.Type.MISS))
|
||||
+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.f_91074_, interactionhand);
|
||||
+
|
||||
if (!itemstack.isEmpty()) {
|
||||
InteractionResult interactionresult2 = this.gameMode.useItem(this.player, interactionhand);
|
||||
if (interactionresult2.consumesAction()) {
|
||||
@@ -1751,6 +_,8 @@
|
||||
--this.rightClickDelay;
|
||||
if (!itemstack.m_41619_()) {
|
||||
InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand);
|
||||
if (interactionresult2.m_19077_()) {
|
||||
@@ -1689,6 +_,8 @@
|
||||
--this.f_91011_;
|
||||
}
|
||||
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
|
||||
+
|
||||
this.profiler.push("gui");
|
||||
this.chatListener.tick();
|
||||
this.gui.tick(this.pause);
|
||||
@@ -1839,6 +_,7 @@
|
||||
this.f_91026_.m_6180_("gui");
|
||||
this.f_240378_.m_240688_();
|
||||
this.f_91065_.m_193832_(this.f_91012_);
|
||||
@@ -1780,6 +_,7 @@
|
||||
|
||||
this.tutorial.tick();
|
||||
this.f_91005_.m_120596_();
|
||||
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.level, () -> true);
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.f_91073_, () -> true);
|
||||
try {
|
||||
this.level.tick(() -> {
|
||||
this.f_91073_.m_104726_(() -> {
|
||||
return true;
|
||||
@@ -1854,6 +_,7 @@
|
||||
@@ -1795,6 +_,7 @@
|
||||
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(this.level, () -> true);
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(this.f_91073_, () -> true);
|
||||
}
|
||||
|
||||
this.profiler.popPush("animateTick");
|
||||
@@ -1873,6 +_,8 @@
|
||||
this.profiler.popPush("keyboard");
|
||||
this.keyboardHandler.tick();
|
||||
this.profiler.pop();
|
||||
this.f_91026_.m_6182_("animateTick");
|
||||
@@ -1814,6 +_,8 @@
|
||||
this.f_91026_.m_6182_("keyboard");
|
||||
this.f_91068_.m_90931_();
|
||||
this.f_91026_.m_7238_();
|
||||
+
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPostClientTick();
|
||||
}
|
||||
|
||||
private boolean isMultiplayerServer() {
|
||||
@@ -2069,6 +_,7 @@
|
||||
private boolean m_91278_() {
|
||||
@@ -2011,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void setLevel(ClientLevel p_91157_) {
|
||||
+ if (this.level != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.level));
|
||||
public void m_91156_(ClientLevel p_91157_) {
|
||||
+ if (this.f_91073_ != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.f_91073_));
|
||||
ProgressScreen progressscreen = new ProgressScreen(true);
|
||||
progressscreen.progressStartNoAbort(Component.translatable("connect.joining"));
|
||||
this.updateScreenAndTick(progressscreen);
|
||||
@@ -2102,10 +_,12 @@
|
||||
IntegratedServer integratedserver = this.singleplayerServer;
|
||||
this.singleplayerServer = null;
|
||||
this.gameRenderer.resetData();
|
||||
+ net.minecraftforge.client.ForgeHooksClient.firePlayerLogout(this.gameMode, this.player);
|
||||
this.gameMode = null;
|
||||
this.narrator.clear();
|
||||
this.updateScreenAndTick(p_91321_);
|
||||
if (this.level != null) {
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.level));
|
||||
progressscreen.m_6309_(Component.m_237115_("connect.joining"));
|
||||
this.m_91362_(progressscreen);
|
||||
@@ -2044,10 +_,12 @@
|
||||
IntegratedServer integratedserver = this.f_91007_;
|
||||
this.f_91007_ = null;
|
||||
this.f_91063_.m_109150_();
|
||||
+ net.minecraftforge.client.ForgeHooksClient.firePlayerLogout(this.f_91072_, this.f_91074_);
|
||||
this.f_91072_ = null;
|
||||
this.f_240365_.m_93328_();
|
||||
this.m_91362_(p_91321_);
|
||||
if (this.f_91073_ != null) {
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.f_91073_));
|
||||
if (integratedserver != null) {
|
||||
this.profiler.push("waitForServer");
|
||||
this.f_91026_.m_6180_("waitForServer");
|
||||
|
||||
@@ -2119,6 +_,7 @@
|
||||
this.downloadedPackSource.clearServerPack();
|
||||
this.gui.onDisconnected();
|
||||
this.isLocalServer = false;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(this.level);
|
||||
@@ -2061,6 +_,7 @@
|
||||
this.f_243981_.m_246151_();
|
||||
this.f_91065_.m_93089_();
|
||||
this.f_91010_ = false;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(this.f_91073_);
|
||||
}
|
||||
|
||||
this.level = null;
|
||||
@@ -2243,6 +_,7 @@
|
||||
this.f_91073_ = null;
|
||||
@@ -2167,6 +_,7 @@
|
||||
|
||||
private void pickBlock() {
|
||||
if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.options.keyPickItem, InteractionHand.MAIN_HAND).isCanceled()) return;
|
||||
boolean flag = this.player.getAbilities().instabuild;
|
||||
private void m_91280_() {
|
||||
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.f_91066_.f_92097_, InteractionHand.MAIN_HAND).isCanceled()) return;
|
||||
boolean flag = this.f_91074_.m_150110_().f_35937_;
|
||||
BlockEntity blockentity = null;
|
||||
HitResult.Type hitresult$type = this.hitResult.getType();
|
||||
@@ -2255,10 +_,7 @@
|
||||
HitResult.Type hitresult$type = this.f_91077_.m_6662_();
|
||||
@@ -2179,10 +_,7 @@
|
||||
}
|
||||
|
||||
Block block = blockstate.getBlock();
|
||||
- itemstack = block.getCloneItemStack(this.level, blockpos, blockstate);
|
||||
- if (itemstack.isEmpty()) {
|
||||
Block block = blockstate.m_60734_();
|
||||
- itemstack = block.m_7397_(this.f_91073_, blockpos, blockstate);
|
||||
- if (itemstack.m_41619_()) {
|
||||
- return;
|
||||
- }
|
||||
+ itemstack = blockstate.getCloneItemStack(this.hitResult, this.level, blockpos, this.player);
|
||||
+ itemstack = blockstate.getCloneItemStack(this.f_91077_, this.f_91073_, blockpos, this.f_91074_);
|
||||
|
||||
if (flag && Screen.hasControlDown() && blockstate.hasBlockEntity()) {
|
||||
blockentity = this.level.getBlockEntity(blockpos);
|
||||
@@ -2269,7 +_,7 @@
|
||||
if (flag && Screen.m_96637_() && blockstate.m_155947_()) {
|
||||
blockentity = this.f_91073_.m_7702_(blockpos);
|
||||
@@ -2193,7 +_,7 @@
|
||||
}
|
||||
|
||||
Entity entity = ((EntityHitResult)this.hitResult).getEntity();
|
||||
- itemstack = entity.getPickResult();
|
||||
+ itemstack = entity.getPickedResult(this.hitResult);
|
||||
Entity entity = ((EntityHitResult)this.f_91077_).m_82443_();
|
||||
- itemstack = entity.m_142340_();
|
||||
+ itemstack = entity.getPickedResult(this.f_91077_);
|
||||
if (itemstack == null) {
|
||||
return;
|
||||
}
|
||||
@@ -2808,6 +_,19 @@
|
||||
@@ -2732,6 +_,19 @@
|
||||
|
||||
public void updateMaxMipLevel(int p_91313_) {
|
||||
this.modelManager.updateMaxMipLevel(p_91313_);
|
||||
public void m_91312_(int p_91313_) {
|
||||
this.f_91051_.m_119410_(p_91313_);
|
||||
+ }
|
||||
+
|
||||
+ public ItemColors getItemColors() {
|
||||
+ return this.itemColors;
|
||||
+ return this.f_91041_;
|
||||
+ }
|
||||
+
|
||||
+ public SearchRegistry getSearchTreeManager() {
|
||||
+ return this.searchRegistry;
|
||||
+ return this.f_90997_;
|
||||
+ }
|
||||
+
|
||||
+ private float realPartialTick;
|
||||
@@ -423,4 +464,4 @@
|
||||
+ return this.realPartialTick;
|
||||
}
|
||||
|
||||
public EntityModelSet getEntityModels() {
|
||||
public EntityModelSet m_167973_() {
|
||||
@@ -1,86 +1,96 @@
|
||||
--- a/net/minecraft/client/MouseHandler.java
|
||||
+++ b/net/minecraft/client/MouseHandler.java
|
||||
@@ -74,6 +_,7 @@
|
||||
this.activeButton = -1;
|
||||
@@ -73,6 +_,7 @@
|
||||
this.f_91510_ = -1;
|
||||
}
|
||||
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPre(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};
|
||||
if (this.minecraft.getOverlay() == null) {
|
||||
if (this.minecraft.screen == null) {
|
||||
@@ -87,11 +_,19 @@
|
||||
if (this.f_91503_.m_91265_() == null) {
|
||||
if (this.f_91503_.f_91080_ == null) {
|
||||
@@ -86,11 +_,19 @@
|
||||
if (flag) {
|
||||
screen.afterMouseAction();
|
||||
Screen.wrapScreenError(() -> {
|
||||
- aboolean[0] = screen.mouseClicked(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClickedPre(screen, d0, d1, i);
|
||||
screen.m_169415_();
|
||||
Screen.m_96579_(() -> {
|
||||
- aboolean[0] = screen.m_6375_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseClickedPre(screen, d0, d1, i);
|
||||
+ if (!aboolean[0]) {
|
||||
+ aboolean[0] = this.minecraft.screen.mouseClicked(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClickedPost(screen, d0, d1, i, aboolean[0]);
|
||||
+ aboolean[0] = this.f_91503_.f_91080_.m_6375_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseClickedPost(screen, d0, d1, i, aboolean[0]);
|
||||
+ }
|
||||
}, "mouseClicked event handler", screen.getClass().getCanonicalName());
|
||||
} else {
|
||||
Screen.wrapScreenError(() -> {
|
||||
- aboolean[0] = screen.mouseReleased(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleasedPre(screen, d0, d1, i);
|
||||
Screen.m_96579_(() -> {
|
||||
- aboolean[0] = screen.m_6348_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseReleasedPre(screen, d0, d1, i);
|
||||
+ if (!aboolean[0]) {
|
||||
+ aboolean[0] = this.minecraft.screen.mouseReleased(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleasedPost(screen, d0, d1, i, aboolean[0]);
|
||||
+ aboolean[0] = this.f_91503_.f_91080_.m_6348_(d0, d1, i);
|
||||
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenMouseReleasedPost(screen, d0, d1, i, aboolean[0]);
|
||||
+ }
|
||||
}, "mouseReleased event handler", screen.getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
@@ -116,6 +_,7 @@
|
||||
@@ -114,19 +_,26 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPost(p_91532_, p_91533_, p_91534_);
|
||||
-
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onMouseButtonPost(p_91532_, p_91533_, p_91534_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,8 +_,10 @@
|
||||
if (this.minecraft.screen != null) {
|
||||
double d3 = this.xpos * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
|
||||
double d4 = this.ypos * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
|
||||
- this.minecraft.screen.mouseScrolled(d3, d4, d1, d2);
|
||||
this.minecraft.screen.afterMouseAction();
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPre(this.minecraft.screen, d3, d4, d1, d2)) return;
|
||||
+ if (this.minecraft.screen.mouseScrolled(d3, d4, d1, d2)) return;
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPost(this.minecraft.screen, d3, d4, d1, d2);
|
||||
} else if (this.minecraft.player != null) {
|
||||
if (this.accumulatedScrollX != 0.0D && Math.signum(d1) != Math.signum(this.accumulatedScrollX)) {
|
||||
this.accumulatedScrollX = 0.0D;
|
||||
@@ -151,6 +_,7 @@
|
||||
this.accumulatedScrollX -= (double)j;
|
||||
this.accumulatedScrollY -= (double)i;
|
||||
int k = i == 0 ? -j : i;
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseScroll(this, d1, d2)) return;
|
||||
if (this.minecraft.player.isSpectator()) {
|
||||
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
|
||||
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-k);
|
||||
@@ -219,7 +_,9 @@
|
||||
double d2 = (p_91563_ - this.xpos) * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
|
||||
double d3 = (p_91564_ - this.ypos) * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
|
||||
Screen.wrapScreenError(() -> {
|
||||
- screen.mouseDragged(d0, d1, this.activeButton, d2, d3);
|
||||
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseDragPre(screen, d0, d1, this.activeButton, d2, d3)) return;
|
||||
+ if (screen.mouseDragged(d0, d1, this.activeButton, d2, d3)) return;
|
||||
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseDragPost(screen, d0, d1, this.activeButton, d2, d3);
|
||||
private void m_91526_(long p_91527_, double p_91528_, double p_91529_) {
|
||||
if (p_91527_ == Minecraft.m_91087_().m_91268_().m_85439_()) {
|
||||
- double d0 = (this.f_91503_.f_91066_.m_231821_().m_231551_() ? Math.signum(p_91529_) : p_91529_) * this.f_91503_.f_91066_.m_232122_().m_231551_();
|
||||
+ // FORGE: Allows for Horizontal Scroll to be recognized as Vertical Scroll - Fixes MC-121772
|
||||
+ double offset = p_91529_;
|
||||
+ if (Minecraft.f_91002_ && p_91529_ == 0) {
|
||||
+ offset = p_91528_;
|
||||
+ }
|
||||
+ double d0 = (this.f_91503_.f_91066_.m_231821_().m_231551_() ? Math.signum(offset) : offset) * this.f_91503_.f_91066_.m_232122_().m_231551_();
|
||||
if (this.f_91503_.m_91265_() == null) {
|
||||
if (this.f_91503_.f_91080_ != null) {
|
||||
double d1 = this.f_91507_ * (double)this.f_91503_.m_91268_().m_85445_() / (double)this.f_91503_.m_91268_().m_85443_();
|
||||
double d2 = this.f_91508_ * (double)this.f_91503_.m_91268_().m_85446_() / (double)this.f_91503_.m_91268_().m_85444_();
|
||||
- this.f_91503_.f_91080_.m_6050_(d1, d2, d0);
|
||||
this.f_91503_.f_91080_.m_169415_();
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenMouseScrollPre(this, this.f_91503_.f_91080_, d0)) return;
|
||||
+ if (this.f_91503_.f_91080_.m_6050_(d1, d2, d0)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseScrollPost(this, this.f_91503_.f_91080_, d0);
|
||||
} else if (this.f_91503_.f_91074_ != null) {
|
||||
if (this.f_91518_ != 0.0D && Math.signum(d0) != Math.signum(this.f_91518_)) {
|
||||
this.f_91518_ = 0.0D;
|
||||
@@ -139,6 +_,7 @@
|
||||
}
|
||||
|
||||
this.f_91518_ -= (double)i;
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onMouseScroll(this, d0)) return;
|
||||
if (this.f_91503_.f_91074_.m_5833_()) {
|
||||
if (this.f_91503_.f_91065_.m_93085_().m_94768_()) {
|
||||
this.f_91503_.f_91065_.m_93085_().m_205380_(-i);
|
||||
@@ -207,7 +_,9 @@
|
||||
double d2 = (p_91563_ - this.f_91507_) * (double)this.f_91503_.m_91268_().m_85445_() / (double)this.f_91503_.m_91268_().m_85443_();
|
||||
double d3 = (p_91564_ - this.f_91508_) * (double)this.f_91503_.m_91268_().m_85446_() / (double)this.f_91503_.m_91268_().m_85444_();
|
||||
Screen.m_96579_(() -> {
|
||||
- screen.m_7979_(d0, d1, this.f_91510_, d2, d3);
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenMouseDragPre(screen, d0, d1, this.f_91510_, d2, d3)) return;
|
||||
+ if (screen.m_7979_(d0, d1, this.f_91510_, d2, d3)) return;
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseDragPost(screen, d0, d1, this.f_91510_, d2, d3);
|
||||
}, "mouseDragged event handler", screen.getClass().getCanonicalName());
|
||||
}
|
||||
|
||||
@@ -302,6 +_,14 @@
|
||||
@@ -290,6 +_,14 @@
|
||||
|
||||
public double ypos() {
|
||||
return this.ypos;
|
||||
public double m_91594_() {
|
||||
return this.f_91508_;
|
||||
+ }
|
||||
+
|
||||
+ public double getXVelocity() {
|
||||
+ return this.accumulatedDX;
|
||||
+ return this.f_91516_;
|
||||
+ }
|
||||
+
|
||||
+ public double getYVelocity() {
|
||||
+ return this.accumulatedDY;
|
||||
+ return this.f_91517_;
|
||||
}
|
||||
|
||||
public void setIgnoreFirstMove() {
|
||||
public void m_91599_() {
|
||||
@@ -1,26 +1,26 @@
|
||||
--- a/net/minecraft/client/Options.java
|
||||
+++ b/net/minecraft/client/Options.java
|
||||
@@ -507,7 +_,8 @@
|
||||
@@ -545,7 +_,8 @@
|
||||
}, new OptionInstance.LazyEnum<>(() -> {
|
||||
return Stream.concat(Stream.of(""), Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().stream()).toList();
|
||||
return Stream.concat(Stream.of(""), Minecraft.m_91087_().m_91106_().m_194525_().stream()).toList();
|
||||
}, (p_232011_) -> {
|
||||
- return Minecraft.getInstance().isRunning() && p_232011_ != "" && !Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().contains(p_232011_) ? Optional.empty() : Optional.of(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.getInstance().isRunning() && (p_232011_ == null || !p_232011_.isEmpty()) && !Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_);
|
||||
}, Codec.STRING), "", (p_299350_) -> {
|
||||
SoundManager soundmanager = Minecraft.getInstance().getSoundManager();
|
||||
soundmanager.reload();
|
||||
@@ -835,6 +_,7 @@
|
||||
+ 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_275584_) -> {
|
||||
SoundManager soundmanager = Minecraft.m_91087_().m_91106_();
|
||||
soundmanager.m_194526_();
|
||||
@@ -869,6 +_,7 @@
|
||||
}
|
||||
|
||||
public Options(Minecraft p_92138_, File p_92139_) {
|
||||
+ setForgeKeybindProperties();
|
||||
this.minecraft = p_92138_;
|
||||
this.optionsFile = new File(p_92139_, "options.txt");
|
||||
boolean flag = p_92138_.is64Bit();
|
||||
@@ -957,11 +_,21 @@
|
||||
p_168428_.process("telemetryOptInExtra", this.telemetryOptInExtra);
|
||||
this.onboardAccessibility = p_168428_.process("onboardAccessibility", this.onboardAccessibility);
|
||||
this.f_92060_ = p_92138_;
|
||||
this.f_92110_ = new File(p_92139_, "options.txt");
|
||||
boolean flag = p_92138_.m_91103_();
|
||||
@@ -990,11 +_,21 @@
|
||||
p_168428_.m_213982_("telemetryOptInExtra", this.f_260461_);
|
||||
this.f_263744_ = p_168428_.m_142682_("onboardAccessibility", this.f_263744_);
|
||||
|
||||
+ net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.processOptions(p_168428_);
|
||||
+ processOptionsForge(p_168428_);
|
||||
@@ -28,69 +28,69 @@
|
||||
+ // FORGE: split off to allow reloading options after mod loading is done
|
||||
+ private void processOptionsForge(Options.FieldAccess p_168428_)
|
||||
+ {
|
||||
for(KeyMapping keymapping : this.keyMappings) {
|
||||
- String s = keymapping.saveString();
|
||||
+ String s = keymapping.saveString() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : "");
|
||||
String s1 = p_168428_.process("key_" + keymapping.getName(), s);
|
||||
for(KeyMapping keymapping : this.f_92059_) {
|
||||
- String s = keymapping.m_90865_();
|
||||
+ String s = keymapping.m_90865_() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : "");
|
||||
String s1 = p_168428_.m_141943_("key_" + keymapping.m_90860_(), s);
|
||||
if (!s.equals(s1)) {
|
||||
- keymapping.setKey(InputConstants.getKey(s1));
|
||||
- keymapping.m_90848_(InputConstants.m_84851_(s1));
|
||||
+ if (s1.indexOf(':') != -1) {
|
||||
+ String[] pts = s1.split(":");
|
||||
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputConstants.getKey(pts[0]));
|
||||
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputConstants.m_84851_(pts[0]));
|
||||
+ } else
|
||||
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputConstants.getKey(s1));
|
||||
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputConstants.m_84851_(s1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -980,6 +_,9 @@
|
||||
@@ -1013,6 +_,9 @@
|
||||
}
|
||||
|
||||
public void load() {
|
||||
public void m_92140_() {
|
||||
+ this.load(false);
|
||||
+ }
|
||||
+ public void load(boolean limited) {
|
||||
try {
|
||||
if (!this.optionsFile.exists()) {
|
||||
if (!this.f_92110_.exists()) {
|
||||
return;
|
||||
@@ -1008,7 +_,8 @@
|
||||
@@ -1041,7 +_,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.processOptions(new Options.FieldAccess() {
|
||||
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsForge : this::processOptions;
|
||||
- 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 getValueOrNull(String p_168459_) {
|
||||
return compoundtag1.contains(p_168459_) ? compoundtag1.getString(p_168459_) : null;
|
||||
@@ -1181,6 +_,7 @@
|
||||
private String m_168458_(String p_168459_) {
|
||||
return compoundtag1.m_128441_(p_168459_) ? compoundtag1.m_128461_(p_168459_) : null;
|
||||
@@ -1204,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void broadcastOptions() {
|
||||
public void m_92172_() {
|
||||
+ if (net.minecraftforge.client.loading.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
|
||||
if (this.minecraft.player != null) {
|
||||
this.minecraft.player.connection.send(new ServerboundClientInformationPacket(this.buildPlayerInformation()));
|
||||
}
|
||||
@@ -1239,6 +_,23 @@
|
||||
if (this.f_92060_.f_91074_ != null) {
|
||||
int i = 0;
|
||||
|
||||
@@ -1268,6 +_,23 @@
|
||||
}
|
||||
|
||||
p_92146_.setSelected(set);
|
||||
p_92146_.m_10509_(set);
|
||||
+ }
|
||||
+
|
||||
+ private void setForgeKeybindProperties() {
|
||||
+ net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME;
|
||||
+ keyUp.setKeyConflictContext(inGame);
|
||||
+ keyLeft.setKeyConflictContext(inGame);
|
||||
+ keyDown.setKeyConflictContext(inGame);
|
||||
+ keyRight.setKeyConflictContext(inGame);
|
||||
+ keyJump.setKeyConflictContext(inGame);
|
||||
+ keyShift.setKeyConflictContext(inGame);
|
||||
+ keySprint.setKeyConflictContext(inGame);
|
||||
+ keyAttack.setKeyConflictContext(inGame);
|
||||
+ keyChat.setKeyConflictContext(inGame);
|
||||
+ keyPlayerList.setKeyConflictContext(inGame);
|
||||
+ keyCommand.setKeyConflictContext(inGame);
|
||||
+ keyTogglePerspective.setKeyConflictContext(inGame);
|
||||
+ keySmoothCamera.setKeyConflictContext(inGame);
|
||||
+ f_92085_.setKeyConflictContext(inGame);
|
||||
+ f_92086_.setKeyConflictContext(inGame);
|
||||
+ f_92087_.setKeyConflictContext(inGame);
|
||||
+ f_92088_.setKeyConflictContext(inGame);
|
||||
+ f_92089_.setKeyConflictContext(inGame);
|
||||
+ f_92090_.setKeyConflictContext(inGame);
|
||||
+ f_92091_.setKeyConflictContext(inGame);
|
||||
+ f_92096_.setKeyConflictContext(inGame);
|
||||
+ f_92098_.setKeyConflictContext(inGame);
|
||||
+ f_92099_.setKeyConflictContext(inGame);
|
||||
+ f_92100_.setKeyConflictContext(inGame);
|
||||
+ f_92103_.setKeyConflictContext(inGame);
|
||||
+ f_92104_.setKeyConflictContext(inGame);
|
||||
}
|
||||
|
||||
public CameraType getCameraType() {
|
||||
public CameraType m_92176_() {
|
||||
@@ -6,20 +6,20 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public enum RecipeBookCategories {
|
||||
+public enum RecipeBookCategories implements net.minecraftforge.common.IExtensibleEnum {
|
||||
CRAFTING_SEARCH(new ItemStack(Items.COMPASS)),
|
||||
CRAFTING_BUILDING_BLOCKS(new ItemStack(Blocks.BRICKS)),
|
||||
CRAFTING_REDSTONE(new ItemStack(Items.REDSTONE)),
|
||||
CRAFTING_SEARCH(new ItemStack(Items.f_42522_)),
|
||||
CRAFTING_BUILDING_BLOCKS(new ItemStack(Blocks.f_50076_)),
|
||||
CRAFTING_REDSTONE(new ItemStack(Items.f_42451_)),
|
||||
@@ -36,7 +_,7 @@
|
||||
public static final List<RecipeBookCategories> BLAST_FURNACE_CATEGORIES = ImmutableList.of(BLAST_FURNACE_SEARCH, BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC);
|
||||
public static final List<RecipeBookCategories> FURNACE_CATEGORIES = ImmutableList.of(FURNACE_SEARCH, FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC);
|
||||
public static final List<RecipeBookCategories> CRAFTING_CATEGORIES = ImmutableList.of(CRAFTING_SEARCH, CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE);
|
||||
- public static final Map<RecipeBookCategories, List<RecipeBookCategories>> AGGREGATE_CATEGORIES = ImmutableMap.of(CRAFTING_SEARCH, ImmutableList.of(CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE), FURNACE_SEARCH, ImmutableList.of(FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC), BLAST_FURNACE_SEARCH, ImmutableList.of(BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC), SMOKER_SEARCH, ImmutableList.of(SMOKER_FOOD));
|
||||
+ public static final Map<RecipeBookCategories, List<RecipeBookCategories>> AGGREGATE_CATEGORIES = net.minecraftforge.client.RecipeBookManager.getAggregateCategories();
|
||||
private final List<ItemStack> itemIcons;
|
||||
public static final List<RecipeBookCategories> f_92257_ = ImmutableList.of(BLAST_FURNACE_SEARCH, BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC);
|
||||
public static final List<RecipeBookCategories> f_92258_ = ImmutableList.of(FURNACE_SEARCH, FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC);
|
||||
public static final List<RecipeBookCategories> 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_ = net.minecraftforge.client.RecipeBookManager.getAggregateCategories();
|
||||
private final List<ItemStack> f_92261_;
|
||||
|
||||
private RecipeBookCategories(ItemStack... p_92267_) {
|
||||
@@ -59,7 +_,7 @@
|
||||
list = SMOKER_CATEGORIES;
|
||||
list = f_92256_;
|
||||
break;
|
||||
default:
|
||||
- throw new IncompatibleClassChangeError();
|
||||
@@ -29,8 +29,8 @@
|
||||
return list;
|
||||
@@ -67,5 +_,9 @@
|
||||
|
||||
public List<ItemStack> getIconItems() {
|
||||
return this.itemIcons;
|
||||
public List<ItemStack> m_92268_() {
|
||||
return this.f_92261_;
|
||||
+ }
|
||||
+
|
||||
+ public static RecipeBookCategories create(String name, ItemStack... icons) {
|
||||
|
||||
@@ -11,19 +11,19 @@
|
||||
+ }
|
||||
+ final File target = event.getScreenshotFile();
|
||||
+
|
||||
Util.ioPool().execute(() -> {
|
||||
Util.m_183992_().execute(() -> {
|
||||
try {
|
||||
- nativeimage.writeToFile(file2);
|
||||
+ nativeimage.writeToFile(target);
|
||||
Component component = Component.literal(file2.getName()).withStyle(ChatFormatting.UNDERLINE).withStyle((p_168608_) -> {
|
||||
- return p_168608_.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath()));
|
||||
+ return p_168608_.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath()));
|
||||
- nativeimage.m_85056_(file2);
|
||||
+ nativeimage.m_85056_(target);
|
||||
Component component = Component.m_237113_(file2.getName()).m_130940_(ChatFormatting.UNDERLINE).m_130938_((p_168608_) -> {
|
||||
- return p_168608_.m_131142_(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath()));
|
||||
+ return p_168608_.m_131142_(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath()));
|
||||
});
|
||||
- p_92311_.accept(Component.translatable("screenshot.success", component));
|
||||
- p_92311_.accept(Component.m_237110_("screenshot.success", component));
|
||||
+ if (event.getResultMessage() != null)
|
||||
+ p_92311_.accept(event.getResultMessage());
|
||||
+ else
|
||||
+ p_92311_.accept(Component.translatable("screenshot.success", component));
|
||||
+ p_92311_.accept(Component.m_237110_("screenshot.success", component));
|
||||
} catch (Exception exception) {
|
||||
LOGGER.warn("Couldn't save screenshot", (Throwable)exception);
|
||||
p_92311_.accept(Component.translatable("screenshot.failure", exception.getMessage()));
|
||||
f_92276_.warn("Couldn't save screenshot", (Throwable)exception);
|
||||
p_92311_.accept(Component.m_237110_("screenshot.failure", exception.getMessage()));
|
||||
@@ -2,18 +2,18 @@
|
||||
+++ b/net/minecraft/client/ToggleKeyMapping.java
|
||||
@@ -16,7 +_,7 @@
|
||||
|
||||
public void setDown(boolean p_92534_) {
|
||||
if (this.needsToggle.getAsBoolean()) {
|
||||
public void m_7249_(boolean p_92534_) {
|
||||
if (this.f_92527_.getAsBoolean()) {
|
||||
- if (p_92534_) {
|
||||
+ if (p_92534_ && isConflictContextAndModifierActive()) {
|
||||
super.setDown(!this.isDown());
|
||||
super.m_7249_(!this.m_90857_());
|
||||
}
|
||||
} else {
|
||||
@@ -24,6 +_,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
+ @Override public boolean isDown() { return this.isDown && (isConflictContextAndModifierActive() || needsToggle.getAsBoolean()); }
|
||||
+ @Override public boolean m_90857_() { return this.f_90817_ && (isConflictContextAndModifierActive() || f_92527_.getAsBoolean()); }
|
||||
|
||||
protected void reset() {
|
||||
super.setDown(false);
|
||||
protected void m_289748_() {
|
||||
super.m_7249_(false);
|
||||
@@ -0,0 +1,49 @@
|
||||
--- a/net/minecraft/client/User.java
|
||||
+++ b/net/minecraft/client/User.java
|
||||
@@ -21,8 +_,22 @@
|
||||
private final Optional<String> f_193796_;
|
||||
private final Optional<String> f_193797_;
|
||||
private final User.Type f_92538_;
|
||||
+ /** Forge: Cache of the local session's GameProfile properties. */
|
||||
+ private com.mojang.authlib.properties.PropertyMap properties;
|
||||
|
||||
public User(String p_193799_, String p_193800_, String p_193801_, Optional<String> p_193802_, Optional<String> p_193803_, User.Type p_193804_) {
|
||||
+ if (p_193799_ == null || p_193799_.isEmpty()) {
|
||||
+ p_193799_ = "MissingName";
|
||||
+ p_193800_ = p_193801_ = "NotValid";
|
||||
+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger(getClass().getName());
|
||||
+ logger.warn("=========================================================");
|
||||
+ logger.warn("WARNING!! the username was not set for this session, typically");
|
||||
+ logger.warn("this means you installed Forge incorrectly. We have set your");
|
||||
+ logger.warn("name to \"MissingName\" and your session to nothing. Please");
|
||||
+ logger.warn("check your installation and post a console log from the launcher");
|
||||
+ logger.warn("when asking for help!");
|
||||
+ logger.warn("=========================================================");
|
||||
+ }
|
||||
this.f_92535_ = p_193799_;
|
||||
this.f_92536_ = p_193800_;
|
||||
this.f_92537_ = p_193801_;
|
||||
@@ -64,8 +_,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ //For internal use only. Modders should never need to use this.
|
||||
+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) {
|
||||
+ if (this.properties == null)
|
||||
+ this.properties = properties;
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasCachedProperties() {
|
||||
+ return properties != null;
|
||||
+ }
|
||||
+
|
||||
public GameProfile m_92548_() {
|
||||
- return new GameProfile(this.m_240411_(), this.m_92546_());
|
||||
+ // FORGE: Add cached GameProfile properties to returned GameProfile. This helps to cut down on calls to the session service.
|
||||
+ GameProfile ret = new GameProfile(this.m_240411_(), this.m_92546_());
|
||||
+ if (this.properties != null)
|
||||
+ ret.getProperties().putAll(this.properties);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
public User.Type m_168638_() {
|
||||
@@ -3,42 +3,42 @@
|
||||
@@ -28,7 +_,8 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class BlockColors {
|
||||
private static final int DEFAULT = -1;
|
||||
- private final IdMapper<BlockColor> blockColors = new IdMapper<>(32);
|
||||
private static final int f_168640_ = -1;
|
||||
- private final IdMapper<BlockColor> f_92571_ = new IdMapper<>(32);
|
||||
+ // FORGE: Use registry delegate as non-Vanilla block ids are not constant
|
||||
+ private final java.util.Map<net.minecraft.core.Holder.Reference<Block>, BlockColor> blockColors = new java.util.HashMap<>();
|
||||
private final Map<Block, Set<Property<?>>> coloringStates = Maps.newHashMap();
|
||||
+ private final java.util.Map<net.minecraft.core.Holder.Reference<Block>, BlockColor> f_92571_ = new java.util.HashMap<>();
|
||||
private final Map<Block, Set<Property<?>>> f_92572_ = Maps.newHashMap();
|
||||
|
||||
public static BlockColors createDefault() {
|
||||
public static BlockColors m_92574_() {
|
||||
@@ -80,11 +_,12 @@
|
||||
blockcolors.register((p_92596_, p_92597_, p_92598_, p_92599_) -> {
|
||||
blockcolors.m_92589_((p_92596_, p_92597_, p_92598_, p_92599_) -> {
|
||||
return p_92597_ != null && p_92598_ != null ? 2129968 : 7455580;
|
||||
}, Blocks.LILY_PAD);
|
||||
}, Blocks.f_50196_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(blockcolors);
|
||||
return blockcolors;
|
||||
}
|
||||
|
||||
public int getColor(BlockState p_92583_, Level p_92584_, BlockPos p_92585_) {
|
||||
- BlockColor blockcolor = this.blockColors.byId(BuiltInRegistries.BLOCK.getId(p_92583_.getBlock()));
|
||||
+ BlockColor blockcolor = this.blockColors.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92583_.getBlock()));
|
||||
public int m_92582_(BlockState p_92583_, Level p_92584_, BlockPos p_92585_) {
|
||||
- BlockColor blockcolor = this.f_92571_.m_7942_(BuiltInRegistries.f_256975_.m_7447_(p_92583_.m_60734_()));
|
||||
+ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92583_.m_60734_()));
|
||||
if (blockcolor != null) {
|
||||
return blockcolor.getColor(p_92583_, (BlockAndTintGetter)null, (BlockPos)null, 0);
|
||||
return blockcolor.m_92566_(p_92583_, (BlockAndTintGetter)null, (BlockPos)null, 0);
|
||||
} else {
|
||||
@@ -94,13 +_,15 @@
|
||||
}
|
||||
|
||||
public int getColor(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) {
|
||||
- BlockColor blockcolor = this.blockColors.byId(BuiltInRegistries.BLOCK.getId(p_92578_.getBlock()));
|
||||
+ BlockColor blockcolor = this.blockColors.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92578_.getBlock()));
|
||||
return blockcolor == null ? -1 : blockcolor.getColor(p_92578_, p_92579_, p_92580_, p_92581_);
|
||||
public int m_92577_(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) {
|
||||
- BlockColor blockcolor = this.f_92571_.m_7942_(BuiltInRegistries.f_256975_.m_7447_(p_92578_.m_60734_()));
|
||||
+ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92578_.m_60734_()));
|
||||
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 register(BlockColor p_92590_, Block... p_92591_) {
|
||||
public void m_92589_(BlockColor p_92590_, Block... p_92591_) {
|
||||
for(Block block : p_92591_) {
|
||||
- this.blockColors.addMapping(p_92590_, BuiltInRegistries.BLOCK.getId(block));
|
||||
+ this.blockColors.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), p_92590_);
|
||||
- this.f_92571_.m_122664_(p_92590_, BuiltInRegistries.f_256975_.m_7447_(block));
|
||||
+ this.f_92571_.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), p_92590_);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,33 +3,33 @@
|
||||
@@ -25,7 +_,8 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ItemColors {
|
||||
private static final int DEFAULT = -1;
|
||||
- private final IdMapper<ItemColor> itemColors = new IdMapper<>(32);
|
||||
private static final int f_168642_ = -1;
|
||||
- private final IdMapper<ItemColor> f_92674_ = new IdMapper<>(32);
|
||||
+ // FORGE: Use registry delegate as non-Vanilla item ids are not constant
|
||||
+ private final java.util.Map<net.minecraft.core.Holder.Reference<Item>, ItemColor> itemColors = new java.util.HashMap<>();
|
||||
+ private final java.util.Map<net.minecraft.core.Holder.Reference<Item>, ItemColor> f_92674_ = new java.util.HashMap<>();
|
||||
|
||||
public static ItemColors createDefault(BlockColors p_92684_) {
|
||||
public static ItemColors m_92683_(BlockColors p_92684_) {
|
||||
ItemColors itemcolors = new ItemColors();
|
||||
@@ -88,17 +_,20 @@
|
||||
itemcolors.register((p_232352_, p_232353_) -> {
|
||||
return p_232353_ == 0 ? -1 : MapItem.getColor(p_232352_);
|
||||
}, Items.FILLED_MAP);
|
||||
itemcolors.m_92689_((p_232352_, p_232353_) -> {
|
||||
return p_232353_ == 0 ? -1 : MapItem.m_42918_(p_232352_);
|
||||
}, Items.f_42573_);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onItemColorsInit(itemcolors, p_92684_);
|
||||
return itemcolors;
|
||||
}
|
||||
|
||||
public int getColor(ItemStack p_92677_, int p_92678_) {
|
||||
- ItemColor itemcolor = this.itemColors.byId(BuiltInRegistries.ITEM.getId(p_92677_.getItem()));
|
||||
+ ItemColor itemcolor = this.itemColors.get(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(p_92677_.getItem()));
|
||||
return itemcolor == null ? -1 : itemcolor.getColor(p_92677_, p_92678_);
|
||||
public int m_92676_(ItemStack p_92677_, int p_92678_) {
|
||||
- ItemColor itemcolor = this.f_92674_.m_7942_(BuiltInRegistries.f_257033_.m_7447_(p_92677_.m_41720_()));
|
||||
+ ItemColor itemcolor = this.f_92674_.get(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(p_92677_.m_41720_()));
|
||||
return itemcolor == null ? -1 : itemcolor.m_92671_(p_92677_, p_92678_);
|
||||
}
|
||||
|
||||
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Item} */
|
||||
+ @Deprecated
|
||||
public void register(ItemColor p_92690_, ItemLike... p_92691_) {
|
||||
public void m_92689_(ItemColor p_92690_, ItemLike... p_92691_) {
|
||||
for(ItemLike itemlike : p_92691_) {
|
||||
- this.itemColors.addMapping(p_92690_, Item.getId(itemlike.asItem()));
|
||||
+ this.itemColors.put(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(itemlike.asItem()), p_92690_);
|
||||
- this.f_92674_.m_122664_(p_92690_, Item.m_41393_(itemlike.m_5456_()));
|
||||
+ this.f_92674_.put(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(itemlike.m_5456_()), p_92690_);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,12 +6,12 @@
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class Font {
|
||||
+public class Font implements net.minecraftforge.client.extensions.IForgeFont {
|
||||
private static final float EFFECT_DEPTH = 0.01F;
|
||||
private static final Vector3f SHADOW_OFFSET = new Vector3f(0.0F, 0.0F, 0.03F);
|
||||
public static final int ALPHA_CUTOFF = 8;
|
||||
private static final float f_168643_ = 0.01F;
|
||||
private static final Vector3f f_92712_ = new Vector3f(0.0F, 0.0F, 0.03F);
|
||||
public static final int f_193827_ = 8;
|
||||
@@ -202,6 +_,8 @@
|
||||
public StringSplitter getSplitter() {
|
||||
return this.splitter;
|
||||
public StringSplitter m_92865_() {
|
||||
return this.f_92714_;
|
||||
}
|
||||
+
|
||||
+ @Override public Font self() { return this; }
|
||||
|
||||
@@ -1,77 +1,68 @@
|
||||
--- a/net/minecraft/client/gui/Gui.java
|
||||
+++ b/net/minecraft/client/gui/Gui.java
|
||||
@@ -130,7 +_,7 @@
|
||||
public float vignetteBrightness = 1.0F;
|
||||
protected int toolHighlightTimer;
|
||||
protected ItemStack lastToolHighlight = ItemStack.EMPTY;
|
||||
- protected final DebugScreenOverlay debugOverlay;
|
||||
+ protected DebugScreenOverlay debugOverlay;
|
||||
protected final SubtitleOverlay subtitleOverlay;
|
||||
protected final SpectatorGui spectatorGui;
|
||||
protected final PlayerTabOverlay tabList;
|
||||
@@ -453,6 +_,8 @@
|
||||
@@ -424,6 +_,8 @@
|
||||
|
||||
for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
|
||||
MobEffect mobeffect = mobeffectinstance.getEffect();
|
||||
MobEffect mobeffect = mobeffectinstance.m_19544_();
|
||||
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
|
||||
+ if (!renderer.isVisibleInGui(mobeffectinstance)) continue;
|
||||
if (mobeffectinstance.showIcon()) {
|
||||
int i = this.screenWidth;
|
||||
if (mobeffectinstance.m_19575_()) {
|
||||
int i = this.f_92977_;
|
||||
int j = 1;
|
||||
@@ -481,6 +_,7 @@
|
||||
@@ -452,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ if (renderer.renderGuiIcon(mobeffectinstance, this, p_282812_, i, j, 0, f)) continue;
|
||||
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(mobeffect);
|
||||
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
|
||||
int i1 = j;
|
||||
float f1 = f;
|
||||
@@ -601,16 +_,21 @@
|
||||
@@ -572,16 +_,21 @@
|
||||
}
|
||||
|
||||
public void renderSelectedItemName(GuiGraphics p_283501_) {
|
||||
public void m_280295_(GuiGraphics p_283501_) {
|
||||
+ renderSelectedItemName(p_283501_, 0);
|
||||
+ }
|
||||
+
|
||||
+ public void renderSelectedItemName(GuiGraphics p_283501_, int yShift) {
|
||||
this.minecraft.getProfiler().push("selectedItemName");
|
||||
if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
|
||||
- MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color);
|
||||
+ MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().getStyleModifier());
|
||||
if (this.lastToolHighlight.hasCustomHoverName()) {
|
||||
mutablecomponent.withStyle(ChatFormatting.ITALIC);
|
||||
this.f_92986_.m_91307_().m_6180_("selectedItemName");
|
||||
if (this.f_92993_ > 0 && !this.f_92994_.m_41619_()) {
|
||||
- MutableComponent mutablecomponent = Component.m_237119_().m_7220_(this.f_92994_.m_41786_()).m_130940_(this.f_92994_.m_41791_().f_43022_);
|
||||
+ MutableComponent mutablecomponent = Component.m_237119_().m_7220_(this.f_92994_.m_41786_()).m_130938_(this.f_92994_.m_41791_().getStyleModifier());
|
||||
if (this.f_92994_.m_41788_()) {
|
||||
mutablecomponent.m_130940_(ChatFormatting.ITALIC);
|
||||
}
|
||||
|
||||
- int i = this.getFont().width(mutablecomponent);
|
||||
+ Component highlightTip = this.lastToolHighlight.getHighlightTip(mutablecomponent);
|
||||
+ int i = this.getFont().width(highlightTip);
|
||||
int j = (this.screenWidth - i) / 2;
|
||||
- int k = this.screenHeight - 59;
|
||||
+ int k = this.screenHeight - Math.max(yShift, 59);
|
||||
if (!this.minecraft.gameMode.canHurtPlayer()) {
|
||||
- int i = this.m_93082_().m_92852_(mutablecomponent);
|
||||
+ Component highlightTip = this.f_92994_.getHighlightTip(mutablecomponent);
|
||||
+ int i = this.m_93082_().m_92852_(highlightTip);
|
||||
int j = (this.f_92977_ - i) / 2;
|
||||
- int k = this.f_92978_ - 59;
|
||||
+ int k = this.f_92978_ - Math.max(yShift, 59);
|
||||
if (!this.f_92986_.f_91072_.m_105205_()) {
|
||||
k += 14;
|
||||
}
|
||||
@@ -622,7 +_,13 @@
|
||||
@@ -593,7 +_,13 @@
|
||||
|
||||
if (l > 0) {
|
||||
p_283501_.fill(j - 2, k - 2, j + i + 2, k + 9 + 2, this.minecraft.options.getBackgroundColor(0));
|
||||
- p_283501_.drawString(this.getFont(), mutablecomponent, j, k, 16777215 + (l << 24));
|
||||
+ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(lastToolHighlight).getFont(lastToolHighlight, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME);
|
||||
p_283501_.m_280509_(j - 2, k - 2, j + i + 2, k + 9 + 2, this.f_92986_.f_91066_.m_92143_(0));
|
||||
- p_283501_.m_280430_(this.m_93082_(), mutablecomponent, j, k, 16777215 + (l << 24));
|
||||
+ 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) {
|
||||
+ p_283501_.drawString(this.getFont(), highlightTip, j, k, 16777215 + (l << 24));
|
||||
+ p_283501_.m_280430_(this.m_93082_(), highlightTip, j, k, 16777215 + (l << 24));
|
||||
+ } else {
|
||||
+ j = (this.screenWidth - font.width(highlightTip)) / 2;
|
||||
+ p_283501_.drawString(font, highlightTip, j, k, 16777215 + (l << 24));
|
||||
+ j = (this.f_92977_ - font.m_92852_(highlightTip)) / 2;
|
||||
+ p_283501_.m_280430_(font, highlightTip, j, k, 16777215 + (l << 24));
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1069,7 +_,7 @@
|
||||
ItemStack itemstack = this.minecraft.player.getInventory().getSelected();
|
||||
if (itemstack.isEmpty()) {
|
||||
this.toolHighlightTimer = 0;
|
||||
- } else if (!this.lastToolHighlight.isEmpty() && itemstack.is(this.lastToolHighlight.getItem()) && itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName())) {
|
||||
+ } else if (!this.lastToolHighlight.isEmpty() && itemstack.getItem() == this.lastToolHighlight.getItem() && (itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName()) && itemstack.getHighlightTip(itemstack.getHoverName()).equals(lastToolHighlight.getHighlightTip(lastToolHighlight.getHoverName())))) {
|
||||
if (this.toolHighlightTimer > 0) {
|
||||
--this.toolHighlightTimer;
|
||||
@@ -1037,7 +_,7 @@
|
||||
ItemStack itemstack = this.f_92986_.f_91074_.m_150109_().m_36056_();
|
||||
if (itemstack.m_41619_()) {
|
||||
this.f_92993_ = 0;
|
||||
- } else if (!this.f_92994_.m_41619_() && itemstack.m_150930_(this.f_92994_.m_41720_()) && itemstack.m_41786_().equals(this.f_92994_.m_41786_())) {
|
||||
+ } else if (!this.f_92994_.m_41619_() && itemstack.m_41720_() == this.f_92994_.m_41720_() && (itemstack.m_41786_().equals(this.f_92994_.m_41786_()) && itemstack.getHighlightTip(itemstack.m_41786_()).equals(f_92994_.getHighlightTip(f_92994_.m_41786_())))) {
|
||||
if (this.f_92993_ > 0) {
|
||||
--this.f_92993_;
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
--- a/net/minecraft/client/gui/GuiGraphics.java
|
||||
+++ b/net/minecraft/client/gui/GuiGraphics.java
|
||||
@@ -55,7 +_,7 @@
|
||||
@@ -56,7 +_,7 @@
|
||||
import org.joml.Vector2ic;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
-public class GuiGraphics {
|
||||
+public class GuiGraphics implements net.minecraftforge.client.extensions.IForgeGuiGraphics {
|
||||
public static final float MAX_GUI_Z = 10000.0F;
|
||||
public static final float MIN_GUI_Z = -10000.0F;
|
||||
private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2;
|
||||
@@ -271,6 +_,11 @@
|
||||
public static final float f_289044_ = 10000.0F;
|
||||
public static final float f_289038_ = -10000.0F;
|
||||
private static final int f_279564_ = 2;
|
||||
@@ -270,6 +_,11 @@
|
||||
}
|
||||
|
||||
public int drawString(Font p_283343_, @Nullable String p_281896_, int p_283569_, int p_283418_, int p_281560_, boolean p_282130_) {
|
||||
public int m_280056_(Font p_283343_, @Nullable String p_281896_, int p_283569_, int p_283418_, int p_281560_, boolean p_282130_) {
|
||||
+ return this.drawString(p_283343_, p_281896_, (float)p_283569_, (float)p_283418_, p_281560_, p_282130_);
|
||||
+ }
|
||||
+
|
||||
@@ -21,120 +21,140 @@
|
||||
if (p_281896_ == null) {
|
||||
return 0;
|
||||
} else {
|
||||
@@ -285,6 +_,11 @@
|
||||
@@ -284,6 +_,11 @@
|
||||
}
|
||||
|
||||
public int drawString(Font p_282636_, FormattedCharSequence p_281596_, int p_281586_, int p_282816_, int p_281743_, boolean p_282394_) {
|
||||
public int m_280649_(Font p_282636_, FormattedCharSequence p_281596_, int p_281586_, int p_282816_, int p_281743_, boolean p_282394_) {
|
||||
+ return this.drawString(p_282636_, p_281596_, (float)p_281586_, (float)p_282816_, p_281743_, p_282394_);
|
||||
+ }
|
||||
+
|
||||
+ // Forge: Add float variant for x,y coordinates
|
||||
+ public int drawString(Font p_282636_, FormattedCharSequence p_281596_, float p_281586_, float p_282816_, int p_281743_, boolean p_282394_) {
|
||||
int i = p_282636_.drawInBatch(p_281596_, (float)p_281586_, (float)p_282816_, p_281743_, p_282394_, this.pose.last().pose(), this.bufferSource, Font.DisplayMode.NORMAL, 0, 15728880);
|
||||
this.flushIfUnmanaged();
|
||||
int i = p_282636_.m_272191_(p_281596_, (float)p_281586_, (float)p_282816_, p_281743_, p_282394_, this.f_279612_.m_85850_().m_252922_(), this.f_279627_, Font.DisplayMode.NORMAL, 0, 15728880);
|
||||
this.m_286081_();
|
||||
return i;
|
||||
@@ -511,6 +_,7 @@
|
||||
crashreportcategory.setDetail("Item Type", () -> {
|
||||
return String.valueOf((Object)p_281675_.getItem());
|
||||
@@ -405,6 +_,10 @@
|
||||
}
|
||||
|
||||
public void m_280543_(ResourceLocation p_283059_, int p_283575_, int p_283192_, int p_281790_, int p_283642_, int p_282691_, int p_281912_, int p_281728_, int p_282324_) {
|
||||
+ blitRepeating(p_283059_, p_283575_, p_283192_, p_281790_, p_283642_, p_282691_, p_281912_, p_281728_, p_282324_, 256, 256);
|
||||
+ }
|
||||
+
|
||||
+ public void blitRepeating(ResourceLocation p_283059_, int p_283575_, int p_283192_, int p_281790_, int p_283642_, int p_282691_, int p_281912_, int p_281728_, int p_282324_, int textureWidth, int textureHeight) {
|
||||
int i = p_283575_;
|
||||
|
||||
int j;
|
||||
@@ -417,7 +_,7 @@
|
||||
for(IntIterator intiterator1 = m_280358_(p_283642_, p_282324_); intiterator1.hasNext(); l += i1) {
|
||||
i1 = intiterator1.nextInt();
|
||||
int j1 = (p_282324_ - i1) / 2;
|
||||
- this.m_280218_(p_283059_, i, l, p_282691_ + k, p_281912_ + j1, j, i1);
|
||||
+ this.m_280163_(p_283059_, i, l, p_282691_ + k, p_281912_ + j1, j, i1, textureWidth, textureHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -477,6 +_,7 @@
|
||||
crashreportcategory.m_128165_("Item Type", () -> {
|
||||
return String.valueOf((Object)p_281675_.m_41720_());
|
||||
});
|
||||
+ crashreportcategory.setDetail("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(p_281675_.getItem())));
|
||||
crashreportcategory.setDetail("Item Damage", () -> {
|
||||
return String.valueOf(p_281675_.getDamageValue());
|
||||
+ crashreportcategory.m_128165_("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(p_281675_.m_41720_())));
|
||||
crashreportcategory.m_128165_("Item Damage", () -> {
|
||||
return String.valueOf(p_281675_.m_41773_());
|
||||
});
|
||||
@@ -558,18 +_,26 @@
|
||||
@@ -524,18 +_,26 @@
|
||||
}
|
||||
|
||||
this.pose.popPose();
|
||||
this.f_279612_.m_85849_();
|
||||
+ net.minecraftforge.client.ItemDecoratorHandler.of(p_283349_).render(this, p_282005_, p_283349_, p_282641_, p_282146_);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ private ItemStack tooltipStack = ItemStack.EMPTY;
|
||||
+ private ItemStack tooltipStack = ItemStack.f_41583_;
|
||||
|
||||
public void renderTooltip(Font p_282308_, ItemStack p_282781_, int p_282687_, int p_282292_) {
|
||||
public void m_280153_(Font p_282308_, ItemStack p_282781_, int p_282687_, int p_282292_) {
|
||||
+ this.tooltipStack = p_282781_;
|
||||
this.renderTooltip(p_282308_, Screen.getTooltipFromItem(this.minecraft, p_282781_), p_282781_.getTooltipImage(), p_282687_, p_282292_);
|
||||
+ this.tooltipStack = ItemStack.EMPTY;
|
||||
this.m_280677_(p_282308_, Screen.m_280152_(this.f_279544_, p_282781_), p_282781_.m_150921_(), p_282687_, p_282292_);
|
||||
+ this.tooltipStack = ItemStack.f_41583_;
|
||||
+ }
|
||||
+
|
||||
+ public void renderTooltip(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY) {
|
||||
+ this.tooltipStack = stack;
|
||||
+ this.renderTooltip(font, textComponents, tooltipComponent, mouseX, mouseY);
|
||||
+ this.tooltipStack = ItemStack.EMPTY;
|
||||
+ this.m_280677_(font, textComponents, tooltipComponent, mouseX, mouseY);
|
||||
+ this.tooltipStack = ItemStack.f_41583_;
|
||||
}
|
||||
|
||||
public void renderTooltip(Font p_283128_, List<Component> p_282716_, Optional<TooltipComponent> p_281682_, int p_283678_, int p_281696_) {
|
||||
- List<ClientTooltipComponent> list = p_282716_.stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create).collect(Collectors.toList());
|
||||
public void m_280677_(Font p_283128_, List<Component> p_282716_, Optional<TooltipComponent> p_281682_, int p_283678_, int p_281696_) {
|
||||
- List<ClientTooltipComponent> list = p_282716_.stream().map(Component::m_7532_).map(ClientTooltipComponent::m_169948_).collect(Collectors.toList());
|
||||
- p_281682_.ifPresent((p_282969_) -> {
|
||||
- list.add(1, ClientTooltipComponent.create(p_282969_));
|
||||
- list.add(1, ClientTooltipComponent.m_169950_(p_282969_));
|
||||
- });
|
||||
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_282716_, p_281682_, p_283678_, guiWidth(), guiHeight(), p_283128_);
|
||||
this.renderTooltipInternal(p_283128_, list, p_283678_, p_281696_, DefaultTooltipPositioner.INSTANCE);
|
||||
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_282716_, p_281682_, p_283678_, m_280182_(), m_280206_(), p_283128_);
|
||||
this.m_280497_(p_283128_, list, p_283678_, p_281696_, DefaultTooltipPositioner.f_262752_);
|
||||
}
|
||||
|
||||
@@ -578,7 +_,15 @@
|
||||
@@ -544,7 +_,15 @@
|
||||
}
|
||||
|
||||
public void renderComponentTooltip(Font p_282739_, List<Component> p_281832_, int p_282191_, int p_282446_) {
|
||||
- this.renderTooltip(p_282739_, Lists.transform(p_281832_, Component::getVisualOrderText), p_282191_, p_282446_);
|
||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_281832_, p_282191_, guiWidth(), guiHeight(), p_282739_);
|
||||
+ this.renderTooltipInternal(p_282739_, components, p_282191_, p_282446_, DefaultTooltipPositioner.INSTANCE);
|
||||
public void m_280666_(Font p_282739_, List<Component> p_281832_, int p_282191_, int p_282446_) {
|
||||
- this.m_280245_(p_282739_, Lists.transform(p_281832_, Component::m_7532_), p_282191_, p_282446_);
|
||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_281832_, p_282191_, m_280182_(), m_280206_(), p_282739_);
|
||||
+ this.m_280497_(p_282739_, components, p_282191_, p_282446_, DefaultTooltipPositioner.f_262752_);
|
||||
+ }
|
||||
+
|
||||
+ public void renderComponentTooltip(Font font, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, ItemStack stack) {
|
||||
+ this.tooltipStack = stack;
|
||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, guiWidth(), guiHeight(), font);
|
||||
+ this.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE);
|
||||
+ this.tooltipStack = ItemStack.EMPTY;
|
||||
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, m_280182_(), m_280206_(), font);
|
||||
+ this.m_280497_(font, components, mouseX, mouseY, DefaultTooltipPositioner.f_262752_);
|
||||
+ this.tooltipStack = ItemStack.f_41583_;
|
||||
}
|
||||
|
||||
public void renderTooltip(Font p_282192_, List<? extends FormattedCharSequence> p_282297_, int p_281680_, int p_283325_) {
|
||||
@@ -591,11 +_,13 @@
|
||||
public void m_280245_(Font p_282192_, List<? extends FormattedCharSequence> p_282297_, int p_281680_, int p_283325_) {
|
||||
@@ -557,11 +_,13 @@
|
||||
|
||||
private void renderTooltipInternal(Font p_282675_, List<ClientTooltipComponent> p_282615_, int p_283230_, int p_283417_, ClientTooltipPositioner p_282442_) {
|
||||
private void m_280497_(Font p_282675_, List<ClientTooltipComponent> p_282615_, int p_283230_, int p_283417_, ClientTooltipPositioner p_282442_) {
|
||||
if (!p_282615_.isEmpty()) {
|
||||
+ net.minecraftforge.client.event.RenderTooltipEvent.Pre preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(this.tooltipStack, this, p_283230_, p_283417_, guiWidth(), guiHeight(), p_282615_, p_282675_, p_282442_);
|
||||
+ net.minecraftforge.client.event.RenderTooltipEvent.Pre preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(this.tooltipStack, this, p_283230_, p_283417_, m_280182_(), m_280206_(), p_282615_, p_282675_, p_282442_);
|
||||
+ if (preEvent.isCanceled()) return;
|
||||
int i = 0;
|
||||
int j = p_282615_.size() == 1 ? -2 : 0;
|
||||
|
||||
for(ClientTooltipComponent clienttooltipcomponent : p_282615_) {
|
||||
- int k = clienttooltipcomponent.getWidth(p_282675_);
|
||||
+ int k = clienttooltipcomponent.getWidth(preEvent.getFont());
|
||||
- int k = clienttooltipcomponent.m_142069_(p_282675_);
|
||||
+ int k = clienttooltipcomponent.m_142069_(preEvent.getFont());
|
||||
if (k > i) {
|
||||
i = k;
|
||||
}
|
||||
@@ -605,20 +_,21 @@
|
||||
@@ -571,20 +_,21 @@
|
||||
|
||||
int i2 = i;
|
||||
int j2 = j;
|
||||
- Vector2ic vector2ic = p_282442_.positionTooltip(this.guiWidth(), this.guiHeight(), p_283230_, p_283417_, i2, j2);
|
||||
+ Vector2ic vector2ic = p_282442_.positionTooltip(this.guiWidth(), this.guiHeight(), preEvent.getX(), preEvent.getY(), i2, j2);
|
||||
- Vector2ic vector2ic = p_282442_.m_262814_(this.m_280182_(), this.m_280206_(), p_283230_, p_283417_, i2, j2);
|
||||
+ Vector2ic vector2ic = p_282442_.m_262814_(this.m_280182_(), this.m_280206_(), preEvent.getX(), preEvent.getY(), i2, j2);
|
||||
int l = vector2ic.x();
|
||||
int i1 = vector2ic.y();
|
||||
this.pose.pushPose();
|
||||
this.f_279612_.m_85836_();
|
||||
int j1 = 400;
|
||||
this.drawManaged(() -> {
|
||||
- TooltipRenderUtil.renderTooltipBackground(this, l, i1, i2, j2, 400);
|
||||
this.m_286007_(() -> {
|
||||
- TooltipRenderUtil.m_280205_(this, l, i1, i2, j2, 400);
|
||||
+ net.minecraftforge.client.event.RenderTooltipEvent.Color colorEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipColor(this.tooltipStack, this, l, i1, preEvent.getFont(), p_282615_);
|
||||
+ TooltipRenderUtil.renderTooltipBackground(this, l, i1, i2, j2, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd(), colorEvent.getBorderStart(), colorEvent.getBorderEnd());
|
||||
});
|
||||
this.pose.translate(0.0F, 0.0F, 400.0F);
|
||||
this.f_279612_.m_252880_(0.0F, 0.0F, 400.0F);
|
||||
int k1 = i1;
|
||||
|
||||
for(int l1 = 0; l1 < p_282615_.size(); ++l1) {
|
||||
ClientTooltipComponent clienttooltipcomponent1 = p_282615_.get(l1);
|
||||
- clienttooltipcomponent1.renderText(p_282675_, l, k1, this.pose.last().pose(), this.bufferSource);
|
||||
+ clienttooltipcomponent1.renderText(preEvent.getFont(), l, k1, this.pose.last().pose(), this.bufferSource);
|
||||
k1 += clienttooltipcomponent1.getHeight() + (l1 == 0 ? 2 : 0);
|
||||
- clienttooltipcomponent1.m_142440_(p_282675_, l, k1, this.f_279612_.m_85850_().m_252922_(), this.f_279627_);
|
||||
+ clienttooltipcomponent1.m_142440_(preEvent.getFont(), l, k1, this.f_279612_.m_85850_().m_252922_(), this.f_279627_);
|
||||
k1 += clienttooltipcomponent1.m_142103_() + (l1 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -626,7 +_,7 @@
|
||||
@@ -592,7 +_,7 @@
|
||||
|
||||
for(int k2 = 0; k2 < p_282615_.size(); ++k2) {
|
||||
ClientTooltipComponent clienttooltipcomponent2 = p_282615_.get(k2);
|
||||
- clienttooltipcomponent2.renderImage(p_282675_, l, k1, this);
|
||||
+ clienttooltipcomponent2.renderImage(preEvent.getFont(), l, k1, this);
|
||||
k1 += clienttooltipcomponent2.getHeight() + (k2 == 0 ? 2 : 0);
|
||||
- clienttooltipcomponent2.m_183452_(p_282675_, l, k1, this);
|
||||
+ clienttooltipcomponent2.m_183452_(preEvent.getFont(), l, k1, this);
|
||||
k1 += clienttooltipcomponent2.m_142103_() + (k2 == 0 ? 2 : 0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/client/gui/MapRenderer.java
|
||||
+++ b/net/minecraft/client/gui/MapRenderer.java
|
||||
@@ -118,6 +_,7 @@
|
||||
|
||||
for(MapDecoration mapdecoration : this.f_93280_.m_164811_()) {
|
||||
if (!p_93294_ || mapdecoration.m_77809_()) {
|
||||
+ if (mapdecoration.render(k)) { k++; continue; }
|
||||
p_93292_.m_85836_();
|
||||
p_93292_.m_252880_(0.0F + (float)mapdecoration.m_77804_() / 2.0F + 64.0F, 0.0F + (float)mapdecoration.m_77805_() / 2.0F + 64.0F, -0.02F);
|
||||
p_93292_.m_252781_(Axis.f_252403_.m_252977_((float)(mapdecoration.m_77806_() * 360) / 16.0F));
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/client/gui/components/AbstractButton.java
|
||||
+++ b/net/minecraft/client/gui/components/AbstractButton.java
|
||||
@@ -29,7 +_,7 @@
|
||||
@@ -32,7 +_,7 @@
|
||||
RenderSystem.enableDepthTest();
|
||||
p_281670_.blitSprite(SPRITES.get(this.active, this.isHoveredOrFocused()), this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
||||
p_281670_.setColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
- int i = this.active ? 16777215 : 10526880;
|
||||
p_281670_.m_280027_(f_93617_, this.m_252754_(), this.m_252907_(), this.m_5711_(), this.m_93694_(), 20, 4, 200, 20, 0, this.m_274533_());
|
||||
p_281670_.m_280246_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
- int i = this.f_93623_ ? 16777215 : 10526880;
|
||||
+ int i = getFGColor();
|
||||
this.renderString(p_281670_, minecraft.font, i | Mth.ceil(this.alpha * 255.0F) << 24);
|
||||
this.m_280139_(p_281670_, minecraft.f_91062_, i | Mth.m_14167_(this.f_93625_ * 255.0F) << 24);
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/client/gui/components/AbstractSelectionList.java
|
||||
+++ b/net/minecraft/client/gui/components/AbstractSelectionList.java
|
||||
@@ -504,6 +_,13 @@
|
||||
return new ScreenRectangle(this.x0, this.y0, this.x1 - this.x0, this.y1 - this.y0);
|
||||
@@ -514,6 +_,13 @@
|
||||
return new ScreenRectangle(this.f_93393_, this.f_93390_, this.f_93392_ - this.f_93393_, this.f_93391_ - this.f_93390_);
|
||||
}
|
||||
|
||||
+ public int getWidth() { return this.width; }
|
||||
+ public int getHeight() { return this.height; }
|
||||
+ public int getTop() { return this.y0; }
|
||||
+ public int getBottom() { return this.y1; }
|
||||
+ public int getLeft() { return this.x0; }
|
||||
+ public int getRight() { return this.x1; }
|
||||
+ public int getWidth() { return this.f_93388_; }
|
||||
+ public int getHeight() { return this.f_93389_; }
|
||||
+ public int getTop() { return this.f_93390_; }
|
||||
+ public int getBottom() { return this.f_93391_; }
|
||||
+ public int getLeft() { return this.f_93393_; }
|
||||
+ public int getRight() { return this.f_93392_; }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
protected abstract static class Entry<E extends AbstractSelectionList.Entry<E>> implements GuiEventListener {
|
||||
|
||||
@@ -1,22 +1,33 @@
|
||||
--- a/net/minecraft/client/gui/components/AbstractWidget.java
|
||||
+++ b/net/minecraft/client/gui/components/AbstractWidget.java
|
||||
@@ -259,6 +_,19 @@
|
||||
this.focused = p_93693_;
|
||||
@@ -234,6 +_,10 @@
|
||||
this.f_93618_ = p_93675_;
|
||||
}
|
||||
|
||||
+ public void setHeight(int value) {
|
||||
+ this.f_93619_ = value;
|
||||
+ }
|
||||
+
|
||||
public void m_93650_(float p_93651_) {
|
||||
this.f_93625_ = p_93651_;
|
||||
}
|
||||
@@ -264,6 +_,19 @@
|
||||
|
||||
public void m_93692_(boolean p_93693_) {
|
||||
this.f_93616_ = p_93693_;
|
||||
+ }
|
||||
+
|
||||
+ public static final int UNSET_FG_COLOR = -1;
|
||||
+ protected int packedFGColor = UNSET_FG_COLOR;
|
||||
+ public int getFGColor() {
|
||||
+ if (packedFGColor != UNSET_FG_COLOR) return packedFGColor;
|
||||
+ return this.active ? 16777215 : 10526880; // White : Light Grey
|
||||
+ return this.f_93623_ ? 16777215 : 10526880; // White : Light Grey
|
||||
+ }
|
||||
+ public void setFGColor(int color) {
|
||||
+ this.packedFGColor = color;
|
||||
+ }
|
||||
+ public void clearFGColor() {
|
||||
+ this.packedFGColor = UNSET_FG_COLOR;
|
||||
+ }
|
||||
+
|
||||
public NarratableEntry.NarrationPriority narrationPriority() {
|
||||
if (this.isFocused()) {
|
||||
return NarratableEntry.NarrationPriority.FOCUSED;
|
||||
}
|
||||
|
||||
public NarratableEntry.NarrationPriority m_142684_() {
|
||||
@@ -1,20 +1,20 @@
|
||||
--- a/net/minecraft/client/gui/components/BossHealthOverlay.java
|
||||
+++ b/net/minecraft/client/gui/components/BossHealthOverlay.java
|
||||
@@ -36,13 +_,16 @@
|
||||
@@ -33,13 +_,16 @@
|
||||
|
||||
for(LerpingBossEvent lerpingbossevent : this.events.values()) {
|
||||
for(LerpingBossEvent lerpingbossevent : this.f_93699_.values()) {
|
||||
int k = i / 2 - 91;
|
||||
+ var event = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(p_283175_, this.minecraft.getWindow(), lerpingbossevent, k, j, 10 + this.minecraft.font.lineHeight);
|
||||
+ var event = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(p_283175_, this.f_93698_.m_91268_(), lerpingbossevent, k, j, 10 + this.f_93698_.f_91062_.f_92710_);
|
||||
+ if (!event.isCanceled()) {
|
||||
this.drawBar(p_283175_, k, j, lerpingbossevent);
|
||||
Component component = lerpingbossevent.getName();
|
||||
int l = this.minecraft.font.width(component);
|
||||
this.m_280106_(p_283175_, k, j, lerpingbossevent);
|
||||
Component component = lerpingbossevent.m_18861_();
|
||||
int l = this.f_93698_.f_91062_.m_92852_(component);
|
||||
int i1 = i / 2 - l / 2;
|
||||
int j1 = j - 9;
|
||||
p_283175_.drawString(this.minecraft.font, component, i1, j1, 16777215);
|
||||
p_283175_.m_280430_(this.f_93698_.f_91062_, component, i1, j1, 16777215);
|
||||
- j += 10 + 9;
|
||||
+ }
|
||||
+ j += event.getIncrement();
|
||||
if (j >= p_283175_.guiHeight() / 3) {
|
||||
if (j >= p_283175_.m_280206_() / 3) {
|
||||
break;
|
||||
}
|
||||
@@ -1,23 +1,23 @@
|
||||
--- a/net/minecraft/client/gui/components/Button.java
|
||||
+++ b/net/minecraft/client/gui/components/Button.java
|
||||
@@ -29,6 +_,11 @@
|
||||
this.createNarration = p_259552_;
|
||||
this.f_252416_ = p_259552_;
|
||||
}
|
||||
|
||||
+ protected Button(Builder builder) {
|
||||
+ this(builder.x, builder.y, builder.width, builder.height, builder.message, builder.onPress, builder.createNarration);
|
||||
+ setTooltip(builder.tooltip); // Forge: Make use of the Builder tooltip
|
||||
+ this(builder.f_252538_, builder.f_252462_, builder.f_252510_, builder.f_252447_, builder.f_252401_, builder.f_252468_, builder.f_252431_);
|
||||
+ m_257544_(builder.f_256855_); // Forge: Make use of the Builder tooltip
|
||||
+ }
|
||||
+
|
||||
public void onPress() {
|
||||
this.onPress.onPress(this);
|
||||
public void m_5691_() {
|
||||
this.f_93717_.m_93750_(this);
|
||||
}
|
||||
@@ -92,9 +_,11 @@
|
||||
}
|
||||
|
||||
public Button build() {
|
||||
- Button button = new Button(this.x, this.y, this.width, this.height, this.message, this.onPress, this.createNarration);
|
||||
- button.setTooltip(this.tooltip);
|
||||
public Button m_253136_() {
|
||||
- Button button = new Button(this.f_252538_, this.f_252462_, this.f_252510_, this.f_252447_, this.f_252401_, this.f_252468_, this.f_252431_);
|
||||
- button.m_257544_(this.f_256855_);
|
||||
- return button;
|
||||
+ return build(Button::new);
|
||||
+ }
|
||||
|
||||
+3
-85
@@ -1,92 +1,10 @@
|
||||
--- a/net/minecraft/client/gui/components/DebugScreenOverlay.java
|
||||
+++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java
|
||||
@@ -93,9 +_,9 @@
|
||||
@Nullable
|
||||
private CompletableFuture<LevelChunk> serverChunk;
|
||||
private boolean renderDebug;
|
||||
- private boolean renderProfilerChart;
|
||||
- private boolean renderFpsCharts;
|
||||
- private boolean renderNetworkCharts;
|
||||
+ protected boolean renderProfilerChart;
|
||||
+ protected boolean renderFpsCharts;
|
||||
+ protected boolean renderNetworkCharts;
|
||||
private final SampleLogger frameTimeLogger = new SampleLogger();
|
||||
private final SampleLogger tickTimeLogger = new SampleLogger();
|
||||
private final SampleLogger pingLogger = new SampleLogger();
|
||||
@@ -120,14 +_,18 @@
|
||||
this.clientChunk = null;
|
||||
}
|
||||
|
||||
- public void render(GuiGraphics p_281427_) {
|
||||
- this.minecraft.getProfiler().push("debug");
|
||||
+ protected void update() {
|
||||
Entity entity = this.minecraft.getCameraEntity();
|
||||
this.block = entity.pick(20.0D, 0.0F, false);
|
||||
this.liquid = entity.pick(20.0D, 0.0F, true);
|
||||
- p_281427_.drawManaged(() -> {
|
||||
- this.drawGameInformation(p_281427_);
|
||||
- this.drawSystemInformation(p_281427_);
|
||||
+ }
|
||||
+
|
||||
+ protected void drawText(GuiGraphics p_281427_) {
|
||||
+ this.drawGameInformation(p_281427_);
|
||||
+ this.drawSystemInformation(p_281427_);
|
||||
+ }
|
||||
+
|
||||
+ protected void drawFPSCharts(GuiGraphics p_281427_) {
|
||||
if (this.renderFpsCharts) {
|
||||
int i = p_281427_.guiWidth();
|
||||
int j = i / 2;
|
||||
@@ -137,7 +_,9 @@
|
||||
this.tpsChart.drawChart(p_281427_, i - k, k);
|
||||
}
|
||||
}
|
||||
+ }
|
||||
|
||||
+ protected void drawNetworkCharts(GuiGraphics p_281427_) {
|
||||
if (this.renderNetworkCharts) {
|
||||
int l = p_281427_.guiWidth();
|
||||
int i1 = l / 2;
|
||||
@@ -148,17 +_,32 @@
|
||||
int j1 = this.pingChart.getWidth(i1);
|
||||
this.pingChart.drawChart(p_281427_, l - j1, j1);
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ public void render(GuiGraphics p_281427_) {
|
||||
+ this.minecraft.getProfiler().push("debug");
|
||||
+ this.update();
|
||||
+ p_281427_.drawManaged(() -> {
|
||||
+ this.drawText(p_281427_);
|
||||
+ this.drawFPSCharts(p_281427_);
|
||||
+ this.drawNetworkCharts(p_281427_);
|
||||
|
||||
});
|
||||
this.minecraft.getProfiler().pop();
|
||||
}
|
||||
|
||||
- protected void drawGameInformation(GuiGraphics p_281525_) {
|
||||
- List<String> list = this.getGameInformation();
|
||||
+ protected List<String> getOverlayHelp() {
|
||||
+ List<String> list = Lists.newArrayList();
|
||||
list.add("");
|
||||
boolean flag = this.minecraft.getSingleplayerServer() != null;
|
||||
list.add("Debug charts: [F3+1] Profiler " + (this.renderProfilerChart ? "visible" : "hidden") + "; [F3+2] " + (flag ? "FPS + TPS " : "FPS ") + (this.renderFpsCharts ? "visible" : "hidden") + "; [F3+3] " + (!this.minecraft.isLocalServer() ? "Bandwidth + Ping" : "Ping") + (this.renderNetworkCharts ? " visible" : " hidden"));
|
||||
list.add("For help: press F3 + Q");
|
||||
+ return list;
|
||||
+ }
|
||||
+
|
||||
+ protected void drawGameInformation(GuiGraphics p_281525_) {
|
||||
+ List<String> list = this.getGameInformation();
|
||||
+ list.addAll(this.getOverlayHelp());
|
||||
this.renderLines(p_281525_, list, true);
|
||||
}
|
||||
|
||||
@@ -430,6 +_,7 @@
|
||||
@@ -403,6 +_,7 @@
|
||||
list.add("");
|
||||
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
|
||||
list.add(String.valueOf((Object)BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType())));
|
||||
+ entity.getType().builtInRegistryHolder().tags().forEach(t -> list.add("#" + t.location()));
|
||||
list.add(String.valueOf((Object)BuiltInRegistries.f_256780_.m_7981_(entity.m_6095_())));
|
||||
+ entity.m_6095_().m_204041_().m_203616_().forEach(t -> list.add("#" + t.f_203868_()));
|
||||
}
|
||||
|
||||
return list;
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
@@ -101,6 +_,7 @@
|
||||
}
|
||||
|
||||
public void addToast(Toast p_94923_) {
|
||||
public void m_94922_(Toast p_94923_) {
|
||||
+ if (net.minecraftforge.client.ForgeHooksClient.onToastAdd(p_94923_)) return;
|
||||
this.queued.add(p_94923_);
|
||||
this.f_94916_.add(p_94923_);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/client/gui/screens/ChatScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/ChatScreen.java
|
||||
@@ -225,7 +_,7 @@
|
||||
this.minecraft.player.connection.sendChat(p_242400_);
|
||||
this.f_96541_.f_91074_.f_108617_.m_246175_(p_242400_);
|
||||
}
|
||||
|
||||
- return true;
|
||||
+ return minecraft.screen == this; // FORGE: Prevent closing the screen if another screen has been opened.
|
||||
+ return f_96541_.f_91080_ == this; // FORGE: Prevent closing the screen if another screen has been opened.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/client/gui/screens/ConnectScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/ConnectScreen.java
|
||||
@@ -84,6 +_,8 @@
|
||||
@@ -86,6 +_,8 @@
|
||||
}
|
||||
|
||||
if (optional.isEmpty()) {
|
||||
+ ConnectScreen.LOGGER.error("Couldn't connect to server: Unknown host \"{}\"", p_249536_.getHost());
|
||||
if (!optional.isPresent()) {
|
||||
+ ConnectScreen.f_95683_.error("Couldn't connect to server: Unknown host \"{}\"", p_249536_.m_171863_());
|
||||
+ net.minecraftforge.network.DualStackUtils.logInitialPreferences();
|
||||
p_251955_.execute(() -> {
|
||||
p_251955_.setScreen(new DisconnectedScreen(ConnectScreen.this.parent, ConnectScreen.this.connectFailedTitle, ConnectScreen.UNKNOWN_HOST_MESSAGE));
|
||||
p_251955_.m_91152_(new DisconnectedScreen(ConnectScreen.this.f_95686_, ConnectScreen.this.f_278471_, ConnectScreen.f_169260_));
|
||||
});
|
||||
@@ -3,16 +3,16 @@
|
||||
@@ -132,6 +_,7 @@
|
||||
}
|
||||
|
||||
if (this.fadeOutStart == -1L && this.reload.isDone() && (!this.fadeIn || f1 >= 2.0F)) {
|
||||
+ this.fadeOutStart = Util.getMillis(); // Moved up to guard against inf loops caused by callback
|
||||
if (this.f_96168_ == -1L && this.f_96164_.m_7746_() && (!this.f_96166_ || f1 >= 2.0F)) {
|
||||
+ this.f_96168_ = Util.m_137550_(); // Moved up to guard against inf loops caused by callback
|
||||
try {
|
||||
this.reload.checkExceptions();
|
||||
this.onFinish.accept(Optional.empty());
|
||||
this.f_96164_.m_7748_();
|
||||
this.f_96165_.accept(Optional.empty());
|
||||
@@ -139,7 +_,6 @@
|
||||
this.onFinish.accept(Optional.of(throwable));
|
||||
this.f_96165_.accept(Optional.of(throwable));
|
||||
}
|
||||
|
||||
- this.fadeOutStart = Util.getMillis();
|
||||
if (this.minecraft.screen != null) {
|
||||
this.minecraft.screen.init(this.minecraft, p_281839_.guiWidth(), p_281839_.guiHeight());
|
||||
- this.f_96168_ = Util.m_137550_();
|
||||
if (this.f_96163_.f_91080_ != null) {
|
||||
this.f_96163_.f_91080_.m_6575_(this.f_96163_, p_281839_.m_280182_(), p_281839_.m_280206_());
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
--- a/net/minecraft/client/gui/screens/MenuScreens.java
|
||||
+++ b/net/minecraft/client/gui/screens/MenuScreens.java
|
||||
@@ -40,6 +_,10 @@
|
||||
private static final Map<MenuType<?>, MenuScreens.ScreenConstructor<?, ?>> SCREENS = Maps.newHashMap();
|
||||
private static final Map<MenuType<?>, MenuScreens.ScreenConstructor<?, ?>> f_96196_ = Maps.newHashMap();
|
||||
|
||||
public static <T extends AbstractContainerMenu> void create(@Nullable MenuType<T> p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) {
|
||||
+ getScreenFactory(p_96202_, p_96203_, p_96204_, p_96205_).ifPresent(f -> f.fromPacket(p_96205_, p_96202_, p_96203_, p_96204_));
|
||||
public static <T extends AbstractContainerMenu> void m_96201_(@Nullable MenuType<T> p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) {
|
||||
+ getScreenFactory(p_96202_, p_96203_, p_96204_, p_96205_).ifPresent(f -> f.m_96209_(p_96205_, p_96202_, p_96203_, p_96204_));
|
||||
+ }
|
||||
+
|
||||
+ public static <T extends AbstractContainerMenu> java.util.Optional<ScreenConstructor<T, ?>> getScreenFactory(@Nullable MenuType<T> p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) {
|
||||
if (p_96202_ == null) {
|
||||
LOGGER.warn("Trying to open invalid screen with name: {}", (Object)p_96205_.getString());
|
||||
f_96195_.warn("Trying to open invalid screen with name: {}", (Object)p_96205_.getString());
|
||||
} else {
|
||||
@@ -47,9 +_,10 @@
|
||||
if (screenconstructor == null) {
|
||||
LOGGER.warn("Failed to create screen for menu type: {}", (Object)BuiltInRegistries.MENU.getKey(p_96202_));
|
||||
f_96195_.warn("Failed to create screen for menu type: {}", (Object)BuiltInRegistries.f_256818_.m_7981_(p_96202_));
|
||||
} else {
|
||||
- screenconstructor.fromPacket(p_96205_, p_96202_, p_96203_, p_96204_);
|
||||
- screenconstructor.m_96209_(p_96205_, p_96202_, p_96203_, p_96204_);
|
||||
+ return java.util.Optional.of(screenconstructor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
--- a/net/minecraft/client/gui/screens/OptionsScreen.java
|
||||
+++ b/net/minecraft/client/gui/screens/OptionsScreen.java
|
||||
@@ -150,6 +_,14 @@
|
||||
p_283520_.drawCenteredString(this.font, this.title, this.width / 2, 15, 16777215);
|
||||
@@ -151,6 +_,14 @@
|
||||
super.m_88315_(p_283520_, p_281826_, p_283378_, p_281975_);
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public void onClose() {
|
||||
+ public void m_7379_() {
|
||||
+ // We need to consider 2 potential parent screens here:
|
||||
+ // 1. From the main menu, in which case display the main menu
|
||||
+ // 2. From the pause menu, in which case exit back to game
|
||||
+ this.minecraft.setScreen(this.lastScreen instanceof PauseScreen ? null : this.lastScreen);
|
||||
+ this.f_96541_.m_91152_(this.f_96235_ instanceof PauseScreen ? null : this.f_96235_);
|
||||
+ }
|
||||
+
|
||||
private Button openScreenButton(Component p_261565_, Supplier<Screen> p_262119_) {
|
||||
return Button.builder(p_261565_, (p_280808_) -> {
|
||||
this.minecraft.setScreen(p_262119_.get());
|
||||
private Button m_260993_(Component p_261565_, Supplier<Screen> p_262119_) {
|
||||
return Button.m_253074_(p_261565_, (p_280808_) -> {
|
||||
this.f_96541_.m_91152_(p_262119_.get());
|
||||
Loaded 100 of 1556 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user