Compare commits

...
13 Commits
Author SHA1 Message Date
LexManos 516b35ce57 1.20.2 Release 2023-09-21 11:28:37 -07:00
LexManos be60ddbfca Enable ForgeLootTableProvider. 2023-09-20 17:46:22 -07:00
LexManos af6e848227 Global Loot Modifiers 2023-09-20 15:24:46 -07:00
LexManos dd139115ed Move old tests. 2023-09-20 15:24:15 -07:00
LexManos 145df60bec 1.20.2-rc2 2023-09-18 10:53:24 -07:00
LexManos f7cca8fb88 1.20.2-rc1 2023-09-15 12:51:23 -07:00
LexManos 1f59b3f9fe 1.20.2-pre4 2023-09-13 15:15:42 -07:00
LexManos 084effdadf 1.20.2-pre3 2023-09-12 12:34:59 -07:00
LexManos 40a7998281 Use official mappings for in-repo patches, will be converted to SRG during build. 2023-09-11 14:47:34 -07:00
LexManos 4786fa6f89 1.20.2-pre2 2023-09-11 12:47:19 -07:00
LexManos 9291b865c7 Fix debug overlay text not rendering. 2023-09-11 11:36:45 -07:00
LexManos 52eca96fdc Make SimpleChannel use a varInt for the discriminator allowing essentially unlimited packets. 2023-09-10 20:56:04 -07:00
LexManos 4649f7af36 Rewrite networking. 2023-09-10 20:27:15 -07:00
1438 changed files with 15557 additions and 22094 deletions

No files matched your search

+3
View File
@@ -21,3 +21,6 @@ src/generated/**/*.json text eol=lf
src/generated_test/**/.cache/cache text eol=lf src/generated_test/**/.cache/cache text eol=lf
src/generated_test/**/*.json text eol=lf src/generated_test/**/*.json text eol=lf
# We force eclipse to use unix line endings
ide/eclipse/template/.settings/*.prefs text eol=lf
+3
View File
@@ -13,6 +13,9 @@
/classes /classes
*.iml *.iml
# We however WANT the ide folder as it has tempaltes/configs for developing Forge.
!ide/**
#gradle #gradle
/build /build
/.gradle /.gradle
-15
View File
@@ -47,8 +47,6 @@ project {
""".trimIndent(), label = "The branch specification of the repository", description = "By default all main branches are build by the configuration. Modify this value to adapt the branches build.", display = ParameterDisplay.HIDDEN, allowEmpty = true) """.trimIndent(), label = "The branch specification of the repository", description = "By default all main branches are build by the configuration. Modify this value to adapt the branches build.", display = ParameterDisplay.HIDDEN, allowEmpty = true)
text("github_repository_name", "MinecraftForge", label = "The github repository name. Used to connect to it in VCS Roots.", description = "This is the repository slug on github. So for example `MinecraftForge` or `MinecraftForge`. It is interpolated into the global VCS Roots.", display = ParameterDisplay.HIDDEN, allowEmpty = false) text("github_repository_name", "MinecraftForge", label = "The github repository name. Used to connect to it in VCS Roots.", description = "This is the repository slug on github. So for example `MinecraftForge` or `MinecraftForge`. It is interpolated into the global VCS Roots.", display = ParameterDisplay.HIDDEN, allowEmpty = false)
text("env.PUBLISHED_JAVA_ARTIFACT_ID", "forge", label = "Published artifact id", description = "The maven coordinate artifact id that has been published by this build. Can not be empty.", allowEmpty = false) text("env.PUBLISHED_JAVA_ARTIFACT_ID", "forge", label = "Published artifact id", description = "The maven coordinate artifact id that has been published by this build. Can not be empty.", allowEmpty = false)
text("env.PUBLISHED_JAVA_FML_ARTIFACT_ID", "fmlonly", label = "Published fmlonly artifact id", description = "The maven coordinate artifact id for fml only that has been published by this build. Can not be empty.", allowEmpty = false)
text("env.PUBLISHED_JAVA_FML_ARTIFACT_VERSION", "0.0.0-SNAPSHOT", label = "Published fmlonly artifact version", description = "The version for fml only that has been published by this build. Can not be empty.", allowEmpty = false)
text("env.PUBLISHED_JAVA_GROUP", "net.minecraftforge", label = "Published group", description = "The maven coordinate group that has been published by this build. Can not be empty.", allowEmpty = false) text("env.PUBLISHED_JAVA_GROUP", "net.minecraftforge", label = "Published group", description = "The maven coordinate group that has been published by this build. Can not be empty.", allowEmpty = false)
//These are references and not actually keys //These are references and not actually keys
password("env.CROWDIN_KEY", "credentialsJSON:a3102dbe-805d-4177-9f54-3d2c2eb08fd5", display = ParameterDisplay.HIDDEN) password("env.CROWDIN_KEY", "credentialsJSON:a3102dbe-805d-4177-9f54-3d2c2eb08fd5", display = ParameterDisplay.HIDDEN)
@@ -76,19 +74,6 @@ object Build : BuildType({
id("MinecraftForge_MinecraftForge__Build") id("MinecraftForge_MinecraftForge__Build")
name = "Build" name = "Build"
description = "Builds and Publishes the main branches of the project." description = "Builds and Publishes the main branches of the project."
features {
feature {
id = "trigger_fml_only_files_generator"
type = "triggerBuildFeature"
param("triggers", "MinecraftForge_FilesGenerator_GeneratePages")
param("parameters", """
env.PUBLISHED_JAVA_FML_ARTIFACT_ID~env.PUBLISHED_JAVA_ARTIFACT_ID
env.PUBLISHED_JAVA_FML_ARTIFACT_VERSION~env.PUBLISHED_JAVA_ARTIFACT_VERSION
env.PUBLISHED_JAVA_GROUP
""".trimIndent())
}
}
}) })
object BuildSecondaryBranches : BuildType({ object BuildSecondaryBranches : BuildType({
+81 -27
View File
@@ -16,6 +16,7 @@ import net.minecraftforge.gradle.common.tasks.CheckJarCompatibility
import net.minecraftforge.gradle.common.tasks.DownloadMavenArtifact import net.minecraftforge.gradle.common.tasks.DownloadMavenArtifact
import net.minecraftforge.gradle.common.tasks.ExtractInheritance import net.minecraftforge.gradle.common.tasks.ExtractInheritance
import net.minecraftforge.gradle.common.tasks.SignJar import net.minecraftforge.gradle.common.tasks.SignJar
import net.minecraftforge.gradle.patcher.tasks.GeneratePatches
import net.minecraftforge.gradle.userdev.tasks.RenameJar import net.minecraftforge.gradle.userdev.tasks.RenameJar
import org.apache.tools.ant.filters.ReplaceTokens import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.plugins.ide.eclipse.model.SourceFolder import org.gradle.plugins.ide.eclipse.model.SourceFolder
@@ -27,8 +28,8 @@ plugins {
id 'net.minecraftforge.gradleutils' version '2.+' id 'net.minecraftforge.gradleutils' version '2.+'
id 'eclipse' id 'eclipse'
id 'de.undercouch.download' version '5.4.0' id 'de.undercouch.download' version '5.4.0'
id 'net.minecraftforge.gradle.patcher' version '[6.0.11,6.2)' apply false id 'net.minecraftforge.gradle.patcher' version '[6.0.13,6.2)' apply false
id 'net.minecraftforge.gradle.mcp' version '[6.0.11,6.2)' apply false id 'net.minecraftforge.gradle.mcp' version '[6.0.13,6.2)' apply false
} }
Util.init() //Init all our extension methods! Util.init() //Init all our extension methods!
@@ -43,10 +44,10 @@ ext {
] ]
} }
MAPPING_CHANNEL = 'official' MAPPING_CHANNEL = 'official'
MC_VERSION = '1.20.2-pre1' MC_VERSION = '1.20.2'
MAPPING_VERSION = MC_VERSION MAPPING_VERSION = MC_VERSION
MC_NEXT_VERSION = '1.21' MC_NEXT_VERSION = '1.21'
MCP_VERSION = '20230906.154413' MCP_VERSION = '20230921.100330'
SNAPSHOT = false SNAPSHOT = false
SPI_VERSION = '7.0.1' SPI_VERSION = '7.0.1'
@@ -87,7 +88,7 @@ ext {
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0' INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0'
JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4' JAR_SPLITTER = 'net.minecraftforge:jarsplitter:1.1.4'
FART = 'net.minecraftforge:ForgeAutoRenamingTool:1.0.5:all' FART = 'net.minecraftforge:ForgeAutoRenamingTool:1.0.5:all'
MIN_TAG_FOR_CHANGELOG = '41.0' MIN_TAG_FOR_CHANGELOG = '47.999'
} }
println('Version: ' + VERSION + println('Version: ' + VERSION +
@@ -165,9 +166,9 @@ subprojects {
tasks.withType(Javadoc).configureEach { tasks.withType(Javadoc).configureEach {
options.tags = [ options.tags = [
'apiNote:a:<em>API Note:</em>', 'apiNote:a:<em>API Note:</em>',
'implSpec:a:<em>Implementation Requirements:</em>', 'implSpec:a:<em>Implementation Requirements:</em>',
'implNote:a:<em>Implementation Note:</em>' 'implNote:a:<em>Implementation Note:</em>'
] ]
options.addStringOption('Xdoclint:all,-missing', '-public') options.addStringOption('Xdoclint:all,-missing', '-public')
} }
@@ -248,7 +249,7 @@ project(':clean') {
ideaModule "${rootProject.name}.${project.name}.main" ideaModule "${rootProject.name}.${project.name}.main"
main 'net.minecraft.client.main.Main' main 'net.minecraft.client.main.Main'
workingDirectory project.file('run') workingDirectory project.file('run/client')
args '--gameDir', '.' args '--gameDir', '.'
args '--version', MC_VERSION args '--version', MC_VERSION
@@ -263,10 +264,15 @@ project(':clean') {
ideaModule "${rootProject.name}.${project.name}.main" ideaModule "${rootProject.name}.${project.name}.main"
main 'net.minecraft.server.Main' main 'net.minecraft.server.Main'
workingDirectory project.file('run') workingDirectory project.file('run/server')
} }
} }
} }
eclipse.classpath.file.whenMerged {
// Disable optional warnings on the minecraft decompiled source code. It just muddies the warning window and hides warnings in our own codebase
def src = entries.find { it.path == 'src/main/java' }
src.entryAttributes['ignore_optional_problems'] = 'true'
}
} }
def sharedDeps = { def sharedDeps = {
@@ -476,7 +482,6 @@ def sharedFmlonlyForge = { Project prj ->
} }
for (def run : prj.patcher.runs) { for (def run : prj.patcher.runs) {
if (run.parents) continue // We already added this to the parent run config if (run.parents) continue // We already added this to the parent run config
run.workingDirectory prj.file('run')
if (run.name.contains('client') || run.name.contains('data')) { if (run.name.contains('client') || run.name.contains('data')) {
// Natives are loaded from the classpath now in all cases // Natives are loaded from the classpath now in all cases
@@ -603,8 +608,12 @@ project(':forge') {
} }
} }
} }
//Eclipse adds the sourcesets twice, once where we tell it to, once in the projects folder. No idea why. So delete them
eclipse.classpath.file.whenMerged { cls -> cls.entries.removeIf { e -> e instanceof SourceFolder && e.path.startsWith('src/') && !e.path.startsWith('src/main/') } } eclipse.classpath.file.whenMerged {
// Disable optional warnings on the minecraft decompiled source code. It just muddies the warning window and hides warnings in our own codebase
def src = entries.find { it.path == 'src/main/java' }
src.entryAttributes['ignore_optional_problems'] = 'true'
}
ext { ext {
SPEC_VERSION = gradleutils.gitInfo.tag SPEC_VERSION = gradleutils.gitInfo.tag
@@ -646,12 +655,13 @@ project(':forge') {
parent = project(':clean') parent = project(':clean')
patches = file("$rootDir/patches/minecraft") patches = file("$rootDir/patches/minecraft")
patchedSrc = file('src/main/java') patchedSrc = file('src/main/java')
srgPatches = true srgPatches = false
accessTransformers.from file("$rootDir/src/main/resources/META-INF/accesstransformer.cfg") accessTransformers.from file("$rootDir/src/main/resources/META-INF/accesstransformer.cfg")
sideAnnotationStrippers.from file("$rootDir/src/main/resources/forge.sas") sideAnnotationStrippers.from file("$rootDir/src/main/resources/forge.sas")
runs { runs {
forge_client { forge_client {
workingDirectory file('run/client')
property 'eventbus.checkTypesOnDispatch', 'true' property 'eventbus.checkTypesOnDispatch', 'true'
args '--launchTarget', 'forgeclientdev' args '--launchTarget', 'forgeclientdev'
ideaModule "${rootProject.name}.${project.name}.main" ideaModule "${rootProject.name}.${project.name}.main"
@@ -661,6 +671,7 @@ project(':forge') {
} }
forge_test_client { forge_test_client {
workingDirectory file('run/client_test')
parent runs.forge_client parent runs.forge_client
taskName 'forge_test_client' taskName 'forge_test_client'
@@ -675,6 +686,7 @@ project(':forge') {
} }
forge_server { forge_server {
workingDirectory file('run/server')
args '--launchTarget', 'forgeserverdev' args '--launchTarget', 'forgeserverdev'
ideaModule "${rootProject.name}.${project.name}.main" ideaModule "${rootProject.name}.${project.name}.main"
@@ -684,6 +696,7 @@ project(':forge') {
} }
forge_test_server { forge_test_server {
workingDirectory file('run/server_test')
parent runs.forge_server parent runs.forge_server
taskName 'forge_test_server' taskName 'forge_test_server'
@@ -756,19 +769,20 @@ project(':forge') {
} }
args '--flat', '--all', '--validate', args '--flat', '--all', '--validate',
'--mod', 'data_gen_test', '--mod', 'empty',
'--mod', 'piston_event_test', //'--mod', 'data_gen_test',
//'--mod', 'piston_event_test',
'--mod', 'global_loot_test', '--mod', 'global_loot_test',
'--mod', 'scaffolding_test', //'--mod', 'scaffolding_test',
'--mod', 'custom_tag_types_test', //'--mod', 'custom_tag_types_test',
'--mod', 'new_model_loader_test', //'--mod', 'new_model_loader_test',
'--mod', 'remove_tag_datagen_test', //'--mod', 'remove_tag_datagen_test',
'--mod', 'tag_based_tool_types', //'--mod', 'tag_based_tool_types',
'--mod', 'custom_transformtype_test', //'--mod', 'custom_transformtype_test',
'--mod', 'data_pack_registries_test', //'--mod', 'data_pack_registries_test',
'--mod', 'biome_modifiers_test', //'--mod', 'biome_modifiers_test',
'--mod', 'structure_modifiers_test', //'--mod', 'structure_modifiers_test',
'--mod', 'custom_preset_editor_test', //'--mod', 'custom_preset_editor_test',
'--output', rootProject.file('src/generated_test/resources/'), '--output', rootProject.file('src/generated_test/resources/'),
'--existing', sourceSets.main.resources.srcDirs[0], '--existing', sourceSets.main.resources.srcDirs[0],
'--existing', sourceSets.test.resources.srcDirs[0] '--existing', sourceSets.test.resources.srcDirs[0]
@@ -802,6 +816,33 @@ project(':forge') {
} }
} }
} }
afterEvaluate {
if (!patcher.srgPatches) {
srg2mcpClean {
dependsOn = []
input = project(':mcp').setupMCP.output
}
userdevJar {
onlyIf = { t -> true }
}
def patches = project.file('build/genPatchesForUserdev/output/')
patches.mkdirs()
def genPatchesForUserdev = tasks.register('genPatchesForUserdev', GeneratePatches){
base = project(':mcp').setupMCP.output
modified = applyRangeMapBase.output
originalPrefix = genPatches.originalPrefix
modifiedPrefix = genPatches.modifiedPrefix
output = patches
autoHeader true
lineEnding = '\n'
}
bakePatches {
dependsOn = []
input = genPatchesForUserdev.get().output
}
}
}
ext { ext {
MANIFESTS = [ MANIFESTS = [
@@ -1208,7 +1249,7 @@ project(':forge') {
], [ ], [
sides: ['client'], sides: ['client'],
jar: JAR_SPLITTER, jar: JAR_SPLITTER,
classpath: JAR_SPLITER_CLASSPATH, classpath: JAR_SPLITTER_CLASSPATH,
args: [ args: [
'--input', '{MINECRAFT_JAR}', '--input', '{MINECRAFT_JAR}',
'--slim', '{MC_SLIM}', '--slim', '{MC_SLIM}',
@@ -1486,3 +1527,16 @@ if (System.env.TEAMCITY_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)
}
}
}
@@ -0,0 +1,92 @@
package net.minecraftforge.forge.tasks;
import java.util.Properties;
import java.util.Enumeration;
import java.util.Map;
import java.util.TreeSet;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.Reader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Set;
/**
* Eclipse config files are literally just java properties, with the header cleaned up.
* https://github.com/eclipse/buildship/blob/5b2c7fca7fa86cd74d71b3c099c7b1559eba038e/org.eclipse.buildship.core/src/main/java/org/eclipse/buildship/core/internal/configuration/PreferenceStore.java#L238
*
* This does the same thing, as well as sorting alphabetically.
* It also ignores all comments. We can add them latter if someone cares.
*/
public class CleanProperties extends Properties {
private static final long serialVersionUID = 1L;
private static final String LINE_SEP = System.getProperty("line.separator");
private static final String UNIX_LINE_SEP = "\n";
private static final Charset ENCODING = StandardCharsets.UTF_8;
public CleanProperties load(File input) throws IOException {
if (input.exists()) {
try (Reader is = new InputStreamReader(new FileInputStream(input), ENCODING)) {
super.load(is);
}
}
return this;
}
public void store(File out) throws IOException {
if (!out.getParentFile().exists())
out.getParentFile().mkdirs();
try (OutputStream os = new FileOutputStream(out)) {
store(os, null);
}
}
@Override
public synchronized Enumeration<Object> keys() {
Set<Object> ret = new TreeSet<>();
for (Enumeration<?> e = super.keys(); e.hasMoreElements();)
ret.add(e.nextElement());
return Collections.enumeration(ret);
}
@Override
public Set<Map.Entry<Object, Object>> entrySet() {
Set<Map.Entry<Object, Object>> ret = new TreeSet<>((l, r) -> ((String)l.getKey()).compareTo((String)r.getKey()));
ret.addAll(super.entrySet());
return ret;
}
@Override
public void store(OutputStream out, String comments) throws IOException {
out.write(clean().getBytes(ENCODING));
out.flush();
}
@Override
public void store(Writer out, String comments) throws IOException {
out.write(clean());
out.flush();
}
private String clean() throws IOException {
ByteArrayOutputStream tmp = new ByteArrayOutputStream();
try {
super.store(tmp, null);
} finally {
tmp.close();
}
String ret = tmp.toString(ENCODING).replace(LINE_SEP, UNIX_LINE_SEP);
ret = ret.substring(ret.indexOf(UNIX_LINE_SEP) + 1);
return ret;
}
}
+2 -3
View File
@@ -2,10 +2,9 @@ plugins {
id 'com.github.ben-manes.versions' id 'com.github.ben-manes.versions'
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
id 'org.cadixdev.licenser' id 'org.cadixdev.licenser'
id 'java-library'
id 'jacoco'
} }
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'org.javamodularity.moduleplugin'
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
@@ -25,6 +25,7 @@ import java.util.function.Supplier;
* @param <T> the type of the record which is held by the extension point * @param <T> the type of the record which is held by the extension point
*/ */
@SuppressWarnings("unused") // Type parameter T @SuppressWarnings("unused") // Type parameter T
// TODO: Complete re-write, this hasnt actually be used in a generic way by mods and we could make it a lot simpler.
public interface IExtensionPoint<T extends Record> public interface IExtensionPoint<T extends Record>
{ {
/** /**
@@ -40,7 +41,7 @@ public interface IExtensionPoint<T extends Record>
* where {@code true} means it is from the server and {@code false} means it is from the world save. The return * where {@code true} means it is from the server and {@code false} means it is from the world save. The return
* value of the predicate determines whether the remote version is "compatible" for the purposes of the display test.</p> * value of the predicate determines whether the remote version is "compatible" for the purposes of the display test.</p>
* *
* <p>The local compatibility version may be of the value {@link net.minecraftforge.network.NetworkConstants#IGNORESERVERONLY}, * <p>The local compatibility version may be of the value {@link DisplayTest#IGNORESERVERONLY},
* in which case clients will ignore the mod's presence if it is present on the server but not on the client. * in which case clients will ignore the mod's presence if it is present on the server but not on the client.
* However, the remote version test predicate must still accept this value as a remote version in order to display * However, the remote version test predicate must still accept this value as a remote version in order to display
* as compatible if the mod is present on the client.</p> * as compatible if the mod is present on the client.</p>
@@ -94,6 +95,6 @@ public interface IExtensionPoint<T extends Record>
*/ */
@SuppressWarnings("JavadocReference") // reference to NetworkConstants, ForgeHooksClient @SuppressWarnings("JavadocReference") // reference to NetworkConstants, ForgeHooksClient
record DisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) implements IExtensionPoint<DisplayTest> { record DisplayTest(Supplier<String> suppliedVersion, BiPredicate<String, Boolean> remoteVersionTest) implements IExtensionPoint<DisplayTest> {
public static final String IGNORESERVERONLY = "OHNOES\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31"; public static final String IGNORESERVERONLY = "SERVER_ONLY";
} }
} }
+2 -3
View File
@@ -2,10 +2,9 @@ plugins {
id 'com.github.ben-manes.versions' id 'com.github.ben-manes.versions'
id 'org.javamodularity.moduleplugin' version '1.8.7' apply false id 'org.javamodularity.moduleplugin' version '1.8.7' apply false
id 'org.cadixdev.licenser' id 'org.cadixdev.licenser'
id 'java-library'
id 'jacoco'
} }
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'org.javamodularity.moduleplugin'
import org.gradle.internal.os.OperatingSystem import org.gradle.internal.os.OperatingSystem
+2 -3
View File
@@ -2,10 +2,9 @@ plugins {
id 'com.github.ben-manes.versions' id 'com.github.ben-manes.versions'
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
id 'org.cadixdev.licenser' id 'org.cadixdev.licenser'
id 'java-library'
id 'jacoco'
} }
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'org.javamodularity.moduleplugin'
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
configurations.forEach{ it.transitive = false } configurations.forEach{ it.transitive = false }
@@ -0,0 +1,19 @@
activeContentFilterList=*.makefile,makefile,*.Makefile,Makefile,Makefile.*,*.mk,MANIFEST.MF,.project,*.yml
addNewLine=true
convertActionOnSaave=AnyEdit.CnvrtTabToSpaces
eclipse.preferences.version=1
encoding/<project>=UTF-8
fixLineDelimiters=false
ignoreBlankLinesWhenTrimming=false
inActiveContentFilterList=
javaTabWidthForJava=true
org.eclipse.jdt.ui.editor.tab.width=2
projectPropsEnabled=true
removeTrailingSpaces=true
replaceAllSpaces=false
replaceAllTabs=false
saveAndAddLine=false
saveAndConvert=true
saveAndFixLineDelimiters=false
saveAndTrim=true
useModulo4Tabs=false
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
line.separator=\n
+2 -3
View File
@@ -2,10 +2,9 @@ plugins {
id 'com.github.ben-manes.versions' id 'com.github.ben-manes.versions'
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
id 'org.cadixdev.licenser' id 'org.cadixdev.licenser'
id 'java-library'
id 'jacoco'
} }
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'org.javamodularity.moduleplugin'
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
+2 -3
View File
@@ -2,10 +2,9 @@ plugins {
id 'com.github.ben-manes.versions' id 'com.github.ben-manes.versions'
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
id 'org.cadixdev.licenser' id 'org.cadixdev.licenser'
id 'java-library'
id 'jacoco'
} }
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'org.javamodularity.moduleplugin'
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
+2 -3
View File
@@ -2,10 +2,9 @@ plugins {
id 'com.github.ben-manes.versions' id 'com.github.ben-manes.versions'
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
id 'org.cadixdev.licenser' id 'org.cadixdev.licenser'
id 'java-library'
id 'jacoco'
} }
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'org.javamodularity.moduleplugin'
dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) }
@@ -5,30 +5,30 @@
GlStateManager._texParameter(3553, 10242, 33071); GlStateManager._texParameter(3553, 10242, 33071);
GlStateManager._texParameter(3553, 10243, 33071); GlStateManager._texParameter(3553, 10243, 33071);
+ if (!stencilEnabled) + if (!stencilEnabled)
GlStateManager._texImage2D(3553, 0, 6402, this.f_83915_, this.f_83916_, 0, 6402, 5126, (IntBuffer)null); GlStateManager._texImage2D(3553, 0, 6402, this.width, this.height, 0, 6402, 5126, (IntBuffer)null);
+ else + else
+ GlStateManager._texImage2D(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.f_83915_, this.f_83916_, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null); + GlStateManager._texImage2D(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.width, this.height, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null);
} }
this.m_83936_(9728); this.setFilterMode(9728);
@@ -124,7 +_,14 @@ @@ -124,7 +_,14 @@
GlStateManager._glBindFramebuffer(36160, this.f_83920_); GlStateManager._glBindFramebuffer(36160, this.frameBufferId);
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.f_83923_, 0); GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.colorTextureId, 0);
if (this.f_83919_) { if (this.useDepth) {
+ if(!stencilEnabled) + if(!stencilEnabled)
GlStateManager._glFramebufferTexture2D(36160, 36096, 3553, this.f_83924_, 0); GlStateManager._glFramebufferTexture2D(36160, 36096, 3553, this.depthBufferId, 0);
+ else if(net.minecraftforge.common.ForgeConfig.CLIENT.useCombinedDepthStencilAttachment.get()) { + else if(net.minecraftforge.common.ForgeConfig.CLIENT.useCombinedDepthStencilAttachment.get()) {
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL_ATTACHMENT, 3553, this.f_83924_, 0); + GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL_ATTACHMENT, 3553, this.depthBufferId, 0);
+ } else { + } else {
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_ATTACHMENT, 3553, this.f_83924_, 0); + GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_ATTACHMENT, 3553, this.depthBufferId, 0);
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, 3553, this.f_83924_, 0); + GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, 3553, this.depthBufferId, 0);
+ } + }
} }
this.m_83949_(); this.checkStatus();
@@ -292,4 +_,27 @@ @@ -292,4 +_,27 @@
public int m_83980_() { public int getDepthTextureId() {
return this.f_83924_; return this.depthBufferId;
} }
+ +
+ /*================================ FORGE START ================================================*/ + /*================================ FORGE START ================================================*/
@@ -42,7 +42,7 @@
+ public void enableStencil() { + public void enableStencil() {
+ if(stencilEnabled) return; + if(stencilEnabled) return;
+ stencilEnabled = true; + stencilEnabled = true;
+ this.m_83941_(f_83917_, f_83918_, net.minecraft.client.Minecraft.f_91002_); + this.resize(viewWidth, viewHeight, net.minecraft.client.Minecraft.ON_OSX);
+ } + }
+ +
+ /** + /**
@@ -4,25 +4,25 @@
GLFW.glfwWindowHint(139267, 2); GLFW.glfwWindowHint(139267, 2);
GLFW.glfwWindowHint(139272, 204801); GLFW.glfwWindowHint(139272, 204801);
GLFW.glfwWindowHint(139270, 1); GLFW.glfwWindowHint(139270, 1);
- this.f_85349_ = GLFW.glfwCreateWindow(this.f_85359_, this.f_85360_, p_85376_, this.f_85355_ && monitor != null ? monitor.m_84954_() : 0L, 0L); - this.window = GLFW.glfwCreateWindow(this.width, this.height, p_85376_, this.fullscreen && monitor != null ? monitor.getMonitor() : 0L, 0L);
+ this.f_85349_ = net.minecraftforge.fml.loading.ImmediateWindowHandler.setupMinecraftWindow(()->this.f_85359_, ()->this.f_85360_, ()->p_85376_, ()->this.f_85355_ && monitor != null ? monitor.m_84954_() : 0L); + this.window = net.minecraftforge.fml.loading.ImmediateWindowHandler.setupMinecraftWindow(()->this.width, ()->this.height, ()->p_85376_, ()->this.fullscreen && monitor != null ? monitor.getMonitor() : 0L);
+ if (!net.minecraftforge.fml.loading.ImmediateWindowHandler.positionWindow(Optional.ofNullable(monitor), w->this.f_85359_ = this.f_85352_ = w, h->this.f_85360_ = this.f_85353_ = h, x->this.f_85357_ = this.f_85350_ = x, y->this.f_85358_ = this.f_85351_ = y)) { + if (!net.minecraftforge.fml.loading.ImmediateWindowHandler.positionWindow(Optional.ofNullable(monitor), w->this.width = this.windowedWidth = w, h->this.height = this.windowedHeight = h, x->this.x = this.windowedX = x, y->this.y = this.windowedY = y)) {
if (monitor != null) { if (monitor != null) {
VideoMode videomode = monitor.m_84948_(this.f_85355_ ? this.f_85354_ : Optional.empty()); VideoMode videomode = monitor.getPreferredVidMode(this.fullscreen ? this.preferredFullscreenVideoMode : Optional.empty());
this.f_85350_ = this.f_85357_ = monitor.m_84951_() + videomode.m_85332_() / 2 - this.f_85359_ / 2; this.windowedX = this.x = monitor.getX() + videomode.getWidth() / 2 - this.width / 2;
@@ -93,6 +_,7 @@ @@ -93,6 +_,7 @@
this.f_85350_ = this.f_85357_ = aint1[0]; this.windowedX = this.x = aint1[0];
this.f_85351_ = this.f_85358_ = aint[0]; this.windowedY = this.y = aint[0];
} }
+ } + }
GLFW.glfwMakeContextCurrent(this.f_85349_); GLFW.glfwMakeContextCurrent(this.window);
GL.createCapabilities(); GL.createCapabilities();
@@ -242,6 +_,7 @@ @@ -242,6 +_,7 @@
GLFW.glfwGetFramebufferSize(this.f_85349_, aint, aint1); GLFW.glfwGetFramebufferSize(this.window, aint, aint1);
this.f_85361_ = aint[0] > 0 ? aint[0] : 1; this.framebufferWidth = aint[0] > 0 ? aint[0] : 1;
this.f_85362_ = aint1[0] > 0 ? aint1[0] : 1; this.framebufferHeight = aint1[0] > 0 ? aint1[0] : 1;
+ if (this.f_85362_ == 0 || this.f_85361_==0) net.minecraftforge.fml.loading.ImmediateWindowHandler.updateFBSize(w->this.f_85361_=w, h->this.f_85362_=h); + if (this.framebufferHeight == 0 || this.framebufferWidth==0) net.minecraftforge.fml.loading.ImmediateWindowHandler.updateFBSize(w->this.framebufferWidth=w, h->this.framebufferHeight=h);
} }
private void m_85427_(long p_85428_, int p_85429_, int p_85430_) { private void onResize(long p_85428_, int p_85429_, int p_85430_) {
@@ -1,17 +1,17 @@
--- a/com/mojang/blaze3d/vertex/BufferBuilder.java --- a/com/mojang/blaze3d/vertex/BufferBuilder.java
+++ b/com/mojang/blaze3d/vertex/BufferBuilder.java +++ b/com/mojang/blaze3d/vertex/BufferBuilder.java
@@ -459,4 +_,14 @@ @@ -459,4 +_,14 @@
this.f_276566_ = p_277855_; this.sorting = p_277855_;
} }
} }
+ +
+ // Forge start + // Forge start
+ public void putBulkData(ByteBuffer buffer) { + public void putBulkData(ByteBuffer buffer) {
+ m_85722_(buffer.limit() + this.f_85658_.m_86020_()); + ensureCapacity(buffer.limit() + this.format.getVertexSize());
+ this.f_85648_.position(this.f_85652_); + this.buffer.position(this.nextElementByte);
+ this.f_85648_.put(buffer); + this.buffer.put(buffer);
+ this.f_85648_.position(0); + this.buffer.position(0);
+ this.f_85654_ += buffer.limit() / this.f_85658_.m_86020_(); + this.vertices += buffer.limit() / this.format.getVertexSize();
+ this.f_85652_ += buffer.limit(); + this.nextElementByte += buffer.limit();
+ } + }
} }
@@ -6,6 +6,6 @@
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
-public class PoseStack { -public class PoseStack {
+public class PoseStack implements net.minecraftforge.client.extensions.IForgePoseStack { +public class PoseStack implements net.minecraftforge.client.extensions.IForgePoseStack {
private final Deque<PoseStack.Pose> f_85834_ = Util.m_137469_(Queues.newArrayDeque(), (p_85848_) -> { private final Deque<PoseStack.Pose> poseStack = Util.make(Queues.newArrayDeque(), (p_85848_) -> {
Matrix4f matrix4f = new Matrix4f(); Matrix4f matrix4f = new Matrix4f();
Matrix3f matrix3f = new Matrix3f(); Matrix3f matrix3f = new Matrix3f();
@@ -2,10 +2,10 @@
+++ b/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java +++ b/com/mojang/blaze3d/vertex/SheetedDecalTextureGenerator.java
@@ -46,7 +_,7 @@ @@ -46,7 +_,7 @@
public void m_5752_() { public void endVertex() {
Vector3f vector3f = this.f_85869_.transform(new Vector3f(this.f_85876_, this.f_85877_, this.f_85878_)); Vector3f vector3f = this.normalInversePose.transform(new Vector3f(this.nx, this.ny, this.nz));
- Direction direction = Direction.m_122372_(vector3f.x(), vector3f.y(), vector3f.z()); - Direction direction = Direction.getNearest(vector3f.x(), vector3f.y(), vector3f.z());
+ Direction direction = net.minecraftforge.client.ForgeHooksClient.getNearestStable(vector3f.x(), vector3f.y(), vector3f.z()); + Direction direction = net.minecraftforge.client.ForgeHooksClient.getNearestStable(vector3f.x(), vector3f.y(), vector3f.z());
Vector4f vector4f = this.f_85868_.transform(new Vector4f(this.f_85870_, this.f_85871_, this.f_85872_, 1.0F)); Vector4f vector4f = this.cameraInversePose.transform(new Vector4f(this.x, this.y, this.z, 1.0F));
vector4f.rotateY((float)Math.PI); vector4f.rotateY((float)Math.PI);
vector4f.rotateX((-(float)Math.PI / 2F)); vector4f.rotateX((-(float)Math.PI / 2F));
@@ -6,20 +6,20 @@
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
-public interface VertexConsumer { -public interface VertexConsumer {
+public interface VertexConsumer extends net.minecraftforge.client.extensions.IForgeVertexConsumer { +public interface VertexConsumer extends net.minecraftforge.client.extensions.IForgeVertexConsumer {
VertexConsumer m_5483_(double p_85945_, double p_85946_, double p_85947_); VertexConsumer vertex(double p_85945_, double p_85946_, double p_85947_);
VertexConsumer m_6122_(int p_85973_, int p_85974_, int p_85975_, int p_85976_); VertexConsumer color(int p_85973_, int p_85974_, int p_85975_, int p_85976_);
@@ -64,6 +_,10 @@ @@ -64,6 +_,10 @@
} }
default void m_85995_(PoseStack.Pose p_85996_, BakedQuad p_85997_, float[] p_85998_, float p_85999_, float p_86000_, float p_86001_, int[] p_86002_, int p_86003_, boolean p_86004_) { default void putBulkData(PoseStack.Pose p_85996_, BakedQuad p_85997_, float[] p_85998_, float p_85999_, float p_86000_, float p_86001_, int[] p_86002_, int p_86003_, boolean p_86004_) {
+ putBulkData(p_85996_, p_85997_, p_85998_, p_85999_, p_86000_, p_86001_, 1, p_86002_, p_86003_, p_86004_); + putBulkData(p_85996_, p_85997_, p_85998_, p_85999_, p_86000_, p_86001_, 1, p_86002_, p_86003_, p_86004_);
+ } + }
+ +
+ default void putBulkData(PoseStack.Pose p_85996_, BakedQuad p_85997_, float[] p_85998_, float p_85999_, float p_86000_, float p_86001_, float alpha, int[] p_86002_, int p_86003_, boolean p_86004_) { + default void putBulkData(PoseStack.Pose p_85996_, BakedQuad p_85997_, float[] p_85998_, float p_85999_, float p_86000_, float p_86001_, float alpha, int[] p_86002_, int p_86003_, boolean p_86004_) {
float[] afloat = new float[]{p_85998_[0], p_85998_[1], p_85998_[2], p_85998_[3]}; float[] afloat = new float[]{p_85998_[0], p_85998_[1], p_85998_[2], p_85998_[3]};
int[] aint = new int[]{p_86002_[0], p_86002_[1], p_86002_[2], p_86002_[3]}; int[] aint = new int[]{p_86002_[0], p_86002_[1], p_86002_[2], p_86002_[3]};
int[] aint1 = p_85997_.m_111303_(); int[] aint1 = p_85997_.getVertices();
@@ -99,11 +_,13 @@ @@ -99,11 +_,13 @@
f5 = afloat[k] * p_86001_; f5 = afloat[k] * p_86001_;
} }
@@ -29,10 +29,10 @@
float f9 = bytebuffer.getFloat(16); float f9 = bytebuffer.getFloat(16);
float f10 = bytebuffer.getFloat(20); float f10 = bytebuffer.getFloat(20);
Vector4f vector4f = matrix4f.transform(new Vector4f(f, f1, f2, 1.0F)); Vector4f vector4f = matrix4f.transform(new Vector4f(f, f1, f2, 1.0F));
- this.m_5954_(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z()); - this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, 1.0F, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
+ applyBakedNormals(vector3f, bytebuffer, p_85996_.m_252943_()); + applyBakedNormals(vector3f, bytebuffer, p_85996_.normal());
+ float vertexAlpha = p_86004_ ? alpha * (float) (bytebuffer.get(15) & 255) / 255.0F : alpha; + float vertexAlpha = p_86004_ ? alpha * (float) (bytebuffer.get(15) & 255) / 255.0F : alpha;
+ this.m_5954_(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z()); + this.vertex(vector4f.x(), vector4f.y(), vector4f.z(), f3, f4, f5, vertexAlpha, f9, f10, p_86003_, l, vector3f.x(), vector3f.y(), vector3f.z());
} }
} }
@@ -5,10 +5,10 @@
} }
} }
+ +
+ public ImmutableMap<String, VertexFormatElement> getElementMapping() { return f_166905_; } + public ImmutableMap<String, VertexFormatElement> getElementMapping() { return elementMapping; }
+ public int getOffset(int index) { return f_86013_.getInt(index); } + public int getOffset(int index) { return offsets.getInt(index); }
+ public boolean hasPosition() { return f_86012_.stream().anyMatch(e -> e.m_86048_() == VertexFormatElement.Usage.POSITION); } + public boolean hasPosition() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.POSITION); }
+ public boolean hasNormal() { return f_86012_.stream().anyMatch(e -> e.m_86048_() == VertexFormatElement.Usage.NORMAL); } + public boolean hasNormal() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.NORMAL); }
+ public boolean hasColor() { return f_86012_.stream().anyMatch(e -> e.m_86048_() == VertexFormatElement.Usage.COLOR); } + public boolean hasColor() { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.COLOR); }
+ public boolean hasUV(int which) { return f_86012_.stream().anyMatch(e -> e.m_86048_() == VertexFormatElement.Usage.UV && e.m_86049_() == which); } + public boolean hasUV(int which) { return elements.stream().anyMatch(e -> e.getUsage() == VertexFormatElement.Usage.UV && e.getIndex() == which); }
} }
@@ -1,11 +1,11 @@
--- a/com/mojang/blaze3d/vertex/VertexFormatElement.java --- a/com/mojang/blaze3d/vertex/VertexFormatElement.java
+++ b/com/mojang/blaze3d/vertex/VertexFormatElement.java +++ b/com/mojang/blaze3d/vertex/VertexFormatElement.java
@@ -90,6 +_,10 @@ @@ -90,6 +_,10 @@
this.f_86031_.m_166978_(this.f_86032_, p_166964_); this.usage.clearBufferState(this.index, p_166964_);
} }
+ public int getElementCount() { + public int getElementCount() {
+ return f_86033_; + return count;
+ } + }
+ +
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@@ -6,12 +6,12 @@
-public final class Transformation { -public final class Transformation {
+public final class Transformation implements net.minecraftforge.common.extensions.IForgeTransformation { +public final class Transformation implements net.minecraftforge.common.extensions.IForgeTransformation {
private final Matrix4f f_121078_; private final Matrix4f matrix;
public static final Codec<Transformation> f_268453_ = RecordCodecBuilder.create((p_269604_) -> { public static final Codec<Transformation> CODEC = RecordCodecBuilder.create((p_269604_) -> {
return p_269604_.group(ExtraCodecs.f_252432_.fieldOf("translation").forGetter((p_269599_) -> { return p_269604_.group(ExtraCodecs.VECTOR3F.fieldOf("translation").forGetter((p_269599_) -> {
@@ -156,6 +_,19 @@ @@ -156,6 +_,19 @@
public int hashCode() { public int hashCode() {
return Objects.hash(this.f_121078_); return Objects.hash(this.matrix);
} }
+ +
+ private Matrix3f normalTransform = null; + private Matrix3f normalTransform = null;
@@ -21,11 +21,11 @@
+ } + }
+ private void checkNormalTransform() { + private void checkNormalTransform() {
+ if (normalTransform == null) { + if (normalTransform == null) {
+ normalTransform = new Matrix3f(f_121078_); + normalTransform = new Matrix3f(matrix);
+ normalTransform.invert(); + normalTransform.invert();
+ normalTransform.transpose(); + normalTransform.transpose();
+ } + }
+ } + }
public Transformation m_175937_(Transformation p_175938_, float p_175939_) { public Transformation slerp(Transformation p_175938_, float p_175939_) {
Vector3f vector3f = this.m_252829_(); Vector3f vector3f = this.getTranslation();
@@ -1,18 +1,18 @@
--- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java --- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
+++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java +++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
@@ -61,6 +_,15 @@ @@ -61,6 +_,15 @@
return Component.m_237119_().m_7220_(this.f_200947_.f_287789_).m_130946_(": ").m_7220_(this.f_200947_.f_287787_); return Component.empty().append(this.lines.title).append(": ").append(this.lines.detail);
} }
+ @Override + @Override
+ public boolean m_7933_(int key, int scanCode, int modifiers) { + public boolean keyPressed(int key, int scanCode, int modifiers) {
+ if (key == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) { + if (key == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) {
+ f_96541_.m_91152_(this.f_88665_); + minecraft.setScreen(this.nextScreen);
+ return true; + return true;
+ } + }
+ return super.m_7933_(key, scanCode, modifiers); + return super.keyPressed(key, scanCode, modifiers);
+ } + }
+ +
public void m_88315_(GuiGraphics p_283497_, int p_88680_, int p_88681_, float p_88682_) { public void render(GuiGraphics p_283497_, int p_88680_, int p_88681_, float p_88682_) {
super.m_88315_(p_283497_, p_88680_, p_88681_, p_88682_); super.render(p_283497_, p_88680_, p_88681_, p_88682_);
p_283497_.m_280653_(this.f_96547_, this.f_200947_.f_287789_, this.f_96543_ / 2, 80, -1); p_283497_.drawCenteredString(this.font, this.lines.title, this.width / 2, 80, -1);
@@ -1,32 +1,32 @@
--- a/net/minecraft/CrashReport.java --- a/net/minecraft/CrashReport.java
+++ b/net/minecraft/CrashReport.java +++ b/net/minecraft/CrashReport.java
@@ -57,14 +_,8 @@ @@ -57,14 +_,8 @@
if (this.f_127506_ != null && this.f_127506_.length > 0) { if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) {
p_127520_.append("-- Head --\n"); p_127520_.append("-- Head --\n");
p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n"); p_127520_.append("Thread: ").append(Thread.currentThread().getName()).append("\n");
- p_127520_.append("Stacktrace:\n"); - p_127520_.append("Stacktrace:\n");
- -
- for(StackTraceElement stacktraceelement : this.f_127506_) { - for(StackTraceElement stacktraceelement : this.uncategorizedStackTrace) {
- p_127520_.append("\t").append("at ").append((Object)stacktraceelement); - p_127520_.append("\t").append("at ").append((Object)stacktraceelement);
- p_127520_.append("\n"); - p_127520_.append("\n");
- } - }
- -
- p_127520_.append("\n"); - p_127520_.append("\n");
+ p_127520_.append("Stacktrace:"); + p_127520_.append("Stacktrace:");
+ p_127520_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.f_127506_)); + p_127520_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.uncategorizedStackTrace));
} }
for(CrashReportCategory crashreportcategory : this.f_127503_) { for(CrashReportCategory crashreportcategory : this.details) {
@@ -72,6 +_,7 @@ @@ -72,6 +_,7 @@
p_127520_.append("\n\n"); p_127520_.append("\n\n");
} }
+ net.minecraftforge.logging.CrashReportExtender.extendSystemReport(f_178624_); + net.minecraftforge.logging.CrashReportExtender.extendSystemReport(systemReport);
this.f_178624_.m_143525_(p_127520_); this.systemReport.appendToCrashReportString(p_127520_);
} }
@@ -91,23 +_,13 @@ @@ -91,23 +_,13 @@
throwable.setStackTrace(this.f_127501_.getStackTrace()); throwable.setStackTrace(this.exception.getStackTrace());
} }
- String s; - String s;
@@ -44,10 +44,10 @@
+ return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(throwable); + return net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(throwable);
} }
public String m_127526_() { public String getFriendlyReport() {
StringBuilder stringbuilder = new StringBuilder(); StringBuilder stringbuilder = new StringBuilder();
stringbuilder.append("---- Minecraft Crash Report ----\n"); stringbuilder.append("---- Minecraft Crash Report ----\n");
+ net.minecraftforge.logging.CrashReportExtender.addCrashReportHeader(stringbuilder, this); + net.minecraftforge.logging.CrashReportExtender.addCrashReportHeader(stringbuilder, this);
stringbuilder.append("// "); stringbuilder.append("// ");
stringbuilder.append(m_127531_()); stringbuilder.append(getErrorComment());
stringbuilder.append("\n\n"); stringbuilder.append("\n\n");
@@ -4,35 +4,35 @@
if (astacktraceelement.length <= 0) { if (astacktraceelement.length <= 0) {
return 0; return 0;
} else { } else {
- this.f_128139_ = new StackTraceElement[astacktraceelement.length - 3 - p_128149_]; - this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - p_128149_];
- System.arraycopy(astacktraceelement, 3 + p_128149_, this.f_128139_, 0, this.f_128139_.length); - System.arraycopy(astacktraceelement, 3 + p_128149_, this.stackTrace, 0, this.stackTrace.length);
+ int len = astacktraceelement.length - 3 - p_128149_; + int len = astacktraceelement.length - 3 - p_128149_;
+ if (len <= 0) len = astacktraceelement.length; + if (len <= 0) len = astacktraceelement.length;
+ this.f_128139_ = new StackTraceElement[len]; + this.stackTrace = new StackTraceElement[len];
+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.f_128139_, 0, this.f_128139_.length); + System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length);
return this.f_128139_.length; return this.stackTrace.length;
} }
} }
@@ -147,17 +_,17 @@ @@ -147,17 +_,17 @@
if (this.f_128139_ != null && this.f_128139_.length > 0) { if (this.stackTrace != null && this.stackTrace.length > 0) {
p_128169_.append("\nStacktrace:"); p_128169_.append("\nStacktrace:");
- -
- for(StackTraceElement stacktraceelement : this.f_128139_) { - for(StackTraceElement stacktraceelement : this.stackTrace) {
- p_128169_.append("\n\tat "); - p_128169_.append("\n\tat ");
- p_128169_.append((Object)stacktraceelement); - p_128169_.append((Object)stacktraceelement);
- } - }
+ p_128169_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.f_128139_)); + p_128169_.append(net.minecraftforge.logging.CrashReportExtender.generateEnhancedStackTrace(this.stackTrace));
} }
} }
public StackTraceElement[] m_128143_() { public StackTraceElement[] getStacktrace() {
return this.f_128139_; return this.stackTrace;
+ } + }
+ +
+ public void applyStackTrace(Throwable t) { + public void applyStackTrace(Throwable t) {
+ this.f_128139_ = t.getStackTrace(); + this.stackTrace = t.getStackTrace();
} }
public static void m_178950_(CrashReportCategory p_178951_, LevelHeightAccessor p_178952_, BlockPos p_178953_, @Nullable BlockState p_178954_) { public static void populateBlockDetails(CrashReportCategory p_178951_, LevelHeightAccessor p_178952_, BlockPos p_178953_, @Nullable BlockState p_178954_) {
@@ -5,6 +5,6 @@
static { static {
+ if (System.getProperty("io.netty.leakDetection.level") == null) // Forge: allow level to be manually specified + if (System.getProperty("io.netty.leakDetection.level") == null) // Forge: allow level to be manually specified
ResourceLeakDetector.setLevel(f_136180_); ResourceLeakDetector.setLevel(NETTY_LEAK_DETECTION);
CommandSyntaxException.ENABLE_COMMAND_STACK_TRACES = false; CommandSyntaxException.ENABLE_COMMAND_STACK_TRACES = false;
CommandSyntaxException.BUILT_IN_EXCEPTIONS = new BrigadierExceptions(); CommandSyntaxException.BUILT_IN_EXCEPTIONS = new BrigadierExceptions();
@@ -9,15 +9,15 @@
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT1 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } }; + @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT1 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
+ @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT2 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } }; + @SuppressWarnings("unused") private static java.util.function.LongSupplier INNER_CLASS_SHIFT2 = new java.util.function.LongSupplier() { public long getAsLong() { return 0; } };
+ +
public static ExecutorService m_183991_() { public static ExecutorService backgroundExecutor() {
return f_137444_; return BACKGROUND_EXECUTOR;
} }
@@ -240,7 +_,7 @@ @@ -240,7 +_,7 @@
try { try {
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().m_183476_().m_193006_())).getChoiceType(p_137552_, p_137553_); type = DataFixers.getDataFixer().getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().getDataVersion().getVersion())).getChoiceType(p_137552_, p_137553_);
} catch (IllegalArgumentException illegalargumentexception) { } catch (IllegalArgumentException illegalargumentexception) {
- f_137446_.error("No data fixer registered for {}", (Object)p_137553_); - LOGGER.error("No data fixer registered for {}", (Object)p_137553_);
+ f_137446_.debug("No data fixer registered for {}", (Object)p_137553_); + LOGGER.debug("No data fixer registered for {}", (Object)p_137553_);
if (SharedConstants.f_136183_) { if (SharedConstants.IS_RUNNING_IN_IDE) {
throw illegalargumentexception; throw illegalargumentexception;
} }
@@ -6,12 +6,25 @@
+ /** @deprecated Forge: use {@linkplain #fromJson(JsonObject, DeserializationContext, net.minecraftforge.common.crafting.conditions.ICondition.IContext) overload with context}. */ + /** @deprecated Forge: use {@linkplain #fromJson(JsonObject, DeserializationContext, net.minecraftforge.common.crafting.conditions.ICondition.IContext) overload with context}. */
+ @Deprecated + @Deprecated
public static Advancement m_294730_(JsonObject p_300691_, DeserializationContext p_300053_) { public static Advancement fromJson(JsonObject p_300691_, DeserializationContext p_300053_) {
+ return fromJson(p_300691_, p_300053_, net.minecraftforge.common.crafting.conditions.ICondition.IContext.EMPTY); + 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) { + 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; + //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.m_13906_(p_300691_, "parent"))) : Optional.empty(); 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.m_14981_(GsonHelper.m_13930_(p_300691_, "display"))) : 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.m_9991_(GsonHelper.m_13930_(p_300691_, "rewards")) : AdvancementRewards.f_9978_; AdvancementRewards advancementrewards = p_300691_.has("rewards") ? AdvancementRewards.deserialize(GsonHelper.getAsJsonObject(p_300691_, "rewards")) : AdvancementRewards.EMPTY;
@@ -182,7 +_,11 @@
}
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_));
+ }
+
+ public AdvancementHolder save(Consumer<AdvancementHolder> p_138390_, ResourceLocation id) {
+ AdvancementHolder advancementholder = this.build(id);
p_138390_.accept(advancementholder);
return advancementholder;
}
@@ -2,10 +2,10 @@
+++ b/net/minecraft/advancements/AdvancementRewards.java +++ b/net/minecraft/advancements/AdvancementRewards.java
@@ -43,7 +_,7 @@ @@ -43,7 +_,7 @@
public void m_9989_(ServerPlayer p_9990_) { public void grant(ServerPlayer p_9990_) {
p_9990_.m_6756_(this.f_9979_); p_9990_.giveExperiencePoints(this.experience);
- LootParams lootparams = (new LootParams.Builder(p_9990_.m_284548_())).m_287286_(LootContextParams.f_81455_, p_9990_).m_287286_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_287235_(LootContextParamSets.f_81418_); - LootParams lootparams = (new LootParams.Builder(p_9990_.serverLevel())).withParameter(LootContextParams.THIS_ENTITY, p_9990_).withParameter(LootContextParams.ORIGIN, p_9990_.position()).create(LootContextParamSets.ADVANCEMENT_REWARD);
+ LootParams lootparams = (new LootParams.Builder(p_9990_.m_284548_())).m_287286_(LootContextParams.f_81455_, p_9990_).m_287286_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_287239_(p_9990_.m_36336_()).m_287235_(LootContextParamSets.f_81418_); // Forge: Add luck to LootContext + LootParams lootparams = (new LootParams.Builder(p_9990_.serverLevel())).withParameter(LootContextParams.THIS_ENTITY, p_9990_).withParameter(LootContextParams.ORIGIN, p_9990_.position()).withLuck(p_9990_.getLuck()).create(LootContextParamSets.ADVANCEMENT_REWARD); // Forge: Add luck to LootContext
boolean flag = false; boolean flag = false;
for(ResourceLocation resourcelocation : this.f_9980_) { for(ResourceLocation resourcelocation : this.loot) {
@@ -3,9 +3,9 @@
@@ -50,7 +_,7 @@ @@ -50,7 +_,7 @@
return false; return false;
} else { } else {
if (!this.f_45033_.isEmpty()) { if (!this.enchantments.isEmpty()) {
- Map<Enchantment, Integer> map = EnchantmentHelper.m_44882_(p_45050_.m_41785_()); - Map<Enchantment, Integer> map = EnchantmentHelper.deserializeEnchantments(p_45050_.getEnchantmentTags());
+ Map<Enchantment, Integer> map = p_45050_.getAllEnchantments(); + Map<Enchantment, Integer> map = p_45050_.getAllEnchantments();
for(EnchantmentPredicate enchantmentpredicate : this.f_45033_) { for(EnchantmentPredicate enchantmentpredicate : this.enchantments) {
if (!enchantmentpredicate.m_30476_(map)) { if (!enchantmentpredicate.containedIn(map)) {
@@ -1,21 +1,21 @@
--- a/net/minecraft/client/Camera.java --- a/net/minecraft/client/Camera.java
+++ b/net/minecraft/client/Camera.java +++ b/net/minecraft/client/Camera.java
@@ -206,6 +_,18 @@ @@ -206,6 +_,18 @@
this.f_90549_ = false; this.initialized = false;
} }
+ public void setAnglesInternal(float yaw, float pitch) { + public void setAnglesInternal(float yaw, float pitch) {
+ this.f_90558_ = yaw; + this.yRot = yaw;
+ this.f_90557_ = pitch; + this.xRot = pitch;
+ } + }
+ +
+ public net.minecraft.world.level.block.state.BlockState getBlockAtCamera() { + public net.minecraft.world.level.block.state.BlockState getBlockAtCamera() {
+ if (!this.f_90549_) + if (!this.initialized)
+ return net.minecraft.world.level.block.Blocks.f_50016_.m_49966_(); + return net.minecraft.world.level.block.Blocks.AIR.defaultBlockState();
+ else + else
+ return this.f_90550_.m_8055_(this.f_90553_).getStateAtViewpoint(this.f_90550_, this.f_90553_, this.f_90552_); + return this.level.getBlockState(this.blockPosition).getStateAtViewpoint(this.level, this.blockPosition, this.position);
+ } + }
+ +
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public static class NearPlane { public static class NearPlane {
final Vec3 f_167687_; final Vec3 forward;
@@ -1,20 +1,20 @@
--- a/net/minecraft/client/ClientRecipeBook.java --- a/net/minecraft/client/ClientRecipeBook.java
+++ b/net/minecraft/client/ClientRecipeBook.java +++ b/net/minecraft/client/ClientRecipeBook.java
@@ -56,7 +_,7 @@ @@ -56,7 +_,7 @@
Recipe<?> recipe = recipeholder.f_291008_(); Recipe<?> recipe = recipeholder.value();
if (!recipe.m_5598_() && !recipe.m_142505_()) { if (!recipe.isSpecial() && !recipe.isIncomplete()) {
RecipeBookCategories recipebookcategories = m_90646_(recipeholder); RecipeBookCategories recipebookcategories = getCategory(recipeholder);
- String s = recipe.m_6076_(); - String s = recipe.getGroup();
+ String s = recipe.m_6076_().isEmpty() ? recipeholder.f_291676_().toString() : recipe.m_6076_(); // FORGE: Group value defaults to the recipe's ID if the recipe's explicit group is empty. + String s = recipe.getGroup().isEmpty() ? recipeholder.id().toString() : recipe.getGroup(); // FORGE: Group value defaults to the recipe's ID if the recipe's explicit group is empty.
if (s.isEmpty()) { if (s.isEmpty()) {
map.computeIfAbsent(recipebookcategories, (p_90645_) -> { map.computeIfAbsent(recipebookcategories, (p_90645_) -> {
return Lists.newArrayList(); return Lists.newArrayList();
@@ -144,6 +_,8 @@ @@ -144,6 +_,8 @@
} else if (recipetype == RecipeType.f_44113_) { } else if (recipetype == RecipeType.SMITHING) {
return RecipeBookCategories.SMITHING; return RecipeBookCategories.SMITHING;
} else { } else {
+ RecipeBookCategories categories = net.minecraftforge.client.RecipeBookManager.findCategories((RecipeType) recipetype, p_299041_); + RecipeBookCategories categories = net.minecraftforge.client.RecipeBookManager.findCategories((RecipeType) recipetype, p_299041_);
+ if (categories != null) return categories; + if (categories != null) return categories;
f_90618_.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> { LOGGER.warn("Unknown recipe category: {}/{}", LogUtils.defer(() -> {
return BuiltInRegistries.f_256990_.m_7981_(recipe.m_6671_()); return BuiltInRegistries.RECIPE_TYPE.getKey(recipe.getType());
}), LogUtils.defer(p_299041_::f_291676_)); }), LogUtils.defer(p_299041_::id));
@@ -6,58 +6,58 @@
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
-public class KeyMapping implements Comparable<KeyMapping> { -public class KeyMapping implements Comparable<KeyMapping> {
+public class KeyMapping implements Comparable<KeyMapping>, net.minecraftforge.client.extensions.IForgeKeyMapping { +public class KeyMapping implements Comparable<KeyMapping>, net.minecraftforge.client.extensions.IForgeKeyMapping {
private static final Map<String, KeyMapping> f_90809_ = Maps.newHashMap(); private static final Map<String, KeyMapping> ALL = Maps.newHashMap();
- private static final Map<InputConstants.Key, KeyMapping> f_90810_ = Maps.newHashMap(); - private static final Map<InputConstants.Key, KeyMapping> MAP = Maps.newHashMap();
+ private static final net.minecraftforge.client.settings.KeyMappingLookup f_90810_ = new net.minecraftforge.client.settings.KeyMappingLookup(); + private static final net.minecraftforge.client.settings.KeyMappingLookup MAP = new net.minecraftforge.client.settings.KeyMappingLookup();
private static final Set<String> f_90811_ = Sets.newHashSet(); private static final Set<String> CATEGORIES = Sets.newHashSet();
public static final String f_167805_ = "key.categories.movement"; public static final String CATEGORY_MOVEMENT = "key.categories.movement";
public static final String f_167806_ = "key.categories.misc"; public static final String CATEGORY_MISC = "key.categories.misc";
@@ -41,7 +_,7 @@ @@ -41,7 +_,7 @@
private int f_90818_; private int clickCount;
public static void m_90835_(InputConstants.Key p_90836_) { public static void click(InputConstants.Key p_90836_) {
- KeyMapping keymapping = f_90810_.get(p_90836_); - KeyMapping keymapping = MAP.get(p_90836_);
+ for (KeyMapping keymapping : f_90810_.getAll(p_90836_)) + for (KeyMapping keymapping : MAP.getAll(p_90836_))
if (keymapping != null) { if (keymapping != null) {
++keymapping.f_90818_; ++keymapping.clickCount;
} }
@@ -49,7 +_,7 @@ @@ -49,7 +_,7 @@
} }
public static void m_90837_(InputConstants.Key p_90838_, boolean p_90839_) { public static void set(InputConstants.Key p_90838_, boolean p_90839_) {
- KeyMapping keymapping = f_90810_.get(p_90838_); - KeyMapping keymapping = MAP.get(p_90838_);
+ for (KeyMapping keymapping : f_90810_.getAll(p_90838_)) + for (KeyMapping keymapping : MAP.getAll(p_90838_))
if (keymapping != null) { if (keymapping != null) {
keymapping.m_7249_(p_90839_); keymapping.setDown(p_90839_);
} }
@@ -105,7 +_,7 @@ @@ -105,7 +_,7 @@
} }
public boolean m_90857_() { public boolean isDown() {
- return this.f_90817_; - return this.isDown;
+ return this.f_90817_ && isConflictContextAndModifierActive(); + return this.isDown && isConflictContextAndModifierActive();
} }
public String m_90858_() { public String getCategory() {
@@ -139,7 +_,13 @@ @@ -139,7 +_,13 @@
} }
public int compareTo(KeyMapping p_90841_) { public int compareTo(KeyMapping p_90841_) {
- return this.f_90815_.equals(p_90841_.f_90815_) ? I18n.m_118938_(this.f_90813_).compareTo(I18n.m_118938_(p_90841_.f_90813_)) : f_90812_.get(this.f_90815_).compareTo(f_90812_.get(p_90841_.f_90815_)); - return this.category.equals(p_90841_.category) ? I18n.get(this.name).compareTo(I18n.get(p_90841_.name)) : CATEGORY_SORT_ORDER.get(this.category).compareTo(CATEGORY_SORT_ORDER.get(p_90841_.category));
+ if (this.f_90815_.equals(p_90841_.f_90815_)) return I18n.m_118938_(this.f_90813_).compareTo(I18n.m_118938_(p_90841_.f_90813_)); + if (this.category.equals(p_90841_.category)) return I18n.get(this.name).compareTo(I18n.get(p_90841_.name));
+ Integer tCat = f_90812_.get(this.f_90815_); + Integer tCat = CATEGORY_SORT_ORDER.get(this.category);
+ Integer oCat = f_90812_.get(p_90841_.f_90815_); + Integer oCat = CATEGORY_SORT_ORDER.get(p_90841_.category);
+ if (tCat == null && oCat != null) return 1; + if (tCat == null && oCat != null) return 1;
+ if (tCat != null && oCat == null) return -1; + if (tCat != null && oCat == null) return -1;
+ if (tCat == null && oCat == null) return I18n.m_118938_(this.f_90815_).compareTo(I18n.m_118938_(p_90841_.f_90815_)); + if (tCat == null && oCat == null) return I18n.get(this.category).compareTo(I18n.get(p_90841_.category));
+ return tCat.compareTo(oCat); + return tCat.compareTo(oCat);
} }
public static Supplier<Component> m_90842_(String p_90843_) { public static Supplier<Component> createNameSupplier(String p_90843_) {
@@ -150,6 +_,20 @@ @@ -150,6 +_,20 @@
} }
public boolean m_90850_(KeyMapping p_90851_) { public boolean same(KeyMapping p_90851_) {
+ if (getKeyConflictContext().conflicts(p_90851_.getKeyConflictContext()) || p_90851_.getKeyConflictContext().conflicts(getKeyConflictContext())) { + if (getKeyConflictContext().conflicts(p_90851_.getKeyConflictContext()) || p_90851_.getKeyConflictContext().conflicts(getKeyConflictContext())) {
+ net.minecraftforge.client.settings.KeyModifier keyModifier = getKeyModifier(); + net.minecraftforge.client.settings.KeyModifier keyModifier = getKeyModifier();
+ net.minecraftforge.client.settings.KeyModifier otherKeyModifier = p_90851_.getKeyModifier(); + net.minecraftforge.client.settings.KeyModifier otherKeyModifier = p_90851_.getKeyModifier();
@@ -72,27 +72,27 @@
+ (keyModifier == net.minecraftforge.client.settings.KeyModifier.NONE || otherKeyModifier == net.minecraftforge.client.settings.KeyModifier.NONE)); + (keyModifier == net.minecraftforge.client.settings.KeyModifier.NONE || otherKeyModifier == net.minecraftforge.client.settings.KeyModifier.NONE));
+ } + }
+ } + }
return this.f_90816_.equals(p_90851_.f_90816_); return this.key.equals(p_90851_.key);
} }
@@ -170,11 +_,13 @@ @@ -170,11 +_,13 @@
} }
public Component m_90863_() { public Component getTranslatedKeyMessage() {
+ return getKeyModifier().getCombinedName(f_90816_, () -> { + return getKeyModifier().getCombinedName(key, () -> {
return this.f_90816_.m_84875_(); return this.key.getDisplayName();
+ }); + });
} }
public boolean m_90864_() { public boolean isDefault() {
- return this.f_90816_.equals(this.f_90814_); - return this.key.equals(this.defaultKey);
+ return this.f_90816_.equals(this.f_90814_) && getKeyModifier() == getDefaultKeyModifier(); + return this.key.equals(this.defaultKey) && getKeyModifier() == getDefaultKeyModifier();
} }
public String m_90865_() { public String saveString() {
@@ -184,4 +_,84 @@ @@ -184,4 +_,84 @@
public void m_7249_(boolean p_90846_) { public void setDown(boolean p_90846_) {
this.f_90817_ = p_90846_; this.isDown = p_90846_;
} }
+ +
+ /****************** Forge Start *****************************/ + /****************** Forge Start *****************************/
@@ -104,7 +104,7 @@
+ * Convenience constructor for creating KeyBindings with keyConflictContext set. + * Convenience constructor for creating KeyBindings with keyConflictContext set.
+ */ + */
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputConstants.Type inputType, final int keyCode, String category) { + public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, final InputConstants.Type inputType, final int keyCode, String category) {
+ this(description, keyConflictContext, inputType.m_84895_(keyCode), category); + this(description, keyConflictContext, inputType.getOrCreate(keyCode), category);
+ } + }
+ +
+ /** + /**
@@ -118,30 +118,30 @@
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set. + * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
+ */ + */
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, final InputConstants.Type inputType, final int keyCode, String category) { + public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, final InputConstants.Type inputType, final int keyCode, String category) {
+ this(description, keyConflictContext, keyModifier, inputType.m_84895_(keyCode), category); + this(description, keyConflictContext, keyModifier, inputType.getOrCreate(keyCode), category);
+ } + }
+ +
+ /** + /**
+ * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set. + * Convenience constructor for creating KeyBindings with keyConflictContext and keyModifier set.
+ */ + */
+ public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode, String category) { + public KeyMapping(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode, String category) {
+ this.f_90813_ = description; + this.name = description;
+ this.f_90816_ = keyCode; + this.key = keyCode;
+ this.f_90814_ = keyCode; + this.defaultKey = keyCode;
+ this.f_90815_ = category; + this.category = category;
+ this.keyConflictContext = keyConflictContext; + this.keyConflictContext = keyConflictContext;
+ this.keyModifier = keyModifier; + this.keyModifier = keyModifier;
+ this.keyModifierDefault = keyModifier; + this.keyModifierDefault = keyModifier;
+ if (this.keyModifier.matches(keyCode)) + if (this.keyModifier.matches(keyCode))
+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; + this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
+ f_90809_.put(description, this); + ALL.put(description, this);
+ f_90810_.put(keyCode, this); + MAP.put(keyCode, this);
+ f_90811_.add(category); + CATEGORIES.add(category);
+ } + }
+ +
+ @Override + @Override
+ public InputConstants.Key getKey() { + public InputConstants.Key getKey() {
+ return this.f_90816_; + return this.key;
+ } + }
+ +
+ @Override + @Override
@@ -166,12 +166,12 @@
+ +
+ @Override + @Override
+ public void setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode) { + public void setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier keyModifier, InputConstants.Key keyCode) {
+ this.f_90816_ = keyCode; + this.key = keyCode;
+ if (keyModifier.matches(keyCode)) + if (keyModifier.matches(keyCode))
+ keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE; + keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
+ f_90810_.remove(this); + MAP.remove(this);
+ this.keyModifier = keyModifier; + this.keyModifier = keyModifier;
+ f_90810_.put(keyCode, this); + MAP.put(keyCode, this);
+ } + }
+ /****************** Forge End *****************************/ + /****************** Forge End *****************************/
} }
@@ -4,42 +4,42 @@
} }
} }
- if (p_90897_ == 1 && (!(this.f_90867_.f_91080_ instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).f_193976_ <= Util.m_137550_() - 20L)) { - if (p_90897_ == 1 && (!(this.minecraft.screen instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).lastKeySelection <= Util.getMillis() - 20L)) {
+ +
+ if ((!(this.f_90867_.f_91080_ instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).f_193976_ <= Util.m_137550_() - 20L)) { + if ((!(this.minecraft.screen instanceof KeyBindsScreen) || ((KeyBindsScreen)screen).lastKeySelection <= Util.getMillis() - 20L)) {
+ if (p_90897_ == 1) { + if (p_90897_ == 1) {
if (this.f_90867_.f_91066_.f_92105_.m_90832_(p_90895_, p_90896_)) { if (this.minecraft.options.keyFullscreen.matches(p_90895_, p_90896_)) {
this.f_90867_.m_91268_().m_85438_(); this.minecraft.getWindow().toggleFullScreen();
this.f_90867_.f_91066_.m_231829_().m_231514_(this.f_90867_.m_91268_().m_85440_()); this.minecraft.options.fullscreen().set(this.minecraft.getWindow().isFullscreen());
@@ -358,6 +_,8 @@ @@ -358,6 +_,8 @@
}); });
return; return;
} }
+ } else if (p_90897_ == 0 /*GLFW_RELEASE*/ && this.f_90867_.f_91080_ instanceof KeyBindsScreen) + } else if (p_90897_ == 0 /*GLFW_RELEASE*/ && this.minecraft.screen instanceof KeyBindsScreen)
+ ((KeyBindsScreen)this.f_90867_.f_91080_).f_193975_ = null; //Forge: Unset pure modifiers. + ((KeyBindsScreen)this.minecraft.screen).selectedKey = null; //Forge: Unset pure modifiers.
} }
if (this.f_90867_.m_240477_().m_93316_() && this.f_90867_.f_91066_.m_292959_().m_231551_()) { if (this.minecraft.getNarrator().isActive() && this.minecraft.options.narratorHotkey().get()) {
@@ -380,11 +_,15 @@ @@ -380,11 +_,15 @@
Screen.m_96579_(() -> { Screen.wrapScreenError(() -> {
if (p_90897_ != 1 && p_90897_ != 2) { if (p_90897_ != 1 && p_90897_ != 2) {
if (p_90897_ == 0) { if (p_90897_ == 0) {
- aboolean[0] = screen.m_7920_(p_90895_, p_90896_, p_90898_); - aboolean[0] = screen.keyReleased(p_90895_, p_90896_, p_90898_);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPre(screen, p_90895_, p_90896_, p_90898_); + aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPre(screen, p_90895_, p_90896_, p_90898_);
+ if (!aboolean[0]) aboolean[0] = screen.m_7920_(p_90895_, p_90896_, p_90898_); + if (!aboolean[0]) aboolean[0] = screen.keyReleased(p_90895_, p_90896_, p_90898_);
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPost(screen, p_90895_, p_90896_, p_90898_); + if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyReleasedPost(screen, p_90895_, p_90896_, p_90898_);
} }
} else { } else {
screen.m_169416_(); screen.afterKeyboardAction();
- aboolean[0] = screen.m_7933_(p_90895_, p_90896_, p_90898_); - aboolean[0] = screen.keyPressed(p_90895_, p_90896_, p_90898_);
+ aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPre(screen, p_90895_, p_90896_, p_90898_); + aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPre(screen, p_90895_, p_90896_, p_90898_);
+ if (!aboolean[0]) aboolean[0] = screen.m_7933_(p_90895_, p_90896_, p_90898_); + if (!aboolean[0]) aboolean[0] = screen.keyPressed(p_90895_, p_90896_, p_90898_);
+ if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPost(screen, p_90895_, p_90896_, p_90898_); + if (!aboolean[0]) aboolean[0] = net.minecraftforge.client.ForgeHooksClient.onScreenKeyPressedPost(screen, p_90895_, p_90896_, p_90898_);
} }
}, "keyPressed event handler", screen.getClass().getCanonicalName()); }, "keyPressed event handler", screen.getClass().getCanonicalName());
@@ -443,22 +_,26 @@ @@ -443,22 +_,26 @@
this.f_90867_.m_91111_(p_90895_ - 48); this.minecraft.debugFpsMeterKeyPress(p_90895_ - 48);
} }
} }
- -
@@ -47,24 +47,24 @@
} }
} }
private void m_90889_(long p_90890_, int p_90891_, int p_90892_) { private void charTyped(long p_90890_, int p_90891_, int p_90892_) {
if (p_90890_ == this.f_90867_.m_91268_().m_85439_()) { if (p_90890_ == this.minecraft.getWindow().getWindow()) {
- GuiEventListener guieventlistener = this.f_90867_.f_91080_; - GuiEventListener guieventlistener = this.minecraft.screen;
+ Screen guieventlistener = this.f_90867_.f_91080_; + Screen guieventlistener = this.minecraft.screen;
if (guieventlistener != null && this.f_90867_.m_91265_() == null) { if (guieventlistener != null && this.minecraft.getOverlay() == null) {
if (Character.charCount(p_90891_) == 1) { if (Character.charCount(p_90891_) == 1) {
Screen.m_96579_(() -> { Screen.wrapScreenError(() -> {
- guieventlistener.m_5534_((char)p_90891_, p_90892_); - guieventlistener.charTyped((char)p_90891_, p_90892_);
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, (char)p_90891_, p_90892_)) return; + if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, (char)p_90891_, p_90892_)) return;
+ if (guieventlistener.m_5534_((char)p_90891_, p_90892_)) return; + if (guieventlistener.charTyped((char)p_90891_, p_90892_)) return;
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, (char)p_90891_, p_90892_); + net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, (char)p_90891_, p_90892_);
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName()); }, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
} else { } else {
for(char c0 : Character.toChars(p_90891_)) { for(char c0 : Character.toChars(p_90891_)) {
Screen.m_96579_(() -> { Screen.wrapScreenError(() -> {
- guieventlistener.m_5534_(c0, p_90892_); - guieventlistener.charTyped(c0, p_90892_);
+ if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, c0, p_90892_)) return; + if (net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPre(guieventlistener, c0, p_90892_)) return;
+ if (guieventlistener.m_5534_(c0, p_90892_)) return; + if (guieventlistener.charTyped(c0, p_90892_)) return;
+ net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, c0, p_90892_); + net.minecraftforge.client.ForgeHooksClient.onScreenCharTypedPost(guieventlistener, c0, p_90892_);
}, "charTyped event handler", guieventlistener.getClass().getCanonicalName()); }, "charTyped event handler", guieventlistener.getClass().getCanonicalName());
} }
@@ -1,432 +1,421 @@
--- a/net/minecraft/client/Minecraft.java --- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java +++ b/net/minecraft/client/Minecraft.java
@@ -251,7 +_,7 @@ @@ -252,7 +_,7 @@
import org.slf4j.Logger; import org.slf4j.Logger;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
-public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler { -public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler {
+public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler, net.minecraftforge.client.extensions.IForgeMinecraft { +public class Minecraft extends ReentrantBlockableEventLoop<Runnable> implements WindowEventHandler, net.minecraftforge.client.extensions.IForgeMinecraft {
static Minecraft f_90981_; static Minecraft instance;
private static final Logger f_90982_ = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX; public static final boolean ON_OSX = Util.getPlatform() == Util.OS.OSX;
@@ -421,7 +_,6 @@ @@ -422,7 +_,6 @@
}, Util.m_183992_()); }, Util.ioPool());
this.f_193584_ = this.m_193585_(this.f_231338_, p_91084_); this.userApiService = this.createUserApiService(this.authenticationService, p_91084_);
f_90982_.info("Setting user: {}", (Object)this.f_90998_.m_92546_()); LOGGER.info("Setting user: {}", (Object)this.user.getName());
- f_90982_.debug("(Session ID is {})", (Object)this.f_90998_.m_92544_()); - LOGGER.debug("(Session ID is {})", (Object)this.user.getSessionId());
this.f_91033_ = p_91084_.f_101908_.f_101926_; this.demo = p_91084_.game.demo;
this.f_91034_ = !p_91084_.f_101908_.f_101929_; this.allowsMultiplayer = !p_91084_.game.disableMultiplayer;
this.f_91035_ = !p_91084_.f_101908_.f_101930_; this.allowsChat = !p_91084_.game.disableChat;
@@ -457,15 +_,15 @@ @@ -458,15 +_,15 @@
} }
this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_()); this.window.setFramerateLimit(this.options.framerateLimit().get());
+ // FORGE: Move mouse and keyboard handler setup further below + // FORGE: Move mouse and keyboard handler setup further below
this.f_91067_ = new MouseHandler(this); this.mouseHandler = new MouseHandler(this);
- this.f_91067_.m_91524_(this.f_90990_.m_85439_()); - this.mouseHandler.setup(this.window.getWindow());
this.f_91068_ = new KeyboardHandler(this); this.keyboardHandler = new KeyboardHandler(this);
- this.f_91068_.m_90887_(this.f_90990_.m_85439_()); - this.keyboardHandler.setup(this.window.getWindow());
RenderSystem.initRenderer(this.f_91066_.f_92035_, false); RenderSystem.initRenderer(this.options.glDebugVerbosity, false);
this.f_91042_ = new MainTarget(this.f_90990_.m_85441_(), this.f_90990_.m_85442_()); this.mainRenderTarget = new MainTarget(this.window.getWidth(), this.window.getHeight());
this.f_91042_.m_83931_(0.0F, 0.0F, 0.0F, 0.0F); this.mainRenderTarget.setClearColor(0.0F, 0.0F, 0.0F, 0.0F);
this.f_91042_.m_83954_(f_91002_); this.mainRenderTarget.clear(ON_OSX);
this.f_91036_ = new ReloadableResourceManager(PackType.CLIENT_RESOURCES); this.resourceManager = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
+ net.minecraftforge.client.loading.ClientModLoader.begin(this, this.f_91038_, this.f_91036_); + net.minecraftforge.client.loading.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager);
this.f_91038_.m_10506_(); this.resourcePackRepository.reload();
this.f_91066_.m_92145_(this.f_91038_); this.options.loadSelectedResourcePacks(this.resourcePackRepository);
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_); this.languageManager = new LanguageManager(this.options.languageCode);
@@ -511,10 +_,13 @@ @@ -512,10 +_,13 @@
this.f_91063_ = new GameRenderer(this, this.f_90994_.m_234586_(), this.f_91036_, this.f_90993_); this.gameRenderer = new GameRenderer(this, this.entityRenderDispatcher.getItemInHandRenderer(), this.resourceManager, this.renderBuffers);
this.f_91036_.m_7217_(this.f_91063_.m_247116_()); this.resourceManager.registerReloadListener(this.gameRenderer.createReloadListener());
this.f_91060_ = new LevelRenderer(this, this.f_90994_, this.f_167845_, this.f_90993_); this.levelRenderer = new LevelRenderer(this, this.entityRenderDispatcher, this.blockEntityRenderDispatcher, this.renderBuffers);
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RenderLevelStageEvent.RegisterStageEvent()); + net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RenderLevelStageEvent.RegisterStageEvent());
this.f_91036_.m_7217_(this.f_91060_); this.resourceManager.registerReloadListener(this.levelRenderer);
- this.m_91271_(); - this.createSearchTrees();
+ // Forge: We delay this to allow registration of modded creative mode tabs + // Forge: We delay this to allow registration of modded creative mode tabs
+ // this.createSearchTrees(); + // this.createSearchTrees();
this.f_91036_.m_7217_(this.f_90997_); this.resourceManager.registerReloadListener(this.searchRegistry);
this.f_91061_ = new ParticleEngine(this.f_91073_, this.f_90987_); this.particleEngine = new ParticleEngine(this.level, this.textureManager);
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(this.f_91061_); + net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(this.particleEngine);
this.f_91036_.m_7217_(this.f_91061_); this.resourceManager.registerReloadListener(this.particleEngine);
this.f_91053_ = new PaintingTextureManager(this.f_90987_); this.paintingTextures = new PaintingTextureManager(this.textureManager);
this.f_91036_.m_7217_(this.f_91053_); this.resourceManager.registerReloadListener(this.paintingTextures);
@@ -525,7 +_,10 @@ @@ -526,7 +_,10 @@
this.f_91047_ = new GpuWarnlistManager(); this.gpuWarnlistManager = new GpuWarnlistManager();
this.f_91036_.m_7217_(this.f_91047_); this.resourceManager.registerReloadListener(this.gpuWarnlistManager);
this.f_91036_.m_7217_(this.f_205120_); this.resourceManager.registerReloadListener(this.regionalCompliancies);
- this.f_91065_ = new Gui(this, this.f_90995_); - this.gui = new Gui(this, this.itemRenderer);
+ this.f_91065_ = new net.minecraftforge.client.gui.overlay.ForgeGui(this); + this.gui = new net.minecraftforge.client.gui.overlay.ForgeGui(this);
+ // FORGE: Moved keyboard and mouse handler setup below ingame gui creation to prevent NPEs in them. + // FORGE: Moved keyboard and mouse handler setup below ingame gui creation to prevent NPEs in them.
+ this.f_91067_.m_91524_(this.f_90990_.m_85439_()); + this.mouseHandler.setup(this.window.getWindow());
+ this.f_91068_.m_90887_(this.f_90990_.m_85439_()); + this.keyboardHandler.setup(this.window.getWindow());
this.f_91064_ = new DebugRenderer(this); this.debugRenderer = new DebugRenderer(this);
RealmsClient realmsclient = RealmsClient.m_239151_(this); RealmsClient realmsclient = RealmsClient.create(this);
this.f_238717_ = new RealmsDataFetcher(realmsclient); this.realmsDataFetcher = new RealmsDataFetcher(realmsclient);
@@ -545,6 +_,7 @@ @@ -546,6 +_,7 @@
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false); TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
} }
+ net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.f_91036_); + net.minecraftforge.client.ForgeHooksClient.initClientHooks(this, this.resourceManager);
this.f_90990_.m_85409_(this.f_91066_.m_231817_().m_231551_()); this.window.updateVsync(this.options.enableVsync().get());
this.f_90990_.m_85424_(this.f_91066_.m_232123_().m_231551_()); this.window.updateRawMouseInput(this.options.rawMouseInput().get());
this.f_90990_.m_85426_(); this.window.setDefaultErrorCallback();
@@ -564,7 +_,7 @@ @@ -565,7 +_,7 @@
ReloadInstance reloadinstance = this.f_91036_.m_142463_(Util.m_183991_(), this, f_90983_, list); ReloadInstance reloadinstance = this.resourceManager.createReload(Util.backgroundExecutor(), this, RESOURCE_RELOAD_INITIAL_TASK, list);
GameLoadTimesEvent.f_285635_.m_285833_(TelemetryProperty.f_285629_); GameLoadTimesEvent.INSTANCE.beginStep(TelemetryProperty.LOAD_TIME_LOADING_OVERLAY_MS);
Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.f_278410_); Minecraft.GameLoadCookie minecraft$gameloadcookie = new Minecraft.GameLoadCookie(realmsclient, p_91084_.quickPlay);
- this.m_91150_(new LoadingOverlay(this, reloadinstance, (p_296164_) -> { - this.setOverlay(new LoadingOverlay(this, reloadinstance, (p_296164_) -> {
+ this.m_91150_(net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(() -> this, () -> reloadinstance, (p_296164_) -> { + this.setOverlay(net.minecraftforge.fml.loading.ImmediateWindowHandler.<LoadingOverlay>loadingOverlay(() -> this, () -> reloadinstance, (p_296164_) -> {
Util.m_137521_(p_296164_, (p_296162_) -> { Util.ifElse(p_296164_, (p_296162_) -> {
this.m_91239_(p_296162_, minecraft$gameloadcookie); this.rollbackResourcePacks(p_296162_, minecraft$gameloadcookie);
}, () -> { }, () -> {
@@ -575,7 +_,7 @@ @@ -575,8 +_,10 @@
this.f_167847_.m_168556_();
this.m_293750_(minecraft$gameloadcookie); this.reloadStateTracker.finishReload();
this.onResourceLoadFinished(minecraft$gameloadcookie);
+ if (net.minecraftforge.client.loading.ClientModLoader.completeModLoading())
+ return; // Do not overwrite the error screen if there are errors
}); });
- }, false)); - }, false));
+ }, false).get()); + }, false).get());
this.f_278504_ = QuickPlayLog.m_278648_(p_91084_.f_278410_.f_278493_()); this.quickPlayLog = QuickPlayLog.of(p_91084_.quickPlay.path());
} }
@@ -673,7 +_,7 @@ @@ -674,7 +_,7 @@
private String m_91270_() { private String createTitle() {
StringBuilder stringbuilder = new StringBuilder("Minecraft"); StringBuilder stringbuilder = new StringBuilder("Minecraft");
if (m_193589_().m_184597_()) { if (checkModStatus().shouldReportAsModified()) {
- stringbuilder.append("*"); - stringbuilder.append("*");
+ stringbuilder.append(' ').append(net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.BRANDING_NAME).append('*'); + stringbuilder.append(' ').append(net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.BRANDING_NAME).append('*');
} }
stringbuilder.append(" "); stringbuilder.append(" ");
@@ -698,6 +_,8 @@ @@ -699,6 +_,8 @@
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) { private UserApiService createUserApiService(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
try { try {
+ if ("0".equals(p_193587_.f_101905_.f_101942_.m_92547_())) // Forge: We use "0" in dev. Short circuit to stop exception spam. + if ("0".equals(p_193587_.user.user.getAccessToken())) // Forge: We use "0" in dev. Short circuit to stop exception spam.
+ return UserApiService.OFFLINE; + return UserApiService.OFFLINE;
return p_193586_.createUserApiService(p_193587_.f_101905_.f_101942_.m_92547_()); return p_193586_.createUserApiService(p_193587_.user.user.getAccessToken());
} catch (AuthenticationException authenticationexception) { } catch (AuthenticationException authenticationexception) {
f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception); LOGGER.error("Failed to verify authentication", (Throwable)authenticationexception);
@@ -710,7 +_,7 @@ @@ -711,7 +_,7 @@
} }
private void m_91239_(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_) { private void rollbackResourcePacks(Throwable p_91240_, @Nullable Minecraft.GameLoadCookie p_299515_) {
- if (this.f_91038_.m_10523_().size() > 1) { - if (this.resourcePackRepository.getSelectedIds().size() > 1) {
+ if (this.f_91038_.m_10524_().stream().anyMatch(e -> !e.m_10449_())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any. + if (this.resourcePackRepository.getSelectedPacks().stream().anyMatch(e -> !e.isRequired())) { //Forge: This caused infinite loop if any resource packs are forced. Such as mod resources. So check if we can disable any.
this.m_91241_(p_91240_, (Component)null, p_299515_); this.clearResourcePacksOnError(p_91240_, (Component)null, p_299515_);
} else { } else {
Util.m_137559_(p_91240_); Util.throwAsRuntime(p_91240_);
@@ -802,7 +_,10 @@ @@ -803,7 +_,10 @@
} }
public void m_91271_() { public void createSearchTrees() {
- this.f_90997_.m_235232_(SearchRegistry.f_119941_, (p_231451_) -> { - this.searchRegistry.register(SearchRegistry.CREATIVE_NAMES, (p_231451_) -> {
+ var nameSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys(); + var nameSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys();
+ var tagSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys(); + var tagSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys();
+ for (var nameSearchKey : nameSearchKeys.values()) + for (var nameSearchKey : nameSearchKeys.values())
+ this.f_90997_.m_235232_(nameSearchKey, (p_231451_) -> { + this.searchRegistry.register(nameSearchKey, (p_231451_) -> {
return new FullTextSearchTree<>((p_210797_) -> { return new FullTextSearchTree<>((p_210797_) -> {
return p_210797_.m_41651_((Player)null, TooltipFlag.Default.f_256752_.m_257777_()).stream().map((p_231455_) -> { return p_210797_.getTooltipLines((Player)null, TooltipFlag.Default.NORMAL.asCreative()).stream().map((p_231455_) -> {
return ChatFormatting.m_126649_(p_231455_.getString()).trim(); return ChatFormatting.stripFormatting(p_231455_.getString()).trim();
@@ -813,14 +_,18 @@ @@ -814,7 +_,8 @@
return Stream.of(BuiltInRegistries.f_257033_.m_7981_(p_91317_.m_41720_())); return Stream.of(BuiltInRegistries.ITEM.getKey(p_91317_.getItem()));
}, p_231451_); }, p_231451_);
}); });
- this.f_90997_.m_235232_(SearchRegistry.f_119942_, (p_231430_) -> { - this.searchRegistry.register(SearchRegistry.CREATIVE_TAGS, (p_231430_) -> {
+ for (var tagSearchKey : tagSearchKeys.values()) + for (var tagSearchKey : tagSearchKeys.values())
+ this.f_90997_.m_235232_(tagSearchKey, (p_231430_) -> { + this.searchRegistry.register(tagSearchKey, (p_231430_) -> {
return new IdSearchTree<>((p_231353_) -> { return new IdSearchTree<>((p_231353_) -> {
return p_231353_.m_204131_().map(TagKey::f_203868_); return p_231353_.getTags().map(TagKey::location);
}, p_231430_); }, p_231430_);
@@ -834,9 +_,12 @@
});
}, p_301514_);
}); });
- CreativeModeTabs.m_258007_().m_257882_((p_255439_) -> { - CreativeModeTabs.searchTab().setSearchTreeBuilder((p_255439_) -> {
- this.m_231374_(SearchRegistry.f_119941_, p_255439_); - this.populateSearchTree(SearchRegistry.CREATIVE_NAMES, p_255439_);
- this.m_231374_(SearchRegistry.f_119942_, p_255439_); - this.populateSearchTree(SearchRegistry.CREATIVE_TAGS, p_255439_);
+ nameSearchKeys.forEach((tab, nameSearchKey) -> { + nameSearchKeys.forEach((tab, nameSearchKey) -> {
+ var tagSearchKey = tagSearchKeys.get(tab); + var tagSearchKey = tagSearchKeys.get(tab);
+ tab.m_257882_(contents -> { + tab.setSearchTreeBuilder(contents -> {
+ this.m_231374_(nameSearchKey, contents); + this.populateSearchTree(nameSearchKey, contents);
+ this.m_231374_(tagSearchKey, contents); + this.populateSearchTree(tagSearchKey, contents);
+ }); + });
}); });
} }
@@ -872,13 +_,13 @@ @@ -1019,10 +_,6 @@
Bootstrap.m_135875_(p_91333_.m_127526_()); LOGGER.error("setScreen called from non-game thread");
if (p_91333_.m_127527_() != null) {
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + p_91333_.m_127527_());
- System.exit(-1);
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-1);
} else if (p_91333_.m_127512_(file2)) {
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
- System.exit(-1);
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-1);
} else {
Bootstrap.m_135875_("#@?@# Game crashed! Crash report could not be saved. #@?@#");
- System.exit(-2);
+ net.minecraftforge.server.ServerLifecycleHooks.handleExit(-2);
} }
} - if (this.screen != null) {
@@ -1003,10 +_,6 @@ - this.screen.removed();
f_90982_.error("setScreen called from non-game thread");
}
- if (this.f_91080_ != null) {
- this.f_91080_.m_7861_();
- } - }
- -
if (p_91153_ == null && this.f_91073_ == null) { if (p_91153_ == null && this.level == null) {
p_91153_ = new TitleScreen(); p_91153_ = new TitleScreen();
} else if (p_91153_ == null && this.f_91074_.m_21224_()) { } else if (p_91153_ == null && this.player.isDeadOrDying()) {
@@ -1017,6 +_,19 @@ @@ -1033,6 +_,19 @@
} }
} }
+ net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this); + net.minecraftforge.client.ForgeHooksClient.clearGuiLayers(this);
+ Screen old = this.f_91080_; + Screen old = this.screen;
+ if (p_91153_ != null) { + if (p_91153_ != null) {
+ var event = net.minecraftforge.event.ForgeEventFactory.onScreenOpening(old, p_91153_); + var event = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenOpening(old, p_91153_);
+ if (event == null) return; + if (event == null) return;
+ p_91153_ = event; + p_91153_ = event;
+ } + }
+ +
+ if (old != null && p_91153_ != old) { + if (old != null && p_91153_ != old) {
+ net.minecraftforge.event.ForgeEventFactory.onScreenClose(old); + net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenClose(old);
+ old.m_7861_(); + old.removed();
+ } + }
+ +
this.f_91080_ = p_91153_; this.screen = p_91153_;
if (this.f_91080_ != null) { if (this.screen != null) {
this.f_91080_.m_274333_(); this.screen.added();
@@ -1163,9 +_,12 @@ @@ -1179,9 +_,12 @@
RenderSystem.enableCull(); RenderSystem.enableCull();
this.f_91026_.m_7238_(); this.profiler.pop();
if (!this.f_91079_) { if (!this.noRender) {
+ this.realPartialTick = this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_; // Cache this since pause is volatile + this.realPartialTick = this.pause ? this.pausePartialTick : this.timer.partialTick; // Cache this since pause is volatile
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.realPartialTick); + net.minecraftforge.event.ForgeEventFactory.onRenderTickStart(this.realPartialTick);
this.f_91026_.m_6182_("gameRenderer"); this.profiler.popPush("gameRenderer");
this.f_91063_.m_109093_(this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_, i, p_91384_); this.gameRenderer.render(this.pause ? this.pausePartialTick : this.timer.partialTick, i, p_91384_);
this.f_91026_.m_7238_(); this.profiler.pop();
+ net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.realPartialTick); + net.minecraftforge.event.ForgeEventFactory.onRenderTickEnd(this.realPartialTick);
} }
if (this.f_91056_ != null) { if (this.fpsPieResults != null) {
@@ -1286,10 +_,12 @@ @@ -1302,10 +_,12 @@
this.f_90990_.m_85378_((double)i); this.window.setGuiScale((double)i);
if (this.f_91080_ != null) { if (this.screen != null) {
this.f_91080_.m_6574_(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_()); this.screen.resize(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
+ net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_()); + net.minecraftforge.client.ForgeHooksClient.resizeGuiLayers(this, this.window.getGuiScaledWidth(), this.window.getGuiScaledHeight());
} }
RenderTarget rendertarget = this.m_91385_(); RenderTarget rendertarget = this.getMainRenderTarget();
rendertarget.m_83941_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_(), f_91002_); rendertarget.resize(this.window.getWidth(), this.window.getHeight(), ON_OSX);
+ if (this.f_91063_ != null) + if (this.gameRenderer != null)
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_()); this.gameRenderer.resize(this.window.getWidth(), this.window.getHeight());
this.f_91067_.m_91599_(); this.mouseHandler.setIgnoreFirstMove();
} }
@@ -1563,6 +_,7 @@ @@ -1579,6 +_,7 @@
} }
public void m_91395_() { public void stop() {
+ if (this.m_91396_()) net.minecraftforge.event.ForgeEventFactory.onGameShuttingDown(); + if (this.isRunning()) net.minecraftforge.event.ForgeEventFactory.onGameShuttingDown();
this.f_91019_ = false; this.running = false;
} }
@@ -1592,10 +_,18 @@ @@ -1608,10 +_,18 @@
if (p_91387_ && this.f_91077_ != null && this.f_91077_.m_6662_() == HitResult.Type.BLOCK) { if (p_91387_ && this.hitResult != null && this.hitResult.getType() == HitResult.Type.BLOCK) {
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_; BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
BlockPos blockpos = blockhitresult.m_82425_(); BlockPos blockpos = blockhitresult.getBlockPos();
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) { - if (!this.level.getBlockState(blockpos).isAir()) {
+ if (!this.f_91073_.m_46859_(blockpos)) { + if (!this.level.isEmptyBlock(blockpos)) {
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND); + var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
+ if (inputEvent.isCanceled()) { + if (inputEvent.isCanceled()) {
+ if (inputEvent.shouldSwingHand()) { + if (inputEvent.shouldSwingHand()) {
+ this.f_91061_.addBlockHitEffects(blockpos, blockhitresult); + this.particleEngine.addBlockHitEffects(blockpos, blockhitresult);
+ this.f_91074_.m_6674_(InteractionHand.MAIN_HAND); + this.player.swing(InteractionHand.MAIN_HAND);
+ } + }
+ return; + return;
+ } + }
Direction direction = blockhitresult.m_82434_(); Direction direction = blockhitresult.getDirection();
- if (this.f_91072_.m_105283_(blockpos, direction)) { - if (this.gameMode.continueDestroyBlock(blockpos, direction)) {
- this.f_91061_.m_107367_(blockpos, direction); - this.particleEngine.crack(blockpos, direction);
+ if (this.f_91072_.m_105283_(blockpos, direction) && inputEvent.shouldSwingHand()) { + if (this.gameMode.continueDestroyBlock(blockpos, direction) && inputEvent.shouldSwingHand()) {
+ this.f_91061_.addBlockHitEffects(blockpos, blockhitresult); + this.particleEngine.addBlockHitEffects(blockpos, blockhitresult);
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND); this.player.swing(InteractionHand.MAIN_HAND);
} }
} }
@@ -1624,6 +_,8 @@ @@ -1640,6 +_,8 @@
return false; return false;
} else { } else {
boolean flag = false; boolean flag = false;
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.f_91066_.f_92096_, InteractionHand.MAIN_HAND); + var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(0, this.options.keyAttack, InteractionHand.MAIN_HAND);
+ if (!inputEvent.isCanceled()) + if (!inputEvent.isCanceled())
switch (this.f_91077_.m_6662_()) { switch (this.hitResult.getType()) {
case ENTITY: case ENTITY:
this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_()); this.gameMode.attack(this.player, ((EntityHitResult)this.hitResult).getEntity());
@@ -1631,7 +_,7 @@ @@ -1647,7 +_,7 @@
case BLOCK: case BLOCK:
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_; BlockHitResult blockhitresult = (BlockHitResult)this.hitResult;
BlockPos blockpos = blockhitresult.m_82425_(); BlockPos blockpos = blockhitresult.getBlockPos();
- if (!this.f_91073_.m_8055_(blockpos).m_60795_()) { - if (!this.level.getBlockState(blockpos).isAir()) {
+ if (!this.f_91073_.m_46859_(blockpos)) { + if (!this.level.isEmptyBlock(blockpos)) {
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_()); this.gameMode.startDestroyBlock(blockpos, blockhitresult.getDirection());
if (this.f_91073_.m_8055_(blockpos).m_60795_()) { if (this.level.getBlockState(blockpos).isAir()) {
flag = true; flag = true;
@@ -1644,8 +_,10 @@ @@ -1660,8 +_,10 @@
} }
this.f_91074_.m_36334_(); this.player.resetAttackStrengthTicker();
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.f_91074_); + net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.player);
} }
+ if (inputEvent.shouldSwingHand()) + if (inputEvent.shouldSwingHand())
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND); this.player.swing(InteractionHand.MAIN_HAND);
return flag; return flag;
} }
@@ -1661,6 +_,11 @@ @@ -1677,6 +_,11 @@
} }
for(InteractionHand interactionhand : InteractionHand.values()) { for(InteractionHand interactionhand : InteractionHand.values()) {
+ var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.f_91066_.f_92095_, interactionhand); + var inputEvent = net.minecraftforge.client.ForgeHooksClient.onClickInput(1, this.options.keyUse, interactionhand);
+ if (inputEvent.isCanceled()) { + if (inputEvent.isCanceled()) {
+ if (inputEvent.shouldSwingHand()) this.f_91074_.m_6674_(interactionhand); + if (inputEvent.shouldSwingHand()) this.player.swing(interactionhand);
+ return; + return;
+ } + }
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand); ItemStack itemstack = this.player.getItemInHand(interactionhand);
if (!itemstack.m_246617_(this.f_91073_.m_246046_())) { if (!itemstack.isItemEnabled(this.level.enabledFeatures())) {
return; return;
@@ -1681,7 +_,7 @@ @@ -1697,7 +_,7 @@
} }
if (interactionresult.m_19077_()) { if (interactionresult.consumesAction()) {
- if (interactionresult.m_19080_()) { - if (interactionresult.shouldSwing()) {
+ if (interactionresult.m_19080_() && inputEvent.shouldSwingHand()) { + if (interactionresult.shouldSwing() && inputEvent.shouldSwingHand()) {
this.f_91074_.m_6674_(interactionhand); this.player.swing(interactionhand);
} }
@@ -1693,7 +_,7 @@ @@ -1709,7 +_,7 @@
int i = itemstack.m_41613_(); int i = itemstack.getCount();
InteractionResult interactionresult1 = this.f_91072_.m_233732_(this.f_91074_, interactionhand, blockhitresult); InteractionResult interactionresult1 = this.gameMode.useItemOn(this.player, interactionhand, blockhitresult);
if (interactionresult1.m_19077_()) { if (interactionresult1.consumesAction()) {
- if (interactionresult1.m_19080_()) { - if (interactionresult1.shouldSwing()) {
+ if (interactionresult1.m_19080_() && inputEvent.shouldSwingHand()) { + if (interactionresult1.shouldSwing() && inputEvent.shouldSwingHand()) {
this.f_91074_.m_6674_(interactionhand); this.player.swing(interactionhand);
if (!itemstack.m_41619_() && (itemstack.m_41613_() != i || this.f_91072_.m_105290_())) { if (!itemstack.isEmpty() && (itemstack.getCount() != i || this.gameMode.hasInfiniteItems())) {
this.f_91063_.f_109055_.m_109320_(interactionhand); this.gameRenderer.itemInHandRenderer.itemUsed(interactionhand);
@@ -1709,6 +_,9 @@ @@ -1725,6 +_,9 @@
} }
} }
+ if (itemstack.m_41619_() && (this.f_91077_ == null || this.f_91077_.m_6662_() == HitResult.Type.MISS)) + if (itemstack.isEmpty() && (this.hitResult == null || this.hitResult.getType() == HitResult.Type.MISS))
+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.f_91074_, interactionhand); + net.minecraftforge.common.ForgeHooks.onEmptyClick(this.player, interactionhand);
+ +
if (!itemstack.m_41619_()) { if (!itemstack.isEmpty()) {
InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand); InteractionResult interactionresult2 = this.gameMode.useItem(this.player, interactionhand);
if (interactionresult2.m_19077_()) { if (interactionresult2.consumesAction()) {
@@ -1735,6 +_,8 @@ @@ -1751,6 +_,8 @@
--this.f_91011_; --this.rightClickDelay;
} }
+ net.minecraftforge.event.ForgeEventFactory.onPreClientTick(); + net.minecraftforge.event.ForgeEventFactory.onPreClientTick();
+ +
this.f_91026_.m_6180_("gui"); this.profiler.push("gui");
this.f_240378_.m_240688_(); this.chatListener.tick();
this.f_91065_.m_193832_(this.f_91012_); this.gui.tick(this.pause);
@@ -1823,6 +_,7 @@ @@ -1839,6 +_,7 @@
this.f_91005_.m_120596_(); this.tutorial.tick();
+ net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.f_91073_, () -> true); + net.minecraftforge.event.ForgeEventFactory.onPreLevelTick(this.level, () -> true);
try { try {
this.f_91073_.m_104726_(() -> { this.level.tick(() -> {
return true; return true;
@@ -1838,6 +_,7 @@ @@ -1854,6 +_,7 @@
throw new ReportedException(crashreport); throw new ReportedException(crashreport);
} }
+ net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(this.f_91073_, () -> true); + net.minecraftforge.event.ForgeEventFactory.onPostLevelTick(this.level, () -> true);
} }
this.f_91026_.m_6182_("animateTick"); this.profiler.popPush("animateTick");
@@ -1857,6 +_,8 @@ @@ -1873,6 +_,8 @@
this.f_91026_.m_6182_("keyboard"); this.profiler.popPush("keyboard");
this.f_91068_.m_90931_(); this.keyboardHandler.tick();
this.f_91026_.m_7238_(); this.profiler.pop();
+ +
+ net.minecraftforge.event.ForgeEventFactory.onPostClientTick(); + net.minecraftforge.event.ForgeEventFactory.onPostClientTick();
} }
private boolean m_91278_() { private boolean isMultiplayerServer() {
@@ -2053,6 +_,7 @@ @@ -2069,6 +_,7 @@
} }
public void m_91156_(ClientLevel p_91157_) { public void setLevel(ClientLevel p_91157_) {
+ if (this.f_91073_ != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.f_91073_)); + if (this.level != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.level));
ProgressScreen progressscreen = new ProgressScreen(true); ProgressScreen progressscreen = new ProgressScreen(true);
progressscreen.m_6309_(Component.m_237115_("connect.joining")); progressscreen.progressStartNoAbort(Component.translatable("connect.joining"));
this.m_91362_(progressscreen); this.updateScreenAndTick(progressscreen);
@@ -2086,10 +_,12 @@ @@ -2102,10 +_,12 @@
IntegratedServer integratedserver = this.f_91007_; IntegratedServer integratedserver = this.singleplayerServer;
this.f_91007_ = null; this.singleplayerServer = null;
this.f_91063_.m_109150_(); this.gameRenderer.resetData();
+ net.minecraftforge.client.ForgeHooksClient.firePlayerLogout(this.f_91072_, this.f_91074_); + net.minecraftforge.client.ForgeHooksClient.firePlayerLogout(this.gameMode, this.player);
this.f_91072_ = null; this.gameMode = null;
this.f_240365_.m_93328_(); this.narrator.clear();
this.m_91362_(p_91321_); this.updateScreenAndTick(p_91321_);
if (this.f_91073_ != null) { if (this.level != null) {
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.f_91073_)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.level));
if (integratedserver != null) { if (integratedserver != null) {
this.f_91026_.m_6180_("waitForServer"); this.profiler.push("waitForServer");
@@ -2103,6 +_,7 @@ @@ -2119,6 +_,7 @@
this.f_243981_.m_246151_(); this.downloadedPackSource.clearServerPack();
this.f_91065_.m_93089_(); this.gui.onDisconnected();
this.f_91010_ = false; this.isLocalServer = false;
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(this.f_91073_); + net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(this.level);
} }
this.f_91073_ = null; this.level = null;
@@ -2227,6 +_,7 @@ @@ -2243,6 +_,7 @@
private void m_91280_() { private void pickBlock() {
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) { if (this.hitResult != null && this.hitResult.getType() != HitResult.Type.MISS) {
+ if (net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.f_91066_.f_92097_, InteractionHand.MAIN_HAND).isCanceled()) return; + if (net.minecraftforge.client.ForgeHooksClient.onClickInput(2, this.options.keyPickItem, InteractionHand.MAIN_HAND).isCanceled()) return;
boolean flag = this.f_91074_.m_150110_().f_35937_; boolean flag = this.player.getAbilities().instabuild;
BlockEntity blockentity = null; BlockEntity blockentity = null;
HitResult.Type hitresult$type = this.f_91077_.m_6662_(); HitResult.Type hitresult$type = this.hitResult.getType();
@@ -2239,10 +_,7 @@ @@ -2255,10 +_,7 @@
} }
Block block = blockstate.m_60734_(); Block block = blockstate.getBlock();
- itemstack = block.m_7397_(this.f_91073_, blockpos, blockstate); - itemstack = block.getCloneItemStack(this.level, blockpos, blockstate);
- if (itemstack.m_41619_()) { - if (itemstack.isEmpty()) {
- return; - return;
- } - }
+ itemstack = blockstate.getCloneItemStack(this.f_91077_, this.f_91073_, blockpos, this.f_91074_); + itemstack = blockstate.getCloneItemStack(this.hitResult, this.level, blockpos, this.player);
if (flag && Screen.m_96637_() && blockstate.m_155947_()) { if (flag && Screen.hasControlDown() && blockstate.hasBlockEntity()) {
blockentity = this.f_91073_.m_7702_(blockpos); blockentity = this.level.getBlockEntity(blockpos);
@@ -2253,7 +_,7 @@ @@ -2269,7 +_,7 @@
} }
Entity entity = ((EntityHitResult)this.f_91077_).m_82443_(); Entity entity = ((EntityHitResult)this.hitResult).getEntity();
- itemstack = entity.m_142340_(); - itemstack = entity.getPickResult();
+ itemstack = entity.getPickedResult(this.f_91077_); + itemstack = entity.getPickedResult(this.hitResult);
if (itemstack == null) { if (itemstack == null) {
return; return;
} }
@@ -2788,6 +_,19 @@ @@ -2808,6 +_,19 @@
public void m_91312_(int p_91313_) { public void updateMaxMipLevel(int p_91313_) {
this.f_91051_.m_119410_(p_91313_); this.modelManager.updateMaxMipLevel(p_91313_);
+ } + }
+ +
+ public ItemColors getItemColors() { + public ItemColors getItemColors() {
+ return this.f_91041_; + return this.itemColors;
+ } + }
+ +
+ public SearchRegistry getSearchTreeManager() { + public SearchRegistry getSearchTreeManager() {
+ return this.f_90997_; + return this.searchRegistry;
+ } + }
+ +
+ private float realPartialTick; + private float realPartialTick;
@@ -434,4 +423,4 @@
+ return this.realPartialTick; + return this.realPartialTick;
} }
public EntityModelSet m_167973_() { public EntityModelSet getEntityModels() {
@@ -1,31 +1,31 @@
--- a/net/minecraft/client/MouseHandler.java --- a/net/minecraft/client/MouseHandler.java
+++ b/net/minecraft/client/MouseHandler.java +++ b/net/minecraft/client/MouseHandler.java
@@ -74,6 +_,7 @@ @@ -74,6 +_,7 @@
this.f_91510_ = -1; this.activeButton = -1;
} }
+ if (net.minecraftforge.event.ForgeEventFactory.onMouseButtonPre(p_91532_, p_91533_, p_91534_)) return; + if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPre(p_91532_, p_91533_, p_91534_)) return;
boolean[] aboolean = new boolean[]{false}; boolean[] aboolean = new boolean[]{false};
if (this.f_91503_.m_91265_() == null) { if (this.minecraft.getOverlay() == null) {
if (this.f_91503_.f_91080_ == null) { if (this.minecraft.screen == null) {
@@ -87,11 +_,19 @@ @@ -87,11 +_,19 @@
if (flag) { if (flag) {
screen.m_169415_(); screen.afterMouseAction();
Screen.m_96579_(() -> { Screen.wrapScreenError(() -> {
- aboolean[0] = screen.m_6375_(d0, d1, i); - aboolean[0] = screen.mouseClicked(d0, d1, i);
+ aboolean[0] = net.minecraftforge.event.ForgeEventFactory.onScreenMouseClickedPre(screen, d0, d1, i); + aboolean[0] = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClickedPre(screen, d0, d1, i);
+ if (!aboolean[0]) { + if (!aboolean[0]) {
+ aboolean[0] = this.f_91503_.f_91080_.m_6375_(d0, d1, i); + aboolean[0] = this.minecraft.screen.mouseClicked(d0, d1, i);
+ aboolean[0] = net.minecraftforge.event.ForgeEventFactory.onScreenMouseClickedPost(screen, d0, d1, i, aboolean[0]); + aboolean[0] = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClickedPost(screen, d0, d1, i, aboolean[0]);
+ } + }
}, "mouseClicked event handler", screen.getClass().getCanonicalName()); }, "mouseClicked event handler", screen.getClass().getCanonicalName());
} else { } else {
Screen.m_96579_(() -> { Screen.wrapScreenError(() -> {
- aboolean[0] = screen.m_6348_(d0, d1, i); - aboolean[0] = screen.mouseReleased(d0, d1, i);
+ aboolean[0] = net.minecraftforge.event.ForgeEventFactory.onScreenMouseReleasedPre(screen, d0, d1, i); + aboolean[0] = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleasedPre(screen, d0, d1, i);
+ if (!aboolean[0]) { + if (!aboolean[0]) {
+ aboolean[0] = this.f_91503_.f_91080_.m_6348_(d0, d1, i); + aboolean[0] = this.minecraft.screen.mouseReleased(d0, d1, i);
+ aboolean[0] = net.minecraftforge.event.ForgeEventFactory.onScreenMouseReleasedPost(screen, d0, d1, i, aboolean[0]); + aboolean[0] = net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleasedPost(screen, d0, d1, i, aboolean[0]);
+ } + }
}, "mouseReleased event handler", screen.getClass().getCanonicalName()); }, "mouseReleased event handler", screen.getClass().getCanonicalName());
} }
@@ -34,53 +34,53 @@
} }
} }
+ net.minecraftforge.event.ForgeEventFactory.onMouseButtonPost(p_91532_, p_91533_, p_91534_); + net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPost(p_91532_, p_91533_, p_91534_);
} }
} }
@@ -129,8 +_,10 @@ @@ -129,8 +_,10 @@
if (this.f_91503_.f_91080_ != null) { if (this.minecraft.screen != null) {
double d3 = this.f_91507_ * (double)this.f_91503_.m_91268_().m_85445_() / (double)this.f_91503_.m_91268_().m_85443_(); double d3 = this.xpos * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
double d4 = this.f_91508_ * (double)this.f_91503_.m_91268_().m_85446_() / (double)this.f_91503_.m_91268_().m_85444_(); double d4 = this.ypos * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
- this.f_91503_.f_91080_.m_6050_(d3, d4, d1, d2); - this.minecraft.screen.mouseScrolled(d3, d4, d1, d2);
this.f_91503_.f_91080_.m_169415_(); this.minecraft.screen.afterMouseAction();
+ if (net.minecraftforge.event.ForgeEventFactory.onScreenMouseScrollPre(this.f_91503_.f_91080_, d3, d4, d1, d2)) return; + if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPre(this.minecraft.screen, d3, d4, d1, d2)) return;
+ if (this.f_91503_.f_91080_.m_6050_(d3, d4, d1, d2)) return; + if (this.minecraft.screen.mouseScrolled(d3, d4, d1, d2)) return;
+ net.minecraftforge.event.ForgeEventFactory.onScreenMouseScrollPost(this.f_91503_.f_91080_, d3, d4, d1, d2); + net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPost(this.minecraft.screen, d3, d4, d1, d2);
} else if (this.f_91503_.f_91074_ != null) { } else if (this.minecraft.player != null) {
if (this.f_291070_ != 0.0D && Math.signum(d1) != Math.signum(this.f_291070_)) { if (this.accumulatedScrollX != 0.0D && Math.signum(d1) != Math.signum(this.accumulatedScrollX)) {
this.f_291070_ = 0.0D; this.accumulatedScrollX = 0.0D;
@@ -151,6 +_,7 @@ @@ -151,6 +_,7 @@
this.f_291070_ -= (double)j; this.accumulatedScrollX -= (double)j;
this.f_291867_ -= (double)i; this.accumulatedScrollY -= (double)i;
int k = i == 0 ? -j : i; int k = i == 0 ? -j : i;
+ if (net.minecraftforge.event.ForgeEventFactory.onMouseScroll(this, d1, d2)) return; + if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseScroll(this, d1, d2)) return;
if (this.f_91503_.f_91074_.m_5833_()) { if (this.minecraft.player.isSpectator()) {
if (this.f_91503_.f_91065_.m_93085_().m_94768_()) { if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
this.f_91503_.f_91065_.m_93085_().m_205380_(-k); this.minecraft.gui.getSpectatorGui().onMouseScrolled(-k);
@@ -219,7 +_,9 @@ @@ -219,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 d2 = (p_91563_ - this.xpos) * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
double d3 = (p_91564_ - this.f_91508_) * (double)this.f_91503_.m_91268_().m_85446_() / (double)this.f_91503_.m_91268_().m_85444_(); double d3 = (p_91564_ - this.ypos) * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
Screen.m_96579_(() -> { Screen.wrapScreenError(() -> {
- screen.m_7979_(d0, d1, this.f_91510_, d2, d3); - screen.mouseDragged(d0, d1, this.activeButton, d2, d3);
+ if (net.minecraftforge.event.ForgeEventFactory.onScreenMouseDragPre(screen, d0, d1, this.f_91510_, d2, d3)) return; + if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseDragPre(screen, d0, d1, this.activeButton, d2, d3)) return;
+ if (screen.m_7979_(d0, d1, this.f_91510_, d2, d3)) return; + if (screen.mouseDragged(d0, d1, this.activeButton, d2, d3)) return;
+ net.minecraftforge.event.ForgeEventFactory.onScreenMouseDragPost(screen, d0, d1, this.f_91510_, d2, d3); + net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseDragPost(screen, d0, d1, this.activeButton, d2, d3);
}, "mouseDragged event handler", screen.getClass().getCanonicalName()); }, "mouseDragged event handler", screen.getClass().getCanonicalName());
} }
@@ -302,6 +_,14 @@ @@ -302,6 +_,14 @@
public double m_91594_() { public double ypos() {
return this.f_91508_; return this.ypos;
+ } + }
+ +
+ public double getXVelocity() { + public double getXVelocity() {
+ return this.f_91516_; + return this.accumulatedDX;
+ } + }
+ +
+ public double getYVelocity() { + public double getYVelocity() {
+ return this.f_91517_; + return this.accumulatedDY;
} }
public void m_91599_() { public void setIgnoreFirstMove() {
@@ -2,25 +2,25 @@
+++ b/net/minecraft/client/Options.java +++ b/net/minecraft/client/Options.java
@@ -507,7 +_,8 @@ @@ -507,7 +_,8 @@
}, new OptionInstance.LazyEnum<>(() -> { }, new OptionInstance.LazyEnum<>(() -> {
return Stream.concat(Stream.of(""), Minecraft.m_91087_().m_91106_().m_194525_().stream()).toList(); return Stream.concat(Stream.of(""), Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().stream()).toList();
}, (p_232011_) -> { }, (p_232011_) -> {
- return Minecraft.m_91087_().m_91396_() && p_232011_ != "" && !Minecraft.m_91087_().m_91106_().m_194525_().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_); - return Minecraft.getInstance().isRunning() && p_232011_ != "" && !Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_);
+ // FORGE: fix incorrect string comparison - PR #8767 + // FORGE: fix incorrect string comparison - PR #8767
+ return Minecraft.m_91087_().m_91396_() && (p_232011_ == null || !p_232011_.isEmpty()) && !Minecraft.m_91087_().m_91106_().m_194525_().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_); + return Minecraft.getInstance().isRunning() && (p_232011_ == null || !p_232011_.isEmpty()) && !Minecraft.getInstance().getSoundManager().getAvailableSoundDevices().contains(p_232011_) ? Optional.empty() : Optional.of(p_232011_);
}, Codec.STRING), "", (p_299350_) -> { }, Codec.STRING), "", (p_299350_) -> {
SoundManager soundmanager = Minecraft.m_91087_().m_91106_(); SoundManager soundmanager = Minecraft.getInstance().getSoundManager();
soundmanager.m_194526_(); soundmanager.reload();
@@ -835,6 +_,7 @@ @@ -835,6 +_,7 @@
} }
public Options(Minecraft p_92138_, File p_92139_) { public Options(Minecraft p_92138_, File p_92139_) {
+ setForgeKeybindProperties(); + setForgeKeybindProperties();
this.f_92060_ = p_92138_; this.minecraft = p_92138_;
this.f_92110_ = new File(p_92139_, "options.txt"); this.optionsFile = new File(p_92139_, "options.txt");
boolean flag = p_92138_.m_91103_(); boolean flag = p_92138_.is64Bit();
@@ -957,11 +_,21 @@ @@ -957,11 +_,21 @@
p_168428_.m_213982_("telemetryOptInExtra", this.f_260461_); p_168428_.process("telemetryOptInExtra", this.telemetryOptInExtra);
this.f_263744_ = p_168428_.m_142682_("onboardAccessibility", this.f_263744_); this.onboardAccessibility = p_168428_.process("onboardAccessibility", this.onboardAccessibility);
+ net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.processOptions(p_168428_); + net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.processOptions(p_168428_);
+ processOptionsForge(p_168428_); + processOptionsForge(p_168428_);
@@ -28,69 +28,69 @@
+ // FORGE: split off to allow reloading options after mod loading is done + // FORGE: split off to allow reloading options after mod loading is done
+ private void processOptionsForge(Options.FieldAccess p_168428_) + private void processOptionsForge(Options.FieldAccess p_168428_)
+ { + {
for(KeyMapping keymapping : this.f_92059_) { for(KeyMapping keymapping : this.keyMappings) {
- String s = keymapping.m_90865_(); - String s = keymapping.saveString();
+ String s = keymapping.m_90865_() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : ""); + String s = keymapping.saveString() + (keymapping.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keymapping.getKeyModifier() : "");
String s1 = p_168428_.m_141943_("key_" + keymapping.m_90860_(), s); String s1 = p_168428_.process("key_" + keymapping.getName(), s);
if (!s.equals(s1)) { if (!s.equals(s1)) {
- keymapping.m_90848_(InputConstants.m_84851_(s1)); - keymapping.setKey(InputConstants.getKey(s1));
+ if (s1.indexOf(':') != -1) { + if (s1.indexOf(':') != -1) {
+ String[] pts = s1.split(":"); + String[] pts = s1.split(":");
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputConstants.m_84851_(pts[0])); + keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputConstants.getKey(pts[0]));
+ } else + } else
+ keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputConstants.m_84851_(s1)); + keymapping.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputConstants.getKey(s1));
} }
} }
@@ -980,6 +_,9 @@ @@ -980,6 +_,9 @@
} }
public void m_92140_() { public void load() {
+ this.load(false); + this.load(false);
+ } + }
+ public void load(boolean limited) { + public void load(boolean limited) {
try { try {
if (!this.f_92110_.exists()) { if (!this.optionsFile.exists()) {
return; return;
@@ -1008,7 +_,8 @@ @@ -1008,7 +_,8 @@
} }
} }
- this.m_168427_(new Options.FieldAccess() { - this.processOptions(new Options.FieldAccess() {
+ java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsForge : this::m_168427_; + java.util.function.Consumer<FieldAccess> processor = limited ? this::processOptionsForge : this::processOptions;
+ processor.accept(new Options.FieldAccess() { + processor.accept(new Options.FieldAccess() {
@Nullable @Nullable
private String m_168458_(String p_168459_) { private String getValueOrNull(String p_168459_) {
return compoundtag1.m_128441_(p_168459_) ? compoundtag1.m_128461_(p_168459_) : null; return compoundtag1.contains(p_168459_) ? compoundtag1.getString(p_168459_) : null;
@@ -1181,6 +_,7 @@ @@ -1181,6 +_,7 @@
} }
public void m_92172_() { public void broadcastOptions() {
+ if (net.minecraftforge.client.loading.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted. + if (net.minecraftforge.client.loading.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
if (this.f_92060_.f_91074_ != null) { if (this.minecraft.player != null) {
this.f_92060_.f_91074_.f_108617_.m_295327_(new ServerboundClientInformationPacket(this.m_294596_())); this.minecraft.player.connection.send(new ServerboundClientInformationPacket(this.buildPlayerInformation()));
} }
@@ -1239,6 +_,23 @@ @@ -1239,6 +_,23 @@
} }
p_92146_.m_10509_(set); p_92146_.setSelected(set);
+ } + }
+ +
+ private void setForgeKeybindProperties() { + private void setForgeKeybindProperties() {
+ net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME; + net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME;
+ f_92085_.setKeyConflictContext(inGame); + keyUp.setKeyConflictContext(inGame);
+ f_92086_.setKeyConflictContext(inGame); + keyLeft.setKeyConflictContext(inGame);
+ f_92087_.setKeyConflictContext(inGame); + keyDown.setKeyConflictContext(inGame);
+ f_92088_.setKeyConflictContext(inGame); + keyRight.setKeyConflictContext(inGame);
+ f_92089_.setKeyConflictContext(inGame); + keyJump.setKeyConflictContext(inGame);
+ f_92090_.setKeyConflictContext(inGame); + keyShift.setKeyConflictContext(inGame);
+ f_92091_.setKeyConflictContext(inGame); + keySprint.setKeyConflictContext(inGame);
+ f_92096_.setKeyConflictContext(inGame); + keyAttack.setKeyConflictContext(inGame);
+ f_92098_.setKeyConflictContext(inGame); + keyChat.setKeyConflictContext(inGame);
+ f_92099_.setKeyConflictContext(inGame); + keyPlayerList.setKeyConflictContext(inGame);
+ f_92100_.setKeyConflictContext(inGame); + keyCommand.setKeyConflictContext(inGame);
+ f_92103_.setKeyConflictContext(inGame); + keyTogglePerspective.setKeyConflictContext(inGame);
+ f_92104_.setKeyConflictContext(inGame); + keySmoothCamera.setKeyConflictContext(inGame);
} }
public CameraType m_92176_() { public CameraType getCameraType() {
@@ -6,20 +6,20 @@
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
-public enum RecipeBookCategories { -public enum RecipeBookCategories {
+public enum RecipeBookCategories implements net.minecraftforge.common.IExtensibleEnum { +public enum RecipeBookCategories implements net.minecraftforge.common.IExtensibleEnum {
CRAFTING_SEARCH(new ItemStack(Items.f_42522_)), CRAFTING_SEARCH(new ItemStack(Items.COMPASS)),
CRAFTING_BUILDING_BLOCKS(new ItemStack(Blocks.f_50076_)), CRAFTING_BUILDING_BLOCKS(new ItemStack(Blocks.BRICKS)),
CRAFTING_REDSTONE(new ItemStack(Items.f_42451_)), CRAFTING_REDSTONE(new ItemStack(Items.REDSTONE)),
@@ -36,7 +_,7 @@ @@ -36,7 +_,7 @@
public static final List<RecipeBookCategories> f_92257_ = ImmutableList.of(BLAST_FURNACE_SEARCH, BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC); public static final List<RecipeBookCategories> BLAST_FURNACE_CATEGORIES = ImmutableList.of(BLAST_FURNACE_SEARCH, BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC);
public static final List<RecipeBookCategories> f_92258_ = ImmutableList.of(FURNACE_SEARCH, FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC); public static final List<RecipeBookCategories> FURNACE_CATEGORIES = ImmutableList.of(FURNACE_SEARCH, FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC);
public static final List<RecipeBookCategories> f_92259_ = ImmutableList.of(CRAFTING_SEARCH, CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE); public static final List<RecipeBookCategories> CRAFTING_CATEGORIES = ImmutableList.of(CRAFTING_SEARCH, CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE);
- public static final Map<RecipeBookCategories, List<RecipeBookCategories>> f_92260_ = ImmutableMap.of(CRAFTING_SEARCH, ImmutableList.of(CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE), FURNACE_SEARCH, ImmutableList.of(FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC), BLAST_FURNACE_SEARCH, ImmutableList.of(BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC), SMOKER_SEARCH, ImmutableList.of(SMOKER_FOOD)); - public static final Map<RecipeBookCategories, List<RecipeBookCategories>> AGGREGATE_CATEGORIES = ImmutableMap.of(CRAFTING_SEARCH, ImmutableList.of(CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE), FURNACE_SEARCH, ImmutableList.of(FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC), BLAST_FURNACE_SEARCH, ImmutableList.of(BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC), SMOKER_SEARCH, ImmutableList.of(SMOKER_FOOD));
+ public static final Map<RecipeBookCategories, List<RecipeBookCategories>> f_92260_ = net.minecraftforge.client.RecipeBookManager.getAggregateCategories(); + public static final Map<RecipeBookCategories, List<RecipeBookCategories>> AGGREGATE_CATEGORIES = net.minecraftforge.client.RecipeBookManager.getAggregateCategories();
private final List<ItemStack> f_92261_; private final List<ItemStack> itemIcons;
private RecipeBookCategories(ItemStack... p_92267_) { private RecipeBookCategories(ItemStack... p_92267_) {
@@ -59,7 +_,7 @@ @@ -59,7 +_,7 @@
list = f_92256_; list = SMOKER_CATEGORIES;
break; break;
default: default:
- throw new IncompatibleClassChangeError(); - throw new IncompatibleClassChangeError();
@@ -29,8 +29,8 @@
return list; return list;
@@ -67,5 +_,9 @@ @@ -67,5 +_,9 @@
public List<ItemStack> m_92268_() { public List<ItemStack> getIconItems() {
return this.f_92261_; return this.itemIcons;
+ } + }
+ +
+ public static RecipeBookCategories create(String name, ItemStack... icons) { + public static RecipeBookCategories create(String name, ItemStack... icons) {
@@ -11,19 +11,19 @@
+ } + }
+ final File target = event.getScreenshotFile(); + final File target = event.getScreenshotFile();
+ +
Util.m_183992_().execute(() -> { Util.ioPool().execute(() -> {
try { try {
- nativeimage.m_85056_(file2); - nativeimage.writeToFile(file2);
+ nativeimage.m_85056_(target); + nativeimage.writeToFile(target);
Component component = Component.m_237113_(file2.getName()).m_130940_(ChatFormatting.UNDERLINE).m_130938_((p_168608_) -> { Component component = Component.literal(file2.getName()).withStyle(ChatFormatting.UNDERLINE).withStyle((p_168608_) -> {
- return p_168608_.m_131142_(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath())); - return p_168608_.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath()));
+ return p_168608_.m_131142_(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath())); + return p_168608_.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, target.getAbsolutePath()));
}); });
- p_92311_.accept(Component.m_237110_("screenshot.success", component)); - p_92311_.accept(Component.translatable("screenshot.success", component));
+ if (event.getResultMessage() != null) + if (event.getResultMessage() != null)
+ p_92311_.accept(event.getResultMessage()); + p_92311_.accept(event.getResultMessage());
+ else + else
+ p_92311_.accept(Component.m_237110_("screenshot.success", component)); + p_92311_.accept(Component.translatable("screenshot.success", component));
} catch (Exception exception) { } catch (Exception exception) {
f_92276_.warn("Couldn't save screenshot", (Throwable)exception); LOGGER.warn("Couldn't save screenshot", (Throwable)exception);
p_92311_.accept(Component.m_237110_("screenshot.failure", exception.getMessage())); p_92311_.accept(Component.translatable("screenshot.failure", exception.getMessage()));
@@ -2,18 +2,18 @@
+++ b/net/minecraft/client/ToggleKeyMapping.java +++ b/net/minecraft/client/ToggleKeyMapping.java
@@ -16,7 +_,7 @@ @@ -16,7 +_,7 @@
public void m_7249_(boolean p_92534_) { public void setDown(boolean p_92534_) {
if (this.f_92527_.getAsBoolean()) { if (this.needsToggle.getAsBoolean()) {
- if (p_92534_) { - if (p_92534_) {
+ if (p_92534_ && isConflictContextAndModifierActive()) { + if (p_92534_ && isConflictContextAndModifierActive()) {
super.m_7249_(!this.m_90857_()); super.setDown(!this.isDown());
} }
} else { } else {
@@ -24,6 +_,7 @@ @@ -24,6 +_,7 @@
} }
} }
+ @Override public boolean m_90857_() { return this.f_90817_ && (isConflictContextAndModifierActive() || f_92527_.getAsBoolean()); } + @Override public boolean isDown() { return this.isDown && (isConflictContextAndModifierActive() || needsToggle.getAsBoolean()); }
protected void m_289748_() { protected void reset() {
super.m_7249_(false); super.setDown(false);
@@ -3,42 +3,42 @@
@@ -28,7 +_,8 @@ @@ -28,7 +_,8 @@
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class BlockColors { public class BlockColors {
private static final int f_168640_ = -1; private static final int DEFAULT = -1;
- private final IdMapper<BlockColor> f_92571_ = new IdMapper<>(32); - private final IdMapper<BlockColor> blockColors = new IdMapper<>(32);
+ // FORGE: Use registry delegate as non-Vanilla block ids are not constant + // FORGE: Use registry delegate as non-Vanilla block ids are not constant
+ private final java.util.Map<net.minecraft.core.Holder.Reference<Block>, BlockColor> f_92571_ = new java.util.HashMap<>(); + private final java.util.Map<net.minecraft.core.Holder.Reference<Block>, BlockColor> blockColors = new java.util.HashMap<>();
private final Map<Block, Set<Property<?>>> f_92572_ = Maps.newHashMap(); private final Map<Block, Set<Property<?>>> coloringStates = Maps.newHashMap();
public static BlockColors m_92574_() { public static BlockColors createDefault() {
@@ -80,11 +_,12 @@ @@ -80,11 +_,12 @@
blockcolors.m_92589_((p_92596_, p_92597_, p_92598_, p_92599_) -> { blockcolors.register((p_92596_, p_92597_, p_92598_, p_92599_) -> {
return p_92597_ != null && p_92598_ != null ? 2129968 : 7455580; return p_92597_ != null && p_92598_ != null ? 2129968 : 7455580;
}, Blocks.f_50196_); }, Blocks.LILY_PAD);
+ net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(blockcolors); + net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(blockcolors);
return blockcolors; return blockcolors;
} }
public int m_92582_(BlockState p_92583_, Level p_92584_, BlockPos p_92585_) { public int getColor(BlockState p_92583_, Level p_92584_, BlockPos p_92585_) {
- BlockColor blockcolor = this.f_92571_.m_7942_(BuiltInRegistries.f_256975_.m_7447_(p_92583_.m_60734_())); - BlockColor blockcolor = this.blockColors.byId(BuiltInRegistries.BLOCK.getId(p_92583_.getBlock()));
+ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92583_.m_60734_())); + BlockColor blockcolor = this.blockColors.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92583_.getBlock()));
if (blockcolor != null) { if (blockcolor != null) {
return blockcolor.m_92566_(p_92583_, (BlockAndTintGetter)null, (BlockPos)null, 0); return blockcolor.getColor(p_92583_, (BlockAndTintGetter)null, (BlockPos)null, 0);
} else { } else {
@@ -94,13 +_,15 @@ @@ -94,13 +_,15 @@
} }
public int m_92577_(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) { public int getColor(BlockState p_92578_, @Nullable BlockAndTintGetter p_92579_, @Nullable BlockPos p_92580_, int p_92581_) {
- BlockColor blockcolor = this.f_92571_.m_7942_(BuiltInRegistries.f_256975_.m_7447_(p_92578_.m_60734_())); - BlockColor blockcolor = this.blockColors.byId(BuiltInRegistries.BLOCK.getId(p_92578_.getBlock()));
+ BlockColor blockcolor = this.f_92571_.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92578_.m_60734_())); + BlockColor blockcolor = this.blockColors.get(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(p_92578_.getBlock()));
return blockcolor == null ? -1 : blockcolor.m_92566_(p_92578_, p_92579_, p_92580_, p_92581_); return blockcolor == null ? -1 : blockcolor.getColor(p_92578_, p_92579_, p_92580_, p_92581_);
} }
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Block} */ + /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Block} */
+ @Deprecated + @Deprecated
public void m_92589_(BlockColor p_92590_, Block... p_92591_) { public void register(BlockColor p_92590_, Block... p_92591_) {
for(Block block : p_92591_) { for(Block block : p_92591_) {
- this.f_92571_.m_122664_(p_92590_, BuiltInRegistries.f_256975_.m_7447_(block)); - this.blockColors.addMapping(p_92590_, BuiltInRegistries.BLOCK.getId(block));
+ this.f_92571_.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), p_92590_); + this.blockColors.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), p_92590_);
} }
} }
@@ -3,33 +3,33 @@
@@ -25,7 +_,8 @@ @@ -25,7 +_,8 @@
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public class ItemColors { public class ItemColors {
private static final int f_168642_ = -1; private static final int DEFAULT = -1;
- private final IdMapper<ItemColor> f_92674_ = new IdMapper<>(32); - private final IdMapper<ItemColor> itemColors = new IdMapper<>(32);
+ // FORGE: Use registry delegate as non-Vanilla item ids are not constant + // FORGE: Use registry delegate as non-Vanilla item ids are not constant
+ private final java.util.Map<net.minecraft.core.Holder.Reference<Item>, ItemColor> f_92674_ = new java.util.HashMap<>(); + private final java.util.Map<net.minecraft.core.Holder.Reference<Item>, ItemColor> itemColors = new java.util.HashMap<>();
public static ItemColors m_92683_(BlockColors p_92684_) { public static ItemColors createDefault(BlockColors p_92684_) {
ItemColors itemcolors = new ItemColors(); ItemColors itemcolors = new ItemColors();
@@ -88,17 +_,20 @@ @@ -88,17 +_,20 @@
itemcolors.m_92689_((p_232352_, p_232353_) -> { itemcolors.register((p_232352_, p_232353_) -> {
return p_232353_ == 0 ? -1 : MapItem.m_42918_(p_232352_); return p_232353_ == 0 ? -1 : MapItem.getColor(p_232352_);
}, Items.f_42573_); }, Items.FILLED_MAP);
+ net.minecraftforge.client.ForgeHooksClient.onItemColorsInit(itemcolors, p_92684_); + net.minecraftforge.client.ForgeHooksClient.onItemColorsInit(itemcolors, p_92684_);
return itemcolors; return itemcolors;
} }
public int m_92676_(ItemStack p_92677_, int p_92678_) { public int getColor(ItemStack p_92677_, int p_92678_) {
- ItemColor itemcolor = this.f_92674_.m_7942_(BuiltInRegistries.f_257033_.m_7447_(p_92677_.m_41720_())); - ItemColor itemcolor = this.itemColors.byId(BuiltInRegistries.ITEM.getId(p_92677_.getItem()));
+ ItemColor itemcolor = this.f_92674_.get(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(p_92677_.m_41720_())); + ItemColor itemcolor = this.itemColors.get(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(p_92677_.getItem()));
return itemcolor == null ? -1 : itemcolor.m_92671_(p_92677_, p_92678_); return itemcolor == null ? -1 : itemcolor.getColor(p_92677_, p_92678_);
} }
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Item} */ + /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterColorHandlersEvent.Item} */
+ @Deprecated + @Deprecated
public void m_92689_(ItemColor p_92690_, ItemLike... p_92691_) { public void register(ItemColor p_92690_, ItemLike... p_92691_) {
for(ItemLike itemlike : p_92691_) { for(ItemLike itemlike : p_92691_) {
- this.f_92674_.m_122664_(p_92690_, Item.m_41393_(itemlike.m_5456_())); - this.itemColors.addMapping(p_92690_, Item.getId(itemlike.asItem()));
+ this.f_92674_.put(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(itemlike.m_5456_()), p_92690_); + this.itemColors.put(net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(itemlike.asItem()), p_92690_);
} }
} }
@@ -6,12 +6,12 @@
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
-public class Font { -public class Font {
+public class Font implements net.minecraftforge.client.extensions.IForgeFont { +public class Font implements net.minecraftforge.client.extensions.IForgeFont {
private static final float f_168643_ = 0.01F; private static final float EFFECT_DEPTH = 0.01F;
private static final Vector3f f_92712_ = new Vector3f(0.0F, 0.0F, 0.03F); private static final Vector3f SHADOW_OFFSET = new Vector3f(0.0F, 0.0F, 0.03F);
public static final int f_193827_ = 8; public static final int ALPHA_CUTOFF = 8;
@@ -202,6 +_,8 @@ @@ -202,6 +_,8 @@
public StringSplitter m_92865_() { public StringSplitter getSplitter() {
return this.f_92714_; return this.splitter;
} }
+ +
+ @Override public Font self() { return this; } + @Override public Font self() { return this; }
@@ -1,68 +1,77 @@
--- a/net/minecraft/client/gui/Gui.java --- a/net/minecraft/client/gui/Gui.java
+++ b/net/minecraft/client/gui/Gui.java +++ b/net/minecraft/client/gui/Gui.java
@@ -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 @@ @@ -453,6 +_,8 @@
for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) { for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
MobEffect mobeffect = mobeffectinstance.m_19544_(); MobEffect mobeffect = mobeffectinstance.getEffect();
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance); + var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (!renderer.isVisibleInGui(mobeffectinstance)) continue; + if (!renderer.isVisibleInGui(mobeffectinstance)) continue;
if (mobeffectinstance.m_19575_()) { if (mobeffectinstance.showIcon()) {
int i = this.f_92977_; int i = this.screenWidth;
int j = 1; int j = 1;
@@ -481,6 +_,7 @@ @@ -481,6 +_,7 @@
} }
} }
+ if (renderer.renderGuiIcon(mobeffectinstance, this, p_282812_, i, j, 0, f)) continue; + if (renderer.renderGuiIcon(mobeffectinstance, this, p_282812_, i, j, 0, f)) continue;
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect); TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(mobeffect);
int i1 = j; int i1 = j;
float f1 = f; float f1 = f;
@@ -601,16 +_,21 @@ @@ -601,16 +_,21 @@
} }
public void m_280295_(GuiGraphics p_283501_) { public void renderSelectedItemName(GuiGraphics p_283501_) {
+ renderSelectedItemName(p_283501_, 0); + renderSelectedItemName(p_283501_, 0);
+ } + }
+ +
+ public void renderSelectedItemName(GuiGraphics p_283501_, int yShift) { + public void renderSelectedItemName(GuiGraphics p_283501_, int yShift) {
this.f_92986_.m_91307_().m_6180_("selectedItemName"); this.minecraft.getProfiler().push("selectedItemName");
if (this.f_92993_ > 0 && !this.f_92994_.m_41619_()) { if (this.toolHighlightTimer > 0 && !this.lastToolHighlight.isEmpty()) {
- MutableComponent mutablecomponent = Component.m_237119_().m_7220_(this.f_92994_.m_41786_()).m_130940_(this.f_92994_.m_41791_().f_43022_); - MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().color);
+ MutableComponent mutablecomponent = Component.m_237119_().m_7220_(this.f_92994_.m_41786_()).m_130938_(this.f_92994_.m_41791_().getStyleModifier()); + MutableComponent mutablecomponent = Component.empty().append(this.lastToolHighlight.getHoverName()).withStyle(this.lastToolHighlight.getRarity().getStyleModifier());
if (this.f_92994_.m_41788_()) { if (this.lastToolHighlight.hasCustomHoverName()) {
mutablecomponent.m_130940_(ChatFormatting.ITALIC); mutablecomponent.withStyle(ChatFormatting.ITALIC);
} }
- int i = this.m_93082_().m_92852_(mutablecomponent); - int i = this.getFont().width(mutablecomponent);
+ Component highlightTip = this.f_92994_.getHighlightTip(mutablecomponent); + Component highlightTip = this.lastToolHighlight.getHighlightTip(mutablecomponent);
+ int i = this.m_93082_().m_92852_(highlightTip); + int i = this.getFont().width(highlightTip);
int j = (this.f_92977_ - i) / 2; int j = (this.screenWidth - i) / 2;
- int k = this.f_92978_ - 59; - int k = this.screenHeight - 59;
+ int k = this.f_92978_ - Math.max(yShift, 59); + int k = this.screenHeight - Math.max(yShift, 59);
if (!this.f_92986_.f_91072_.m_105205_()) { if (!this.minecraft.gameMode.canHurtPlayer()) {
k += 14; k += 14;
} }
@@ -622,7 +_,13 @@ @@ -622,7 +_,13 @@
if (l > 0) { if (l > 0) {
p_283501_.m_280509_(j - 2, k - 2, j + i + 2, k + 9 + 2, this.f_92986_.f_91066_.m_92143_(0)); p_283501_.fill(j - 2, k - 2, j + i + 2, k + 9 + 2, this.minecraft.options.getBackgroundColor(0));
- p_283501_.m_280430_(this.m_93082_(), mutablecomponent, j, k, 16777215 + (l << 24)); - p_283501_.drawString(this.getFont(), 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); + Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(lastToolHighlight).getFont(lastToolHighlight, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME);
+ if (font == null) { + if (font == null) {
+ p_283501_.m_280430_(this.m_93082_(), highlightTip, j, k, 16777215 + (l << 24)); + p_283501_.drawString(this.getFont(), highlightTip, j, k, 16777215 + (l << 24));
+ } else { + } else {
+ j = (this.f_92977_ - font.m_92852_(highlightTip)) / 2; + j = (this.screenWidth - font.width(highlightTip)) / 2;
+ p_283501_.m_280430_(font, highlightTip, j, k, 16777215 + (l << 24)); + p_283501_.drawString(font, highlightTip, j, k, 16777215 + (l << 24));
+ } + }
} }
} }
@@ -1069,7 +_,7 @@ @@ -1069,7 +_,7 @@
ItemStack itemstack = this.f_92986_.f_91074_.m_150109_().m_36056_(); ItemStack itemstack = this.minecraft.player.getInventory().getSelected();
if (itemstack.m_41619_()) { if (itemstack.isEmpty()) {
this.f_92993_ = 0; this.toolHighlightTimer = 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.lastToolHighlight.isEmpty() && itemstack.is(this.lastToolHighlight.getItem()) && itemstack.getHoverName().equals(this.lastToolHighlight.getHoverName())) {
+ } 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_())))) { + } 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.f_92993_ > 0) { if (this.toolHighlightTimer > 0) {
--this.f_92993_; --this.toolHighlightTimer;
} }
@@ -6,13 +6,13 @@
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
-public class GuiGraphics { -public class GuiGraphics {
+public class GuiGraphics implements net.minecraftforge.client.extensions.IForgeGuiGraphics { +public class GuiGraphics implements net.minecraftforge.client.extensions.IForgeGuiGraphics {
public static final float f_289044_ = 10000.0F; public static final float MAX_GUI_Z = 10000.0F;
public static final float f_289038_ = -10000.0F; public static final float MIN_GUI_Z = -10000.0F;
private static final int f_279564_ = 2; private static final int EXTRA_SPACE_AFTER_FIRST_TOOLTIP_LINE = 2;
@@ -271,6 +_,11 @@ @@ -271,6 +_,11 @@
} }
public int m_280056_(Font p_283343_, @Nullable String p_281896_, int p_283569_, int p_283418_, int p_281560_, boolean p_282130_) { public int drawString(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_); + return this.drawString(p_283343_, p_281896_, (float)p_283569_, (float)p_283418_, p_281560_, p_282130_);
+ } + }
+ +
@@ -24,83 +24,83 @@
@@ -285,6 +_,11 @@ @@ -285,6 +_,11 @@
} }
public int m_280649_(Font p_282636_, FormattedCharSequence p_281596_, int p_281586_, int p_282816_, int p_281743_, boolean p_282394_) { public int drawString(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_); + 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 + // 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_) { + 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_.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); 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.m_286081_(); this.flushIfUnmanaged();
return i; return i;
@@ -511,6 +_,7 @@ @@ -511,6 +_,7 @@
crashreportcategory.m_128165_("Item Type", () -> { crashreportcategory.setDetail("Item Type", () -> {
return String.valueOf((Object)p_281675_.m_41720_()); return String.valueOf((Object)p_281675_.getItem());
}); });
+ crashreportcategory.m_128165_("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(p_281675_.m_41720_()))); + crashreportcategory.setDetail("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(p_281675_.getItem())));
crashreportcategory.m_128165_("Item Damage", () -> { crashreportcategory.setDetail("Item Damage", () -> {
return String.valueOf(p_281675_.m_41773_()); return String.valueOf(p_281675_.getDamageValue());
}); });
@@ -558,18 +_,26 @@ @@ -558,18 +_,26 @@
} }
this.f_279612_.m_85849_(); this.pose.popPose();
+ net.minecraftforge.client.ItemDecoratorHandler.of(p_283349_).render(this, p_282005_, p_283349_, p_282641_, p_282146_); + net.minecraftforge.client.ItemDecoratorHandler.of(p_283349_).render(this, p_282005_, p_283349_, p_282641_, p_282146_);
} }
} }
+ +
+ private ItemStack tooltipStack = ItemStack.f_41583_; + private ItemStack tooltipStack = ItemStack.EMPTY;
public void m_280153_(Font p_282308_, ItemStack p_282781_, int p_282687_, int p_282292_) { public void renderTooltip(Font p_282308_, ItemStack p_282781_, int p_282687_, int p_282292_) {
+ this.tooltipStack = p_282781_; + this.tooltipStack = p_282781_;
this.m_280677_(p_282308_, Screen.m_280152_(this.f_279544_, p_282781_), p_282781_.m_150921_(), p_282687_, p_282292_); this.renderTooltip(p_282308_, Screen.getTooltipFromItem(this.minecraft, p_282781_), p_282781_.getTooltipImage(), p_282687_, p_282292_);
+ this.tooltipStack = ItemStack.f_41583_; + this.tooltipStack = ItemStack.EMPTY;
+ } + }
+ +
+ public void renderTooltip(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY) { + public void renderTooltip(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY) {
+ this.tooltipStack = stack; + this.tooltipStack = stack;
+ this.m_280677_(font, textComponents, tooltipComponent, mouseX, mouseY); + this.renderTooltip(font, textComponents, tooltipComponent, mouseX, mouseY);
+ this.tooltipStack = ItemStack.f_41583_; + this.tooltipStack = ItemStack.EMPTY;
} }
public void m_280677_(Font p_283128_, List<Component> p_282716_, Optional<TooltipComponent> p_281682_, int p_283678_, int p_281696_) { 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::m_7532_).map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()); - List<ClientTooltipComponent> list = p_282716_.stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create).collect(Collectors.toList());
- p_281682_.ifPresent((p_282969_) -> { - p_281682_.ifPresent((p_282969_) -> {
- list.add(1, ClientTooltipComponent.m_169950_(p_282969_)); - list.add(1, ClientTooltipComponent.create(p_282969_));
- }); - });
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_282716_, p_281682_, p_283678_, m_280182_(), m_280206_(), p_283128_); + List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_282716_, p_281682_, p_283678_, guiWidth(), guiHeight(), p_283128_);
this.m_280497_(p_283128_, list, p_283678_, p_281696_, DefaultTooltipPositioner.f_262752_); this.renderTooltipInternal(p_283128_, list, p_283678_, p_281696_, DefaultTooltipPositioner.INSTANCE);
} }
@@ -578,7 +_,15 @@ @@ -578,7 +_,15 @@
} }
public void m_280666_(Font p_282739_, List<Component> p_281832_, int p_282191_, int p_282446_) { public void renderComponentTooltip(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_); - 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_, m_280182_(), m_280206_(), p_282739_); + List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_281832_, p_282191_, guiWidth(), guiHeight(), p_282739_);
+ this.m_280497_(p_282739_, components, p_282191_, p_282446_, DefaultTooltipPositioner.f_262752_); + this.renderTooltipInternal(p_282739_, components, p_282191_, p_282446_, DefaultTooltipPositioner.INSTANCE);
+ } + }
+ +
+ public void renderComponentTooltip(Font font, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, ItemStack stack) { + public void renderComponentTooltip(Font font, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, ItemStack stack) {
+ this.tooltipStack = stack; + this.tooltipStack = stack;
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, m_280182_(), m_280206_(), font); + List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, guiWidth(), guiHeight(), font);
+ this.m_280497_(font, components, mouseX, mouseY, DefaultTooltipPositioner.f_262752_); + this.renderTooltipInternal(font, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE);
+ this.tooltipStack = ItemStack.f_41583_; + this.tooltipStack = ItemStack.EMPTY;
} }
public void m_280245_(Font p_282192_, List<? extends FormattedCharSequence> p_282297_, int p_281680_, int p_283325_) { public void renderTooltip(Font p_282192_, List<? extends FormattedCharSequence> p_282297_, int p_281680_, int p_283325_) {
@@ -591,11 +_,13 @@ @@ -591,11 +_,13 @@
private void m_280497_(Font p_282675_, List<ClientTooltipComponent> p_282615_, int p_283230_, int p_283417_, ClientTooltipPositioner p_282442_) { private void renderTooltipInternal(Font p_282675_, List<ClientTooltipComponent> p_282615_, int p_283230_, int p_283417_, ClientTooltipPositioner p_282442_) {
if (!p_282615_.isEmpty()) { if (!p_282615_.isEmpty()) {
+ 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_); + 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_);
+ if (preEvent.isCanceled()) return; + if (preEvent.isCanceled()) return;
int i = 0; int i = 0;
int j = p_282615_.size() == 1 ? -2 : 0; int j = p_282615_.size() == 1 ? -2 : 0;
for(ClientTooltipComponent clienttooltipcomponent : p_282615_) { for(ClientTooltipComponent clienttooltipcomponent : p_282615_) {
- int k = clienttooltipcomponent.m_142069_(p_282675_); - int k = clienttooltipcomponent.getWidth(p_282675_);
+ int k = clienttooltipcomponent.m_142069_(preEvent.getFont()); + int k = clienttooltipcomponent.getWidth(preEvent.getFont());
if (k > i) { if (k > i) {
i = k; i = k;
} }
@@ -108,33 +108,33 @@
int i2 = i; int i2 = i;
int j2 = j; int j2 = j;
- Vector2ic vector2ic = p_282442_.m_262814_(this.m_280182_(), this.m_280206_(), p_283230_, p_283417_, i2, j2); - Vector2ic vector2ic = p_282442_.positionTooltip(this.guiWidth(), this.guiHeight(), p_283230_, p_283417_, i2, j2);
+ Vector2ic vector2ic = p_282442_.m_262814_(this.m_280182_(), this.m_280206_(), preEvent.getX(), preEvent.getY(), i2, j2); + Vector2ic vector2ic = p_282442_.positionTooltip(this.guiWidth(), this.guiHeight(), preEvent.getX(), preEvent.getY(), i2, j2);
int l = vector2ic.x(); int l = vector2ic.x();
int i1 = vector2ic.y(); int i1 = vector2ic.y();
this.f_279612_.m_85836_(); this.pose.pushPose();
int j1 = 400; int j1 = 400;
this.m_286007_(() -> { this.drawManaged(() -> {
- TooltipRenderUtil.m_280205_(this, l, i1, i2, j2, 400); - TooltipRenderUtil.renderTooltipBackground(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_); + 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()); + TooltipRenderUtil.renderTooltipBackground(this, l, i1, i2, j2, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd(), colorEvent.getBorderStart(), colorEvent.getBorderEnd());
}); });
this.f_279612_.m_252880_(0.0F, 0.0F, 400.0F); this.pose.translate(0.0F, 0.0F, 400.0F);
int k1 = i1; int k1 = i1;
for(int l1 = 0; l1 < p_282615_.size(); ++l1) { for(int l1 = 0; l1 < p_282615_.size(); ++l1) {
ClientTooltipComponent clienttooltipcomponent1 = p_282615_.get(l1); ClientTooltipComponent clienttooltipcomponent1 = p_282615_.get(l1);
- clienttooltipcomponent1.m_142440_(p_282675_, l, k1, this.f_279612_.m_85850_().m_252922_(), this.f_279627_); - clienttooltipcomponent1.renderText(p_282675_, l, k1, this.pose.last().pose(), this.bufferSource);
+ clienttooltipcomponent1.m_142440_(preEvent.getFont(), l, k1, this.f_279612_.m_85850_().m_252922_(), this.f_279627_); + clienttooltipcomponent1.renderText(preEvent.getFont(), l, k1, this.pose.last().pose(), this.bufferSource);
k1 += clienttooltipcomponent1.m_142103_() + (l1 == 0 ? 2 : 0); k1 += clienttooltipcomponent1.getHeight() + (l1 == 0 ? 2 : 0);
} }
@@ -626,7 +_,7 @@ @@ -626,7 +_,7 @@
for(int k2 = 0; k2 < p_282615_.size(); ++k2) { for(int k2 = 0; k2 < p_282615_.size(); ++k2) {
ClientTooltipComponent clienttooltipcomponent2 = p_282615_.get(k2); ClientTooltipComponent clienttooltipcomponent2 = p_282615_.get(k2);
- clienttooltipcomponent2.m_183452_(p_282675_, l, k1, this); - clienttooltipcomponent2.renderImage(p_282675_, l, k1, this);
+ clienttooltipcomponent2.m_183452_(preEvent.getFont(), l, k1, this); + clienttooltipcomponent2.renderImage(preEvent.getFont(), l, k1, this);
k1 += clienttooltipcomponent2.m_142103_() + (k2 == 0 ? 2 : 0); k1 += clienttooltipcomponent2.getHeight() + (k2 == 0 ? 2 : 0);
} }
@@ -2,10 +2,10 @@
+++ b/net/minecraft/client/gui/components/AbstractButton.java +++ b/net/minecraft/client/gui/components/AbstractButton.java
@@ -29,7 +_,7 @@ @@ -29,7 +_,7 @@
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
p_281670_.m_292816_(f_290895_.m_295557_(this.f_93623_, this.m_198029_()), this.m_252754_(), this.m_252907_(), this.m_5711_(), this.m_93694_()); p_281670_.blitSprite(SPRITES.get(this.active, this.isHoveredOrFocused()), this.getX(), this.getY(), this.getWidth(), this.getHeight());
p_281670_.m_280246_(1.0F, 1.0F, 1.0F, 1.0F); p_281670_.setColor(1.0F, 1.0F, 1.0F, 1.0F);
- int i = this.f_93623_ ? 16777215 : 10526880; - int i = this.active ? 16777215 : 10526880;
+ int i = getFGColor(); + int i = getFGColor();
this.m_280465_(p_281670_, minecraft.f_91062_, i | Mth.m_14167_(this.f_93625_ * 255.0F) << 24); this.renderString(p_281670_, minecraft.font, i | Mth.ceil(this.alpha * 255.0F) << 24);
} }
@@ -1,15 +1,15 @@
--- a/net/minecraft/client/gui/components/AbstractSelectionList.java --- a/net/minecraft/client/gui/components/AbstractSelectionList.java
+++ b/net/minecraft/client/gui/components/AbstractSelectionList.java +++ b/net/minecraft/client/gui/components/AbstractSelectionList.java
@@ -504,6 +_,13 @@ @@ -504,6 +_,13 @@
return new ScreenRectangle(this.f_93393_, this.f_93390_, this.f_93392_ - this.f_93393_, this.f_93391_ - this.f_93390_); return new ScreenRectangle(this.x0, this.y0, this.x1 - this.x0, this.y1 - this.y0);
} }
+ public int getWidth() { return this.f_93388_; } + public int getWidth() { return this.width; }
+ public int getHeight() { return this.f_93389_; } + public int getHeight() { return this.height; }
+ public int getTop() { return this.f_93390_; } + public int getTop() { return this.y0; }
+ public int getBottom() { return this.f_93391_; } + public int getBottom() { return this.y1; }
+ public int getLeft() { return this.f_93393_; } + public int getLeft() { return this.x0; }
+ public int getRight() { return this.f_93392_; } + public int getRight() { return this.x1; }
+ +
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
protected abstract static class Entry<E extends AbstractSelectionList.Entry<E>> implements GuiEventListener { protected abstract static class Entry<E extends AbstractSelectionList.Entry<E>> implements GuiEventListener {
@@ -1,14 +1,14 @@
--- a/net/minecraft/client/gui/components/AbstractWidget.java --- a/net/minecraft/client/gui/components/AbstractWidget.java
+++ b/net/minecraft/client/gui/components/AbstractWidget.java +++ b/net/minecraft/client/gui/components/AbstractWidget.java
@@ -259,6 +_,19 @@ @@ -259,6 +_,19 @@
this.f_93616_ = p_93693_; this.focused = p_93693_;
} }
+ public static final int UNSET_FG_COLOR = -1; + public static final int UNSET_FG_COLOR = -1;
+ protected int packedFGColor = UNSET_FG_COLOR; + protected int packedFGColor = UNSET_FG_COLOR;
+ public int getFGColor() { + public int getFGColor() {
+ if (packedFGColor != UNSET_FG_COLOR) return packedFGColor; + if (packedFGColor != UNSET_FG_COLOR) return packedFGColor;
+ return this.f_93623_ ? 16777215 : 10526880; // White : Light Grey + return this.active ? 16777215 : 10526880; // White : Light Grey
+ } + }
+ public void setFGColor(int color) { + public void setFGColor(int color) {
+ this.packedFGColor = color; + this.packedFGColor = color;
@@ -17,6 +17,6 @@
+ this.packedFGColor = UNSET_FG_COLOR; + this.packedFGColor = UNSET_FG_COLOR;
+ } + }
+ +
public NarratableEntry.NarrationPriority m_142684_() { public NarratableEntry.NarrationPriority narrationPriority() {
if (this.m_93696_()) { if (this.isFocused()) {
return NarratableEntry.NarrationPriority.FOCUSED; return NarratableEntry.NarrationPriority.FOCUSED;
@@ -2,19 +2,19 @@
+++ b/net/minecraft/client/gui/components/BossHealthOverlay.java +++ b/net/minecraft/client/gui/components/BossHealthOverlay.java
@@ -36,13 +_,16 @@ @@ -36,13 +_,16 @@
for(LerpingBossEvent lerpingbossevent : this.f_93699_.values()) { for(LerpingBossEvent lerpingbossevent : this.events.values()) {
int k = i / 2 - 91; int k = i / 2 - 91;
+ 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_); + var event = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(p_283175_, this.minecraft.getWindow(), lerpingbossevent, k, j, 10 + this.minecraft.font.lineHeight);
+ if (!event.isCanceled()) { + if (!event.isCanceled()) {
this.m_280106_(p_283175_, k, j, lerpingbossevent); this.drawBar(p_283175_, k, j, lerpingbossevent);
Component component = lerpingbossevent.m_18861_(); Component component = lerpingbossevent.getName();
int l = this.f_93698_.f_91062_.m_92852_(component); int l = this.minecraft.font.width(component);
int i1 = i / 2 - l / 2; int i1 = i / 2 - l / 2;
int j1 = j - 9; int j1 = j - 9;
p_283175_.m_280430_(this.f_93698_.f_91062_, component, i1, j1, 16777215); p_283175_.drawString(this.minecraft.font, component, i1, j1, 16777215);
- j += 10 + 9; - j += 10 + 9;
+ } + }
+ j += event.getIncrement(); + j += event.getIncrement();
if (j >= p_283175_.m_280206_() / 3) { if (j >= p_283175_.guiHeight() / 3) {
break; break;
} }
@@ -1,23 +1,23 @@
--- a/net/minecraft/client/gui/components/Button.java --- a/net/minecraft/client/gui/components/Button.java
+++ b/net/minecraft/client/gui/components/Button.java +++ b/net/minecraft/client/gui/components/Button.java
@@ -29,6 +_,11 @@ @@ -29,6 +_,11 @@
this.f_252416_ = p_259552_; this.createNarration = p_259552_;
} }
+ protected Button(Builder builder) { + protected Button(Builder builder) {
+ this(builder.f_252538_, builder.f_252462_, builder.f_252510_, builder.f_252447_, builder.f_252401_, builder.f_252468_, builder.f_252431_); + this(builder.x, builder.y, builder.width, builder.height, builder.message, builder.onPress, builder.createNarration);
+ m_257544_(builder.f_256855_); // Forge: Make use of the Builder tooltip + setTooltip(builder.tooltip); // Forge: Make use of the Builder tooltip
+ } + }
+ +
public void m_5691_() { public void onPress() {
this.f_93717_.m_93750_(this); this.onPress.onPress(this);
} }
@@ -92,9 +_,11 @@ @@ -92,9 +_,11 @@
} }
public Button m_253136_() { public Button build() {
- 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 button = new Button(this.x, this.y, this.width, this.height, this.message, this.onPress, this.createNarration);
- button.m_257544_(this.f_256855_); - button.setTooltip(this.tooltip);
- return button; - return button;
+ return build(Button::new); + return build(Button::new);
+ } + }
@@ -2,22 +2,91 @@
+++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java +++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java
@@ -93,9 +_,9 @@ @@ -93,9 +_,9 @@
@Nullable @Nullable
private CompletableFuture<LevelChunk> f_94036_; private CompletableFuture<LevelChunk> serverChunk;
private boolean f_291101_; private boolean renderDebug;
- private boolean f_291871_; - private boolean renderProfilerChart;
- private boolean f_290551_; - private boolean renderFpsCharts;
- private boolean f_291005_; - private boolean renderNetworkCharts;
+ protected boolean f_291871_; + protected boolean renderProfilerChart;
+ protected boolean f_290551_; + protected boolean renderFpsCharts;
+ protected boolean f_291005_; + protected boolean renderNetworkCharts;
private final SampleLogger f_291039_ = new SampleLogger(); private final SampleLogger frameTimeLogger = new SampleLogger();
private final SampleLogger f_291524_ = new SampleLogger(); private final SampleLogger tickTimeLogger = new SampleLogger();
private final SampleLogger f_290653_ = 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 @@ @@ -430,6 +_,7 @@
list.add(""); list.add("");
list.add(ChatFormatting.UNDERLINE + "Targeted Entity"); list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
list.add(String.valueOf((Object)BuiltInRegistries.f_256780_.m_7981_(entity.m_6095_()))); list.add(String.valueOf((Object)BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType())));
+ entity.m_6095_().m_204041_().m_203616_().forEach(t -> list.add("#" + t.f_203868_())); + entity.getType().builtInRegistryHolder().tags().forEach(t -> list.add("#" + t.location()));
} }
return list; return list;
@@ -3,8 +3,8 @@
@@ -101,6 +_,7 @@ @@ -101,6 +_,7 @@
} }
public void m_94922_(Toast p_94923_) { public void addToast(Toast p_94923_) {
+ if (net.minecraftforge.client.ForgeHooksClient.onToastAdd(p_94923_)) return; + if (net.minecraftforge.client.ForgeHooksClient.onToastAdd(p_94923_)) return;
this.f_94916_.add(p_94923_); this.queued.add(p_94923_);
} }
@@ -1,11 +1,11 @@
--- a/net/minecraft/client/gui/screens/ChatScreen.java --- a/net/minecraft/client/gui/screens/ChatScreen.java
+++ b/net/minecraft/client/gui/screens/ChatScreen.java +++ b/net/minecraft/client/gui/screens/ChatScreen.java
@@ -224,7 +_,7 @@ @@ -225,7 +_,7 @@
this.f_96541_.f_91074_.f_108617_.m_246175_(p_242400_); this.minecraft.player.connection.sendChat(p_242400_);
} }
- return true; - return true;
+ return f_96541_.f_91080_ == this; // FORGE: Prevent closing the screen if another screen has been opened. + return minecraft.screen == this; // FORGE: Prevent closing the screen if another screen has been opened.
} }
} }
@@ -4,8 +4,8 @@
} }
if (optional.isEmpty()) { if (optional.isEmpty()) {
+ ConnectScreen.f_95683_.error("Couldn't connect to server: Unknown host \"{}\"", p_249536_.m_171863_()); + ConnectScreen.LOGGER.error("Couldn't connect to server: Unknown host \"{}\"", p_249536_.getHost());
+ net.minecraftforge.network.DualStackUtils.logInitialPreferences(); + net.minecraftforge.network.DualStackUtils.logInitialPreferences();
p_251955_.execute(() -> { p_251955_.execute(() -> {
p_251955_.m_91152_(new DisconnectedScreen(ConnectScreen.this.f_95686_, ConnectScreen.this.f_278471_, ConnectScreen.f_169260_)); p_251955_.setScreen(new DisconnectedScreen(ConnectScreen.this.parent, ConnectScreen.this.connectFailedTitle, ConnectScreen.UNKNOWN_HOST_MESSAGE));
}); });
@@ -3,16 +3,16 @@
@@ -132,6 +_,7 @@ @@ -132,6 +_,7 @@
} }
if (this.f_96168_ == -1L && this.f_96164_.m_7746_() && (!this.f_96166_ || f1 >= 2.0F)) { if (this.fadeOutStart == -1L && this.reload.isDone() && (!this.fadeIn || f1 >= 2.0F)) {
+ this.f_96168_ = Util.m_137550_(); // Moved up to guard against inf loops caused by callback + this.fadeOutStart = Util.getMillis(); // Moved up to guard against inf loops caused by callback
try { try {
this.f_96164_.m_7748_(); this.reload.checkExceptions();
this.f_96165_.accept(Optional.empty()); this.onFinish.accept(Optional.empty());
@@ -139,7 +_,6 @@ @@ -139,7 +_,6 @@
this.f_96165_.accept(Optional.of(throwable)); this.onFinish.accept(Optional.of(throwable));
} }
- this.f_96168_ = Util.m_137550_(); - this.fadeOutStart = Util.getMillis();
if (this.f_96163_.f_91080_ != null) { if (this.minecraft.screen != null) {
this.f_96163_.f_91080_.m_6575_(this.f_96163_, p_281839_.m_280182_(), p_281839_.m_280206_()); this.minecraft.screen.init(this.minecraft, p_281839_.guiWidth(), p_281839_.guiHeight());
} }
@@ -1,21 +1,21 @@
--- a/net/minecraft/client/gui/screens/MenuScreens.java --- a/net/minecraft/client/gui/screens/MenuScreens.java
+++ b/net/minecraft/client/gui/screens/MenuScreens.java +++ b/net/minecraft/client/gui/screens/MenuScreens.java
@@ -40,6 +_,10 @@ @@ -40,6 +_,10 @@
private static final Map<MenuType<?>, MenuScreens.ScreenConstructor<?, ?>> f_96196_ = Maps.newHashMap(); private static final Map<MenuType<?>, MenuScreens.ScreenConstructor<?, ?>> SCREENS = Maps.newHashMap();
public static <T extends AbstractContainerMenu> void m_96201_(@Nullable MenuType<T> p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) { 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.m_96209_(p_96205_, p_96202_, p_96203_, p_96204_)); + 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> java.util.Optional<ScreenConstructor<T, ?>> getScreenFactory(@Nullable MenuType<T> p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) { + 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) { if (p_96202_ == null) {
f_96195_.warn("Trying to open invalid screen with name: {}", (Object)p_96205_.getString()); LOGGER.warn("Trying to open invalid screen with name: {}", (Object)p_96205_.getString());
} else { } else {
@@ -47,9 +_,10 @@ @@ -47,9 +_,10 @@
if (screenconstructor == null) { if (screenconstructor == null) {
f_96195_.warn("Failed to create screen for menu type: {}", (Object)BuiltInRegistries.f_256818_.m_7981_(p_96202_)); LOGGER.warn("Failed to create screen for menu type: {}", (Object)BuiltInRegistries.MENU.getKey(p_96202_));
} else { } else {
- screenconstructor.m_96209_(p_96205_, p_96202_, p_96203_, p_96204_); - screenconstructor.fromPacket(p_96205_, p_96202_, p_96203_, p_96204_);
+ return java.util.Optional.of(screenconstructor); + return java.util.Optional.of(screenconstructor);
} }
} }
@@ -1,17 +1,17 @@
--- a/net/minecraft/client/gui/screens/OptionsScreen.java --- a/net/minecraft/client/gui/screens/OptionsScreen.java
+++ b/net/minecraft/client/gui/screens/OptionsScreen.java +++ b/net/minecraft/client/gui/screens/OptionsScreen.java
@@ -150,6 +_,14 @@ @@ -150,6 +_,14 @@
p_283520_.m_280653_(this.f_96547_, this.f_96539_, this.f_96543_ / 2, 15, 16777215); p_283520_.drawCenteredString(this.font, this.title, this.width / 2, 15, 16777215);
} }
+ @Override + @Override
+ public void m_7379_() { + public void onClose() {
+ // We need to consider 2 potential parent screens here: + // We need to consider 2 potential parent screens here:
+ // 1. From the main menu, in which case display the main menu + // 1. From the main menu, in which case display the main menu
+ // 2. From the pause menu, in which case exit back to game + // 2. From the pause menu, in which case exit back to game
+ this.f_96541_.m_91152_(this.f_96235_ instanceof PauseScreen ? null : this.f_96235_); + this.minecraft.setScreen(this.lastScreen instanceof PauseScreen ? null : this.lastScreen);
+ } + }
+ +
private Button m_260993_(Component p_261565_, Supplier<Screen> p_262119_) { private Button openScreenButton(Component p_261565_, Supplier<Screen> p_262119_) {
return Button.m_253074_(p_261565_, (p_280808_) -> { return Button.builder(p_261565_, (p_280808_) -> {
this.f_96541_.m_91152_(p_262119_.get()); this.minecraft.setScreen(p_262119_.get());
@@ -2,9 +2,9 @@
+++ b/net/minecraft/client/gui/screens/PauseScreen.java +++ b/net/minecraft/client/gui/screens/PauseScreen.java
@@ -88,6 +_,7 @@ @@ -88,6 +_,7 @@
} else { } else {
gridlayout$rowhelper.m_264139_(this.m_262456_(f_262254_, SocialInteractionsScreen::new)); gridlayout$rowhelper.addChild(this.openScreenButton(PLAYER_REPORTING, SocialInteractionsScreen::new));
} }
+ gridlayout$rowhelper.m_264108_(Button.m_253074_(Component.m_237115_("fml.menu.mods"), button -> this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this))).m_252780_(f_262268_).m_253136_(), 2); + gridlayout$rowhelper.addChild(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.minecraftforge.client.gui.ModListScreen(this))).width(BUTTON_WIDTH_FULL).build(), 2);
Component component = this.f_96541_.m_91090_() ? f_262217_ : CommonComponents.f_290546_; Component component = this.minecraft.isLocalServer() ? RETURN_TO_MENU : CommonComponents.GUI_DISCONNECT;
this.f_252482_ = gridlayout$rowhelper.m_264108_(Button.m_253074_(component, (p_280815_) -> { this.disconnectButton = gridlayout$rowhelper.addChild(Button.builder(component, (p_280815_) -> {
@@ -3,72 +3,72 @@
@@ -207,7 +_,7 @@ @@ -207,7 +_,7 @@
} }
public void m_7379_() { public void onClose() {
- this.f_96541_.m_91152_((Screen)null); - this.minecraft.setScreen((Screen)null);
+ this.f_96541_.popGuiLayer(); + this.minecraft.popGuiLayer();
} }
protected <T extends GuiEventListener & Renderable & NarratableEntry> T m_142416_(T p_169406_) { protected <T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(T p_169406_) {
@@ -319,7 +_,10 @@ @@ -319,7 +_,10 @@
this.f_96543_ = p_96608_; this.width = p_96608_;
this.f_96544_ = p_96609_; this.height = p_96609_;
if (!this.f_267454_) { if (!this.initialized) {
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.f_96540_, this::addEventWidget, this::m_169411_))) { + if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.children, this::addEventWidget, this::removeWidget))) {
this.m_7856_(); this.init();
+ } + }
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.f_96540_, this::addEventWidget, this::m_169411_)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.children, this::addEventWidget, this::removeWidget));
} else { } else {
this.m_267719_(); this.repositionElements();
} }
@@ -332,7 +_,10 @@ @@ -332,7 +_,10 @@
protected void m_232761_() { protected void rebuildWidgets() {
this.m_169413_(); this.clearWidgets();
this.m_264131_(); this.clearFocus();
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.f_96540_, this::addEventWidget, this::m_169411_))) { + if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Pre(this, this.children, this::addEventWidget, this::removeWidget))) {
this.m_7856_(); this.init();
+ } + }
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.f_96540_, this::addEventWidget, this::m_169411_)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.Init.Post(this, this.children, this::addEventWidget, this::removeWidget));
} }
public List<? extends GuiEventListener> m_6702_() { public List<? extends GuiEventListener> children() {
@@ -354,6 +_,7 @@ @@ -354,6 +_,7 @@
public void m_280273_(GuiGraphics p_283688_, int p_299421_, int p_298679_, float p_297268_) { public void renderBackground(GuiGraphics p_283688_, int p_299421_, int p_298679_, float p_297268_) {
if (this.f_96541_.f_91073_ != null) { if (this.minecraft.level != null) {
this.m_293900_(p_283688_); this.renderTransparentBackground(p_283688_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, p_283688_)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, p_283688_));
} else { } else {
this.m_280039_(p_283688_); this.renderDirtBackground(p_283688_);
} }
@@ -369,6 +_,7 @@ @@ -369,6 +_,7 @@
int i = 32; int i = 32;
p_282281_.m_280398_(f_279548_, 0, 0, 0, 0.0F, 0.0F, this.f_96543_, this.f_96544_, 32, 32); p_282281_.blit(BACKGROUND_LOCATION, 0, 0, 0, 0.0F, 0.0F, this.width, this.height, 32, 32);
p_282281_.m_280246_(1.0F, 1.0F, 1.0F, 1.0F); p_282281_.setColor(1.0F, 1.0F, 1.0F, 1.0F);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, p_282281_)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, p_282281_));
} }
public boolean m_7043_() { public boolean isPauseScreen() {
@@ -462,6 +_,10 @@ @@ -462,6 +_,10 @@
public void m_7400_(List<Path> p_96591_) { public void onFilesDrop(List<Path> p_96591_) {
} }
+ public Minecraft getMinecraft() { + public Minecraft getMinecraft() {
+ return this.f_96541_; + return this.minecraft;
+ } + }
+ +
private void m_169380_(long p_169381_, boolean p_169382_) { private void scheduleNarration(long p_169381_, boolean p_169382_) {
this.f_169377_ = Util.m_137550_() + p_169381_; this.nextNarrationTime = Util.getMillis() + p_169381_;
if (p_169382_) { if (p_169382_) {
@@ -628,5 +_,13 @@ @@ -632,5 +_,13 @@
this.f_169421_ = p_169425_; this.index = p_169425_;
this.f_169422_ = p_169426_; this.priority = p_169426_;
} }
+ } + }
+ +
+ private void addEventWidget(GuiEventListener b) { + private void addEventWidget(GuiEventListener b) {
+ if (b instanceof Renderable r) + if (b instanceof Renderable r)
+ this.f_169369_.add(r); + this.renderables.add(r);
+ if (b instanceof NarratableEntry ne) + if (b instanceof NarratableEntry ne)
+ this.f_169368_.add(ne); + this.narratables.add(ne);
+ f_96540_.add(b); + children.add(b);
} }
} }
@@ -2,66 +2,66 @@
+++ b/net/minecraft/client/gui/screens/TitleScreen.java +++ b/net/minecraft/client/gui/screens/TitleScreen.java
@@ -64,6 +_,7 @@ @@ -64,6 +_,7 @@
@Nullable @Nullable
private TitleScreen.WarningLabel f_232768_; private TitleScreen.WarningLabel warningLabel;
private final LogoRenderer f_263781_; private final LogoRenderer logoRenderer;
+ private net.minecraftforge.client.gui.TitleScreenModUpdateIndicator modUpdateNotification; + private net.minecraftforge.client.gui.TitleScreenModUpdateIndicator modUpdateNotification;
public TitleScreen() { public TitleScreen() {
this(false); this(false);
@@ -114,11 +_,15 @@ @@ -114,11 +_,15 @@
int j = this.f_96543_ - i - 2; int j = this.width - i - 2;
int k = 24; int k = 24;
int l = this.f_96544_ / 4 + 48; int l = this.height / 4 + 48;
+ Button modButton = null; + Button modButton = null;
if (this.f_96541_.m_91402_()) { if (this.minecraft.isDemo()) {
this.m_96772_(l, 24); this.createDemoMenuOptions(l, 24);
} else { } else {
this.m_96763_(l, 24); this.createNormalMenuOptions(l, 24);
+ modButton = this.m_142416_(Button.m_253074_(Component.m_237115_("fml.menu.mods"), button -> this.f_96541_.m_91152_(new net.minecraftforge.client.gui.ModListScreen(this))) + modButton = this.addRenderableWidget(Button.builder(Component.translatable("fml.menu.mods"), button -> this.minecraft.setScreen(new net.minecraftforge.client.gui.ModListScreen(this)))
+ .m_252794_(this.f_96543_ / 2 - 100, l + 24 * 2).m_253046_(98, 20).m_253136_()); + .pos(this.width / 2 - 100, l + 24 * 2).size(98, 20).build());
} }
+ modUpdateNotification = net.minecraftforge.client.gui.TitleScreenModUpdateIndicator.init(this, modButton); + modUpdateNotification = net.minecraftforge.client.gui.TitleScreenModUpdateIndicator.init(this, modButton);
SpriteIconButton spriteiconbutton = this.m_142416_(CommonButtons.m_292713_(20, (p_280830_) -> { SpriteIconButton spriteiconbutton = this.addRenderableWidget(CommonButtons.language(20, (p_280830_) -> {
this.f_96541_.m_91152_(new LanguageSelectScreen(this, this.f_96541_.f_91066_, this.f_96541_.m_91102_())); this.minecraft.setScreen(new LanguageSelectScreen(this, this.minecraft.options, this.minecraft.getLanguageManager()));
@@ -164,7 +_,7 @@ @@ -164,7 +_,7 @@
}).m_252987_(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 1, 200, 20).m_257505_(tooltip).m_253136_())).f_93623_ = flag; }).bounds(this.width / 2 - 100, p_96764_ + p_96765_ * 1, 200, 20).tooltip(tooltip).build())).active = flag;
(this.m_142416_(Button.m_253074_(Component.m_237115_("menu.online"), (p_210872_) -> { (this.addRenderableWidget(Button.builder(Component.translatable("menu.online"), (p_210872_) -> {
this.m_96793_(); this.realmsButtonClicked();
- }).m_252987_(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20).m_257505_(tooltip).m_253136_())).f_93623_ = flag; - }).bounds(this.width / 2 - 100, p_96764_ + p_96765_ * 2, 200, 20).tooltip(tooltip).build())).active = flag;
+ }).m_252987_(this.f_96543_ / 2 + 2, p_96764_ + p_96765_ * 2, 98, 20).m_257505_(tooltip).m_253136_())).f_93623_ = flag; + }).bounds(this.width / 2 + 2, p_96764_ + p_96765_ * 2, 98, 20).tooltip(tooltip).build())).active = flag;
} }
@Nullable @Nullable
@@ -248,6 +_,7 @@ @@ -248,6 +_,7 @@
this.f_232768_.m_280409_(p_282860_, i); this.warningLabel.render(p_282860_, i);
} }
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_282860_, this.f_96547_, this.f_96543_, this.f_96544_, i); + net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_282860_, this.font, this.width, this.height, i);
if (this.f_96721_ != null) { if (this.splash != null) {
this.f_96721_.m_280672_(p_282860_, this.f_96543_, this.f_96547_, i); this.splash.render(p_282860_, this.width, this.font, i);
} }
@@ -263,7 +_,14 @@ @@ -263,7 +_,14 @@
s = s + I18n.m_118938_("menu.modded"); s = s + I18n.get("menu.modded");
} }
- p_282860_.m_280488_(this.f_96547_, s, 2, this.f_96544_ - 10, 16777215 | i); - p_282860_.drawString(this.font, s, 2, this.height - 10, 16777215 | i);
+ net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brdline, brd) -> + net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brdline, brd) ->
+ p_282860_.m_280488_(this.f_96547_, brd, 2, this.f_96544_ - ( 10 + brdline * (this.f_96547_.f_92710_ + 1)), 16777215 | i) + p_282860_.drawString(this.font, brd, 2, this.height - ( 10 + brdline * (this.font.lineHeight + 1)), 16777215 | i)
+ ); + );
+ +
+ net.minecraftforge.internal.BrandingControl.forEachAboveCopyrightLine((brdline, brd) -> + net.minecraftforge.internal.BrandingControl.forEachAboveCopyrightLine((brdline, brd) ->
+ p_282860_.m_280488_(this.f_96547_, brd, this.f_96543_ - f_96547_.m_92895_(brd), this.f_96544_ - (10 + (brdline + 1) * ( this.f_96547_.f_92710_ + 1)), 16777215 | i) + p_282860_.drawString(this.font, brd, this.width - font.width(brd), this.height - (10 + (brdline + 1) * ( this.font.lineHeight + 1)), 16777215 | i)
+ ); + );
+ +
for(GuiEventListener guieventlistener : this.m_6702_()) { for(GuiEventListener guieventlistener : this.children()) {
if (guieventlistener instanceof AbstractWidget) { if (guieventlistener instanceof AbstractWidget) {
@@ -276,6 +_,7 @@ @@ -276,6 +_,7 @@
RenderSystem.enableDepthTest(); RenderSystem.enableDepthTest();
this.f_96726_.m_88315_(p_282860_, p_281753_, p_283539_, p_282628_); this.realmsNotificationsScreen.render(p_282860_, p_281753_, p_283539_, p_282628_);
} }
+ if (f1 >= 1.0f) modUpdateNotification.m_88315_(p_282860_, p_281753_, p_283539_, p_282628_); + if (f1 >= 1.0f) modUpdateNotification.render(p_282860_, p_281753_, p_283539_, p_282628_);
} }
} }
@@ -1,15 +1,15 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java --- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java +++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
@@ -38,6 +_,7 @@ @@ -38,6 +_,7 @@
private int f_97141_ = Integer.MIN_VALUE; private int maxY = Integer.MIN_VALUE;
private float f_97142_; private float fade;
private boolean f_97143_; private boolean centered;
+ private int page; + private int page;
public AdvancementTab(Minecraft p_97145_, AdvancementsScreen p_97146_, AdvancementTabType p_97147_, int p_97148_, AdvancementNode p_297568_, DisplayInfo p_97150_) { public AdvancementTab(Minecraft p_97145_, AdvancementsScreen p_97146_, AdvancementTabType p_97147_, int p_97148_, AdvancementNode p_297568_, DisplayInfo p_97150_) {
this.f_97126_ = p_97145_; this.minecraft = p_97145_;
@@ -52,6 +_,15 @@ @@ -52,6 +_,15 @@
this.m_97175_(this.f_97134_, p_297568_.m_295246_()); this.addWidget(this.root, p_297568_.holder());
} }
+ public AdvancementTab(Minecraft mc, AdvancementsScreen screen, AdvancementTabType type, int index, int page, AdvancementNode adv, DisplayInfo info) { + public AdvancementTab(Minecraft mc, AdvancementsScreen screen, AdvancementTabType type, int index, int page, AdvancementNode adv, DisplayInfo info) {
@@ -21,17 +21,17 @@
+ return page; + return page;
+ } + }
+ +
public AdvancementTabType m_169538_() { public AdvancementTabType getType() {
return this.f_97128_; return this.type;
} }
@@ -146,8 +_,8 @@ @@ -146,8 +_,8 @@
return null; return null;
} else { } else {
for(AdvancementTabType advancementtabtype : AdvancementTabType.values()) { for(AdvancementTabType advancementtabtype : AdvancementTabType.values()) {
- if (p_97173_ < advancementtabtype.m_97210_()) { - if (p_97173_ < advancementtabtype.getMax()) {
- return new AdvancementTab(p_97171_, p_97172_, advancementtabtype, p_97173_, p_299876_, optional.get()); - return new AdvancementTab(p_97171_, p_97172_, advancementtabtype, p_97173_, p_299876_, optional.get());
+ if ((p_97173_ % AdvancementTabType.MAX_TABS) < advancementtabtype.m_97210_()) { + if ((p_97173_ % AdvancementTabType.MAX_TABS) < advancementtabtype.getMax()) {
+ return new AdvancementTab(p_97171_, p_97172_, advancementtabtype, p_97173_ % AdvancementTabType.MAX_TABS, p_97173_ / AdvancementTabType.MAX_TABS, p_299876_, optional.get()); + return new AdvancementTab(p_97171_, p_97172_, advancementtabtype, p_97173_ % AdvancementTabType.MAX_TABS, p_97173_ / AdvancementTabType.MAX_TABS, p_299876_, optional.get());
} }
p_97173_ -= advancementtabtype.m_97210_(); p_97173_ -= advancementtabtype.getMax();
@@ -4,7 +4,7 @@
LEFT(new AdvancementTabType.Sprites(new ResourceLocation("advancements/tab_left_top_selected"), new ResourceLocation("advancements/tab_left_middle_selected"), new ResourceLocation("advancements/tab_left_bottom_selected")), new AdvancementTabType.Sprites(new ResourceLocation("advancements/tab_left_top"), new ResourceLocation("advancements/tab_left_middle"), new ResourceLocation("advancements/tab_left_bottom")), 32, 28, 5), LEFT(new AdvancementTabType.Sprites(new ResourceLocation("advancements/tab_left_top_selected"), new ResourceLocation("advancements/tab_left_middle_selected"), new ResourceLocation("advancements/tab_left_bottom_selected")), new AdvancementTabType.Sprites(new ResourceLocation("advancements/tab_left_top"), new ResourceLocation("advancements/tab_left_middle"), new ResourceLocation("advancements/tab_left_bottom")), 32, 28, 5),
RIGHT(new AdvancementTabType.Sprites(new ResourceLocation("advancements/tab_right_top_selected"), new ResourceLocation("advancements/tab_right_middle_selected"), new ResourceLocation("advancements/tab_right_bottom_selected")), new AdvancementTabType.Sprites(new ResourceLocation("advancements/tab_right_top"), new ResourceLocation("advancements/tab_right_middle"), new ResourceLocation("advancements/tab_right_bottom")), 32, 28, 5); RIGHT(new AdvancementTabType.Sprites(new ResourceLocation("advancements/tab_right_top_selected"), new ResourceLocation("advancements/tab_right_middle_selected"), new ResourceLocation("advancements/tab_right_bottom_selected")), new AdvancementTabType.Sprites(new ResourceLocation("advancements/tab_right_top"), new ResourceLocation("advancements/tab_right_middle"), new ResourceLocation("advancements/tab_right_bottom")), 32, 28, 5);
+ public static final int MAX_TABS = java.util.Arrays.stream(values()).mapToInt(e -> e.f_97199_).sum(); + public static final int MAX_TABS = java.util.Arrays.stream(values()).mapToInt(e -> e.max).sum();
private final AdvancementTabType.Sprites f_291110_; private final AdvancementTabType.Sprites selectedSprites;
private final AdvancementTabType.Sprites f_291777_; private final AdvancementTabType.Sprites unselectedSprites;
private final int f_97197_; private final int width;
@@ -2,73 +2,73 @@
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java +++ b/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java
@@ -42,6 +_,7 @@ @@ -42,6 +_,7 @@
@Nullable @Nullable
private AdvancementTab f_97336_; private AdvancementTab selectedTab;
private boolean f_97337_; private boolean isScrolling;
+ private static int tabPage, maxPages; + private static int tabPage, maxPages;
public AdvancementsScreen(ClientAdvancements p_97340_) { public AdvancementsScreen(ClientAdvancements p_97340_) {
super(GameNarrator.f_93310_); super(GameNarrator.NO_TITLE);
@@ -58,7 +_,15 @@ @@ -58,7 +_,15 @@
} else { } else {
this.f_97334_.m_104401_(this.f_97336_ == null ? null : this.f_97336_.m_293004_().m_295246_(), true); this.advancements.setSelectedTab(this.selectedTab == null ? null : this.selectedTab.getRootNode().holder(), true);
} }
- -
+ if (this.f_97335_.size() > AdvancementTabType.MAX_TABS) { + if (this.tabs.size() > AdvancementTabType.MAX_TABS) {
+ int guiLeft = (this.f_96543_ - 252) / 2; + int guiLeft = (this.width - 252) / 2;
+ int guiTop = (this.f_96544_ - 140) / 2; + int guiTop = (this.height - 140) / 2;
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_("<"), b -> tabPage = Math.max(tabPage - 1, 0 )) + addRenderableWidget(net.minecraft.client.gui.components.Button.builder(Component.literal("<"), b -> tabPage = Math.max(tabPage - 1, 0 ))
+ .m_252794_(guiLeft, guiTop - 50).m_253046_(20, 20).m_253136_()); + .pos(guiLeft, guiTop - 50).size(20, 20).build());
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_(">"), b -> tabPage = Math.min(tabPage + 1, maxPages)) + addRenderableWidget(net.minecraft.client.gui.components.Button.builder(Component.literal(">"), b -> tabPage = Math.min(tabPage + 1, maxPages))
+ .m_252794_(guiLeft + f_169556_ - 20, guiTop - 50).m_253046_(20, 20).m_253136_()); + .pos(guiLeft + WINDOW_WIDTH - 20, guiTop - 50).size(20, 20).build());
+ maxPages = this.f_97335_.size() / AdvancementTabType.MAX_TABS; + maxPages = this.tabs.size() / AdvancementTabType.MAX_TABS;
+ } + }
} }
public void m_7861_() { public void removed() {
@@ -76,7 +_,7 @@ @@ -76,7 +_,7 @@
int j = (this.f_96544_ - 140) / 2; int j = (this.height - 140) / 2;
for(AdvancementTab advancementtab : this.f_97335_.values()) { for(AdvancementTab advancementtab : this.tabs.values()) {
- if (advancementtab.m_97154_(i, j, p_97343_, p_97344_)) { - if (advancementtab.isMouseOver(i, j, p_97343_, p_97344_)) {
+ if (advancementtab.getPage() == tabPage && advancementtab.m_97154_(i, j, p_97343_, p_97344_)) { + if (advancementtab.getPage() == tabPage && advancementtab.isMouseOver(i, j, p_97343_, p_97344_)) {
this.f_97334_.m_104401_(advancementtab.m_293004_().m_295246_(), true); this.advancements.setSelectedTab(advancementtab.getRootNode().holder(), true);
break; break;
} }
@@ -100,9 +_,15 @@ @@ -100,9 +_,15 @@
int i = (this.f_96543_ - 252) / 2; int i = (this.width - 252) / 2;
int j = (this.f_96544_ - 140) / 2; int j = (this.height - 140) / 2;
this.m_280273_(p_282589_, p_282255_, p_283354_, p_283123_); this.renderBackground(p_282589_, p_282255_, p_283354_, p_283123_);
+ if (maxPages != 0) { + if (maxPages != 0) {
+ net.minecraft.network.chat.Component page = Component.m_237113_(String.format("%d / %d", tabPage + 1, maxPages + 1)); + net.minecraft.network.chat.Component page = Component.literal(String.format("%d / %d", tabPage + 1, maxPages + 1));
+ int width = this.f_96547_.m_92852_(page); + int width = this.font.width(page);
+ p_282589_.m_280648_(this.f_96547_, page.m_7532_(), i + (252 / 2) - (width / 2), j - 44, -1); + p_282589_.drawString(this.font, page.getVisualOrderText(), i + (252 / 2) - (width / 2), j - 44, -1);
+ } + }
this.m_97373_(p_282589_, p_282255_, p_283354_, i, j); this.renderInside(p_282589_, p_282255_, p_283354_, i, j);
this.m_280088_(p_282589_, i, j); this.renderWindow(p_282589_, i, j);
this.m_280355_(p_282589_, p_282255_, p_283354_, i, j); this.renderTooltips(p_282589_, p_282255_, p_283354_, i, j);
+ super.m_88315_(p_282589_, p_282255_, p_283354_, p_283123_); + super.render(p_282589_, p_282255_, p_283354_, p_283123_);
} }
public boolean m_7979_(double p_97347_, double p_97348_, int p_97349_, double p_97350_, double p_97351_) { public boolean mouseDragged(double p_97347_, double p_97348_, int p_97349_, double p_97350_, double p_97351_) {
@@ -146,10 +_,12 @@ @@ -146,10 +_,12 @@
p_283395_.m_280218_(f_97329_, p_281890_, p_282532_, 0, 0, 252, 140); p_283395_.blit(WINDOW_LOCATION, p_281890_, p_282532_, 0, 0, 252, 140);
if (this.f_97335_.size() > 1) { if (this.tabs.size() > 1) {
for(AdvancementTab advancementtab : this.f_97335_.values()) { for(AdvancementTab advancementtab : this.tabs.values()) {
+ if (advancementtab.getPage() == tabPage) + if (advancementtab.getPage() == tabPage)
advancementtab.m_280105_(p_283395_, p_281890_, p_282532_, advancementtab == this.f_97336_); advancementtab.drawTab(p_283395_, p_281890_, p_282532_, advancementtab == this.selectedTab);
} }
for(AdvancementTab advancementtab1 : this.f_97335_.values()) { for(AdvancementTab advancementtab1 : this.tabs.values()) {
+ if (advancementtab1.getPage() == tabPage) + if (advancementtab1.getPage() == tabPage)
advancementtab1.m_280485_(p_283395_, p_281890_, p_282532_); advancementtab1.drawIcon(p_283395_, p_281890_, p_282532_);
} }
} }
@@ -169,7 +_,7 @@ @@ -169,7 +_,7 @@
if (this.f_97335_.size() > 1) { if (this.tabs.size() > 1) {
for(AdvancementTab advancementtab : this.f_97335_.values()) { for(AdvancementTab advancementtab : this.tabs.values()) {
- if (advancementtab.m_97154_(p_281519_, p_283371_, (double)p_283556_, (double)p_282458_)) { - if (advancementtab.isMouseOver(p_281519_, p_283371_, (double)p_283556_, (double)p_282458_)) {
+ if (advancementtab.getPage() == tabPage && advancementtab.m_97154_(p_281519_, p_283371_, (double)p_283556_, (double)p_282458_)) { + if (advancementtab.getPage() == tabPage && advancementtab.isMouseOver(p_281519_, p_283371_, (double)p_283556_, (double)p_282458_)) {
p_282784_.m_280557_(this.f_96547_, advancementtab.m_97189_(), p_283556_, p_282458_); p_282784_.renderTooltip(this.font, advancementtab.getTitle(), p_283556_, p_282458_);
} }
} }
@@ -3,40 +3,40 @@
@@ -64,7 +_,7 @@ @@ -64,7 +_,7 @@
} }
protected int m_5756_() { protected int getScrollbarPosition() {
- return super.m_5756_() + 15; - return super.getScrollbarPosition() + 15;
+ return super.m_5756_() + 15 + 20; + return super.getScrollbarPosition() + 15 + 20;
} }
public int m_5759_() { public int getRowWidth() {
@@ -129,10 +_,11 @@ @@ -129,10 +_,11 @@
this.f_193912_ = Button.m_253074_(p_193917_, (p_269618_) -> { this.changeButton = Button.builder(p_193917_, (p_269618_) -> {
KeyBindsList.this.f_193858_.f_193975_ = p_193916_; KeyBindsList.this.keyBindsScreen.selectedKey = p_193916_;
KeyBindsList.this.m_269130_(); KeyBindsList.this.resetMappingAndUpdateButtons();
- }).m_252987_(0, 0, 75, 20).m_252778_((p_253311_) -> { - }).bounds(0, 0, 75, 20).createNarration((p_253311_) -> {
+ }).m_252987_(0, 0, 75 + 20 /* Forge: Add space */, 20).m_252778_((p_253311_) -> { + }).bounds(0, 0, 75 + 20 /* Forge: Add space */, 20).createNarration((p_253311_) -> {
return p_193916_.m_90862_() ? Component.m_237110_("narrator.controls.unbound", p_193917_) : Component.m_237110_("narrator.controls.bound", p_193917_, p_253311_.get()); return p_193916_.isUnbound() ? Component.translatable("narrator.controls.unbound", p_193917_) : Component.translatable("narrator.controls.bound", p_193917_, p_253311_.get());
}).m_253136_(); }).build();
this.f_193913_ = Button.m_253074_(Component.m_237115_("controls.reset"), (p_269616_) -> { this.resetButton = Button.builder(Component.translatable("controls.reset"), (p_269616_) -> {
+ this.f_193910_.setToDefault(); + this.key.setToDefault();
KeyBindsList.this.f_93386_.f_91066_.m_92159_(p_193916_, p_193916_.m_90861_()); KeyBindsList.this.minecraft.options.setKey(p_193916_, p_193916_.getDefaultKey());
KeyBindsList.this.m_269130_(); KeyBindsList.this.resetMappingAndUpdateButtons();
}).m_252987_(0, 0, 50, 20).m_252778_((p_253313_) -> { }).bounds(0, 0, 50, 20).createNarration((p_253313_) -> {
@@ -144,7 +_,7 @@ @@ -144,7 +_,7 @@
public void m_6311_(GuiGraphics p_281805_, int p_281298_, int p_282357_, int p_281373_, int p_283433_, int p_281932_, int p_282224_, int p_282053_, boolean p_282605_, float p_281432_) { public void render(GuiGraphics p_281805_, int p_281298_, int p_282357_, int p_281373_, int p_283433_, int p_281932_, int p_282224_, int p_282053_, boolean p_282605_, float p_281432_) {
int k = p_281373_ + 90 - KeyBindsList.this.f_193859_; int k = p_281373_ + 90 - KeyBindsList.this.maxNameWidth;
p_281805_.m_280614_(KeyBindsList.this.f_93386_.f_91062_, this.f_193911_, k, p_282357_ + p_281932_ / 2 - 9 / 2, 16777215, false); p_281805_.drawString(KeyBindsList.this.minecraft.font, this.name, k, p_282357_ + p_281932_ / 2 - 9 / 2, 16777215, false);
- this.f_193913_.m_252865_(p_281373_ + 190); - this.resetButton.setX(p_281373_ + 190);
+ this.f_193913_.m_252865_(p_281373_ + 190 + 20); + this.resetButton.setX(p_281373_ + 190 + 20);
this.f_193913_.m_253211_(p_282357_); this.resetButton.setY(p_282357_);
this.f_193913_.m_88315_(p_281805_, p_282224_, p_282053_, p_281432_); this.resetButton.render(p_281805_, p_282224_, p_282053_, p_281432_);
this.f_193912_.m_252865_(p_281373_ + 105); this.changeButton.setX(p_281373_ + 105);
@@ -173,7 +_,7 @@ @@ -173,7 +_,7 @@
MutableComponent mutablecomponent = Component.m_237119_(); MutableComponent mutablecomponent = Component.empty();
if (!this.f_193910_.m_90862_()) { if (!this.key.isUnbound()) {
for(KeyMapping keymapping : KeyBindsList.this.f_93386_.f_91066_.f_92059_) { for(KeyMapping keymapping : KeyBindsList.this.minecraft.options.keyMappings) {
- if (keymapping != this.f_193910_ && this.f_193910_.m_90850_(keymapping)) { - if (keymapping != this.key && this.key.same(keymapping)) {
+ if ((keymapping != this.f_193910_ && this.f_193910_.m_90850_(keymapping)) || keymapping.hasKeyModifierConflict(this.f_193910_)) { // FORGE: gracefully handle conflicts like SHIFT vs SHIFT+G + if ((keymapping != this.key && this.key.same(keymapping)) || keymapping.hasKeyModifierConflict(this.key)) { // FORGE: gracefully handle conflicts like SHIFT vs SHIFT+G
if (this.f_268447_) { if (this.hasCollision) {
mutablecomponent.m_130946_(", "); mutablecomponent.append(", ");
} }
@@ -1,26 +1,26 @@
--- a/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java --- a/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java +++ b/net/minecraft/client/gui/screens/controls/KeyBindsScreen.java
@@ -31,7 +_,7 @@ @@ -31,7 +_,7 @@
this.m_7787_(this.f_193977_); this.addWidget(this.keyBindsList);
this.f_193978_ = this.m_142416_(Button.m_253074_(Component.m_237115_("controls.resetAll"), (p_269619_) -> { this.resetButton = this.addRenderableWidget(Button.builder(Component.translatable("controls.resetAll"), (p_269619_) -> {
for(KeyMapping keymapping : this.f_96282_.f_92059_) { for(KeyMapping keymapping : this.options.keyMappings) {
- keymapping.m_90848_(keymapping.m_90861_()); - keymapping.setKey(keymapping.getDefaultKey());
+ keymapping.setToDefault(); + keymapping.setToDefault();
} }
this.f_193977_.m_269130_(); this.keyBindsList.resetMappingAndUpdateButtons();
@@ -55,11 +_,14 @@ @@ -55,11 +_,14 @@
public boolean m_7933_(int p_193987_, int p_193988_, int p_193989_) { public boolean keyPressed(int p_193987_, int p_193988_, int p_193989_) {
if (this.f_193975_ != null) { if (this.selectedKey != null) {
if (p_193987_ == 256) { if (p_193987_ == 256) {
+ this.f_193975_.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputConstants.f_84822_); + this.selectedKey.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputConstants.UNKNOWN);
this.f_96282_.m_92159_(this.f_193975_, InputConstants.f_84822_); this.options.setKey(this.selectedKey, InputConstants.UNKNOWN);
} else { } else {
+ this.f_193975_.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputConstants.m_84827_(p_193987_, p_193988_)); + this.selectedKey.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputConstants.getKey(p_193987_, p_193988_));
this.f_96282_.m_92159_(this.f_193975_, InputConstants.m_84827_(p_193987_, p_193988_)); this.options.setKey(this.selectedKey, InputConstants.getKey(p_193987_, p_193988_));
} }
+ if(!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.f_193975_.getKey())) + if(!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.selectedKey.getKey()))
this.f_193975_ = null; this.selectedKey = null;
this.f_193976_ = Util.m_137550_(); this.lastKeySelection = Util.getMillis();
this.f_193977_.m_269130_(); this.keyBindsList.resetMappingAndUpdateButtons();
@@ -1,150 +1,150 @@
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java --- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java +++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
@@ -90,6 +_,7 @@ @@ -90,6 +_,7 @@
int i = this.f_97735_; int i = this.leftPos;
int j = this.f_97736_; int j = this.topPos;
super.m_88315_(p_283479_, p_283661_, p_281248_, p_281886_); super.render(p_283479_, p_283661_, p_281248_, p_281886_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.Render.Background(this, p_283479_, p_283661_, p_281248_)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.Render.Background(this, p_283479_, p_283661_, p_281248_));
RenderSystem.disableDepthTest(); RenderSystem.disableDepthTest();
p_283479_.m_280168_().m_85836_(); p_283479_.pose().pushPose();
p_283479_.m_280168_().m_252880_((float)i, (float)j, 0.0F); p_283479_.pose().translate((float)i, (float)j, 0.0F);
@@ -106,12 +_,13 @@ @@ -106,12 +_,13 @@
int l = slot.f_40220_; int l = slot.x;
int i1 = slot.f_40221_; int i1 = slot.y;
if (this.f_97734_.m_280329_()) { if (this.hoveredSlot.isHighlightable()) {
- m_280359_(p_283479_, l, i1, 0); - renderSlotHighlight(p_283479_, l, i1, 0);
+ renderSlotHighlight(p_283479_, l, i1, 0, getSlotColor(k)); + renderSlotHighlight(p_283479_, l, i1, 0, getSlotColor(k));
} }
} }
} }
this.m_280003_(p_283479_, p_283661_, p_281248_); this.renderLabels(p_283479_, p_283661_, p_281248_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.Render.Foreground(this, p_283479_, p_283661_, p_281248_)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.Render.Foreground(this, p_283479_, p_283661_, p_281248_));
ItemStack itemstack = this.f_97711_.m_41619_() ? this.f_97732_.m_142621_() : this.f_97711_; ItemStack itemstack = this.draggingItem.isEmpty() ? this.menu.getCarried() : this.draggingItem;
if (!itemstack.m_41619_()) { if (!itemstack.isEmpty()) {
int l1 = 8; int l1 = 8;
@@ -153,13 +_,16 @@ @@ -153,13 +_,16 @@
} }
public static void m_280359_(GuiGraphics p_283692_, int p_281453_, int p_281915_, int p_283504_) { public static void renderSlotHighlight(GuiGraphics p_283692_, int p_281453_, int p_281915_, int p_283504_) {
- p_283692_.m_285978_(RenderType.m_286086_(), p_281453_, p_281915_, p_281453_ + 16, p_281915_ + 16, -2130706433, -2130706433, p_283504_); - p_283692_.fillGradient(RenderType.guiOverlay(), p_281453_, p_281915_, p_281453_ + 16, p_281915_ + 16, -2130706433, -2130706433, p_283504_);
+ renderSlotHighlight(p_283692_, p_281453_, p_281915_, p_283504_, -2130706433); + renderSlotHighlight(p_283692_, p_281453_, p_281915_, p_283504_, -2130706433);
+ } + }
+ public static void renderSlotHighlight(GuiGraphics p_283692_, int p_281453_, int p_281915_, int p_283504_, int color) { + public static void renderSlotHighlight(GuiGraphics p_283692_, int p_281453_, int p_281915_, int p_283504_, int color) {
+ p_283692_.m_285978_(RenderType.m_286086_(), p_281453_, p_281915_, p_281453_ + 16, p_281915_ + 16, color, color, p_283504_); + p_283692_.fillGradient(RenderType.guiOverlay(), p_281453_, p_281915_, p_281453_ + 16, p_281915_ + 16, color, color, p_283504_);
} }
protected void m_280072_(GuiGraphics p_283594_, int p_282171_, int p_281909_) { protected void renderTooltip(GuiGraphics p_283594_, int p_282171_, int p_281909_) {
if (this.f_97732_.m_142621_().m_41619_() && this.f_97734_ != null && this.f_97734_.m_6657_()) { if (this.menu.getCarried().isEmpty() && this.hoveredSlot != null && this.hoveredSlot.hasItem()) {
ItemStack itemstack = this.f_97734_.m_7993_(); ItemStack itemstack = this.hoveredSlot.getItem();
- p_283594_.m_280677_(this.f_96547_, this.m_280553_(itemstack), itemstack.m_150921_(), p_282171_, p_281909_); - p_283594_.renderTooltip(this.font, this.getTooltipFromContainerItem(itemstack), itemstack.getTooltipImage(), p_282171_, p_281909_);
+ p_283594_.renderTooltip(this.f_96547_, this.m_280553_(itemstack), itemstack.m_150921_(), itemstack, p_282171_, p_281909_); + p_283594_.renderTooltip(this.font, this.getTooltipFromContainerItem(itemstack), itemstack.getTooltipImage(), itemstack, p_282171_, p_281909_);
} }
} }
@@ -172,7 +_,8 @@ @@ -172,7 +_,8 @@
p_282567_.m_280168_().m_85836_(); p_282567_.pose().pushPose();
p_282567_.m_280168_().m_252880_(0.0F, 0.0F, 232.0F); p_282567_.pose().translate(0.0F, 0.0F, 232.0F);
p_282567_.m_280480_(p_281330_, p_281772_, p_281689_); p_282567_.renderItem(p_281330_, p_281772_, p_281689_);
- p_282567_.m_280302_(this.f_96547_, p_281330_, p_281772_, p_281689_ - (this.f_97711_.m_41619_() ? 0 : 8), p_282568_); - p_282567_.renderItemDecorations(this.font, p_281330_, p_281772_, p_281689_ - (this.draggingItem.isEmpty() ? 0 : 8), p_282568_);
+ var font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_281330_).getFont(p_281330_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.ITEM_COUNT); + var font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_281330_).getFont(p_281330_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.ITEM_COUNT);
+ p_282567_.m_280302_(font == null ? this.f_96547_ : font, p_281330_, p_281772_, p_281689_ - (this.f_97711_.m_41619_() ? 0 : 8), p_282568_); + p_282567_.renderItemDecorations(font == null ? this.font : font, p_281330_, p_281772_, p_281689_ - (this.draggingItem.isEmpty() ? 0 : 8), p_282568_);
p_282567_.m_280168_().m_85849_(); p_282567_.pose().popPose();
} }
@@ -274,7 +_,8 @@ @@ -274,7 +_,8 @@
if (super.m_6375_(p_97748_, p_97749_, p_97750_)) { if (super.mouseClicked(p_97748_, p_97749_, p_97750_)) {
return true; return true;
} else { } else {
- boolean flag = this.f_96541_.f_91066_.f_92097_.m_90830_(p_97750_) && this.f_96541_.f_91072_.m_105290_(); - boolean flag = this.minecraft.options.keyPickItem.matchesMouse(p_97750_) && this.minecraft.gameMode.hasInfiniteItems();
+ InputConstants.Key mouseKey = InputConstants.Type.MOUSE.m_84895_(p_97750_); + InputConstants.Key mouseKey = InputConstants.Type.MOUSE.getOrCreate(p_97750_);
+ boolean flag = this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey); + boolean flag = this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey);
Slot slot = this.m_97744_(p_97748_, p_97749_); Slot slot = this.findSlot(p_97748_, p_97749_);
long i = Util.m_137550_(); long i = Util.getMillis();
this.f_97723_ = this.f_97709_ == slot && i - this.f_97721_ < 250L && this.f_97722_ == p_97750_; this.doubleclick = this.lastClickSlot == slot && i - this.lastClickTime < 250L && this.lastClickButton == p_97750_;
@@ -285,6 +_,7 @@ @@ -285,6 +_,7 @@
int j = this.f_97735_; int j = this.leftPos;
int k = this.f_97736_; int k = this.topPos;
boolean flag1 = this.m_7467_(p_97748_, p_97749_, j, k, p_97750_); boolean flag1 = this.hasClickedOutside(p_97748_, p_97749_, j, k, p_97750_);
+ if (slot != null) flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries + if (slot != null) flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
int l = -1; int l = -1;
if (slot != null) { if (slot != null) {
l = slot.f_40219_; l = slot.index;
@@ -310,7 +_,7 @@ @@ -310,7 +_,7 @@
} }
} else if (!this.f_97738_) { } else if (!this.isQuickCrafting) {
if (this.f_97732_.m_142621_().m_41619_()) { if (this.menu.getCarried().isEmpty()) {
- if (flag) { - if (flag) {
+ if (this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey)) { + if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
this.m_6597_(slot, l, p_97750_, ClickType.CLONE); this.slotClicked(slot, l, p_97750_, ClickType.CLONE);
} else { } else {
boolean flag2 = l != -999 && (InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 340) || InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 344)); boolean flag2 = l != -999 && (InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 340) || InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 344));
@@ -334,7 +_,7 @@ @@ -334,7 +_,7 @@
this.f_97717_ = 0; this.quickCraftingType = 0;
} else if (p_97750_ == 1) { } else if (p_97750_ == 1) {
this.f_97717_ = 1; this.quickCraftingType = 1;
- } else if (flag) { - } else if (flag) {
+ } else if (this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey)) { + } else if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
this.f_97717_ = 2; this.quickCraftingType = 2;
} }
} }
@@ -403,10 +_,13 @@ @@ -403,10 +_,13 @@
} }
public boolean m_6348_(double p_97812_, double p_97813_, int p_97814_) { public boolean mouseReleased(double p_97812_, double p_97813_, int p_97814_) {
+ super.m_6348_(p_97812_, p_97813_, p_97814_); //Forge, Call parent to release buttons + super.mouseReleased(p_97812_, p_97813_, p_97814_); //Forge, Call parent to release buttons
Slot slot = this.m_97744_(p_97812_, p_97813_); Slot slot = this.findSlot(p_97812_, p_97813_);
int i = this.f_97735_; int i = this.leftPos;
int j = this.f_97736_; int j = this.topPos;
boolean flag = this.m_7467_(p_97812_, p_97813_, i, j, p_97814_); boolean flag = this.hasClickedOutside(p_97812_, p_97813_, i, j, p_97814_);
+ if (slot != null) flag = false; // Forge, prevent dropping of items through slots outside of GUI boundaries + if (slot != null) flag = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
+ InputConstants.Key mouseKey = InputConstants.Type.MOUSE.m_84895_(p_97814_); + InputConstants.Key mouseKey = InputConstants.Type.MOUSE.getOrCreate(p_97814_);
int k = -1; int k = -1;
if (slot != null) { if (slot != null) {
k = slot.f_40219_; k = slot.index;
@@ -420,7 +_,7 @@ @@ -420,7 +_,7 @@
if (m_96638_()) { if (hasShiftDown()) {
if (!this.f_97724_.m_41619_()) { if (!this.lastQuickMoved.isEmpty()) {
for(Slot slot2 : this.f_97732_.f_38839_) { for(Slot slot2 : this.menu.slots) {
- if (slot2 != null && slot2.m_8010_(this.f_96541_.f_91074_) && slot2.m_6657_() && slot2.f_40218_ == slot.f_40218_ && AbstractContainerMenu.m_38899_(slot2, this.f_97724_, true)) { - if (slot2 != null && slot2.mayPickup(this.minecraft.player) && slot2.hasItem() && slot2.container == slot.container && AbstractContainerMenu.canItemQuickReplace(slot2, this.lastQuickMoved, true)) {
+ if (slot2 != null && slot2.m_8010_(this.f_96541_.f_91074_) && slot2.m_6657_() && slot2.isSameInventory(slot) && AbstractContainerMenu.m_38899_(slot2, this.f_97724_, true)) { + if (slot2 != null && slot2.mayPickup(this.minecraft.player) && slot2.hasItem() && slot2.isSameInventory(slot) && AbstractContainerMenu.canItemQuickReplace(slot2, this.lastQuickMoved, true)) {
this.m_6597_(slot2, slot2.f_40219_, p_97814_, ClickType.QUICK_MOVE); this.slotClicked(slot2, slot2.index, p_97814_, ClickType.QUICK_MOVE);
} }
} }
@@ -483,7 +_,7 @@ @@ -483,7 +_,7 @@
this.m_6597_((Slot)null, -999, AbstractContainerMenu.m_38930_(2, this.f_97717_), ClickType.QUICK_CRAFT); this.slotClicked((Slot)null, -999, AbstractContainerMenu.getQuickcraftMask(2, this.quickCraftingType), ClickType.QUICK_CRAFT);
} else if (!this.f_97732_.m_142621_().m_41619_()) { } else if (!this.menu.getCarried().isEmpty()) {
- if (this.f_96541_.f_91066_.f_92097_.m_90830_(p_97814_)) { - if (this.minecraft.options.keyPickItem.matchesMouse(p_97814_)) {
+ if (this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey)) { + if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
this.m_6597_(slot, k, p_97814_, ClickType.CLONE); this.slotClicked(slot, k, p_97814_, ClickType.CLONE);
} else { } else {
boolean flag1 = k != -999 && (InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 340) || InputConstants.m_84830_(Minecraft.m_91087_().m_91268_().m_85439_(), 344)); boolean flag1 = k != -999 && (InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 340) || InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), 344));
@@ -530,34 +_,39 @@ @@ -530,34 +_,39 @@
} }
public boolean m_7933_(int p_97765_, int p_97766_, int p_97767_) { public boolean keyPressed(int p_97765_, int p_97766_, int p_97767_) {
+ InputConstants.Key mouseKey = InputConstants.m_84827_(p_97765_, p_97766_); + InputConstants.Key mouseKey = InputConstants.getKey(p_97765_, p_97766_);
if (super.m_7933_(p_97765_, p_97766_, p_97767_)) { if (super.keyPressed(p_97765_, p_97766_, p_97767_)) {
return true; return true;
- } else if (this.f_96541_.f_91066_.f_92092_.m_90832_(p_97765_, p_97766_)) { - } else if (this.minecraft.options.keyInventory.matches(p_97765_, p_97766_)) {
+ } else if (this.f_96541_.f_91066_.f_92092_.isActiveAndMatches(mouseKey)) { + } else if (this.minecraft.options.keyInventory.isActiveAndMatches(mouseKey)) {
this.m_7379_(); this.onClose();
return true; return true;
} else { } else {
- this.m_97805_(p_97765_, p_97766_); - this.checkHotbarKeyPressed(p_97765_, p_97766_);
+ boolean handled = this.m_97805_(p_97765_, p_97766_);// Forge MC-146650: Needs to return true when the key is handled + boolean handled = this.checkHotbarKeyPressed(p_97765_, p_97766_);// Forge MC-146650: Needs to return true when the key is handled
if (this.f_97734_ != null && this.f_97734_.m_6657_()) { if (this.hoveredSlot != null && this.hoveredSlot.hasItem()) {
- if (this.f_96541_.f_91066_.f_92097_.m_90832_(p_97765_, p_97766_)) { - if (this.minecraft.options.keyPickItem.matches(p_97765_, p_97766_)) {
+ if (this.f_96541_.f_91066_.f_92097_.isActiveAndMatches(mouseKey)) { + if (this.minecraft.options.keyPickItem.isActiveAndMatches(mouseKey)) {
this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, 0, ClickType.CLONE); this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, 0, ClickType.CLONE);
- } else if (this.f_96541_.f_91066_.f_92094_.m_90832_(p_97765_, p_97766_)) { - } else if (this.minecraft.options.keyDrop.matches(p_97765_, p_97766_)) {
+ handled = true; + handled = true;
+ } else if (this.f_96541_.f_91066_.f_92094_.isActiveAndMatches(mouseKey)) { + } else if (this.minecraft.options.keyDrop.isActiveAndMatches(mouseKey)) {
this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, m_96637_() ? 1 : 0, ClickType.THROW); this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, hasControlDown() ? 1 : 0, ClickType.THROW);
+ handled = true; + handled = true;
} }
+ } else if (this.f_96541_.f_91066_.f_92094_.isActiveAndMatches(mouseKey)) { + } else if (this.minecraft.options.keyDrop.isActiveAndMatches(mouseKey)) {
+ handled = true; // Forge MC-146650: Emulate MC bug, so we don't drop from hotbar when pressing drop without hovering over a item. + handled = true; // Forge MC-146650: Emulate MC bug, so we don't drop from hotbar when pressing drop without hovering over a item.
} }
@@ -153,36 +153,36 @@
} }
} }
protected boolean m_97805_(int p_97806_, int p_97807_) { protected boolean checkHotbarKeyPressed(int p_97806_, int p_97807_) {
if (this.f_97732_.m_142621_().m_41619_() && this.f_97734_ != null) { if (this.menu.getCarried().isEmpty() && this.hoveredSlot != null) {
- if (this.f_96541_.f_91066_.f_92093_.m_90832_(p_97806_, p_97807_)) { - if (this.minecraft.options.keySwapOffhand.matches(p_97806_, p_97807_)) {
+ if (this.f_96541_.f_91066_.f_92093_.isActiveAndMatches(InputConstants.m_84827_(p_97806_, p_97807_))) { + if (this.minecraft.options.keySwapOffhand.isActiveAndMatches(InputConstants.getKey(p_97806_, p_97807_))) {
this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, 40, ClickType.SWAP); this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, 40, ClickType.SWAP);
return true; return true;
} }
for(int i = 0; i < 9; ++i) { for(int i = 0; i < 9; ++i) {
- if (this.f_96541_.f_91066_.f_92056_[i].m_90832_(p_97806_, p_97807_)) { - if (this.minecraft.options.keyHotbarSlots[i].matches(p_97806_, p_97807_)) {
+ if (this.f_96541_.f_91066_.f_92056_[i].isActiveAndMatches(InputConstants.m_84827_(p_97806_, p_97807_))) { + if (this.minecraft.options.keyHotbarSlots[i].isActiveAndMatches(InputConstants.getKey(p_97806_, p_97807_))) {
this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, i, ClickType.SWAP); this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, i, ClickType.SWAP);
return true; return true;
} }
@@ -592,6 +_,18 @@ @@ -592,6 +_,18 @@
public T m_6262_() { public T getMenu() {
return this.f_97732_; return this.menu;
+ } + }
+ +
+ @org.jetbrains.annotations.Nullable + @org.jetbrains.annotations.Nullable
+ public Slot getSlotUnderMouse() { return this.f_97734_; } + public Slot getSlotUnderMouse() { return this.hoveredSlot; }
+ public int getGuiLeft() { return f_97735_; } + public int getGuiLeft() { return leftPos; }
+ public int getGuiTop() { return f_97736_; } + public int getGuiTop() { return topPos; }
+ public int getXSize() { return f_97726_; } + public int getXSize() { return imageWidth; }
+ public int getYSize() { return f_97727_; } + public int getYSize() { return imageHeight; }
+ +
+ protected int slotColor = -2130706433; + protected int slotColor = -2130706433;
+ public int getSlotColor(int index) { + public int getSlotColor(int index) {
+ return slotColor; + return slotColor;
} }
public void m_7379_() { public void onClose() {
@@ -1,27 +1,27 @@
--- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java --- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
@@ -79,6 +_,8 @@ @@ -79,6 +_,8 @@
private boolean f_98515_; private boolean hasClickedOutside;
private final Set<TagKey<Item>> f_98516_ = new HashSet<>(); private final Set<TagKey<Item>> visibleTags = new HashSet<>();
private final boolean f_256872_; private final boolean displayOperatorCreativeTab;
+ private final List<net.minecraftforge.client.gui.CreativeTabsScreenPage> pages = new java.util.ArrayList<>(); + private final List<net.minecraftforge.client.gui.CreativeTabsScreenPage> pages = new java.util.ArrayList<>();
+ private net.minecraftforge.client.gui.CreativeTabsScreenPage currentPage = new net.minecraftforge.client.gui.CreativeTabsScreenPage(new java.util.ArrayList<>()); + private net.minecraftforge.client.gui.CreativeTabsScreenPage currentPage = new net.minecraftforge.client.gui.CreativeTabsScreenPage(new java.util.ArrayList<>());
public CreativeModeInventoryScreen(Player p_259788_, FeatureFlagSet p_260074_, boolean p_259569_) { public CreativeModeInventoryScreen(Player p_259788_, FeatureFlagSet p_260074_, boolean p_259569_) {
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_259788_), p_259788_.m_150109_(), CommonComponents.f_237098_); super(new CreativeModeInventoryScreen.ItemPickerMenu(p_259788_), p_259788_.getInventory(), CommonComponents.EMPTY);
@@ -112,7 +_,7 @@ @@ -112,7 +_,7 @@
private void m_257687_(Collection<ItemStack> p_261591_) { private void refreshCurrentTabContents(Collection<ItemStack> p_261591_) {
int i = this.f_97732_.m_257485_(this.f_98508_); int i = this.menu.getRowIndexForScroll(this.scrollOffs);
(this.f_97732_).f_98639_.clear(); (this.menu).items.clear();
- if (f_98507_.m_257962_() == CreativeModeTab.Type.SEARCH) { - if (selectedTab.getType() == CreativeModeTab.Type.SEARCH) {
+ if (f_98507_.hasSearchBar()) { + if (selectedTab.hasSearchBar()) {
this.m_98630_(); this.refreshSearchResults();
} else { } else {
(this.f_97732_).f_98639_.addAll(p_261591_); (this.menu).items.addAll(p_261591_);
@@ -266,6 +_,34 @@ @@ -266,6 +_,34 @@
protected void m_7856_() { protected void init() {
if (this.f_96541_.f_91072_.m_105290_()) { if (this.minecraft.gameMode.hasInfiniteItems()) {
super.m_7856_(); super.init();
+ this.pages.clear(); + this.pages.clear();
+ int tabIndex = 0; + int tabIndex = 0;
+ List<CreativeModeTab> currentPage = new java.util.ArrayList<>(); + List<CreativeModeTab> currentPage = new java.util.ArrayList<>();
@@ -43,211 +43,211 @@
+ this.currentPage = this.pages.get(0); + this.currentPage = this.pages.get(0);
+ } + }
+ if (this.pages.size() > 1) { + if (this.pages.size() > 1) {
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_("<"), b -> setCurrentPage(this.pages.get(Math.max(this.pages.indexOf(this.currentPage) - 1, 0)))).m_252794_(f_97735_, f_97736_ - 50).m_253046_(20, 20).m_253136_()); + addRenderableWidget(net.minecraft.client.gui.components.Button.builder(Component.literal("<"), b -> setCurrentPage(this.pages.get(Math.max(this.pages.indexOf(this.currentPage) - 1, 0)))).pos(leftPos, topPos - 50).size(20, 20).build());
+ m_142416_(net.minecraft.client.gui.components.Button.m_253074_(Component.m_237113_(">"), b -> setCurrentPage(this.pages.get(Math.min(this.pages.indexOf(this.currentPage) + 1, this.pages.size() - 1)))).m_252794_(f_97735_ + f_97726_ - 20, f_97736_ - 50).m_253046_(20, 20).m_253136_()); + addRenderableWidget(net.minecraft.client.gui.components.Button.builder(Component.literal(">"), b -> setCurrentPage(this.pages.get(Math.min(this.pages.indexOf(this.currentPage) + 1, this.pages.size() - 1)))).pos(leftPos + imageWidth - 20, topPos - 50).size(20, 20).build());
+ } + }
+ this.currentPage = this.pages.stream().filter(page -> page.getVisibleTabs().contains(f_98507_)).findFirst().orElse(this.currentPage); + this.currentPage = this.pages.stream().filter(page -> page.getVisibleTabs().contains(selectedTab)).findFirst().orElse(this.currentPage);
+ if (!this.currentPage.getVisibleTabs().contains(f_98507_)) { + if (!this.currentPage.getVisibleTabs().contains(selectedTab)) {
+ f_98507_ = this.currentPage.getVisibleTabs().get(0); + selectedTab = this.currentPage.getVisibleTabs().get(0);
+ } + }
this.f_98510_ = new EditBox(this.f_96547_, this.f_97735_ + 82, this.f_97736_ + 6, 80, 9, Component.m_237115_("itemGroup.search")); this.searchBox = new EditBox(this.font, this.leftPos + 82, this.topPos + 6, 80, 9, Component.translatable("itemGroup.search"));
this.f_98510_.m_94199_(50); this.searchBox.setMaxLength(50);
this.f_98510_.m_94182_(false); this.searchBox.setBordered(false);
@@ -311,7 +_,7 @@ @@ -311,7 +_,7 @@
public boolean m_5534_(char p_98521_, int p_98522_) { public boolean charTyped(char p_98521_, int p_98522_) {
if (this.f_98514_) { if (this.ignoreTextInput) {
return false; return false;
- } else if (f_98507_.m_257962_() != CreativeModeTab.Type.SEARCH) { - } else if (selectedTab.getType() != CreativeModeTab.Type.SEARCH) {
+ } else if (!f_98507_.hasSearchBar()) { + } else if (!selectedTab.hasSearchBar()) {
return false; return false;
} else { } else {
String s = this.f_98510_.m_94155_(); String s = this.searchBox.getValue();
@@ -329,7 +_,7 @@ @@ -329,7 +_,7 @@
public boolean m_7933_(int p_98547_, int p_98548_, int p_98549_) { public boolean keyPressed(int p_98547_, int p_98548_, int p_98549_) {
this.f_98514_ = false; this.ignoreTextInput = false;
- if (f_98507_.m_257962_() != CreativeModeTab.Type.SEARCH) { - if (selectedTab.getType() != CreativeModeTab.Type.SEARCH) {
+ if (!f_98507_.hasSearchBar()) { + if (!selectedTab.hasSearchBar()) {
if (this.f_96541_.f_91066_.f_92098_.m_90832_(p_98547_, p_98548_)) { if (this.minecraft.options.keyChat.matches(p_98547_, p_98548_)) {
this.f_98514_ = true; this.ignoreTextInput = true;
this.m_98560_(CreativeModeTabs.m_258007_()); this.selectTab(CreativeModeTabs.searchTab());
@@ -364,6 +_,7 @@ @@ -364,6 +_,7 @@
} }
private void m_98630_() { private void refreshSearchResults() {
+ if (!f_98507_.hasSearchBar()) return; + if (!selectedTab.hasSearchBar()) return;
(this.f_97732_).f_98639_.clear(); (this.menu).items.clear();
this.f_98516_.clear(); this.visibleTags.clear();
String s = this.f_98510_.m_94155_(); String s = this.searchBox.getValue();
@@ -373,10 +_,10 @@ @@ -373,10 +_,10 @@
SearchTree<ItemStack> searchtree; SearchTree<ItemStack> searchtree;
if (s.startsWith("#")) { if (s.startsWith("#")) {
s = s.substring(1); s = s.substring(1);
- searchtree = this.f_96541_.m_231372_(SearchRegistry.f_119942_); - searchtree = this.minecraft.getSearchTree(SearchRegistry.CREATIVE_TAGS);
+ searchtree = this.f_96541_.m_231372_(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(f_98507_)); + searchtree = this.minecraft.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKey(selectedTab));
this.m_98619_(s); this.updateVisibleTags(s);
} else { } else {
- searchtree = this.f_96541_.m_231372_(SearchRegistry.f_119941_); - searchtree = this.minecraft.getSearchTree(SearchRegistry.CREATIVE_NAMES);
+ searchtree = this.f_96541_.m_231372_(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(f_98507_)); + searchtree = this.minecraft.getSearchTree(net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKey(selectedTab));
} }
(this.f_97732_).f_98639_.addAll(searchtree.m_6293_(s.toLowerCase(Locale.ROOT))); (this.menu).items.addAll(searchtree.search(s.toLowerCase(Locale.ROOT)));
@@ -408,7 +_,8 @@ @@ -408,7 +_,8 @@
protected void m_280003_(GuiGraphics p_283168_, int p_281774_, int p_281466_) { protected void renderLabels(GuiGraphics p_283168_, int p_281774_, int p_281466_) {
if (f_98507_.m_40789_()) { if (selectedTab.showTitle()) {
- p_283168_.m_280614_(this.f_96547_, f_98507_.m_40786_(), 8, 6, 4210752, false); - p_283168_.drawString(this.font, selectedTab.getDisplayName(), 8, 6, 4210752, false);
+ com.mojang.blaze3d.systems.RenderSystem.disableBlend(); + com.mojang.blaze3d.systems.RenderSystem.disableBlend();
+ p_283168_.m_280614_(this.f_96547_, f_98507_.m_40786_(), 8, 6, f_98507_.getLabelColor(), false); + p_283168_.drawString(this.font, selectedTab.getDisplayName(), 8, 6, selectedTab.getLabelColor(), false);
} }
} }
@@ -418,7 +_,7 @@ @@ -418,7 +_,7 @@
double d0 = p_98531_ - (double)this.f_97735_; double d0 = p_98531_ - (double)this.leftPos;
double d1 = p_98532_ - (double)this.f_97736_; double d1 = p_98532_ - (double)this.topPos;
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) { - for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { + for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (this.m_98562_(creativemodetab, d0, d1)) { if (this.checkTabClicked(creativemodetab, d0, d1)) {
return true; return true;
} }
@@ -439,7 +_,7 @@ @@ -439,7 +_,7 @@
double d1 = p_98623_ - (double)this.f_97736_; double d1 = p_98623_ - (double)this.topPos;
this.f_98509_ = false; this.scrolling = false;
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) { - for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { + for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (this.m_98562_(creativemodetab, d0, d1)) { if (this.checkTabClicked(creativemodetab, d0, d1)) {
this.m_98560_(creativemodetab); this.selectTab(creativemodetab);
return true; return true;
@@ -457,6 +_,7 @@ @@ -457,6 +_,7 @@
private void m_98560_(CreativeModeTab p_98561_) { private void selectTab(CreativeModeTab p_98561_) {
CreativeModeTab creativemodetab = f_98507_; CreativeModeTab creativemodetab = selectedTab;
f_98507_ = p_98561_; selectedTab = p_98561_;
+ slotColor = p_98561_.getSlotColor(); + slotColor = p_98561_.getSlotColor();
this.f_97737_.clear(); this.quickCraftSlots.clear();
(this.f_97732_).f_98639_.clear(); (this.menu).items.clear();
this.m_238391_(); this.clearDraggingState();
@@ -533,13 +_,15 @@ @@ -533,13 +_,15 @@
this.f_98511_ = null; this.originalSlots = null;
} }
- if (f_98507_.m_257962_() == CreativeModeTab.Type.SEARCH) { - if (selectedTab.getType() == CreativeModeTab.Type.SEARCH) {
+ if (f_98507_.hasSearchBar()) { + if (selectedTab.hasSearchBar()) {
this.f_98510_.m_94194_(true); this.searchBox.setVisible(true);
this.f_98510_.m_94190_(false); this.searchBox.setCanLoseFocus(false);
this.f_98510_.m_93692_(true); this.searchBox.setFocused(true);
if (creativemodetab != p_98561_) { if (creativemodetab != p_98561_) {
this.f_98510_.m_94144_(""); this.searchBox.setValue("");
} }
+ this.f_98510_.m_93674_(f_98507_.getSearchBarWidth()); + this.searchBox.setWidth(selectedTab.getSearchBarWidth());
+ this.f_98510_.m_252865_(this.f_97735_ + (82 /*default left*/ + 89 /*default width*/) - this.f_98510_.m_5711_()); + this.searchBox.setX(this.leftPos + (82 /*default left*/ + 89 /*default width*/) - this.searchBox.getWidth());
this.m_98630_(); this.refreshSearchResults();
} else { } else {
@@ -595,7 +_,7 @@ @@ -595,7 +_,7 @@
public void m_88315_(GuiGraphics p_283000_, int p_281317_, int p_282770_, float p_281295_) { public void render(GuiGraphics p_283000_, int p_281317_, int p_282770_, float p_281295_) {
super.m_88315_(p_283000_, p_281317_, p_282770_, p_281295_); super.render(p_283000_, p_281317_, p_282770_, p_281295_);
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) { - for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { + for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (this.m_280537_(p_283000_, creativemodetab, p_281317_, p_282770_)) { if (this.checkTabHovering(p_283000_, creativemodetab, p_281317_, p_282770_)) {
break; break;
} }
@@ -605,13 +_,22 @@ @@ -605,13 +_,22 @@
p_283000_.m_280557_(this.f_96547_, f_98506_, p_281317_, p_282770_); p_283000_.renderTooltip(this.font, TRASH_SLOT_TOOLTIP, p_281317_, p_282770_);
} }
+ if (this.pages.size() != 1) { + if (this.pages.size() != 1) {
+ Component page = Component.m_237113_(String.format("%d / %d", this.pages.indexOf(this.currentPage) + 1, this.pages.size())); + Component page = Component.literal(String.format("%d / %d", this.pages.indexOf(this.currentPage) + 1, this.pages.size()));
+ p_283000_.m_280168_().m_85836_(); + p_283000_.pose().pushPose();
+ p_283000_.m_280168_().m_252880_(0F, 0F, 300F); + p_283000_.pose().translate(0F, 0F, 300F);
+ p_283000_.m_280648_(f_96547_, page.m_7532_(), f_97735_ + (f_97726_ / 2) - (f_96547_.m_92852_(page) / 2), f_97736_ - 44, -1); + p_283000_.drawString(font, page.getVisualOrderText(), leftPos + (imageWidth / 2) - (font.width(page) / 2), topPos - 44, -1);
+ p_283000_.m_280168_().m_85849_(); + p_283000_.pose().popPose();
+ } + }
+ +
+ com.mojang.blaze3d.systems.RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + com.mojang.blaze3d.systems.RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
this.m_280072_(p_283000_, p_281317_, p_282770_); this.renderTooltip(p_283000_, p_281317_, p_282770_);
} }
public List<Component> m_280553_(ItemStack p_281769_) { public List<Component> getTooltipFromContainerItem(ItemStack p_281769_) {
boolean flag = this.f_97734_ != null && this.f_97734_ instanceof CreativeModeInventoryScreen.CustomCreativeSlot; boolean flag = this.hoveredSlot != null && this.hoveredSlot instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
boolean flag1 = f_98507_.m_257962_() == CreativeModeTab.Type.CATEGORY; boolean flag1 = selectedTab.getType() == CreativeModeTab.Type.CATEGORY;
- boolean flag2 = f_98507_.m_257962_() == CreativeModeTab.Type.SEARCH; - boolean flag2 = selectedTab.getType() == CreativeModeTab.Type.SEARCH;
+ boolean flag2 = f_98507_.hasSearchBar(); + boolean flag2 = selectedTab.hasSearchBar();
TooltipFlag.Default tooltipflag$default = this.f_96541_.f_91066_.f_92125_ ? TooltipFlag.Default.f_256730_ : TooltipFlag.Default.f_256752_; TooltipFlag.Default tooltipflag$default = this.minecraft.options.advancedItemTooltips ? TooltipFlag.Default.ADVANCED : TooltipFlag.Default.NORMAL;
TooltipFlag tooltipflag = flag ? tooltipflag$default.m_257777_() : tooltipflag$default; TooltipFlag tooltipflag = flag ? tooltipflag$default.asCreative() : tooltipflag$default;
List<Component> list = p_281769_.m_41651_(this.f_96541_.f_91074_, tooltipflag); List<Component> list = p_281769_.getTooltipLines(this.minecraft.player, tooltipflag);
@@ -631,7 +_,7 @@ @@ -631,7 +_,7 @@
int i = 1; int i = 1;
for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) { for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
- if (creativemodetab.m_257962_() != CreativeModeTab.Type.SEARCH && creativemodetab.m_257694_(p_281769_)) { - if (creativemodetab.getType() != CreativeModeTab.Type.SEARCH && creativemodetab.contains(p_281769_)) {
+ if (!creativemodetab.hasSearchBar() && creativemodetab.m_257694_(p_281769_)) { + if (!creativemodetab.hasSearchBar() && creativemodetab.contains(p_281769_)) {
list1.add(i++, creativemodetab.m_40786_().m_6881_().m_130940_(ChatFormatting.BLUE)); list1.add(i++, creativemodetab.getDisplayName().copy().withStyle(ChatFormatting.BLUE));
} }
} }
@@ -641,13 +_,13 @@ @@ -641,13 +_,13 @@
} }
protected void m_7286_(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) { protected void renderBg(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) {
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) { - for(CreativeModeTab creativemodetab : CreativeModeTabs.tabs()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) { + for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (creativemodetab != f_98507_) { if (creativemodetab != selectedTab) {
this.m_280560_(p_282663_, creativemodetab); this.renderTabButton(p_282663_, creativemodetab);
} }
} }
- p_282663_.m_280218_(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + f_98507_.m_40788_()), this.f_97735_, this.f_97736_, 0, 0, this.f_97726_, this.f_97727_); - p_282663_.blit(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + selectedTab.getBackgroundSuffix()), this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight);
+ p_282663_.m_280218_(f_98507_.getBackgroundLocation(), this.f_97735_, this.f_97736_, 0, 0, this.f_97726_, this.f_97727_); + p_282663_.blit(selectedTab.getBackgroundLocation(), this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight);
this.f_98510_.m_88315_(p_282663_, p_282089_, p_282249_, p_282504_); this.searchBox.render(p_282663_, p_282089_, p_282249_, p_282504_);
int j = this.f_97735_ + 175; int j = this.leftPos + 175;
int k = this.f_97736_ + 18; int k = this.topPos + 18;
@@ -657,6 +_,7 @@ @@ -657,6 +_,7 @@
p_282663_.m_292816_(resourcelocation, j, k + (int)((float)(i - k - 17) * this.f_98508_), 12, 15); p_282663_.blitSprite(resourcelocation, j, k + (int)((float)(i - k - 17) * this.scrollOffs), 12, 15);
} }
+ if (currentPage.getVisibleTabs().contains(f_98507_)) //Forge: only display tab selection when the selected tab is on the current page + if (currentPage.getVisibleTabs().contains(selectedTab)) //Forge: only display tab selection when the selected tab is on the current page
this.m_280560_(p_282663_, f_98507_); this.renderTabButton(p_282663_, selectedTab);
if (f_98507_.m_257962_() == CreativeModeTab.Type.INVENTORY) { if (selectedTab.getType() == CreativeModeTab.Type.INVENTORY) {
InventoryScreen.m_274545_(p_282663_, this.f_97735_ + 73, this.f_97736_ + 6, this.f_97735_ + 105, this.f_97736_ + 49, 20, 0.0625F, (float)p_282089_, (float)p_282249_, this.f_96541_.f_91074_); InventoryScreen.renderEntityInInventoryFollowsMouse(p_282663_, this.leftPos + 73, this.topPos + 6, this.leftPos + 105, this.topPos + 49, 20, 0.0625F, (float)p_282089_, (float)p_282249_, this.minecraft.player);
@@ -665,7 +_,7 @@ @@ -665,7 +_,7 @@
} }
private int m_258094_(CreativeModeTab p_260136_) { private int getTabX(CreativeModeTab p_260136_) {
- int i = p_260136_.m_257903_(); - int i = p_260136_.column();
+ int i = currentPage.getColumn(p_260136_); + int i = currentPage.getColumn(p_260136_);
int j = 27; int j = 27;
int k = 27 * i; int k = 27 * i;
if (p_260136_.m_6563_()) { if (p_260136_.isAlignedRight()) {
@@ -677,7 +_,7 @@ @@ -677,7 +_,7 @@
private int m_257995_(CreativeModeTab p_260181_) { private int getTabY(CreativeModeTab p_260181_) {
int i = 0; int i = 0;
- if (p_260181_.m_258064_() == CreativeModeTab.Row.TOP) { - if (p_260181_.row() == CreativeModeTab.Row.TOP) {
+ if (currentPage.isTop(p_260181_)) { + if (currentPage.isTop(p_260181_)) {
i -= 32; i -= 32;
} else { } else {
i += this.f_97727_; i += this.imageHeight;
@@ -705,8 +_,8 @@ @@ -705,8 +_,8 @@
protected void m_280560_(GuiGraphics p_283590_, CreativeModeTab p_283489_) { protected void renderTabButton(GuiGraphics p_283590_, CreativeModeTab p_283489_) {
boolean flag = p_283489_ == f_98507_; boolean flag = p_283489_ == selectedTab;
- boolean flag1 = p_283489_.m_258064_() == CreativeModeTab.Row.TOP; - boolean flag1 = p_283489_.row() == CreativeModeTab.Row.TOP;
- int i = p_283489_.m_257903_(); - int i = p_283489_.column();
+ boolean flag1 = currentPage.isTop(p_283489_); + boolean flag1 = currentPage.isTop(p_283489_);
+ int i = currentPage.getColumn(p_283489_); + int i = currentPage.getColumn(p_283489_);
int j = this.f_97735_ + this.m_258094_(p_283489_); int j = this.leftPos + this.getTabX(p_283489_);
int k = this.f_97736_ - (flag1 ? 28 : -(this.f_97727_ - 4)); int k = this.topPos - (flag1 ? 28 : -(this.imageHeight - 4));
ResourceLocation[] aresourcelocation; ResourceLocation[] aresourcelocation;
@@ -716,6 +_,7 @@ @@ -716,6 +_,7 @@
aresourcelocation = flag ? f_291557_ : f_291303_; aresourcelocation = flag ? SELECTED_BOTTOM_TABS : UNSELECTED_BOTTOM_TABS;
} }
+ com.mojang.blaze3d.systems.RenderSystem.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border. + com.mojang.blaze3d.systems.RenderSystem.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
p_283590_.m_292816_(aresourcelocation[Mth.m_14045_(i, 0, aresourcelocation.length)], j, k, 26, 32); p_283590_.blitSprite(aresourcelocation[Mth.clamp(i, 0, aresourcelocation.length)], j, k, 26, 32);
p_283590_.m_280168_().m_85836_(); p_283590_.pose().pushPose();
p_283590_.m_280168_().m_252880_(0.0F, 0.0F, 100.0F); p_283590_.pose().translate(0.0F, 0.0F, 100.0F);
@@ -759,6 +_,14 @@ @@ -759,6 +_,14 @@
} }
@@ -265,23 +265,23 @@
public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) { public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) {
@@ -926,6 +_,22 @@ @@ -926,6 +_,22 @@
public boolean m_8010_(Player p_98665_) { public boolean mayPickup(Player p_98665_) {
return this.f_98655_.m_8010_(p_98665_); return this.target.mayPickup(p_98665_);
+ } + }
+ +
+ @Override + @Override
+ public int getSlotIndex() { + public int getSlotIndex() {
+ return this.f_98655_.getSlotIndex(); + return this.target.getSlotIndex();
+ } + }
+ +
+ @Override + @Override
+ public boolean isSameInventory(Slot other) { + public boolean isSameInventory(Slot other) {
+ return this.f_98655_.isSameInventory(other); + return this.target.isSameInventory(other);
+ } + }
+ +
+ @Override + @Override
+ public Slot setBackground(ResourceLocation atlas, ResourceLocation sprite) { + public Slot setBackground(ResourceLocation atlas, ResourceLocation sprite) {
+ this.f_98655_.setBackground(atlas, sprite); + this.target.setBackground(atlas, sprite);
+ return this; + return this;
} }
} }
@@ -1,7 +1,7 @@
--- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java --- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
@@ -45,12 +_,17 @@ @@ -45,12 +_,17 @@
Collection<MobEffectInstance> collection = this.f_96541_.f_91074_.m_21220_(); Collection<MobEffectInstance> collection = this.minecraft.player.getActiveEffects();
if (!collection.isEmpty() && j >= 32) { if (!collection.isEmpty() && j >= 32) {
boolean flag = j >= 120; boolean flag = j >= 120;
+ var event = net.minecraftforge.client.ForgeHooksClient.onScreenPotionSize(this, j, !flag, i); + var event = net.minecraftforge.client.ForgeHooksClient.onScreenPotionSize(this, j, !flag, i);
@@ -16,11 +16,11 @@
- Iterable<MobEffectInstance> iterable = Ordering.natural().sortedCopy(collection); - Iterable<MobEffectInstance> iterable = Ordering.natural().sortedCopy(collection);
+ +
+ Iterable<MobEffectInstance> iterable = collection.stream().filter(net.minecraftforge.client.ForgeHooksClient::shouldRenderEffect).sorted().collect(java.util.stream.Collectors.toList()); + Iterable<MobEffectInstance> iterable = collection.stream().filter(net.minecraftforge.client.ForgeHooksClient::shouldRenderEffect).sorted().collect(java.util.stream.Collectors.toList());
this.m_280172_(p_281945_, i, k, iterable, flag); this.renderBackgrounds(p_281945_, i, k, iterable, flag);
this.m_280301_(p_281945_, i, k, iterable, flag); this.renderIcons(p_281945_, i, k, iterable, flag);
if (flag) { if (flag) {
@@ -96,6 +_,11 @@ @@ -96,6 +_,11 @@
int i = this.f_97736_; int i = this.topPos;
for(MobEffectInstance mobeffectinstance : p_282642_) { for(MobEffectInstance mobeffectinstance : p_282642_) {
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance); + var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
@@ -28,11 +28,11 @@
+ i += p_282291_; + i += p_282291_;
+ continue; + continue;
+ } + }
MobEffect mobeffect = mobeffectinstance.m_19544_(); MobEffect mobeffect = mobeffectinstance.getEffect();
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect); TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.get(mobeffect);
p_282745_.m_280159_(p_282521_ + (p_281536_ ? 6 : 7), i + 7, 0, 18, 18, textureatlassprite); p_282745_.blit(p_282521_ + (p_281536_ ? 6 : 7), i + 7, 0, 18, 18, textureatlassprite);
@@ -108,6 +_,11 @@ @@ -108,6 +_,11 @@
int i = this.f_97736_; int i = this.topPos;
for(MobEffectInstance mobeffectinstance : p_281986_) { for(MobEffectInstance mobeffectinstance : p_281986_) {
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance); + var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
@@ -40,6 +40,6 @@
+ i += p_282057_; + i += p_282057_;
+ continue; + continue;
+ } + }
Component component = this.m_194000_(mobeffectinstance); Component component = this.getEffectName(mobeffectinstance);
p_281462_.m_280430_(this.f_96547_, component, p_283484_ + 10 + 18, i + 6, 16777215); p_281462_.drawString(this.font, component, p_283484_ + 10 + 18, i + 6, 16777215);
Component component1 = MobEffectUtil.m_267641_(mobeffectinstance, 1.0F); Component component1 = MobEffectUtil.formatDuration(mobeffectinstance, 1.0F);
@@ -1,28 +1,28 @@
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java --- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java +++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
@@ -93,7 +_,7 @@ @@ -93,7 +_,7 @@
int l1 = 86 - this.f_96547_.m_92895_(s); int l1 = 86 - this.font.width(s);
FormattedText formattedtext = EnchantmentNames.m_98734_().m_98737_(this.f_96547_, l1); FormattedText formattedtext = EnchantmentNames.getInstance().getRandomName(this.font, l1);
int i2 = 6839882; int i2 = 6839882;
- if ((k < l + 1 || this.f_96541_.f_91074_.f_36078_ < k1) && !this.f_96541_.f_91074_.m_150110_().f_35937_) { - if ((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.getAbilities().instabuild) {
+ if (((k < l + 1 || this.f_96541_.f_91074_.f_36078_ < k1) && !this.f_96541_.f_91074_.m_150110_().f_35937_) || this.f_97732_.f_39447_[l] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels + if (((k < l + 1 || this.minecraft.player.experienceLevel < k1) && !this.minecraft.player.getAbilities().instabuild) || this.menu.enchantClue[l] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels
p_282430_.m_292816_(f_291504_, i1, j + 14 + 19 * l, 108, 19); p_282430_.blitSprite(ENCHANTMENT_SLOT_DISABLED_SPRITE, i1, j + 14 + 19 * l, 108, 19);
p_282430_.m_292816_(f_291094_[l], i1 + 1, j + 15 + 19 * l, 16, 16); p_282430_.blitSprite(DISABLED_LEVEL_SPRITES[l], i1 + 1, j + 15 + 19 * l, 16, 16);
p_282430_.m_280554_(this.f_96547_, formattedtext, j1, j + 16 + 19 * l, l1, (i2 & 16711422) >> 1); p_282430_.drawWordWrap(this.font, formattedtext, j1, j + 16 + 19 * l, l1, (i2 & 16711422) >> 1);
@@ -154,10 +_,13 @@ @@ -154,10 +_,13 @@
Enchantment enchantment = Enchantment.m_44697_((this.f_97732_).f_39447_[j]); Enchantment enchantment = Enchantment.byId((this.menu).enchantClue[j]);
int l = (this.f_97732_).f_39448_[j]; int l = (this.menu).levelClue[j];
int i1 = j + 1; int i1 = j + 1;
- if (this.m_6774_(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0 && l >= 0 && enchantment != null) { - if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0 && l >= 0 && enchantment != null) {
+ if (this.m_6774_(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0) { + if (this.isHovering(60, 14 + 19 * j, 108, 17, (double)p_282491_, (double)p_281953_) && k > 0) {
List<Component> list = Lists.newArrayList(); List<Component> list = Lists.newArrayList();
- list.add(Component.m_237110_("container.enchant.clue", enchantment.m_44700_(l)).m_130940_(ChatFormatting.WHITE)); - list.add(Component.translatable("container.enchant.clue", enchantment.getFullname(l)).withStyle(ChatFormatting.WHITE));
- if (!flag) { - if (!flag) {
+ list.add((Component.m_237110_("container.enchant.clue", enchantment == null ? "" : enchantment.m_44700_(l))).m_130940_(ChatFormatting.WHITE)); + list.add((Component.translatable("container.enchant.clue", enchantment == null ? "" : enchantment.getFullname(l))).withStyle(ChatFormatting.WHITE));
+ if (enchantment == null) { + if (enchantment == null) {
+ list.add(Component.m_237113_("")); + list.add(Component.literal(""));
+ list.add(Component.m_237115_("forge.container.enchant.limitedEnchantability").m_130940_(ChatFormatting.RED)); + list.add(Component.translatable("forge.container.enchant.limitedEnchantability").withStyle(ChatFormatting.RED));
+ } else if (!flag) { + } else if (!flag) {
list.add(CommonComponents.f_237098_); list.add(CommonComponents.EMPTY);
if (this.f_96541_.f_91074_.f_36078_ < k) { if (this.minecraft.player.experienceLevel < k) {
list.add(Component.m_237110_("container.enchant.level.requirement", (this.f_97732_).f_39446_[j]).m_130940_(ChatFormatting.RED)); list.add(Component.translatable("container.enchant.level.requirement", (this.menu).costs[j]).withStyle(ChatFormatting.RED));
@@ -1,11 +1,11 @@
--- a/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java --- a/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java +++ b/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
@@ -15,7 +_,7 @@ @@ -15,7 +_,7 @@
private static final Vector3f f_243728_ = new Vector3f(1.0F, 1.0F, 1.0F); private static final Vector3f TEXT_SCALE = new Vector3f(1.0F, 1.0F, 1.0F);
private static final int f_244604_ = 16; private static final int TEXTURE_WIDTH = 16;
private static final int f_244207_ = 16; private static final int TEXTURE_HEIGHT = 16;
- private final ResourceLocation f_243720_ = new ResourceLocation("textures/gui/hanging_signs/" + this.f_244069_.f_61839_() + ".png"); - private final ResourceLocation texture = new ResourceLocation("textures/gui/hanging_signs/" + this.woodType.name() + ".png");
+ private final ResourceLocation f_243720_ = new ResourceLocation(this.f_244069_.f_61839_() + ".png").m_246208_("textures/gui/hanging_signs/"); + private final ResourceLocation texture = new ResourceLocation(this.woodType.name() + ".png").withPrefix("textures/gui/hanging_signs/");
public HangingSignEditScreen(SignBlockEntity p_278017_, boolean p_277942_, boolean p_277778_) { public HangingSignEditScreen(SignBlockEntity p_278017_, boolean p_277942_, boolean p_277778_) {
super(p_278017_, p_277942_, p_277778_, Component.m_237115_("hanging_sign.edit")); super(p_278017_, p_277942_, p_277778_, Component.translatable("hanging_sign.edit"));
@@ -1,16 +1,16 @@
--- a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java --- a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java +++ b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
@@ -236,7 +_,12 @@ @@ -236,7 +_,12 @@
p_281357_.m_280370_(this.f_96547_, p_283466_, p_282403_, p_283601_); p_281357_.renderItemDecorations(this.font, p_283466_, p_282403_, p_283601_);
} else { } else {
p_281357_.m_280302_(this.f_96547_, p_282046_, p_282403_, p_283601_, p_282046_.m_41613_() == 1 ? "1" : null); p_281357_.renderItemDecorations(this.font, p_282046_, p_282403_, p_283601_, p_282046_.getCount() == 1 ? "1" : null);
- p_281357_.m_280302_(this.f_96547_, p_283466_, p_282403_ + 14, p_283601_, p_283466_.m_41613_() == 1 ? "1" : null); - p_281357_.renderItemDecorations(this.font, p_283466_, p_282403_ + 14, p_283601_, p_283466_.getCount() == 1 ? "1" : null);
+ // Forge: fixes Forge-8806, code for count rendering taken from GuiGraphics#renderGuiItemDecorations + // Forge: fixes Forge-8806, code for count rendering taken from GuiGraphics#renderGuiItemDecorations
+ p_281357_.m_280168_().m_85836_(); + p_281357_.pose().pushPose();
+ p_281357_.m_280168_().m_252880_(0.0F, 0.0F, 200.0F); + p_281357_.pose().translate(0.0F, 0.0F, 200.0F);
+ String count = p_283466_.m_41613_() == 1 ? "1" : String.valueOf(p_283466_.m_41613_()); + String count = p_283466_.getCount() == 1 ? "1" : String.valueOf(p_283466_.getCount());
+ f_96547_.m_272078_(count, (float) (p_282403_ + 14) + 19 - 2 - f_96547_.m_92895_(count), (float)p_283601_ + 6 + 3, 0xFFFFFF, true, p_281357_.m_280168_().m_85850_().m_252922_(), p_281357_.m_280091_(), net.minecraft.client.gui.Font.DisplayMode.NORMAL, 0, 15728880, false); + font.drawInBatch(count, (float) (p_282403_ + 14) + 19 - 2 - font.width(count), (float)p_283601_ + 6 + 3, 0xFFFFFF, true, p_281357_.pose().last().pose(), p_281357_.bufferSource(), net.minecraft.client.gui.Font.DisplayMode.NORMAL, 0, 15728880, false);
+ p_281357_.m_280168_().m_85849_(); + p_281357_.pose().popPose();
p_281357_.m_280168_().m_85836_(); p_281357_.pose().pushPose();
p_281357_.m_280168_().m_252880_(0.0F, 0.0F, 300.0F); p_281357_.pose().translate(0.0F, 0.0F, 300.0F);
p_281357_.m_295520_(f_291695_, p_282403_ + 7, p_283601_ + 12, 0, 9, 2); p_281357_.blitSprite(DISCOUNT_STRIKETHRUOGH_SPRITE, p_282403_ + 7, p_283601_ + 12, 0, 9, 2);
@@ -1,10 +1,10 @@
--- a/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java --- a/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java +++ b/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java
@@ -17,16 +_,22 @@ @@ -17,16 +_,22 @@
private static final int f_262743_ = 1344798847; private static final int BORDER_COLOR_BOTTOM = 1344798847;
public static void m_280205_(GuiGraphics p_282666_, int p_281901_, int p_281846_, int p_281559_, int p_283336_, int p_283422_) { public static void renderTooltipBackground(GuiGraphics p_282666_, int p_281901_, int p_281846_, int p_281559_, int p_283336_, int p_283422_) {
+ renderTooltipBackground(p_282666_, p_281901_, p_281846_, p_281559_, p_283336_, p_283422_, f_262744_, f_262744_, f_262725_, f_262743_); + renderTooltipBackground(p_282666_, p_281901_, p_281846_, p_281559_, p_283336_, p_283422_, BACKGROUND_COLOR, BACKGROUND_COLOR, BORDER_COLOR_TOP, BORDER_COLOR_BOTTOM);
+ } + }
+ +
+ // Forge: Allow specifying colors for the inner border gradient and a gradient instead of a single color for the background and outer border + // Forge: Allow specifying colors for the inner border gradient and a gradient instead of a single color for the background and outer border
@@ -14,36 +14,36 @@
int j = p_281846_ - 3; int j = p_281846_ - 3;
int k = p_281559_ + 3 + 3; int k = p_281559_ + 3 + 3;
int l = p_283336_ + 3 + 3; int l = p_283336_ + 3 + 3;
- m_280217_(p_282666_, i, j - 1, k, p_283422_, -267386864); - renderHorizontalLine(p_282666_, i, j - 1, k, p_283422_, -267386864);
- m_280217_(p_282666_, i, j + l, k, p_283422_, -267386864); - renderHorizontalLine(p_282666_, i, j + l, k, p_283422_, -267386864);
- m_280538_(p_282666_, i, j, k, l, p_283422_, -267386864); - renderRectangle(p_282666_, i, j, k, l, p_283422_, -267386864);
- m_280387_(p_282666_, i - 1, j, l, p_283422_, -267386864); - renderVerticalLine(p_282666_, i - 1, j, l, p_283422_, -267386864);
- m_280387_(p_282666_, i + k, j, l, p_283422_, -267386864); - renderVerticalLine(p_282666_, i + k, j, l, p_283422_, -267386864);
- m_280115_(p_282666_, i, j + 1, k, l, p_283422_, 1347420415, 1344798847); - renderFrameGradient(p_282666_, i, j + 1, k, l, p_283422_, 1347420415, 1344798847);
+ m_280217_(p_282666_, i, j - 1, k, p_283422_, backgroundTop); + renderHorizontalLine(p_282666_, i, j - 1, k, p_283422_, backgroundTop);
+ m_280217_(p_282666_, i, j + l, k, p_283422_, backgroundBottom); + renderHorizontalLine(p_282666_, i, j + l, k, p_283422_, backgroundBottom);
+ renderRectangle(p_282666_, i, j, k, l, p_283422_, backgroundTop, backgroundBottom); + renderRectangle(p_282666_, i, j, k, l, p_283422_, backgroundTop, backgroundBottom);
+ m_280556_(p_282666_, i - 1, j, l, p_283422_, backgroundTop, backgroundBottom); + renderVerticalLineGradient(p_282666_, i - 1, j, l, p_283422_, backgroundTop, backgroundBottom);
+ m_280556_(p_282666_, i + k, j, l, p_283422_, backgroundTop, backgroundBottom); + renderVerticalLineGradient(p_282666_, i + k, j, l, p_283422_, backgroundTop, backgroundBottom);
+ m_280115_(p_282666_, i, j + 1, k, l, p_283422_, borderTop, borderBottom); + renderFrameGradient(p_282666_, i, j + 1, k, l, p_283422_, borderTop, borderBottom);
} }
private static void m_280115_(GuiGraphics p_282000_, int p_282055_, int p_281580_, int p_283284_, int p_282599_, int p_283432_, int p_282907_, int p_283153_) { private static void renderFrameGradient(GuiGraphics p_282000_, int p_282055_, int p_281580_, int p_283284_, int p_282599_, int p_283432_, int p_282907_, int p_283153_) {
@@ -48,7 +_,16 @@ @@ -48,7 +_,16 @@
p_282981_.m_280046_(p_282028_, p_282141_, p_282028_ + p_281771_, p_282141_ + 1, p_282734_, p_281979_); p_282981_.fill(p_282028_, p_282141_, p_282028_ + p_281771_, p_282141_ + 1, p_282734_, p_281979_);
} }
+ /** + /**
+ * @deprecated Forge: Use gradient overload instead + * @deprecated Forge: Use gradient overload instead
+ */ + */
+ @Deprecated + @Deprecated
private static void m_280538_(GuiGraphics p_281392_, int p_282294_, int p_283353_, int p_282640_, int p_281964_, int p_283211_, int p_282349_) { private static void renderRectangle(GuiGraphics p_281392_, int p_282294_, int p_283353_, int p_282640_, int p_281964_, int p_283211_, int p_282349_) {
- p_281392_.m_280046_(p_282294_, p_283353_, p_282294_ + p_282640_, p_283353_ + p_281964_, p_283211_, p_282349_); - p_281392_.fill(p_282294_, p_283353_, p_282294_ + p_282640_, p_283353_ + p_281964_, p_283211_, p_282349_);
+ renderRectangle(p_281392_, p_282294_, p_283353_, p_282640_, p_281964_, p_283211_, p_282349_, p_282349_); + renderRectangle(p_281392_, p_282294_, p_283353_, p_282640_, p_281964_, p_283211_, p_282349_, p_282349_);
+ } + }
+ +
+ // Forge: Allow specifying a gradient instead of a single color for the background + // Forge: Allow specifying a gradient instead of a single color for the background
+ private static void renderRectangle(GuiGraphics p_281392_, int p_282294_, int p_283353_, int p_282640_, int p_281964_, int p_283211_, int p_282349_, int colorTo) { + private static void renderRectangle(GuiGraphics p_281392_, int p_282294_, int p_283353_, int p_282640_, int p_281964_, int p_283211_, int p_282349_, int colorTo) {
+ p_281392_.m_280120_(p_282294_, p_283353_, p_282294_ + p_282640_, p_283353_ + p_281964_, p_283211_, p_282349_, colorTo); + p_281392_.fillGradient(p_282294_, p_283353_, p_282294_ + p_282640_, p_283353_ + p_281964_, p_283211_, p_282349_, colorTo);
} }
} }
@@ -5,10 +5,10 @@
} }
+ @Override + @Override
+ public void m_7379_() { + public void onClose() {
+ this.f_96541_.m_91152_(this.f_99676_); + this.minecraft.setScreen(this.lastScreen);
+ } + }
+ +
public ServerStatusPinger m_99731_() { public ServerStatusPinger getPinger() {
return this.f_99675_; return this.pinger;
} }
@@ -1,11 +1,11 @@
--- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java --- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
+++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java +++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
@@ -346,6 +_,8 @@ @@ -346,6 +_,8 @@
this.f_99855_.m_99707_(list1); this.screen.setToolTip(list1);
} }
+ net.minecraftforge.client.ForgeHooksClient.drawForgePingInfo(this.f_99855_, f_99857_, p_281406_, p_281363_, p_282921_, p_283596_, l, i1); + net.minecraftforge.client.ForgeHooksClient.drawForgePingInfo(this.screen, serverData, p_281406_, p_281363_, p_282921_, p_283596_, l, i1);
+ +
if (this.f_99856_.f_91066_.m_231828_().m_231551_() || p_282999_) { if (this.minecraft.options.touchscreen().get() || p_282999_) {
p_281406_.m_280509_(p_281363_, p_282921_, p_281363_ + 32, p_282921_ + 32, -1601138544); p_281406_.fill(p_281363_, p_282921_, p_281363_ + 32, p_282921_ + 32, -1601138544);
int j1 = p_283567_ - p_281363_; int j1 = p_283567_ - p_281363_;
@@ -1,9 +1,9 @@
--- a/net/minecraft/client/gui/screens/packs/PackSelectionModel.java --- a/net/minecraft/client/gui/screens/packs/PackSelectionModel.java
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionModel.java +++ b/net/minecraft/client/gui/screens/packs/PackSelectionModel.java
@@ -110,6 +_,8 @@ @@ -110,6 +_,8 @@
boolean m_7802_(); boolean canMoveUp();
boolean m_7803_(); boolean canMoveDown();
+ +
+ default boolean notHidden() { return true; } + default boolean notHidden() { return true; }
} }
@@ -11,13 +11,13 @@
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@@ -198,6 +_,11 @@ @@ -198,6 +_,11 @@
public void m_7845_() { public void moveDown() {
this.m_99938_(1); this.move(1);
+ } + }
+ +
+ @Override + @Override
+ public boolean notHidden() { + public boolean notHidden() {
+ return !f_99933_.isHidden(); + return !pack.isHidden();
} }
} }
@@ -1,16 +1,16 @@
--- a/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java --- a/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java +++ b/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
@@ -138,10 +_,10 @@ @@ -138,10 +_,10 @@
TransferableSelectionList.PackEntry transferableselectionlist$packentry = p_100014_.m_93511_(); TransferableSelectionList.PackEntry transferableselectionlist$packentry = p_100014_.getSelected();
String s = transferableselectionlist$packentry == null ? "" : transferableselectionlist$packentry.m_264411_(); String s = transferableselectionlist$packentry == null ? "" : transferableselectionlist$packentry.getPackId();
p_100014_.m_6987_((TransferableSelectionList.PackEntry)null); p_100014_.setSelected((TransferableSelectionList.PackEntry)null);
- p_100015_.forEach((p_280875_) -> { - p_100015_.forEach((p_280875_) -> {
- TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(this.f_96541_, p_100014_, p_280875_); - TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(this.minecraft, p_100014_, p_280875_);
+ p_100015_.filter(PackSelectionModel.Entry::notHidden).forEach((p_264692_) -> { + p_100015_.filter(PackSelectionModel.Entry::notHidden).forEach((p_264692_) -> {
+ TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(this.f_96541_, p_100014_, p_264692_); + TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(this.minecraft, p_100014_, p_264692_);
p_100014_.m_6702_().add(transferableselectionlist$packentry1); p_100014_.children().add(transferableselectionlist$packentry1);
- if (p_280875_.m_264249_().equals(s)) { - if (p_280875_.getId().equals(s)) {
+ if (p_264692_.m_264249_().equals(s)) { + if (p_264692_.getId().equals(s)) {
p_100014_.m_6987_(transferableselectionlist$packentry1); p_100014_.setSelected(transferableselectionlist$packentry1);
} }
@@ -1,20 +1,20 @@
--- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java --- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
+++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java +++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
@@ -106,7 +_,7 @@ @@ -107,7 +_,7 @@
this.m_5674_(); this.initFilterButtonTextures();
this.f_100279_.clear(); this.tabButtons.clear();
- for(RecipeBookCategories recipebookcategories : RecipeBookCategories.m_92269_(this.f_100271_.m_5867_())) { - for(RecipeBookCategories recipebookcategories : RecipeBookCategories.getCategories(this.menu.getRecipeBookType())) {
+ for(RecipeBookCategories recipebookcategories : this.f_100271_.getRecipeBookCategories()) { + for(RecipeBookCategories recipebookcategories : this.menu.getRecipeBookCategories()) {
this.f_100279_.add(new RecipeBookTabButton(recipebookcategories)); this.tabButtons.add(new RecipeBookTabButton(recipebookcategories));
} }
@@ -309,7 +_,7 @@ @@ -296,7 +_,7 @@
} }
if (itemstack != null && this.f_100272_.f_91080_ != null) { if (itemstack != null && this.minecraft.screen != null) {
- p_282776_.m_280666_(this.f_100272_.f_91062_, Screen.m_280152_(this.f_100272_, itemstack), p_282948_, p_283050_); - p_282776_.renderComponentTooltip(this.minecraft.font, Screen.getTooltipFromItem(this.minecraft, itemstack), p_282948_, p_283050_);
+ p_282776_.renderComponentTooltip(this.f_100272_.f_91062_, Screen.m_280152_(this.f_100272_, itemstack), p_282948_, p_283050_, itemstack); + p_282776_.renderComponentTooltip(this.minecraft.font, Screen.getTooltipFromItem(this.minecraft, itemstack), p_282948_, p_283050_, itemstack);
} }
} }
@@ -1,27 +1,27 @@
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java --- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java +++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
@@ -121,6 +_,7 @@ @@ -121,6 +_,7 @@
public static void m_232896_(Minecraft p_232897_, @Nullable Screen p_232898_) { public static void openFresh(Minecraft p_232897_, @Nullable Screen p_232898_) {
m_232899_(p_232897_, f_232866_); queueLoadScreen(p_232897_, PREPARING_WORLD_DATA);
PackRepository packrepository = new PackRepository(new ServerPacksSource(p_232897_.m_294312_())); PackRepository packrepository = new PackRepository(new ServerPacksSource(p_232897_.directoryValidator()));
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.event.AddPackFindersEvent(net.minecraft.server.packs.PackType.SERVER_DATA, packrepository::addPackFinder)); + net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.event.AddPackFindersEvent(net.minecraft.server.packs.PackType.SERVER_DATA, packrepository::addPackFinder));
WorldLoader.InitConfig worldloader$initconfig = m_245574_(packrepository, WorldDataConfiguration.f_244649_); WorldLoader.InitConfig worldloader$initconfig = createDefaultLoadConfig(packrepository, WorldDataConfiguration.DEFAULT);
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.m_214362_(worldloader$initconfig, (p_247792_) -> { CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.load(worldloader$initconfig, (p_247792_) -> {
return new WorldLoader.DataLoadOutput<>(new CreateWorldScreen.DataPackReloadCookie(new WorldGenSettings(WorldOptions.m_247394_(), WorldPresets.m_246552_(p_247792_.f_244104_())), p_247792_.f_244127_()), p_247792_.f_243759_()); return new WorldLoader.DataLoadOutput<>(new CreateWorldScreen.DataPackReloadCookie(new WorldGenSettings(WorldOptions.defaultWithRandomSeed(), WorldPresets.createNormalWorldDimensions(p_247792_.datapackWorldgen())), p_247792_.dataConfiguration()), p_247792_.datapackDimensions());
@@ -364,7 +_,7 @@ @@ -364,7 +_,7 @@
if (p_269627_) { if (p_269627_) {
p_270552_.accept(this.f_267389_.m_267573_().f_243842_()); p_270552_.accept(this.uiState.getSettings().dataConfiguration());
} else { } else {
- p_270552_.accept(WorldDataConfiguration.f_244649_); - p_270552_.accept(WorldDataConfiguration.DEFAULT);
+ p_270552_.accept(new WorldDataConfiguration(new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), FeatureFlags.f_244332_)); // FORGE: Revert to *actual* vanilla data + p_270552_.accept(new WorldDataConfiguration(new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of()), FeatureFlags.DEFAULT_FLAGS)); // FORGE: Revert to *actual* vanilla data
} }
}, Component.m_237115_("dataPack.validation.failed"), CommonComponents.f_237098_, Component.m_237115_("dataPack.validation.back"), Component.m_237115_("dataPack.validation.reset"))); }, Component.translatable("dataPack.validation.failed"), CommonComponents.EMPTY, Component.translatable("dataPack.validation.back"), Component.translatable("dataPack.validation.reset")));
@@ -478,6 +_,7 @@ @@ -478,6 +_,7 @@
if (path != null) { if (path != null) {
if (this.f_100832_ == null) { if (this.tempDataPackRepository == null) {
this.f_100832_ = ServerPacksSource.m_245786_(path, this.f_291518_); this.tempDataPackRepository = ServerPacksSource.createPackRepository(path, this.packValidator);
+ net.minecraftforge.resource.ResourcePackLoader.loadResourcePacks(this.f_100832_, net.minecraftforge.server.ServerLifecycleHooks::buildPackFinder); + net.minecraftforge.resource.ResourcePackLoader.loadResourcePacks(this.tempDataPackRepository, net.minecraftforge.server.ServerLifecycleHooks::buildPackFinder);
this.f_100832_.m_10506_(); this.tempDataPackRepository.reload();
} }
@@ -8,6 +8,6 @@
+ * @deprecated Forge: Use {@link net.minecraftforge.client.PresetEditorManager#get(ResourceKey)} instead. + * @deprecated Forge: Use {@link net.minecraftforge.client.PresetEditorManager#get(ResourceKey)} instead.
+ */ + */
+ @Deprecated + @Deprecated
Map<Optional<ResourceKey<WorldPreset>>, PresetEditor> f_232950_ = Map.of(Optional.of(WorldPresets.f_226438_), (p_232974_, p_232975_) -> { Map<Optional<ResourceKey<WorldPreset>>, PresetEditor> EDITORS = Map.of(Optional.of(WorldPresets.FLAT), (p_232974_, p_232975_) -> {
ChunkGenerator chunkgenerator = p_232975_.f_243796_().m_246737_(); ChunkGenerator chunkgenerator = p_232975_.selectedDimensions().overworld();
RegistryAccess registryaccess = p_232975_.m_246480_(); RegistryAccess registryaccess = p_232975_.worldgenLoadContext();
@@ -1,13 +1,13 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java --- a/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationContext.java
@@ -38,6 +_,10 @@ @@ -38,6 +_,10 @@
return new WorldCreationContext(this.f_244272_, this.f_244375_, p_250676_.apply(this.m_246480_(), this.f_243796_), this.f_243708_, this.f_232990_, this.f_243842_); return new WorldCreationContext(this.options, this.datapackDimensions, p_250676_.apply(this.worldgenLoadContext(), this.selectedDimensions), this.worldgenRegistries, this.dataPackResources, this.dataConfiguration);
} }
+ public WorldCreationContext withDataConfiguration(WorldDataConfiguration dataConfiguration) { + public WorldCreationContext withDataConfiguration(WorldDataConfiguration dataConfiguration) {
+ return new WorldCreationContext(this.f_244272_, this.f_244375_, this.f_243796_, this.f_243708_, this.f_232990_, dataConfiguration); + return new WorldCreationContext(this.options, this.datapackDimensions, this.selectedDimensions, this.worldgenRegistries, this.dataPackResources, dataConfiguration);
+ } + }
+ +
public RegistryAccess.Frozen m_246480_() { public RegistryAccess.Frozen worldgenLoadContext() {
return this.f_243708_.m_247579_(); return this.worldgenRegistries.compositeAccess();
} }
@@ -2,10 +2,10 @@
+++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldCreationUiState.java
@@ -226,7 +_,7 @@ @@ -226,7 +_,7 @@
@Nullable @Nullable
public PresetEditor m_267744_() { public PresetEditor getPresetEditor() {
Holder<WorldPreset> holder = this.m_267828_().f_267398_(); Holder<WorldPreset> holder = this.getWorldType().preset();
- return holder != null ? PresetEditor.f_232950_.get(holder.m_203543_()) : null; - return holder != null ? PresetEditor.EDITORS.get(holder.unwrapKey()) : null;
+ return holder != null ? holder.m_203543_().map(net.minecraftforge.client.PresetEditorManager::get).orElse(null) : null; // FORGE: redirect lookup to expanded map + return holder != null ? holder.unwrapKey().map(net.minecraftforge.client.PresetEditorManager::get).orElse(null) : null; // FORGE: redirect lookup to expanded map
} }
public List<WorldCreationUiState.WorldTypeEntry> m_267815_() { public List<WorldCreationUiState.WorldTypeEntry> getNormalPresetList() {
@@ -1,49 +1,49 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java --- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
@@ -165,13 +_,23 @@ @@ -181,13 +_,23 @@
} }
private void m_233145_(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_) { private void doLoadLevel(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_) {
+ // FORGE: Patch in overload to reduce further patching + // FORGE: Patch in overload to reduce further patching
+ this.doLoadLevel(p_233146_, p_233147_, p_233148_, p_233149_, false); + this.doLoadLevel(p_233146_, p_233147_, p_233148_, p_233149_, false);
+ } + }
+ +
+ // FORGE: Patch in confirmExperimentalWarning which confirms the experimental warning when true + // FORGE: Patch in confirmExperimentalWarning which confirms the experimental warning when true
+ private void doLoadLevel(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_, boolean confirmExperimentalWarning) { + private void doLoadLevel(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_, boolean confirmExperimentalWarning) {
LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = this.m_233155_(p_233147_); LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = this.createWorldAccess(p_233147_);
if (levelstoragesource$levelstorageaccess != null) { if (levelstoragesource$levelstorageaccess != null) {
PackRepository packrepository = ServerPacksSource.m_247728_(levelstoragesource$levelstorageaccess); PackRepository packrepository = ServerPacksSource.createPackRepository(levelstoragesource$levelstorageaccess);
WorldStem worldstem; WorldStem worldstem;
try { try {
+ levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData(); // Read extra (e.g. modded) data from the world before creating it + levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData(); // Read extra (e.g. modded) data from the world before creating it
worldstem = this.m_233122_(levelstoragesource$levelstorageaccess, p_233148_, packrepository); worldstem = this.loadWorldStem(levelstoragesource$levelstorageaccess, p_233148_, packrepository);
+ if (confirmExperimentalWarning && worldstem.f_206895_() instanceof PrimaryLevelData pld) { + if (confirmExperimentalWarning && worldstem.worldData() instanceof PrimaryLevelData pld) {
+ pld.withConfirmedWarning(true); + pld.withConfirmedWarning(true);
+ } + }
} catch (Exception exception) { } catch (Exception exception) {
f_233088_.warn("Failed to load level data or datapacks, can't proceed with server load", (Throwable)exception); LOGGER.warn("Failed to load level data or datapacks, can't proceed with server load", (Throwable)exception);
if (!p_233148_) { if (!p_233148_) {
@@ -191,7 +_,9 @@ @@ -207,7 +_,9 @@
WorldData worlddata = worldstem.f_206895_(); WorldData worlddata = worldstem.worldData();
boolean flag = worlddata.m_246337_().m_247070_(); boolean flag = worlddata.worldGenOptions().isOldCustomizedWorld();
boolean flag1 = worlddata.m_5754_() != Lifecycle.stable(); boolean flag1 = worlddata.worldGenSettingsLifecycle() != Lifecycle.stable();
- if (!p_233149_ || !flag && !flag1) { - if (!p_233149_ || !flag && !flag1) {
+ // Forge: Skip confirmation if it has been done already for this world + // Forge: Skip confirmation if it has been done already for this world
+ boolean skipConfirmation = worlddata instanceof PrimaryLevelData pld && pld.hasConfirmedExperimentalWarning(); + boolean skipConfirmation = worlddata instanceof PrimaryLevelData pld && pld.hasConfirmedExperimentalWarning();
+ if (skipConfirmation || !p_233149_ || !flag && !flag1) { + if (skipConfirmation || !p_233149_ || !flag && !flag1) {
this.f_233089_.m_247489_().m_247400_(levelstoragesource$levelstorageaccess).thenApply((p_233177_) -> { this.minecraft.getDownloadedPackSource().loadBundledResourcePack(levelstoragesource$levelstorageaccess).thenApply((p_233177_) -> {
return true; return true;
}).exceptionallyComposeAsync((p_233183_) -> { }).exceptionallyComposeAsync((p_233183_) -> {
@@ -213,9 +_,11 @@ @@ -229,9 +_,11 @@
return null; return null;
}); });
} else { } else {
+ if (flag) // Forge: For legacy world options, let vanilla handle it. + if (flag) // Forge: For legacy world options, let vanilla handle it.
this.m_233140_(p_233146_, p_233147_, flag, () -> { this.askForBackup(p_233146_, p_233147_, flag, () -> {
this.m_233145_(p_233146_, p_233147_, p_233148_, false); this.doLoadLevel(p_233146_, p_233147_, p_233148_, false);
}); });
+ else net.minecraftforge.client.ForgeHooksClient.createWorldConfirmationScreen(() -> this.doLoadLevel(p_233146_, p_233147_, p_233148_, false, true)); + else net.minecraftforge.client.ForgeHooksClient.createWorldConfirmationScreen(() -> this.doLoadLevel(p_233146_, p_233147_, p_233148_, false, true));
worldstem.close(); worldstem.close();
m_233116_(levelstoragesource$levelstorageaccess, p_233147_); safeCloseAccess(levelstoragesource$levelstorageaccess, p_233147_);
} }
@@ -1,36 +1,36 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java --- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java +++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
@@ -74,6 +_,7 @@ @@ -74,6 +_,7 @@
static final Logger f_101645_ = LogUtils.getLogger(); static final Logger LOGGER = LogUtils.getLogger();
static final DateFormat f_101646_ = new SimpleDateFormat(); static final DateFormat DATE_FORMAT = new SimpleDateFormat();
private static final ResourceLocation f_101647_ = new ResourceLocation("textures/misc/unknown_server.png"); private static final ResourceLocation ICON_MISSING = new ResourceLocation("textures/misc/unknown_server.png");
+ private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = new ResourceLocation("forge","textures/gui/experimental_warning.png"); + private static final ResourceLocation FORGE_EXPERIMENTAL_WARNING_ICON = new ResourceLocation("forge","textures/gui/experimental_warning.png");
static final Component f_101649_ = Component.m_237115_("selectWorld.tooltip.fromNewerVersion1").m_130940_(ChatFormatting.RED); static final Component FROM_NEWER_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.fromNewerVersion1").withStyle(ChatFormatting.RED);
static final Component f_101650_ = Component.m_237115_("selectWorld.tooltip.fromNewerVersion2").m_130940_(ChatFormatting.RED); static final Component FROM_NEWER_TOOLTIP_2 = Component.translatable("selectWorld.tooltip.fromNewerVersion2").withStyle(ChatFormatting.RED);
static final Component f_101651_ = Component.m_237115_("selectWorld.tooltip.snapshot1").m_130940_(ChatFormatting.GOLD); static final Component SNAPSHOT_TOOLTIP_1 = Component.translatable("selectWorld.tooltip.snapshot1").withStyle(ChatFormatting.GOLD);
@@ -362,6 +_,7 @@ @@ -362,6 +_,7 @@
RenderSystem.enableBlend(); RenderSystem.enableBlend();
p_281612_.m_280163_(this.f_101698_.m_289196_(), p_282820_, p_283181_, 0.0F, 0.0F, 32, 32, 32, 32); p_281612_.blit(this.icon.textureLocation(), p_282820_, p_283181_, 0.0F, 0.0F, 32, 32, 32, 32);
RenderSystem.disableBlend(); RenderSystem.disableBlend();
+ renderExperimentalWarning(p_281612_, p_283204_, p_283025_, p_283181_, p_282820_); + renderExperimentalWarning(p_281612_, p_283204_, p_283025_, p_283181_, p_282820_);
if (this.f_101693_.f_91066_.m_231828_().m_231551_() || p_283396_) { if (this.minecraft.options.touchscreen().get() || p_283396_) {
p_281612_.m_280509_(p_282820_, p_283181_, p_282820_ + 32, p_283181_ + 32, -1601138544); p_281612_.fill(p_282820_, p_283181_, p_282820_ + 32, p_283181_ + 32, -1601138544);
int j = p_283204_ - p_282820_; int j = p_283204_ - p_282820_;
@@ -608,6 +_,19 @@ @@ -608,6 +_,19 @@
public boolean m_214209_() { public boolean isSelectable() {
return !this.f_101695_.m_164916_(); return !this.summary.isDisabled();
+ } + }
+ +
+ // FORGE: Patch in experimental warning icon for worlds in the world selection screen + // FORGE: Patch in experimental warning icon for worlds in the world selection screen
+ private void renderExperimentalWarning(GuiGraphics guiGraphics, int mouseX, int mouseY, int top, int left) { + private void renderExperimentalWarning(GuiGraphics guiGraphics, int mouseX, int mouseY, int top, int left) {
+ if (this.f_101695_.isLifecycleExperimental()) { + if (this.summary.isLifecycleExperimental()) {
+ int leftStart = left + WorldSelectionList.this.m_5759_(); + int leftStart = left + WorldSelectionList.this.getRowWidth();
+ guiGraphics.m_280163_(WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32); + guiGraphics.blit(WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32);
+ if (WorldSelectionList.this.m_93412_(mouseX, mouseY) == this && mouseX > leftStart - 36 && mouseX < leftStart) { + if (WorldSelectionList.this.getEntryAtPosition(mouseX, mouseY) == this && mouseX > leftStart - 36 && mouseX < leftStart) {
+ var font = Minecraft.m_91087_().f_91062_; + var font = Minecraft.getInstance().font;
+ List<net.minecraft.util.FormattedCharSequence> tooltip = font.m_92923_(Component.m_237115_("forge.experimentalsettings.tooltip"), 200); + List<net.minecraft.util.FormattedCharSequence> tooltip = font.split(Component.translatable("forge.experimentalsettings.tooltip"), 200);
+ guiGraphics.m_280245_(font, tooltip, mouseX, mouseY); + guiGraphics.renderTooltip(font, tooltip, mouseX, mouseY);
+ } + }
+ } + }
} }
@@ -3,10 +3,10 @@
@@ -150,8 +_,8 @@ @@ -150,8 +_,8 @@
} }
CrashReport.m_127529_(); CrashReport.preload();
- Bootstrap.m_135870_(); - Bootstrap.bootStrap();
GameLoadTimesEvent.f_285635_.m_286069_(Bootstrap.f_285608_.get()); GameLoadTimesEvent.INSTANCE.setBootstrapTime(Bootstrap.bootstrapDuration.get());
+ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(()->Bootstrap.m_135870_(), net.minecraftforge.fml.loading.FMLLoader.progressWindowTick); + net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(()->Bootstrap.bootStrap(), net.minecraftforge.fml.loading.FMLLoader.progressWindowTick);
Bootstrap.m_135889_(); Bootstrap.validate();
Util.m_137584_(); Util.startTimerHackThread();
String s12 = optionspec25.value(optionset); String s12 = optionspec25.value(optionset);
@@ -2,19 +2,19 @@
+++ b/net/minecraft/client/model/HumanoidModel.java +++ b/net/minecraft/client/model/HumanoidModel.java
@@ -270,6 +_,8 @@ @@ -270,6 +_,8 @@
case TOOT_HORN: case TOOT_HORN:
this.f_102811_.f_104203_ = Mth.m_14036_(this.f_102808_.f_104203_, -1.2F, 1.2F) - 1.4835298F; this.rightArm.xRot = Mth.clamp(this.head.xRot, -1.2F, 1.2F) - 1.4835298F;
this.f_102811_.f_104204_ = this.f_102808_.f_104204_ - ((float)Math.PI / 6F); this.rightArm.yRot = this.head.yRot - ((float)Math.PI / 6F);
+ default: + default:
+ this.f_102816_.applyTransform(this, p_102876_, net.minecraft.world.entity.HumanoidArm.RIGHT); + this.rightArmPose.applyTransform(this, p_102876_, net.minecraft.world.entity.HumanoidArm.RIGHT);
} }
} }
@@ -314,6 +_,8 @@ @@ -314,6 +_,8 @@
case TOOT_HORN: case TOOT_HORN:
this.f_102812_.f_104203_ = Mth.m_14036_(this.f_102808_.f_104203_, -1.2F, 1.2F) - 1.4835298F; this.leftArm.xRot = Mth.clamp(this.head.xRot, -1.2F, 1.2F) - 1.4835298F;
this.f_102812_.f_104204_ = this.f_102808_.f_104204_ + ((float)Math.PI / 6F); this.leftArm.yRot = this.head.yRot + ((float)Math.PI / 6F);
+ default: + default:
+ this.f_102815_.applyTransform(this, p_102879_, net.minecraft.world.entity.HumanoidArm.LEFT); + this.leftArmPose.applyTransform(this, p_102879_, net.minecraft.world.entity.HumanoidArm.LEFT);
} }
} }
@@ -30,19 +30,19 @@
@@ -422,10 +_,29 @@ @@ -422,10 +_,29 @@
private ArmPose(boolean p_102896_) { private ArmPose(boolean p_102896_) {
this.f_102890_ = p_102896_; this.twoHanded = p_102896_;
+ this.forgeArmPose = null; + this.forgeArmPose = null;
} }
public boolean m_102897_() { public boolean isTwoHanded() {
return this.f_102890_; return this.twoHanded;
} }
+ // FORGE START + // FORGE START
+ @javax.annotation.Nullable + @javax.annotation.Nullable
+ private final net.minecraftforge.client.IArmPoseTransformer forgeArmPose; + private final net.minecraftforge.client.IArmPoseTransformer forgeArmPose;
+ +
+ private ArmPose(boolean twoHanded, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) { + private ArmPose(boolean twoHanded, @javax.annotation.Nonnull net.minecraftforge.client.IArmPoseTransformer forgeArmPose) {
+ this.f_102890_ = twoHanded; + this.twoHanded = twoHanded;
+ com.google.common.base.Preconditions.checkNotNull(forgeArmPose, "Cannot create new ArmPose with null transformer!"); + com.google.common.base.Preconditions.checkNotNull(forgeArmPose, "Cannot create new ArmPose with null transformer!");
+ this.forgeArmPose = forgeArmPose; + this.forgeArmPose = forgeArmPose;
+ } + }
@@ -1,10 +1,10 @@
--- a/net/minecraft/client/model/geom/LayerDefinitions.java --- a/net/minecraft/client/model/geom/LayerDefinitions.java
+++ b/net/minecraft/client/model/geom/LayerDefinitions.java +++ b/net/minecraft/client/model/geom/LayerDefinitions.java
@@ -319,6 +_,7 @@ @@ -319,6 +_,7 @@
WoodType.m_61843_().forEach((p_247864_) -> { WoodType.values().forEach((p_247864_) -> {
builder.put(ModelLayers.m_247439_(p_247864_), layerdefinition24); builder.put(ModelLayers.createHangingSignModelName(p_247864_), layerdefinition24);
}); });
+ net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(builder); + net.minecraftforge.client.ForgeHooksClient.loadLayerDefinitions(builder);
ImmutableMap<ModelLayerLocation, LayerDefinition> immutablemap = builder.build(); ImmutableMap<ModelLayerLocation, LayerDefinition> immutablemap = builder.build();
List<ModelLayerLocation> list = ModelLayers.m_171288_().filter((p_171117_) -> { List<ModelLayerLocation> list = ModelLayers.getKnownLocations().filter((p_171117_) -> {
return !immutablemap.containsKey(p_171117_); return !immutablemap.containsKey(p_171117_);
@@ -3,16 +3,16 @@
@@ -220,11 +_,13 @@ @@ -220,11 +_,13 @@
} }
public static ModelLayerLocation m_171291_(WoodType p_171292_) { public static ModelLayerLocation createSignModelName(WoodType p_171292_) {
- return m_171300_("sign/" + p_171292_.f_61839_(), "main"); - return createLocation("sign/" + p_171292_.name(), "main");
+ ResourceLocation location = new ResourceLocation(p_171292_.f_61839_()); + ResourceLocation location = new ResourceLocation(p_171292_.name());
+ return new ModelLayerLocation(new ResourceLocation(location.m_135827_(), "sign/" + location.m_135815_()), "main"); + return new ModelLayerLocation(new ResourceLocation(location.getNamespace(), "sign/" + location.getPath()), "main");
} }
public static ModelLayerLocation m_247439_(WoodType p_252225_) { public static ModelLayerLocation createHangingSignModelName(WoodType p_252225_) {
- return m_171300_("hanging_sign/" + p_252225_.f_61839_(), "main"); - return createLocation("hanging_sign/" + p_252225_.name(), "main");
+ ResourceLocation location = new ResourceLocation(p_252225_.f_61839_()); + ResourceLocation location = new ResourceLocation(p_252225_.name());
+ return new ModelLayerLocation(new ResourceLocation(location.m_135827_(), "hanging_sign/" + location.m_135815_()), "main"); + return new ModelLayerLocation(new ResourceLocation(location.getNamespace(), "hanging_sign/" + location.getPath()), "main");
} }
public static Stream<ModelLayerLocation> m_171288_() { public static Stream<ModelLayerLocation> getKnownLocations() {
@@ -1,11 +1,11 @@
--- a/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java --- a/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java
+++ b/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java +++ b/net/minecraft/client/multiplayer/AccountProfileKeyPairManager.java
@@ -75,6 +_,8 @@ @@ -75,6 +_,8 @@
this.m_253216_(profilekeypair); this.writeProfileKeyPair(profilekeypair);
return Optional.of(profilekeypair); return Optional.of(profilekeypair);
} catch (CryptException | MinecraftClientException | IOException ioexception) { } catch (CryptException | MinecraftClientException | IOException ioexception) {
+ // Forge: The offline user api service always returns a null profile key pair, so let's hide this useless exception if in dev + // Forge: The offline user api service always returns a null profile key pair, so let's hide this useless exception if in dev
+ if (net.minecraftforge.fml.loading.FMLLoader.isProduction() || this.f_252526_ != UserApiService.OFFLINE) + if (net.minecraftforge.fml.loading.FMLLoader.isProduction() || this.userApiService != UserApiService.OFFLINE)
f_252448_.error("Failed to retrieve profile key pair", (Throwable)ioexception); LOGGER.error("Failed to retrieve profile key pair", (Throwable)ioexception);
this.m_253216_((ProfileKeyPair)null); this.writeProfileKeyPair((ProfileKeyPair)null);
return p_254074_; return p_254074_;
@@ -1,17 +1,17 @@
--- a/net/minecraft/client/multiplayer/ClientChunkCache.java --- a/net/minecraft/client/multiplayer/ClientChunkCache.java
+++ b/net/minecraft/client/multiplayer/ClientChunkCache.java +++ b/net/minecraft/client/multiplayer/ClientChunkCache.java
@@ -60,6 +_,7 @@ @@ -60,6 +_,7 @@
int i = this.f_104410_.m_104481_(p_298665_.f_45578_, p_298665_.f_45579_); int i = this.storage.getIndex(p_298665_.x, p_298665_.z);
LevelChunk levelchunk = this.f_104410_.m_104479_(i); LevelChunk levelchunk = this.storage.getChunk(i);
if (m_104438_(levelchunk, p_298665_.f_45578_, p_298665_.f_45579_)) { if (isValidChunk(levelchunk, p_298665_.x, p_298665_.z)) {
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.ChunkEvent.Unload(levelchunk)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.ChunkEvent.Unload(levelchunk));
this.f_104410_.m_104487_(i, levelchunk, (LevelChunk)null); this.storage.replace(i, levelchunk, (LevelChunk)null);
} }
@@ -115,6 +_,7 @@ @@ -115,6 +_,7 @@
} }
this.f_104411_.m_171649_(chunkpos); this.level.onChunkLoaded(chunkpos);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(levelchunk, false)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.ChunkEvent.Load(levelchunk, false));
return levelchunk; return levelchunk;
} }
@@ -3,8 +3,8 @@
@@ -89,6 +_,7 @@ @@ -89,6 +_,7 @@
} }
public void m_293213_(ClientboundCustomPayloadPacket p_298103_) { public void handleCustomPayload(ClientboundCustomPayloadPacket p_298103_) {
+ if (net.minecraftforge.network.NetworkHooks.onCustomPayload(p_298103_, this.f_290549_)) return; + if (net.minecraftforge.common.ForgeHooks.onCustomPayload(p_298103_, this.connection)) return;
CustomPacketPayload custompacketpayload = p_298103_.f_291001_(); CustomPacketPayload custompacketpayload = p_298103_.payload();
if (!(custompacketpayload instanceof DiscardedPayload)) { if (!(custompacketpayload instanceof DiscardedPayload)) {
PacketUtils.m_131363_(p_298103_, this, this.f_291812_); PacketUtils.ensureRunningOnSameThread(p_298103_, this, this.minecraft);
@@ -0,0 +1,10 @@
--- a/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientConfigurationPacketListenerImpl.java
@@ -71,6 +_,7 @@
this.connection.setListener(new ClientPacketListener(this.minecraft, this.connection, new CommonListenerCookie(this.localGameProfile, this.telemetryManager, this.receivedRegistries, this.enabledFeatures, this.serverBrand, this.serverData, this.postDisconnectScreen)));
this.connection.resumeInboundAfterProtocolChange();
this.connection.send(new ServerboundFinishConfigurationPacket());
+ net.minecraftforge.common.ForgeHooks.handleClientConfigurationComplete(this.connection);
}
public void tick() {
@@ -1,27 +1,18 @@
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java --- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java +++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
@@ -133,6 +_,7 @@ @@ -156,6 +_,7 @@
this.f_104521_.accept(Component.m_237115_("connect.joining")); public void onDisconnect(Component p_104543_) {
GameProfile gameprofile = p_104547_.m_134774_(); if (this.serverData != null && this.serverData.isRealm()) {
this.f_104522_.m_129512_(new ServerboundLoginAcknowledgedPacket()); this.minecraft.setScreen(new DisconnectedRealmsScreen(this.parent, CommonComponents.CONNECT_FAILED, p_104543_));
+ net.minecraftforge.network.NetworkHooks.handleClientLoginSuccess(this.f_104522_); + } else if (net.minecraftforge.client.ForgeHooksClient.onClientDisconnect(this.connection, this.minecraft, this.parent, p_104543_)) {
this.f_104522_.m_129505_(new ClientConfigurationPacketListenerImpl(this.f_104519_, this.f_104522_, new CommonListenerCookie(gameprofile, this.f_104519_.m_261007_().m_285995_(this.f_260722_, this.f_260612_, this.f_285614_), ClientRegistryLayer.m_245874_().m_247579_(), FeatureFlags.f_244332_, (String)null, this.f_243717_, this.f_104520_)));
this.f_104522_.m_129512_(new ServerboundCustomPayloadPacket(new BrandPayload(ClientBrandRetriever.getClientModName())));
this.f_104522_.m_129512_(new ServerboundClientInformationPacket(this.f_104519_.f_91066_.m_294596_()));
@@ -142,7 +_,7 @@
if (this.f_243717_ != null && this.f_243717_.m_295074_()) {
this.f_104519_.m_91152_(new DisconnectedRealmsScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_));
} else { } else {
- this.f_104519_.m_91152_(new DisconnectedScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_)); this.minecraft.setScreen(new DisconnectedScreen(this.parent, CommonComponents.CONNECT_FAILED, p_104543_));
+ this.f_104519_.m_91152_(net.minecraftforge.network.NetworkHooks.getModMismatchData(f_104522_) != null ? new net.minecraftforge.client.gui.ModMismatchDisconnectedScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_, net.minecraftforge.network.NetworkHooks.getModMismatchData(f_104522_)) : new DisconnectedScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_));
} }
@@ -178,6 +_,7 @@
}
@@ -163,6 +_,7 @@
} }
public void m_7254_(ClientboundCustomQueryPacket p_104545_) { public void handleCustomQuery(ClientboundCustomQueryPacket p_104545_) {
+ if (net.minecraftforge.network.NetworkHooks.onCustomPayload(p_104545_, this.f_104522_)) return; + if (net.minecraftforge.common.ForgeHooks.onCustomPayload(p_104545_, this.connection)) return;
this.f_104521_.accept(Component.m_237115_("connect.negotiating")); this.updateStatus.accept(Component.translatable("connect.negotiating"));
this.f_104522_.m_129512_(new ServerboundCustomQueryAnswerPacket(p_104545_.f_134745_(), (CustomQueryAnswerPayload)null)); this.connection.send(new ServerboundCustomQueryAnswerPacket(p_104545_.transactionId(), (CustomQueryAnswerPayload)null));
} }
@@ -1,109 +1,109 @@
--- a/net/minecraft/client/multiplayer/ClientLevel.java --- a/net/minecraft/client/multiplayer/ClientLevel.java
+++ b/net/minecraft/client/multiplayer/ClientLevel.java +++ b/net/minecraft/client/multiplayer/ClientLevel.java
@@ -116,12 +_,15 @@ @@ -116,12 +_,15 @@
p_194170_.put(BiomeColors.f_108791_, new BlockTintCache((p_194168_) -> { p_194170_.put(BiomeColors.WATER_COLOR_RESOLVER, new BlockTintCache((p_194168_) -> {
return this.m_104762_(p_194168_, BiomeColors.f_108791_); return this.calculateBlockTint(p_194168_, BiomeColors.WATER_COLOR_RESOLVER);
})); }));
+ net.minecraftforge.client.ColorResolverManager.registerBlockTintCaches(ClientLevel.this, p_194170_); + net.minecraftforge.client.ColorResolverManager.registerBlockTintCaches(ClientLevel.this, p_194170_);
}); });
private final ClientChunkCache f_104559_; private final ClientChunkCache chunkSource;
private final Deque<Runnable> f_194122_ = Queues.newArrayDeque(); private final Deque<Runnable> lightUpdateQueue = Queues.newArrayDeque();
private int f_194123_; private int serverSimulationDistance;
private final BlockStatePredictionHandler f_233599_ = new BlockStatePredictionHandler(); private final BlockStatePredictionHandler blockStatePredictionHandler = new BlockStatePredictionHandler();
private static final Set<Item> f_194124_ = Set.of(Items.f_42127_, Items.f_151033_); private static final Set<Item> MARKER_PARTICLE_ITEMS = Set.of(Items.BARRIER, Items.LIGHT);
+ private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<net.minecraftforge.entity.PartEntity<?>> partEntities = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>(); + private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<net.minecraftforge.entity.PartEntity<?>> partEntities = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>();
+ private final net.minecraftforge.client.model.data.ModelDataManager modelDataManager = new net.minecraftforge.client.model.data.ModelDataManager(this); + private final net.minecraftforge.client.model.data.ModelDataManager modelDataManager = new net.minecraftforge.client.model.data.ModelDataManager(this);
public void m_233651_(int p_233652_) { public void handleBlockChangedAck(int p_233652_) {
this.f_233599_.m_233856_(p_233652_, this); this.blockStatePredictionHandler.endPredictionsUpTo(p_233652_, this);
@@ -175,6 +_,8 @@ @@ -175,6 +_,8 @@
this.f_194123_ = p_205510_; this.serverSimulationDistance = p_205510_;
this.m_46465_(); this.updateSkyBrightness();
this.m_46466_(); this.prepareWeather();
+ this.gatherCapabilities(); + this.gatherCapabilities();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Load(this)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Load(this));
} }
public void m_194171_(Runnable p_194172_) { public void queueLightUpdate(Runnable p_194172_) {
@@ -265,6 +_,7 @@ @@ -265,6 +_,7 @@
this.m_46473_().m_6521_(() -> { this.getProfiler().push(() -> {
return BuiltInRegistries.f_256780_.m_7981_(p_104640_.m_6095_()).toString(); return BuiltInRegistries.ENTITY_TYPE.getKey(p_104640_.getType()).toString();
}); });
+ if (p_104640_.canUpdate()) + if (p_104640_.canUpdate())
p_104640_.m_8119_(); p_104640_.tick();
this.m_46473_().m_7238_(); this.getProfiler().pop();
@@ -328,8 +_,10 @@ @@ -320,8 +_,10 @@
} }
private void m_104739_(int p_104740_, Entity p_104741_) { public void addEntity(Entity p_104741_) {
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinLevelEvent(p_104741_, this))) return; + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinLevelEvent(p_104741_, this))) return;
this.m_171642_(p_104740_, Entity.RemovalReason.DISCARDED); this.removeEntity(p_104741_.getId(), Entity.RemovalReason.DISCARDED);
this.f_171631_.m_157653_(p_104741_); this.entityStorage.addEntity(p_104741_);
+ p_104741_.onAddedToWorld(); + p_104741_.onAddedToWorld();
} }
public void m_171642_(int p_171643_, Entity.RemovalReason p_171644_) { public void removeEntity(int p_171643_, Entity.RemovalReason p_171644_) {
@@ -456,6 +_,12 @@ @@ -448,6 +_,12 @@
} }
public void m_262808_(@Nullable Player p_263381_, double p_263372_, double p_263404_, double p_263365_, Holder<SoundEvent> p_263335_, SoundSource p_263417_, float p_263416_, float p_263349_, long p_263408_) { public void playSeededSound(@Nullable Player p_263381_, double p_263372_, double p_263404_, double p_263365_, Holder<SoundEvent> p_263335_, SoundSource p_263417_, float p_263416_, float p_263349_, long p_263408_) {
+ net.minecraftforge.event.PlayLevelSoundEvent.AtPosition event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, p_263372_, p_263404_, p_263365_, p_263335_, p_263417_, p_263416_, p_263349_); + net.minecraftforge.event.PlayLevelSoundEvent.AtPosition event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtPosition(this, p_263372_, p_263404_, p_263365_, p_263335_, p_263417_, p_263416_, p_263349_);
+ if (event.isCanceled() || event.getSound() == null) return; + if (event.isCanceled() || event.getSound() == null) return;
+ p_263335_ = event.getSound(); + p_263335_ = event.getSound();
+ p_263417_ = event.getSource(); + p_263417_ = event.getSource();
+ p_263416_ = event.getNewVolume(); + p_263416_ = event.getNewVolume();
+ p_263349_ = event.getNewPitch(); + p_263349_ = event.getNewPitch();
if (p_263381_ == this.f_104565_.f_91074_) { if (p_263381_ == this.minecraft.player) {
this.m_233602_(p_263372_, p_263404_, p_263365_, p_263335_.m_203334_(), p_263417_, p_263416_, p_263349_, false, p_263408_); this.playSound(p_263372_, p_263404_, p_263365_, p_263335_.value(), p_263417_, p_263416_, p_263349_, false, p_263408_);
} }
@@ -463,6 +_,12 @@ @@ -455,6 +_,12 @@
} }
public void m_213890_(@Nullable Player p_263514_, Entity p_263536_, Holder<SoundEvent> p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_) { public void playSeededSound(@Nullable Player p_263514_, Entity p_263536_, Holder<SoundEvent> p_263518_, SoundSource p_263487_, float p_263538_, float p_263524_, long p_263509_) {
+ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_263536_, p_263518_, p_263487_, p_263538_, p_263524_); + net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(p_263536_, p_263518_, p_263487_, p_263538_, p_263524_);
+ if (event.isCanceled() || event.getSound() == null) return; + if (event.isCanceled() || event.getSound() == null) return;
+ p_263518_ = event.getSound(); + p_263518_ = event.getSound();
+ p_263487_ = event.getSource(); + p_263487_ = event.getSource();
+ p_263538_ = event.getNewVolume(); + p_263538_ = event.getNewVolume();
+ p_263524_ = event.getNewPitch(); + p_263524_ = event.getNewPitch();
if (p_263514_ == this.f_104565_.f_91074_) { if (p_263514_ == this.minecraft.player) {
this.f_104565_.m_91106_().m_120367_(new EntityBoundSoundInstance(p_263518_.m_203334_(), p_263487_, p_263538_, p_263524_, p_263536_, p_263509_)); this.minecraft.getSoundManager().play(new EntityBoundSoundInstance(p_263518_.value(), p_263487_, p_263538_, p_263524_, p_263536_, p_263509_));
} }
@@ -900,6 +_,7 @@ @@ -892,6 +_,7 @@
} }
public void m_104851_(Difficulty p_104852_) { public void setDifficulty(Difficulty p_104852_) {
+ net.minecraftforge.common.ForgeHooks.onDifficultyChange(p_104852_, this.f_104840_); + net.minecraftforge.common.ForgeHooks.onDifficultyChange(p_104852_, this.difficulty);
this.f_104840_ = p_104852_; this.difficulty = p_104852_;
} }
@@ -937,14 +_,46 @@ @@ -929,14 +_,46 @@
ClientLevel.this.f_104566_.add((AbstractClientPlayer)p_171712_); ClientLevel.this.players.add((AbstractClientPlayer)p_171712_);
} }
+ if (p_171712_.isMultipartEntity()) { + if (p_171712_.isMultipartEntity()) {
+ for (net.minecraftforge.entity.PartEntity<?> part : p_171712_.getParts()) { + for (net.minecraftforge.entity.PartEntity<?> part : p_171712_.getParts()) {
+ ClientLevel.this.partEntities.put(part.m_19879_(), part); + ClientLevel.this.partEntities.put(part.getId(), part);
+ } + }
+ } + }
} }
public void m_141981_(Entity p_171716_) { public void onTrackingEnd(Entity p_171716_) {
p_171716_.m_19877_(); p_171716_.unRide();
ClientLevel.this.f_104566_.remove(p_171716_); ClientLevel.this.players.remove(p_171716_);
+ +
+ p_171716_.onRemovedFromWorld(); + p_171716_.onRemovedFromWorld();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityLeaveLevelEvent(p_171716_, ClientLevel.this)); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityLeaveLevelEvent(p_171716_, ClientLevel.this));
+ +
+ if (p_171716_.isMultipartEntity()) { + if (p_171716_.isMultipartEntity()) {
+ for (net.minecraftforge.entity.PartEntity<?> part : p_171716_.getParts()) { + for (net.minecraftforge.entity.PartEntity<?> part : p_171716_.getParts()) {
+ ClientLevel.this.partEntities.remove(part.m_19879_()); + ClientLevel.this.partEntities.remove(part.getId());
+ } + }
+ } + }
} }
public void m_214006_(Entity p_233660_) { public void onSectionChange(Entity p_233660_) {
} }
+ } + }
+ +
@@ -119,7 +119,7 @@
+ +
+ @Override + @Override
+ public float getShade(float normalX, float normalY, float normalZ, boolean shade) { + public float getShade(float normalX, float normalY, float normalZ, boolean shade) {
+ boolean constantAmbientLight = this.m_104583_().m_108885_(); + boolean constantAmbientLight = this.effects().constantAmbientLight();
+ if (!shade) + if (!shade)
+ return constantAmbientLight ? 0.9F : 1.0F; + return constantAmbientLight ? 0.9F : 1.0F;
+ return net.minecraftforge.client.model.lighting.QuadLighter.calculateShade(normalX, normalY, normalZ, constantAmbientLight); + return net.minecraftforge.client.model.lighting.QuadLighter.calculateShade(normalX, normalY, normalZ, constantAmbientLight);
@@ -1,86 +1,78 @@
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java --- a/net/minecraft/client/multiplayer/ClientPacketListener.java
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java +++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
@@ -386,6 +_,7 @@ @@ -385,6 +_,7 @@
this.f_291812_.f_91064_.m_113434_(); this.minecraft.debugRenderer.clear();
this.f_291812_.f_91074_.m_172530_(); this.minecraft.player.resetPos();
+ net.minecraftforge.client.ForgeHooksClient.firePlayerLogin(this.f_291812_.f_91072_, this.f_291812_.f_91074_, this.f_291812_.m_91403_().f_290549_); + net.minecraftforge.client.ForgeHooksClient.firePlayerLogin(this.minecraft.gameMode, this.minecraft.player, this.minecraft.getConnection().connection);
int i = p_105030_.f_132360_(); this.minecraft.player.setId(p_105030_.playerId());
this.f_291812_.f_91074_.m_20234_(i); this.level.addEntity(this.minecraft.player);
this.f_104889_.m_104630_(i, this.f_291812_.f_91074_); this.minecraft.player.input = new KeyboardInput(this.minecraft.options);
@@ -400,6 +_,7 @@ @@ -1016,7 +_,9 @@
this.f_291812_.f_91074_.m_287199_(commonplayerspawninfo.f_291470_()); localplayer1.getAttributes().assignValues(localplayer.getAttributes());
this.f_291812_.f_91072_.m_171805_(commonplayerspawninfo.f_291098_(), commonplayerspawninfo.f_290730_());
this.f_291812_.f_91066_.m_193770_(p_105030_.f_132370_());
+ net.minecraftforge.network.NetworkHooks.sendMCRegistryPackets(f_290549_, "PLAY_TO_SERVER");
this.f_252517_ = null;
this.f_244346_ = new LastSeenMessagesTracker(20);
this.f_244113_ = MessageSignatureCache.m_246587_();
@@ -1026,7 +_,9 @@
localplayer1.m_21204_().m_22159_(localplayer.m_21204_());
} }
+ localplayer1.updateSyncFields(localplayer); // Forge: fix MC-10657 + localplayer1.updateSyncFields(localplayer); // Forge: fix MC-10657
localplayer1.m_172530_(); localplayer1.resetPos();
+ net.minecraftforge.client.ForgeHooksClient.firePlayerRespawn(this.f_291812_.f_91072_, localplayer, localplayer1, localplayer1.f_108617_.f_290549_); + net.minecraftforge.client.ForgeHooksClient.firePlayerRespawn(this.minecraft.gameMode, localplayer, localplayer1, localplayer1.connection.connection);
this.f_104889_.m_104630_(i, localplayer1); this.level.addEntity(localplayer1);
localplayer1.m_146922_(-180.0F); localplayer1.setYRot(-180.0F);
localplayer1.f_108618_ = new KeyboardInput(this.f_291812_.f_91066_); localplayer1.input = new KeyboardInput(this.minecraft.options);
@@ -1135,10 +_,7 @@ @@ -1125,10 +_,7 @@
PacketUtils.m_131363_(p_104976_, this, this.f_291812_); PacketUtils.ensureRunningOnSameThread(p_104976_, this, this.minecraft);
BlockPos blockpos = p_104976_.m_131704_(); BlockPos blockpos = p_104976_.getPos();
this.f_291812_.f_91073_.m_141902_(blockpos, p_104976_.m_195645_()).ifPresent((p_205557_) -> { this.minecraft.level.getBlockEntity(blockpos, p_104976_.getType()).ifPresent((p_205557_) -> {
- CompoundTag compoundtag = p_104976_.m_131708_(); - CompoundTag compoundtag = p_104976_.getTag();
- if (compoundtag != null) { - if (compoundtag != null) {
- p_205557_.m_142466_(compoundtag); - p_205557_.load(compoundtag);
- } - }
+ p_205557_.onDataPacket(f_290549_, p_104976_); + p_205557_.onDataPacket(connection, p_104976_);
if (p_205557_ instanceof CommandBlockEntity && this.f_291812_.f_91080_ instanceof CommandBlockEditScreen) { if (p_205557_ instanceof CommandBlockEntity && this.minecraft.screen instanceof CommandBlockEditScreen) {
((CommandBlockEditScreen)this.f_291812_.f_91080_).m_98398_(); ((CommandBlockEditScreen)this.minecraft.screen).updateGui();
@@ -1286,7 +_,9 @@ @@ -1276,7 +_,9 @@
public void m_7443_(ClientboundCommandsPacket p_104990_) { public void handleCommands(ClientboundCommandsPacket p_104990_) {
PacketUtils.m_131363_(p_104990_, this, this.f_291812_); PacketUtils.ensureRunningOnSameThread(p_104990_, this, this.minecraft);
- this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(CommandBuildContext.m_255418_(this.f_104903_, this.f_244039_))); - this.commands = new CommandDispatcher<>(p_104990_.getRoot(CommandBuildContext.simple(this.registryAccess, this.enabledFeatures)));
+ var context = CommandBuildContext.m_255418_(this.f_104903_, this.f_244039_); + var context = CommandBuildContext.simple(this.registryAccess, this.enabledFeatures);
+ this.f_104899_ = new CommandDispatcher<>(p_104990_.m_237624_(context)); + this.commands = new CommandDispatcher<>(p_104990_.getRoot(context));
+ this.f_104899_ = net.minecraftforge.client.ClientCommandHandler.mergeServerCommands(this.f_104899_, context); + this.commands = net.minecraftforge.client.ClientCommandHandler.mergeServerCommands(this.commands, context);
} }
public void m_7183_(ClientboundStopSoundPacket p_105116_) { public void handleStopSoundEvent(ClientboundStopSoundPacket p_105116_) {
@@ -1304,6 +_,7 @@ @@ -1295,6 +_,7 @@
this.f_104900_.m_44024_(p_105132_.m_133644_()); ClientRecipeBook clientrecipebook = this.minecraft.player.getRecipeBook();
ClientRecipeBook clientrecipebook = this.f_291812_.f_91074_.m_108631_(); clientrecipebook.setupCollections(this.recipeManager.getRecipes(), this.minecraft.level.registryAccess());
clientrecipebook.m_266394_(this.f_104900_.m_44051_(), this.f_291812_.f_91073_.m_9598_()); this.minecraft.populateSearchTree(SearchRegistry.RECIPE_COLLECTIONS, clientrecipebook.getCollections());
+ net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.f_104900_); + net.minecraftforge.client.ForgeHooksClient.onRecipesUpdated(this.recipeManager);
} }
public void m_7244_(ClientboundPlayerLookAtPacket p_105054_) { public void handleLookAt(ClientboundPlayerLookAtPacket p_105054_) {
@@ -1402,7 +_,8 @@ @@ -1393,7 +_,8 @@
Blocks.m_50758_(); Blocks.rebuildCache();
} }
- CreativeModeTabs.m_258007_().m_257466_(); - CreativeModeTabs.searchTab().rebuildSearchTree();
+ CreativeModeTabs.m_257478_().stream().filter(net.minecraft.world.item.CreativeModeTab::hasSearchBar).forEach(net.minecraft.world.item.CreativeModeTab::m_257466_); + CreativeModeTabs.allTabs().stream().filter(net.minecraft.world.item.CreativeModeTab::hasSearchBar).forEach(net.minecraft.world.item.CreativeModeTab::rebuildSearchTree);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this.f_104903_, true, f_290549_.m_129531_())); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent(this.registryAccess, true, connection.isMemoryConnection()));
} }
public void m_142234_(ClientboundPlayerCombatEndPacket p_171771_) { public void handlePlayerCombatEnd(ClientboundPlayerCombatEndPacket p_171771_) {
@@ -2095,6 +_,8 @@ @@ -2086,6 +_,8 @@
} }
public void m_246175_(String p_249888_) { public void sendChat(String p_249888_) {
+ p_249888_ = net.minecraftforge.client.ForgeHooksClient.onClientSendMessage(p_249888_); + p_249888_ = net.minecraftforge.client.ForgeHooksClient.onClientSendMessage(p_249888_);
+ if (p_249888_.isEmpty()) return; + if (p_249888_.isEmpty()) return;
Instant instant = Instant.now(); Instant instant = Instant.now();
long i = Crypt.SaltSupplier.m_216113_(); long i = Crypt.SaltSupplier.getLong();
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.f_244346_.m_246442_(); LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate();
@@ -2103,6 +_,7 @@ @@ -2094,6 +_,7 @@
} }
public void m_246623_(String p_250092_) { public void sendCommand(String p_250092_) {
+ if (net.minecraftforge.client.ClientCommandHandler.runCommand(p_250092_)) return; + if (net.minecraftforge.client.ClientCommandHandler.runCommand(p_250092_)) return;
Instant instant = Instant.now(); Instant instant = Instant.now();
long i = Crypt.SaltSupplier.m_216113_(); long i = Crypt.SaltSupplier.getLong();
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.f_244346_.m_246442_(); LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.lastSeenMessages.generateAndApplyUpdate();
@@ -3,52 +3,52 @@
@@ -104,6 +_,7 @@ @@ -104,6 +_,7 @@
} }
public boolean m_105267_(BlockPos p_105268_) { public boolean destroyBlock(BlockPos p_105268_) {
+ if (f_105189_.f_91074_.m_21205_().onBlockStartBreak(p_105268_, f_105189_.f_91074_)) return false; + if (minecraft.player.getMainHandItem().onBlockStartBreak(p_105268_, minecraft.player)) return false;
if (this.f_105189_.f_91074_.m_36187_(this.f_105189_.f_91073_, p_105268_, this.f_105197_)) { if (this.minecraft.player.blockActionRestricted(this.minecraft.level, p_105268_, this.localPlayerMode)) {
return false; return false;
} else { } else {
@@ -118,9 +_,8 @@ @@ -118,9 +_,8 @@
} else if (blockstate.m_60795_()) { } else if (blockstate.isAir()) {
return false; return false;
} else { } else {
- block.m_5707_(level, p_105268_, blockstate, this.f_105189_.f_91074_); - block.playerWillDestroy(level, p_105268_, blockstate, this.minecraft.player);
FluidState fluidstate = level.m_6425_(p_105268_); FluidState fluidstate = level.getFluidState(p_105268_);
- boolean flag = level.m_7731_(p_105268_, fluidstate.m_76188_(), 11); - boolean flag = level.setBlock(p_105268_, fluidstate.createLegacyBlock(), 11);
+ boolean flag = blockstate.onDestroyedByPlayer(level, p_105268_, f_105189_.f_91074_, false, fluidstate); + boolean flag = blockstate.onDestroyedByPlayer(level, p_105268_, minecraft.player, false, fluidstate);
if (flag) { if (flag) {
block.m_6786_(level, p_105268_, blockstate); block.destroy(level, p_105268_, blockstate);
} }
@@ -141,6 +_,7 @@ @@ -141,6 +_,7 @@
BlockState blockstate = this.f_105189_.f_91073_.m_8055_(p_105270_); BlockState blockstate = this.minecraft.level.getBlockState(p_105270_);
this.f_105189_.m_91301_().m_120581_(this.f_105189_.f_91073_, p_105270_, blockstate, 1.0F); this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105270_, blockstate, 1.0F);
this.m_233729_(this.f_105189_.f_91073_, (p_233757_) -> { this.startPrediction(this.minecraft.level, (p_233757_) -> {
+ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.f_105189_.f_91074_, p_105270_, p_105271_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK).isCanceled()) + if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.minecraft.player, p_105270_, p_105271_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK).isCanceled())
this.m_105267_(p_105270_); this.destroyBlock(p_105270_);
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_); return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233757_);
}); });
@@ -149,15 +_,19 @@ @@ -149,15 +_,19 @@
if (this.f_105196_) { if (this.isDestroying) {
this.f_105190_.m_295327_(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.f_105191_, p_105271_)); this.connection.send(new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK, this.destroyBlockPos, p_105271_));
} }
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.f_105189_.f_91074_, p_105270_, p_105271_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK); + net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.minecraft.player, p_105270_, p_105271_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK);
BlockState blockstate1 = this.f_105189_.f_91073_.m_8055_(p_105270_); BlockState blockstate1 = this.minecraft.level.getBlockState(p_105270_);
this.f_105189_.m_91301_().m_120581_(this.f_105189_.f_91073_, p_105270_, blockstate1, 0.0F); this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105270_, blockstate1, 0.0F);
this.m_233729_(this.f_105189_.f_91073_, (p_233728_) -> { this.startPrediction(this.minecraft.level, (p_233728_) -> {
boolean flag = !blockstate1.m_60795_(); boolean flag = !blockstate1.isAir();
if (flag && this.f_105193_ == 0.0F) { if (flag && this.destroyProgress == 0.0F) {
+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) + if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY)
blockstate1.m_60686_(this.f_105189_.f_91073_, p_105270_, this.f_105189_.f_91074_); blockstate1.attack(this.minecraft.level, p_105270_, this.minecraft.player);
} }
+ ServerboundPlayerActionPacket packet = new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_); + ServerboundPlayerActionPacket packet = new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_);
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return packet; + if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return packet;
if (flag && blockstate1.m_60625_(this.f_105189_.f_91074_, this.f_105189_.f_91074_.m_9236_(), p_105270_) >= 1.0F) { if (flag && blockstate1.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105270_) >= 1.0F) {
this.m_105267_(p_105270_); this.destroyBlock(p_105270_);
} else { } else {
@@ -169,7 +_,7 @@ @@ -169,7 +_,7 @@
this.f_105189_.f_91073_.m_6801_(this.f_105189_.f_91074_.m_19879_(), this.f_105191_, this.m_287167_()); this.minecraft.level.destroyBlockProgress(this.minecraft.player.getId(), this.destroyBlockPos, this.getDestroyStage());
} }
- return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_); - return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_);
@@ -57,58 +57,58 @@
} }
@@ -200,6 +_,7 @@ @@ -200,6 +_,7 @@
BlockState blockstate1 = this.f_105189_.f_91073_.m_8055_(p_105284_); BlockState blockstate1 = this.minecraft.level.getBlockState(p_105284_);
this.f_105189_.m_91301_().m_120581_(this.f_105189_.f_91073_, p_105284_, blockstate1, 1.0F); this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate1, 1.0F);
this.m_233729_(this.f_105189_.f_91073_, (p_233753_) -> { this.startPrediction(this.minecraft.level, (p_233753_) -> {
+ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.f_105189_.f_91074_, p_105284_, p_105285_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK).isCanceled()) + if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.minecraft.player, p_105284_, p_105285_, ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK).isCanceled())
this.m_105267_(p_105284_); this.destroyBlock(p_105284_);
return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_); return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105284_, p_105285_, p_233753_);
}); });
@@ -212,12 +_,13 @@ @@ -212,12 +_,13 @@
} else { } else {
this.f_105193_ += blockstate.m_60625_(this.f_105189_.f_91074_, this.f_105189_.f_91074_.m_9236_(), p_105284_); this.destroyProgress += blockstate.getDestroyProgress(this.minecraft.player, this.minecraft.player.level(), p_105284_);
if (this.f_105194_ % 4.0F == 0.0F) { if (this.destroyTicks % 4.0F == 0.0F) {
- SoundType soundtype = blockstate.m_60827_(); - SoundType soundtype = blockstate.getSoundType();
+ SoundType soundtype = blockstate.getSoundType(this.f_105189_.f_91073_, p_105284_, this.f_105189_.f_91074_); + SoundType soundtype = blockstate.getSoundType(this.minecraft.level, p_105284_, this.minecraft.player);
this.f_105189_.m_91106_().m_120367_(new SimpleSoundInstance(soundtype.m_56778_(), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 8.0F, soundtype.m_56774_() * 0.5F, SoundInstance.m_235150_(), p_105284_)); this.minecraft.getSoundManager().play(new SimpleSoundInstance(soundtype.getHitSound(), SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 8.0F, soundtype.getPitch() * 0.5F, SoundInstance.createUnseededRandom(), p_105284_));
} }
++this.f_105194_; ++this.destroyTicks;
this.f_105189_.m_91301_().m_120581_(this.f_105189_.f_91073_, p_105284_, blockstate, Mth.m_14036_(this.f_105193_, 0.0F, 1.0F)); this.minecraft.getTutorial().onDestroyBlock(this.minecraft.level, p_105284_, blockstate, Mth.clamp(this.destroyProgress, 0.0F, 1.0F));
+ if (net.minecraftforge.common.ForgeHooks.onClientMineHold(this.f_105189_.f_91074_, p_105284_, p_105285_).getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true; + if (net.minecraftforge.common.ForgeHooks.onClientMineHold(this.minecraft.player, p_105284_, p_105285_).getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true;
if (this.f_105193_ >= 1.0F) { if (this.destroyProgress >= 1.0F) {
this.f_105196_ = false; this.isDestroying = false;
this.m_233729_(this.f_105189_.f_91073_, (p_233739_) -> { this.startPrediction(this.minecraft.level, (p_233739_) -> {
@@ -247,7 +_,7 @@ @@ -247,7 +_,7 @@
} }
public float m_105286_() { public float getPickRange() {
- return this.f_105197_.m_46408_() ? 5.0F : 4.5F; - return this.localPlayerMode.isCreative() ? 5.0F : 4.5F;
+ return (float) this.f_105189_.f_91074_.getBlockReach(); + return (float) this.minecraft.player.getBlockReach();
} }
public void m_105287_() { public void tick() {
@@ -262,7 +_,7 @@ @@ -262,7 +_,7 @@
private boolean m_105281_(BlockPos p_105282_) { private boolean sameDestroyTarget(BlockPos p_105282_) {
ItemStack itemstack = this.f_105189_.f_91074_.m_21205_(); ItemStack itemstack = this.minecraft.player.getMainHandItem();
- return p_105282_.equals(this.f_105191_) && ItemStack.m_150942_(itemstack, this.f_105192_); - return p_105282_.equals(this.destroyBlockPos) && ItemStack.isSameItemSameTags(itemstack, this.destroyingItem);
+ return p_105282_.equals(this.f_105191_) && ItemStack.m_150942_(itemstack, this.f_105192_) && !f_105192_.shouldCauseBlockBreakReset(itemstack); + return p_105282_.equals(this.destroyBlockPos) && ItemStack.isSameItemSameTags(itemstack, this.destroyingItem) && !destroyingItem.shouldCauseBlockBreakReset(itemstack);
} }
private void m_105297_() { private void ensureHasSentCarriedItem() {
@@ -291,25 +_,38 @@ @@ -291,25 +_,38 @@
private InteractionResult m_233746_(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) { private InteractionResult performUseItemOn(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) {
BlockPos blockpos = p_233749_.m_82425_(); BlockPos blockpos = p_233749_.getBlockPos();
ItemStack itemstack = p_233747_.m_21120_(p_233748_); ItemStack itemstack = p_233747_.getItemInHand(p_233748_);
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks.onRightClickBlock(p_233747_, p_233748_, blockpos, p_233749_); + net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks.onRightClickBlock(p_233747_, p_233748_, blockpos, p_233749_);
+ if (event.isCanceled()) { + if (event.isCanceled()) {
+ return event.getCancellationResult(); + return event.getCancellationResult();
+ } + }
if (this.f_105197_ == GameType.SPECTATOR) { if (this.localPlayerMode == GameType.SPECTATOR) {
return InteractionResult.SUCCESS; return InteractionResult.SUCCESS;
} else { } else {
- boolean flag = !p_233747_.m_21205_().m_41619_() || !p_233747_.m_21206_().m_41619_(); - boolean flag = !p_233747_.getMainHandItem().isEmpty() || !p_233747_.getOffhandItem().isEmpty();
+ UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_); + UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_);
+ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) { + if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
+ InteractionResult result = itemstack.onItemUseFirst(useoncontext); + InteractionResult result = itemstack.onItemUseFirst(useoncontext);
@@ -116,30 +116,30 @@
+ return result; + return result;
+ } + }
+ } + }
+ boolean flag = !p_233747_.m_21205_().doesSneakBypassUse(p_233747_.m_9236_(), blockpos, p_233747_) || !p_233747_.m_21206_().doesSneakBypassUse(p_233747_.m_9236_(), blockpos, p_233747_); + boolean flag = !p_233747_.getMainHandItem().doesSneakBypassUse(p_233747_.level(), blockpos, p_233747_) || !p_233747_.getOffhandItem().doesSneakBypassUse(p_233747_.level(), blockpos, p_233747_);
boolean flag1 = p_233747_.m_36341_() && flag; boolean flag1 = p_233747_.isSecondaryUseActive() && flag;
- if (!flag1) { - if (!flag1) {
BlockState blockstate = this.f_105189_.f_91073_.m_8055_(blockpos); BlockState blockstate = this.minecraft.level.getBlockState(blockpos);
if (!this.f_105190_.m_246351_(blockstate.m_60734_().m_245183_())) { if (!this.connection.isFeatureEnabled(blockstate.getBlock().requiredFeatures())) {
return InteractionResult.FAIL; return InteractionResult.FAIL;
} }
+ if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) { + if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) {
InteractionResult interactionresult = blockstate.m_60664_(this.f_105189_.f_91073_, p_233747_, p_233748_, p_233749_); InteractionResult interactionresult = blockstate.use(this.minecraft.level, p_233747_, p_233748_, p_233749_);
if (interactionresult.m_19077_()) { if (interactionresult.consumesAction()) {
return interactionresult; return interactionresult;
} }
} }
- if (!itemstack.m_41619_() && !p_233747_.m_36335_().m_41519_(itemstack.m_41720_())) { - if (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack.getItem())) {
- UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_); - UseOnContext useoncontext = new UseOnContext(p_233747_, p_233748_, p_233749_);
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) { + if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) {
+ return InteractionResult.PASS; + return InteractionResult.PASS;
+ } + }
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!itemstack.m_41619_() && !p_233747_.m_36335_().m_41519_(itemstack.m_41720_()))) { + if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (!itemstack.isEmpty() && !p_233747_.getCooldowns().isOnCooldown(itemstack.getItem()))) {
InteractionResult interactionresult1; InteractionResult interactionresult1;
if (this.f_105197_.m_46408_()) { if (this.localPlayerMode.isCreative()) {
int i = itemstack.m_41613_(); int i = itemstack.getCount();
@@ -340,10 +_,17 @@ @@ -340,10 +_,17 @@
mutableobject.setValue(InteractionResult.PASS); mutableobject.setValue(InteractionResult.PASS);
return serverbounduseitempacket; return serverbounduseitempacket;
@@ -149,22 +149,22 @@
+ mutableobject.setValue(cancelResult); + mutableobject.setValue(cancelResult);
+ return serverbounduseitempacket; + return serverbounduseitempacket;
+ } + }
InteractionResultHolder<ItemStack> interactionresultholder = itemstack.m_41682_(this.f_105189_.f_91073_, p_233722_, p_233723_); InteractionResultHolder<ItemStack> interactionresultholder = itemstack.use(this.minecraft.level, p_233722_, p_233723_);
ItemStack itemstack1 = interactionresultholder.m_19095_(); ItemStack itemstack1 = interactionresultholder.getObject();
if (itemstack1 != itemstack) { if (itemstack1 != itemstack) {
p_233722_.m_21008_(p_233723_, itemstack1); p_233722_.setItemInHand(p_233723_, itemstack1);
+ if (itemstack1.m_41619_()) + if (itemstack1.isEmpty())
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_233722_, itemstack, p_233723_); + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_233722_, itemstack, p_233723_);
} }
mutableobject.setValue(interactionresultholder.m_19089_()); mutableobject.setValue(interactionresultholder.getResult());
@@ -382,6 +_,9 @@ @@ -382,6 +_,9 @@
this.m_105297_(); this.ensureHasSentCarriedItem();
Vec3 vec3 = p_105233_.m_82450_().m_82492_(p_105232_.m_20185_(), p_105232_.m_20186_(), p_105232_.m_20189_()); Vec3 vec3 = p_105233_.getLocation().subtract(p_105232_.getX(), p_105232_.getY(), p_105232_.getZ());
this.f_105190_.m_295327_(ServerboundInteractPacket.m_179612_(p_105232_, p_105231_.m_6144_(), p_105234_, vec3)); this.connection.send(ServerboundInteractPacket.createInteractionPacket(p_105232_, p_105231_.isShiftKeyDown(), p_105234_, vec3));
+ if (this.f_105197_ == GameType.SPECTATOR) return InteractionResult.PASS; // don't fire for spectators to match non-specific EntityInteract + if (this.localPlayerMode == GameType.SPECTATOR) return InteractionResult.PASS; // don't fire for spectators to match non-specific EntityInteract
+ InteractionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntityAt(p_105231_, p_105232_, p_105233_, p_105234_); + InteractionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntityAt(p_105231_, p_105232_, p_105233_, p_105234_);
+ if(cancelResult != null) return cancelResult; + if(cancelResult != null) return cancelResult;
return this.f_105197_ == GameType.SPECTATOR ? InteractionResult.PASS : p_105232_.m_7111_(p_105231_, vec3, p_105234_); return this.localPlayerMode == GameType.SPECTATOR ? InteractionResult.PASS : p_105232_.interactAt(p_105231_, vec3, p_105234_);
} }
@@ -3,8 +3,8 @@
@@ -89,6 +_,7 @@ @@ -89,6 +_,7 @@
} }
protected void m_105317_(GameType p_105318_) { protected void setGameMode(GameType p_105318_) {
+ net.minecraftforge.client.ForgeHooksClient.onClientChangeGameType(this, this.f_105300_, p_105318_); + net.minecraftforge.client.ForgeHooksClient.onClientChangeGameType(this, this.gameMode, p_105318_);
this.f_105300_ = p_105318_; this.gameMode = p_105318_;
} }
@@ -1,10 +1,10 @@
--- a/net/minecraft/client/multiplayer/ServerData.java --- a/net/minecraft/client/multiplayer/ServerData.java
+++ b/net/minecraft/client/multiplayer/ServerData.java +++ b/net/minecraft/client/multiplayer/ServerData.java
@@ -32,6 +_,7 @@ @@ -35,6 +_,7 @@
private byte[] f_271511_; private byte[] iconBytes;
private ServerData.Type f_291831_; private ServerData.Type type;
private boolean f_242950_; private boolean enforcesSecureChat;
+ public net.minecraftforge.client.ExtendedServerListData forgeData = null; + public net.minecraftforge.client.ExtendedServerListData forgeData = null;
public ServerData(String p_105375_, String p_105376_, ServerData.Type p_297678_) { public ServerData(String p_105375_, String p_105376_, ServerData.Type p_297678_) {
this.f_105362_ = p_105375_; this.name = p_105375_;
@@ -5,6 +5,6 @@
}); });
+ net.minecraftforge.client.ForgeHooksClient.processForgeListPingData(serverstatus, p_105460_); + net.minecraftforge.client.ForgeHooksClient.processForgeListPingData(serverstatus, p_105460_);
this.f_105477_ = Util.m_137550_(); this.pingStart = Util.getMillis();
connection.m_129512_(new ServerboundPingRequestPacket(this.f_105477_)); connection.send(new ServerboundPingRequestPacket(this.pingStart));
this.f_105475_ = true; this.success = true;
Loaded 100 of 1438 files, more files were not shown because too many files have changed in this diff. Show more