Forge 1.20

- Creative mode tabs are now a registry; the `BuildContents` event was renamed to `BuildCreativeModeTabContentsEvent` and moved it to its own class
- The pack format is now 15 for both resource packs and data packs
- `ScreenUtils` was deprecated in favor of a `GuiGraphics` extension
- Forge and the MDK were updated to Gradle 8 and FG6
- The Forge common config file was removed (it only contained the deprecated old fields for resource caching, which was removed in 1.19.3)
- Registry dummy entries were removed
- `RemappingVertexPipeline` was fixed to forward the `endVertex()` call
- Forge tool tags were removed in favor of vanilla ones

Co-authored-by: ChampionAsh5357 <ash@ashwork.net>
Co-authored-by: coehlrich <coehlrich@users.noreply.github.com>
Co-authored-by: Dennis C <11262040+XFactHD@users.noreply.github.com>
Co-authored-by: Matyrobbrt <matyrobbrt@gmail.com>
This commit is contained in:
SizableShrimp 2023-04-01 20:45:29 -05:00
parent 658e614dc1
commit d8c84e2949
568 changed files with 5114 additions and 5807 deletions

6
.gitignore vendored
View file

@ -37,9 +37,9 @@ src/generated_test/resources/.cache/
src/generated_mdk/resources/.cache/
#Patch rejects
/patches-/
*.patch.rej
/projects/*/rejects/
#/patches-/
#*.patch.rej
#/projects/*/rejects/
# FML changelog
changelog.txt

View file

@ -4,7 +4,7 @@ import net.minecraftforge.forge.tasks.checks.CheckExcs
import net.minecraftforge.forge.tasks.checks.CheckPatches
import net.minecraftforge.forge.tasks.checks.CheckSAS
import net.minecraftforge.forge.tasks.checks.CheckTask
import net.minecraftforge.forge.tasks.checks.CheckMode
import net.minecraftforge.forge.tasks.FixPatchImports
import java.nio.file.Files
import java.util.Date
@ -23,12 +23,12 @@ import org.objectweb.asm.Opcodes
plugins {
id 'org.cadixdev.licenser' version '0.6.1'
id 'com.github.ben-manes.versions' version '0.36.0'
id 'com.github.ben-manes.versions' version '0.46.0'
id 'net.minecraftforge.gradleutils' version '2.+'
id 'eclipse'
id 'de.undercouch.download' version '5.1.3'
id 'net.minecraftforge.gradle.patcher' version '[5.1.50,5.2.0)' apply false
id 'net.minecraftforge.gradle.mcp' version '[5.1.50,5.2.0)' apply false
id 'de.undercouch.download' version '5.4.0'
id 'net.minecraftforge.gradle.patcher' version '[6.0,6.2)' apply false
id 'net.minecraftforge.gradle.mcp' version '[6.0,6.2)' apply false
}
Util.init() //Init all our extension methods!
@ -43,11 +43,14 @@ ext {
]
}
MAPPING_CHANNEL = 'official'
MAPPING_VERSION = '1.19.4'
MC_VERSION = '1.19.4'
MC_NEXT_VERSION = '1.20'
MCP_VERSION = '20230314.122934'
SPI_VERSION = '6.0.0'
MAPPING_VERSION = '1.20'
MC_VERSION = '1.20'
MC_NEXT_VERSION = '1.21'
MCP_VERSION = '20230608.053357'
SNAPSHOT = false
SPI_VERSION = '7.0.0'
MERGETOOL_VERSION = '1.1.5'
ACCESSTRANSFORMERS_VERSION = '8.0.4'
COREMODS_VERSION = '5.0.1'
EVENTBUS_VERSION = '6.0.3'
@ -284,6 +287,7 @@ def sharedDeps = {
installer "net.minecraftforge:coremods:${COREMODS_VERSION}"
installer "cpw.mods:modlauncher:${MODLAUNCHER_VERSION}"
installer 'net.minecraftforge:unsafe:0.2.+'
installer "net.minecraftforge:mergetool:${MERGETOOL_VERSION}:api"
installer "com.electronwill.night-config:core:${NIGHTCONFIG_VERSION}"
installer "com.electronwill.night-config:toml:${NIGHTCONFIG_VERSION}"
installer "org.apache.maven:maven-artifact:${APACHE_MAVEN_ARTIFACT_VERSION}"
@ -884,12 +888,15 @@ project(':forge') {
apply plugin: 'net.minecraftforge.gradle.patcher'
apply plugin: 'org.cadixdev.licenser'
applyPatches { verbose = true }
sourceSets {
main {
java {
srcDirs = [
"$rootDir/src/main/java",
"$rootDir/src/fmlcommon/java"
"$rootDir/src/fmlcommon/java",
SNAPSHOT ? "$rootDir/src/snapshots/java" : "$rootDir/src/snapshots_disabled/java"
]
}
resources {
@ -1176,7 +1183,7 @@ project(':forge') {
output = rootProject.file('build/libraries/')
}
task extractInheritance(type: ExtractInheritance, dependsOn: [genJoinedBinPatches, downloadLibraries]) {
task extractInheritance(type: ExtractInheritance, dependsOn: [downloadLibraries]) {
tool = INSTALLER_TOOLS + ':fatjar'
args.add '--annotations'
input = genJoinedBinPatches.cleanJar
@ -1258,6 +1265,11 @@ project(':forge') {
]
}
tasks.register('fixPatchImports', FixPatchImports) {
clean.set(rootProject.file('projects/clean/src/main/java'))
patched.set(rootProject.file('projects/forge/src/main/java'))
}
genPatches {
finalizedBy checkAndFixPatches
autoHeader true
@ -1653,9 +1665,8 @@ project(':forge') {
}
}
reobfJar {
tool = FART
args = ['--input', '{input}', '--output', '{output}', '--map', '{srg}']
tasks.register('genAllData') {
dependsOn 'forge_data', 'forge_mdk_data', 'forge_test_data'
}
tasks.eclipse.dependsOn('genEclipseRuns')
@ -1776,6 +1787,10 @@ task setup() { //These must be strings so that we can do lazy resolution. Else
dependsOn ':forge:extractMapped'
}
if (symlinkValid)
project.gradle.startParameter.excludedTaskNames.add(':fmlonly:genPatches')
project.gradle.startParameter.excludedTaskNames.add(':clean:genPatches')
//Also output FMLOnly when building a version.
if (System.env.TEAMCITY_VERSION) {
//Only setup the CI environment if and only if the environment variables are set.

View file

@ -1,13 +1,13 @@
repositories {
maven { url = 'https://maven.minecraftforge.net/' }
mavenCentral()
mavenCentral()
}
dependencies {
implementation 'org.ow2.asm:asm:9.5'
implementation 'org.ow2.asm:asm-tree:9.5'
implementation 'net.minecraftforge:srgutils:0.5.+'
implementation 'commons-io:commons-io:2.8.0'
implementation 'com.google.code.gson:gson:2.10'
implementation 'commons-io:commons-io:2.12.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.5.0.202303070854-r'
}

View file

@ -4,7 +4,7 @@ import groovy.json.JsonBuilder
import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.TaskAction
import org.objectweb.asm.tree.ClassNode
import org.objectweb.asm.tree.FieldNode
@ -12,7 +12,9 @@ import org.objectweb.asm.tree.MethodNode
abstract class BytecodeFinder extends DefaultTask {
@InputFile abstract RegularFileProperty getJar()
@OutputFile abstract RegularFileProperty getOutput()
// It should be fine to mark the output as internal as we want to control when we run it anyways.
// This also shuts Gradle 8 up about implicit task dependencies.
@Internal abstract RegularFileProperty getOutput()
BytecodeFinder() {
output.convention(project.layout.buildDirectory.dir(name).map { it.file("output.json") })

View file

@ -0,0 +1,40 @@
package net.minecraftforge.forge.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.TaskAction
import java.nio.file.Files
abstract class FixPatchImports extends DefaultTask {
@InputDirectory abstract DirectoryProperty getClean()
@InputDirectory abstract DirectoryProperty getPatched()
@TaskAction
void run() {
final patchedPath = getPatched().get().asFile.toPath()
final cleanPath = getClean().get().asFile.toPath()
try (final var stream = Files.find(patchedPath, Integer.MAX_VALUE, (path, attr) -> path.toString().endsWith('.java'))) {
final itr = stream.iterator()
while (itr.hasNext()) {
final next = itr.next()
final clean = cleanPath.resolve(patchedPath.relativize(next).toString())
final patchedLines = Files.readAllLines(next)
final cleanLines = Files.readAllLines(clean)
final patchedImport = patchedLines.findLastIndexOf(2) { it.startsWith('import ') }
final cleanImport = cleanLines.findLastIndexOf(2) { it.startsWith('import ') }
if (cleanImport !== patchedImport) {
patchedLines.removeIf { it.startsWith('import ') }
patchedLines.addAll(2, cleanLines.subList(2, cleanImport + 1))
Files.write(next, patchedLines)
}
}
}
}
}

View file

@ -81,14 +81,6 @@ public class Util {
if (!checkExists(url)) {
url = "https://maven.minecraftforge.net/${path}"
}
//TODO remove when Mojang launcher is updated
if (!classifiers && art.classifier != null) {
//Mojang launcher doesn't currently support classifiers, so... move it to part of the version, and force the extension to 'jar'
// However, keep the path normal so that our mirror system works.
art.version = "${art.version}-${art.classifier}"
art.classifier = null
art.extension = 'jar'
}
ret[key] = [
name: "${art.group}:${art.name}:${art.version}" + (art.classifier == null ? '' : ":${art.classifier}") + (art.extension == 'jar' ? '' : "@${art.extension}"),
downloads: [

View file

@ -171,7 +171,7 @@ abstract class CheckATs extends CheckTask {
}
private static List<String> joinBack(TreeMap<String, ATParser.Entry> lines, Map<String, InheritanceData> inheritance, IMappingFile mappings) {
final data = []
final data = [] as List<String>
final remapComment = { ATParser.Entry entry ->
if (!mappings || !entry || !entry.desc) return null
final comment = entry.comment?.substring(1)?.trim()

View file

@ -36,7 +36,7 @@ abstract class CheckTask extends DefaultTask implements VerificationTask {
final doFix = getMode().get() === CheckMode.FIX
final Reporter reporter = new Reporter(doFix)
check(reporter, doFix)
if (reporter.messages) {
if (getMode().get() === CheckMode.CHECK) {
logger.error("Check task '{}' found errors:\n{}", name, reporter.messages.join('\n'))
@ -91,18 +91,20 @@ abstract class CheckTask extends DefaultTask implements VerificationTask {
@DelegatesTo(genericTypeIndex = 0, target = 'type') Closure configuration) {
taskName = taskName.capitalize()
tasks.register("check$taskName", clazz) { CheckTask task ->
configuration.setDelegate((T) task)
configuration.call(task)
task.mode.set(CheckMode.CHECK)
task.group = 'checks'
def castedTask = task as T
configuration.setDelegate(castedTask)
configuration.call(castedTask)
castedTask.mode.set(CheckMode.CHECK)
castedTask.group = 'checks'
}
tasks.named('checkAll').configure { it.dependsOn("check$taskName") }
tasks.register("checkAndFix$taskName", clazz) { CheckTask task ->
configuration.setDelegate((T) task)
configuration.call(task)
task.mode.set(CheckMode.FIX)
task.group = 'checks'
def castedTask = task as T
configuration.setDelegate(castedTask)
configuration.call(castedTask)
castedTask.mode.set(CheckMode.FIX)
castedTask.group = 'checks'
}
tasks.named('checkAllAndFix').configure { it.dependsOn("checkAndFix$taskName") }
}

View file

@ -3,15 +3,14 @@
MinecraftForge
=============
[![Stable Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Stable&prefix=1.19.4-&query=$.promos["1.19.4-recommended"]&color=brightgreen&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtc3RhciBmYS13LTE4IiBhcmlhLWhpZGRlbj0idHJ1ZSIgZGF0YS1pY29uPSJzdGFyIiBkYXRhLXByZWZpeD0iZmFzIiBmb2N1c2FibGU9ImZhbHNlIiByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCA1NzYgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMjU5LjMgMTcuOEwxOTQgMTUwLjIgNDcuOSAxNzEuNWMtMjYuMiAzLjgtMzYuNyAzNi4xLTE3LjcgNTQuNmwxMDUuNyAxMDMtMjUgMTQ1LjVjLTQuNSAyNi4zIDIzLjIgNDYgNDYuNCAzMy43TDI4OCA0MzkuNmwxMzAuNyA2OC43YzIzLjIgMTIuMiA1MC45LTcuNCA0Ni40LTMzLjdsLTI1LTE0NS41IDEwNS43LTEwM2MxOS0xOC41IDguNS01MC44LTE3LjctNTQuNkwzODIgMTUwLjIgMzE2LjcgMTcuOGMtMTEuNy0yMy42LTQ1LjYtMjMuOS01Ny40IDB6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)][Download]
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.19.4-&query=$.promos["1.19.4-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
[![Latest Release](https://img.shields.io/badge/dynamic/json?url=https://files.minecraftforge.net/net/minecraftforge/forge/promotions_slim.json&label=Latest&prefix=1.20-&query=$.promos["1.20-latest"]&color=blue&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtYnVnIGZhLXctMTYiIGFyaWEtaGlkZGVuPSJ0cnVlIiBkYXRhLWljb249ImJ1ZyIgZGF0YS1wcmVmaXg9ImZhcyIgZm9jdXNhYmxlPSJmYWxzZSIgcm9sZT0iaW1nIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUxMS45ODggMjg4LjljLS40NzggMTcuNDMtMTUuMjE3IDMxLjEtMzIuNjUzIDMxLjFINDI0djE2YzAgMjEuODY0LTQuODgyIDQyLjU4NC0xMy42IDYxLjE0NWw2MC4yMjggNjAuMjI4YzEyLjQ5NiAxMi40OTcgMTIuNDk2IDMyLjc1OCAwIDQ1LjI1NS0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDBsLTU0LjczNi01NC43MzZDMzQ1Ljg4NiA0NjcuOTY1IDMxNC4zNTEgNDgwIDI4MCA0ODBWMjM2YzAtNi42MjctNS4zNzMtMTItMTItMTJoLTI0Yy02LjYyNyAwLTEyIDUuMzczLTEyIDEydjI0NGMtMzQuMzUxIDAtNjUuODg2LTEyLjAzNS05MC42MzYtMzIuMTA4bC01NC43MzYgNTQuNzM2Yy0xMi40OTggMTIuNDk3LTMyLjc1OSAxMi40OTYtNDUuMjU2IDAtMTIuNDk2LTEyLjQ5Ny0xMi40OTYtMzIuNzU4IDAtNDUuMjU1bDYwLjIyOC02MC4yMjhDOTIuODgyIDM3OC41ODQgODggMzU3Ljg2NCA4OCAzMzZ2LTE2SDMyLjY2NkMxNS4yMyAzMjAgLjQ5MSAzMDYuMzMuMDEzIDI4OC45LS40ODQgMjcwLjgxNiAxNC4wMjggMjU2IDMyIDI1Nmg1NnYtNTguNzQ1bC00Ni42MjgtNDYuNjI4Yy0xMi40OTYtMTIuNDk3LTEyLjQ5Ni0zMi43NTggMC00NS4yNTUgMTIuNDk4LTEyLjQ5NyAzMi43NTgtMTIuNDk3IDQ1LjI1NiAwTDE0MS4yNTUgMTYwaDIyOS40ODlsNTQuNjI3LTU0LjYyN2MxMi40OTgtMTIuNDk3IDMyLjc1OC0xMi40OTcgNDUuMjU2IDAgMTIuNDk2IDEyLjQ5NyAxMi40OTYgMzIuNzU4IDAgNDUuMjU1TDQyNCAxOTcuMjU1VjI1Nmg1NmMxNy45NzIgMCAzMi40ODQgMTQuODE2IDMxLjk4OCAzMi45ek0yNTcgMGMtNjEuODU2IDAtMTEyIDUwLjE0NC0xMTIgMTEyaDIyNEMzNjkgNTAuMTQ0IDMxOC44NTYgMCAyNTcgMHoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=
)][Download] [![Discord](https://img.shields.io/discord/313125603924639766.svg?color=%237289da&label=Discord&logo=discord&logoColor=%237289da)][Discord] [![Support](https://img.shields.io/badge/Patreon-Support-orange.svg?logo=Patreon)][Patreon]
Forge is a free, open-source modding API all of your favourite mods use!
| Version | Support |
|---------| ------------- |
| 1.19.x | Active |
| 1.18.x | LTS |
| 1.20.x | Active |
* [Download]
* [Forum]

View file

@ -44,6 +44,7 @@ ext {
}
jar.doFirst {
manifest.attributes['Automatic-Module-Name'] = project.name
MANIFESTS.each { pkg, values ->
if (pkg == '')
manifest.attributes(values)

View file

@ -66,7 +66,7 @@ public class DeferredWorkQueue
timer,
aggregate
);
//TODO 1.20: throw aggregate exception
throw aggregate;
} else {
LOGGER.debug(LOADING, "Synchronous work queue completed in {}", timer);
}

View file

@ -17,6 +17,7 @@ dependencies {
api("org.ow2.asm:asm-tree:${ASM_VERSION}")
api("org.ow2.asm:asm-commons:${ASM_VERSION}")
api("net.minecraftforge:forgespi:${SPI_VERSION}")
api("net.minecraftforge:mergetool:${MERGETOOL_VERSION}:api")
api("org.apache.logging.log4j:log4j-api:${LOG4J_VERSION}")
api("org.slf4j:slf4j-api:${SLF4J_API_VERSION}")
api("com.google.guava:guava:${GUAVA_VERSION}")
@ -69,6 +70,7 @@ ext {
}
jar.doFirst {
manifest.attributes['Automatic-Module-Name'] = project.name
MANIFESTS.each { pkg, values ->
manifest.attributes(values, pkg)
}

View file

@ -74,14 +74,6 @@ public enum FMLPaths
}
}
/**
* @deprecated Use {@link #getOrCreateGameRelativePath(Path)} instead.
*/
@Deprecated(forRemoval = true, since = "1.19.4")
public static Path getOrCreateGameRelativePath(Path path, String name) {
return getOrCreateGameRelativePath(path);
}
public static Path getOrCreateGameRelativePath(Path path) {
Path gameFolderPath = FMLPaths.GAMEDIR.get().resolve(path);

View file

@ -5,35 +5,11 @@
package net.minecraftforge.fml.loading;
import com.mojang.logging.LogUtils;
import org.slf4j.Logger;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
public class FileUtils
{
private static final Logger LOGGER = LogUtils.getLogger();
/**
* @deprecated Use normal Java NIO methods instead
*/
@Deprecated(forRemoval = true, since = "1.19.4")
public static Path getOrCreateDirectory(Path dirPath, String dirLabel) {
if (!Files.isDirectory(dirPath))
{
try {
Files.createDirectories(dirPath);
} catch (IOException e) {
throw new RuntimeException("Problem creating directory", e);
}
}
return dirPath;
}
public static String fileExtension(final Path path) {
String fileName = path.getFileName().toString();

View file

@ -13,7 +13,6 @@ import net.minecraftforge.api.distmarker.Dist;
import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.stream.Stream;
public abstract class CommonClientLaunchHandler extends CommonLaunchHandler {
@ -24,7 +23,9 @@ public abstract class CommonClientLaunchHandler extends CommonLaunchHandler {
@Override
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
return () -> {
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.client.main.Main").getMethod("main", String[].class).invoke(null, (Object)arguments);
var args = preLaunch(arguments, layer);
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.client.main.Main").getMethod("main", String[].class).invoke(null, (Object)args);
};
}

View file

@ -46,7 +46,10 @@ public abstract class CommonDevLaunchHandler extends CommonLaunchHandler {
return new LocatedPaths(mcstream.build().toList(), mcFilter, modstream.build().toList(), getFmlStuff(legacyCP));
}
@Override
protected String[] preLaunch(String[] arguments, ModuleLayer layer) {
super.preLaunch(arguments, layer);
if (getDist().isDedicatedServer())
return arguments;

View file

@ -10,9 +10,16 @@ import cpw.mods.modlauncher.api.ILaunchHandlerService;
import cpw.mods.modlauncher.api.ITransformingClassLoaderBuilder;
import net.minecraftforge.fml.loading.LogMarkers;
import net.minecraftforge.api.distmarker.Dist;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.ConfigurationFactory;
import org.apache.logging.log4j.core.config.ConfigurationSource;
import org.apache.logging.log4j.core.config.Configurator;
import org.slf4j.Logger;
import sun.misc.Unsafe;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
@ -46,6 +53,20 @@ public abstract class CommonLaunchHandler implements ILaunchHandlerService {
}
protected String[] preLaunch(String[] arguments, ModuleLayer layer) {
URI uri;
try (var reader = layer.configuration().findModule("fmlloader").orElseThrow().reference().open()) {
uri = reader.find("log4j2.xml").orElseThrow();
} catch (IOException e) {
throw new RuntimeException(e);
}
// Force the log4j2 configuration to be loaded from fmlloader
Configurator.reconfigure(ConfigurationFactory.getInstance().getConfiguration(LoggerContext.getContext(), ConfigurationSource.fromUri(uri)));
return arguments;
}
protected final Map<String, List<Path>> getModClasses() {
final String modClasses = Optional.ofNullable(System.getenv("MOD_CLASSES")).orElse("");
LOGGER.debug(LogMarkers.CORE, "Got mod coordinates {} from env", modClasses);

View file

@ -14,7 +14,6 @@ import net.minecraftforge.api.distmarker.Dist;
import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.function.BiPredicate;
import java.util.stream.Stream;
@ -26,7 +25,9 @@ public abstract class CommonServerLaunchHandler extends CommonLaunchHandler {
@Override
public ServiceRunner launchService(String[] arguments, ModuleLayer layer) {
return () -> {
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.server.Main").getMethod("main", String[].class).invoke(null, (Object)arguments);
var args = preLaunch(arguments, layer);
Class.forName(layer.findModule("minecraft").orElseThrow(),"net.minecraft.server.Main").getMethod("main", String[].class).invoke(null, (Object)args);
};
}

Binary file not shown.

View file

@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

12
gradlew vendored
View file

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -80,10 +80,10 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac

1
gradlew.bat vendored
View file

@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

View file

@ -41,6 +41,7 @@ ext {
}
jar.doFirst {
manifest.attributes['Automatic-Module-Name'] = project.name
MANIFESTS.each { pkg, values ->
if (pkg == '')
manifest.attributes(values)

View file

@ -39,6 +39,7 @@ ext {
}
jar.doFirst {
manifest.attributes['Automatic-Module-Name'] = project.name
MANIFESTS.each { pkg, values ->
if (pkg == '')
manifest.attributes(values)

View file

@ -41,6 +41,7 @@ ext {
}
jar.doFirst {
manifest.attributes['Automatic-Module-Name'] = project.name
MANIFESTS.each { pkg, values ->
if (pkg == '')
manifest.attributes(values)

View file

@ -1,12 +1,16 @@
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
}
version = '1.0'
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'modid'
version = mod_version
group = mod_group_id
base {
archivesName = mod_id
}
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
@ -26,9 +30,33 @@ minecraft {
//
// Use non-default mappings at your own risk. They may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: '@MAPPING_CHANNEL@', version: '@MAPPING_VERSION@'
mappings channel: mapping_channel, version: mapping_version
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.
// When true, this property will have all Eclipse run configurations run the "prepareX" task for the given run configuration before launching the game.
// In most cases, it is not necessary to enable.
// enableEclipsePrepareRuns = true
// When true, this property will have all IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
// In most cases, it is not necessary to enable.
// enableIdeaPrepareRuns = true
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
// It is REQUIRED to be set to true for this template to function.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
copyIdeResources = true
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
// The folder name can be set on a run configuration using the "folderName" property.
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
// generateRunFolders = true
// This property enables access transformers for use in development.
// They will be applied to the Minecraft artifact.
// The access transformer file can be anywhere in the project.
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
// This default location is a best practice to automatically put the file in the right place in the final jar.
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
@ -49,10 +77,10 @@ minecraft {
property 'forge.logging.console.level', 'debug'
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', 'examplemod'
property 'forge.enabledGameTestNamespaces', mod_id
mods {
examplemod {
"${mod_id}" {
source sourceSets.main
}
}
@ -65,10 +93,10 @@ minecraft {
property 'forge.logging.console.level', 'debug'
property 'forge.enabledGameTestNamespaces', 'examplemod'
property 'forge.enabledGameTestNamespaces', mod_id
mods {
examplemod {
"${mod_id}" {
source sourceSets.main
}
}
@ -84,10 +112,10 @@ minecraft {
property 'forge.logging.console.level', 'debug'
property 'forge.enabledGameTestNamespaces', 'examplemod'
property 'forge.enabledGameTestNamespaces', mod_id
mods {
examplemod {
"${mod_id}" {
source sourceSets.main
}
}
@ -101,10 +129,10 @@ minecraft {
property 'forge.logging.console.level', 'debug'
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
examplemod {
"${mod_id}" {
source sourceSets.main
}
}
@ -119,39 +147,68 @@ repositories {
// Put repositories for dependencies here
// ForgeGradle automatically adds the Forge maven and Maven Central for you
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
// flatDir {
// dir 'libs'
// }
}
dependencies {
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
// that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft '@FORGE_GROUP@:@FORGE_NAME@:@FORGE_VERSION@'
// Specify the version of Minecraft to use.
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
// The "userdev" classifier will be requested and setup by ForgeGradle.
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
// Real mod deobf dependency examples - these get remapped to your current mappings
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
// Examples using mod jars from ./libs
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
// For more info...
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta']
def replaceProperties = [
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version: forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description
]
processResources {
inputs.properties replaceProperties
replaceProperties.put 'project', project
filesMatching(resourceTargets) {
expand replaceProperties
}
}
// Example for how to get properties into the manifest for reading at runtime.
jar {
manifest {
attributes([
"Specification-Title" : "examplemod",
"Specification-Vendor" : "examplemodsareus",
"Specification-Title" : mod_id,
"Specification-Vendor" : mod_authors,
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : "examplemodsareus",
"Implementation-Vendor" : mod_authors,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}

View file

@ -1,4 +1,59 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.daemon=false
## Environment Properties
# The Minecraft version must agree with the Forge version to get a valid artifact
minecraft_version=@MC_VERSION@
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[@MC_VERSION@,@MC_NEXT_VERSION@)
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=@FORGE_VERSION@
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[@FORGE_SPEC_VERSION@,)
# The loader version range can only use the major version of Forge/FML as bounds
loader_version_range=[@FORGE_SPEC_VERSION@,)
# The mapping channel to use for mappings.
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
#
# | Channel | Version | |
# |-----------|----------------------|--------------------------------------------------------------------------------|
# | official | MCVersion | Official field/method names from Mojang mapping files |
# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official |
#
# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
#
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
mapping_channel=@MAPPING_CHANNEL@
# The mapping version to query from the mapping channel.
# This must match the format required by the mapping channel.
mapping_version=@MAPPING_VERSION@
## Mod Properties
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=examplemod
# The human-readable display name for the mod.
mod_name=Example Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=1.0.0
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=com.example.examplemod
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=YourNameHere, OtherNameHere
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.

View file

@ -1,6 +1,13 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
}
}
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}

View file

@ -2,16 +2,19 @@ package com.example.examplemod;
import com.mojang.logging.LogUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MapColor;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.CreativeModeTabEvent;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -36,12 +39,26 @@ public class ExampleMod
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);
// Create a Deferred Register to hold Items which will all be registered under the "examplemod" namespace
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
// Create a Deferred Register to hold CreativeModeTabs which will all be registered under the "examplemod" namespace
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID);
// Creates a new Block with the id "examplemod:example_block", combining the namespace and path
public static final RegistryObject<Block> EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE)));
public static final RegistryObject<Block> EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE)));
// Creates a new BlockItem with the id "examplemod:example_block", combining the namespace and path
public static final RegistryObject<Item> EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties()));
// Creates a new food item with the id "examplemod:example_id", nutrition 1 and saturation 2
public static final RegistryObject<Item> EXAMPLE_ITEM = ITEMS.register("example_item", () -> new Item(new Item.Properties().food(new FoodProperties.Builder()
.alwaysEat().nutrition(1).saturationMod(2f).build())));
// Creates a creative tab with the id "examplemod:example_tab" for the example item, that is placed after the combat tab
public static final RegistryObject<CreativeModeTab> EXAMPLE_TAB = CREATIVE_MODE_TABS.register("example_tab", () -> CreativeModeTab.builder()
.withTabsBefore(CreativeModeTabs.COMBAT)
.icon(() -> EXAMPLE_ITEM.get().getDefaultInstance())
.displayItems((parameters, output) -> {
output.accept(EXAMPLE_ITEM.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event
}).build());
public ExampleMod()
{
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
@ -53,6 +70,8 @@ public class ExampleMod
BLOCKS.register(modEventBus);
// Register the Deferred Register to the mod event bus so items get registered
ITEMS.register(modEventBus);
// Register the Deferred Register to the mod event bus so tabs get registered
CREATIVE_MODE_TABS.register(modEventBus);
// Register ourselves for server and other game events we are interested in
MinecraftForge.EVENT_BUS.register(this);
@ -68,9 +87,10 @@ public class ExampleMod
LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT));
}
private void addCreative(CreativeModeTabEvent.BuildContents event)
// Add the example block item to the building blocks tab
private void addCreative(BuildCreativeModeTabContentsEvent event)
{
if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS)
if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS)
event.accept(EXAMPLE_BLOCK_ITEM);
}

View file

@ -6,32 +6,30 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[@FORGE_SPEC_VERSION@,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="All rights reserved"
license="${mod_license}"
# A URL to refer people to when problems occur with this mod
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="examplemod" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
# see the associated build.gradle script for how to populate this completely automatically during a build
version="${file.jarVersion}" #mandatory
# A display name for the mod
displayName="Example Mod" #mandatory
modId="${mod_id}" #mandatory
# The version number of the mod
version="${mod_version}" #mandatory
# A display name for the mod
displayName="${mod_name}" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
logoFile="examplemod.png" #optional
#logoFile="examplemod.png" #optional
# A text field displayed in the mod UI
credits="Thanks for this example mod goes to Java" #optional
#credits="" #optional
# A text field displayed in the mod UI
authors="Love, Cheese and small house plants" #optional
authors="${mod_authors}" #optional
# Display Test controls the display for your mod in the server connection screen
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
@ -41,30 +39,26 @@ authors="Love, Cheese and small house plants" #optional
#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional)
# The description text for the mod (multi line!) (#mandatory)
description='''
This is a long form description of the mod. You can write whatever you want here
Have some lorem ipsum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
'''
description='''${mod_description}'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.examplemod]] #optional
[[dependencies.${mod_id}]] #optional
# the modid of the dependency
modId="forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[@FORGE_SPEC_VERSION@,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
versionRange="${forge_version_range}" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
# BEFORE - This mod is loaded BEFORE the dependency
# AFTER - This mod is loaded AFTER the dependency
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
side="BOTH"
# Here's another dependency
[[dependencies.examplemod]]
[[dependencies.${mod_id}]]
modId="minecraft"
mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[@MC_VERSION@,@MC_NEXT_VERSION@)"
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="${minecraft_version_range}"
ordering="NONE"
side="BOTH"

View file

@ -1,32 +1,32 @@
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
@@ -112,7 +_,10 @@
GlStateManager.m_84331_(3553, 34892, 0);
GlStateManager.m_84331_(3553, 10242, 33071);
GlStateManager.m_84331_(3553, 10243, 33071);
@@ -113,7 +_,10 @@
GlStateManager._texParameter(3553, 34892, 0);
GlStateManager._texParameter(3553, 10242, 33071);
GlStateManager._texParameter(3553, 10243, 33071);
+ if (!stencilEnabled)
GlStateManager.m_84209_(3553, 0, 6402, this.f_83915_, this.f_83916_, 0, 6402, 5126, (IntBuffer)null);
GlStateManager._texImage2D(3553, 0, 6402, this.f_83915_, this.f_83916_, 0, 6402, 5126, (IntBuffer)null);
+ else
+ GlStateManager.m_84209_(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.f_83915_, this.f_83916_, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null);
}
this.m_83936_(9728);
@@ -123,7 +_,14 @@
GlStateManager.m_84486_(36160, this.f_83920_);
GlStateManager.m_84173_(36160, 36064, 3553, this.f_83923_, 0);
@@ -124,7 +_,14 @@
GlStateManager._glBindFramebuffer(36160, this.f_83920_);
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.f_83923_, 0);
if (this.f_83919_) {
+ if(!stencilEnabled)
GlStateManager.m_84173_(36160, 36096, 3553, this.f_83924_, 0);
GlStateManager._glFramebufferTexture2D(36160, 36096, 3553, this.f_83924_, 0);
+ else if(net.minecraftforge.common.ForgeConfig.CLIENT.useCombinedDepthStencilAttachment.get()) {
+ GlStateManager.m_84173_(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.f_83924_, 0);
+ } else {
+ GlStateManager.m_84173_(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_ATTACHMENT, 3553, this.f_83924_, 0);
+ GlStateManager.m_84173_(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_DEPTH_ATTACHMENT, 3553, this.f_83924_, 0);
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, 3553, this.f_83924_, 0);
+ }
}
this.m_83949_();
@@ -291,4 +_,27 @@
@@ -292,4 +_,27 @@
public int m_83980_() {
return this.f_83924_;
}

View file

@ -1,14 +1,14 @@
--- a/com/mojang/blaze3d/platform/GlStateManager.java
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
@@ -500,9 +_,16 @@
@@ -501,9 +_,16 @@
}
+ /* Stores the last values sent into glMultiTexCoord2f */
+ public static float lastBrightnessX = 0.0f;
+ public static float lastBrightnessY = 0.0f;
public static void m_84160_(int p_84161_, int p_84162_, float p_84163_) {
RenderSystem.m_187555_();
public static void _texParameter(int p_84161_, int p_84162_, float p_84163_) {
RenderSystem.assertOnRenderThreadOrInit();
GL11.glTexParameterf(p_84161_, p_84162_, p_84163_);
+ if (p_84161_ == GL13.GL_TEXTURE1) {
+ lastBrightnessX = p_84162_;
@ -16,4 +16,4 @@
+ }
}
public static void m_84331_(int p_84332_, int p_84333_, int p_84334_) {
public static void _texParameter(int p_84332_, int p_84333_, int p_84334_) {

View file

@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/platform/Window.java
+++ b/com/mojang/blaze3d/platform/Window.java
@@ -82,7 +_,7 @@
@@ -83,7 +_,7 @@
GLFW.glfwWindowHint(139267, 2);
GLFW.glfwWindowHint(139272, 204801);
GLFW.glfwWindowHint(139270, 1);
@ -9,7 +9,7 @@
if (monitor != null) {
VideoMode videomode = monitor.m_84948_(this.f_85355_ ? this.f_85354_ : Optional.empty());
this.f_85350_ = this.f_85357_ = monitor.m_84951_() + videomode.m_85332_() / 2 - this.f_85359_ / 2;
@@ -260,6 +_,7 @@
@@ -238,6 +_,7 @@
GLFW.glfwGetFramebufferSize(this.f_85349_, aint, aint1);
this.f_85361_ = aint[0] > 0 ? aint[0] : 1;
this.f_85362_ = aint1[0] > 0 ? aint1[0] : 1;

View file

@ -1,7 +1,7 @@
--- a/com/mojang/blaze3d/vertex/BufferBuilder.java
+++ b/com/mojang/blaze3d/vertex/BufferBuilder.java
@@ -486,4 +_,14 @@
this.f_166822_ = p_254368_;
@@ -459,4 +_,14 @@
this.f_276566_ = p_277855_;
}
}
+

View file

@ -1,6 +1,6 @@
--- a/com/mojang/blaze3d/vertex/VertexFormat.java
+++ b/com/mojang/blaze3d/vertex/VertexFormat.java
@@ -181,4 +_,11 @@
@@ -176,4 +_,11 @@
return i;
}
}

View file

@ -5,7 +5,7 @@
import org.joml.Vector3fc;
-public final class Transformation {
+public final class Transformation implements net.minecraftforge.client.extensions.IForgeTransformation {
+public final class Transformation implements net.minecraftforge.common.extensions.IForgeTransformation {
private final Matrix4f f_121078_;
public static final Codec<Transformation> f_268453_ = RecordCodecBuilder.create((p_269604_) -> {
return p_269604_.group(ExtraCodecs.f_252432_.fieldOf("translation").forGetter((p_269599_) -> {

View file

@ -1,7 +1,7 @@
--- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
+++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
@@ -65,6 +_,15 @@
return Component.m_237119_().m_7220_(this.f_200947_.getFirst()).m_130946_(": ").m_7220_(this.f_200947_.getSecond());
@@ -68,6 +_,15 @@
return Component.m_237119_().m_7220_(this.f_200947_.f_287789_).m_130946_(": ").m_7220_(this.f_200947_.f_287787_);
}
+ @Override
@ -13,6 +13,6 @@
+ return super.m_7933_(key, scanCode, modifiers);
+ }
+
public void m_86412_(PoseStack p_88679_, int p_88680_, int p_88681_, float p_88682_) {
this.m_7333_(p_88679_);
m_93215_(p_88679_, this.f_96547_, this.f_200947_.getFirst(), this.f_96543_ / 2, 80, 16777215);
public void m_88315_(GuiGraphics p_283497_, int p_88680_, int p_88681_, float p_88682_) {
this.m_280273_(p_283497_);
p_283497_.m_280653_(this.f_96547_, this.f_200947_.f_287789_, this.f_96543_ / 2, 80, 16777215);

View file

@ -1,6 +1,6 @@
--- a/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java
+++ b/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java
@@ -47,9 +_,9 @@
@@ -45,9 +_,9 @@
}
};
private final RealmsNotificationsScreen.DataFetcherConfiguration f_273849_ = new RealmsNotificationsScreen.DataFetcherConfiguration() {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/SharedConstants.java
+++ b/net/minecraft/SharedConstants.java
@@ -205,6 +_,7 @@
@@ -210,6 +_,7 @@
}
static {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/Util.java
+++ b/net/minecraft/Util.java
@@ -170,6 +_,11 @@
@@ -171,6 +_,11 @@
return 255;
}
@ -12,7 +12,7 @@
public static ExecutorService m_183991_() {
return f_137444_;
}
@@ -238,7 +_,7 @@
@@ -239,7 +_,7 @@
try {
type = DataFixers.m_14512_().getSchema(DataFixUtils.makeKey(SharedConstants.m_183709_().m_183476_().m_193006_())).getChoiceType(p_137552_, p_137553_);
} catch (IllegalArgumentException illegalargumentexception) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/advancements/Advancement.java
+++ b/net/minecraft/advancements/Advancement.java
@@ -144,7 +_,7 @@
@@ -150,7 +_,7 @@
return this.f_138305_;
}
@ -9,8 +9,8 @@
@Nullable
private ResourceLocation f_138332_;
@Nullable
@@ -325,7 +_,14 @@
return "Task Advancement{parentId=" + this.f_138332_ + ", display=" + this.f_138334_ + ", rewards=" + this.f_138335_ + ", criteria=" + this.f_138336_ + ", requirements=" + Arrays.deepToString(this.f_138337_) + "}";
@@ -340,7 +_,14 @@
return "Task Advancement{parentId=" + this.f_138332_ + ", display=" + this.f_138334_ + ", rewards=" + this.f_138335_ + ", criteria=" + this.f_138336_ + ", requirements=" + Arrays.deepToString(this.f_138337_) + ", sends_telemetry_event=" + this.f_285655_ + "}";
}
+ /** @deprecated Forge: use {@linkplain #fromJson(JsonObject, DeserializationContext, net.minecraftforge.common.crafting.conditions.ICondition.IContext) overload with context}. */

View file

@ -4,8 +4,8 @@
public void m_9989_(ServerPlayer p_9990_) {
p_9990_.m_6756_(this.f_9979_);
- LootContext lootcontext = (new LootContext.Builder(p_9990_.m_9236_())).m_78972_(LootContextParams.f_81455_, p_9990_).m_78972_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_230911_(p_9990_.m_217043_()).m_78975_(LootContextParamSets.f_81418_);
+ LootContext lootcontext = (new LootContext.Builder(p_9990_.m_9236_())).m_78972_(LootContextParams.f_81455_, p_9990_).m_78972_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_230911_(p_9990_.m_217043_()).m_78963_(p_9990_.m_36336_()).m_78975_(LootContextParamSets.f_81418_); // FORGE: luck to LootContext
- LootParams lootparams = (new LootParams.Builder(p_9990_.m_284548_())).m_287286_(LootContextParams.f_81455_, p_9990_).m_287286_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_287235_(LootContextParamSets.f_81418_);
+ LootParams lootparams = (new LootParams.Builder(p_9990_.m_284548_())).m_287286_(LootContextParams.f_81455_, p_9990_).m_287286_(LootContextParams.f_81460_, p_9990_.m_20182_()).m_287239_(p_9990_.m_36336_()).m_287235_(LootContextParamSets.f_81418_); // Forge: Add luck to LootContext
boolean flag = false;
for(ResourceLocation resourcelocation : this.f_9980_) {

View file

@ -3,7 +3,7 @@
@@ -10,6 +_,6 @@
@DontObfuscate
public static String m_129629_() {
public static String getClientModName() {
- return "vanilla";
+ return net.minecraftforge.internal.BrandingControl.getClientBranding();
}

View file

@ -21,7 +21,7 @@
if (keymapping != null) {
keymapping.m_7249_(p_90839_);
}
@@ -96,7 +_,7 @@
@@ -105,7 +_,7 @@
}
public boolean m_90857_() {
@ -30,7 +30,7 @@
}
public String m_90858_() {
@@ -130,7 +_,13 @@
@@ -139,7 +_,13 @@
}
public int compareTo(KeyMapping p_90841_) {
@ -45,7 +45,7 @@
}
public static Supplier<Component> m_90842_(String p_90843_) {
@@ -141,6 +_,20 @@
@@ -150,6 +_,20 @@
}
public boolean m_90850_(KeyMapping p_90851_) {
@ -66,7 +66,7 @@
return this.f_90816_.equals(p_90851_.f_90816_);
}
@@ -161,11 +_,13 @@
@@ -170,11 +_,13 @@
}
public Component m_90863_() {
@ -81,7 +81,7 @@
}
public String m_90865_() {
@@ -175,4 +_,84 @@
@@ -184,4 +_,84 @@
public void m_7249_(boolean p_90846_) {
this.f_90817_ = p_90846_;
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/KeyboardHandler.java
+++ b/net/minecraft/client/KeyboardHandler.java
@@ -328,7 +_,9 @@
@@ -329,7 +_,9 @@
}
}
@ -11,7 +11,7 @@
if (this.f_90867_.f_91066_.f_92105_.m_90832_(p_90895_, p_90896_)) {
this.f_90867_.m_91268_().m_85438_();
this.f_90867_.f_91066_.m_231829_().m_231514_(this.f_90867_.m_91268_().m_85440_());
@@ -346,6 +_,8 @@
@@ -347,6 +_,8 @@
});
return;
}
@ -20,7 +20,7 @@
}
if (this.f_90867_.m_240477_().m_93316_()) {
@@ -368,11 +_,15 @@
@@ -369,11 +_,15 @@
Screen.m_96579_(() -> {
if (p_90897_ != 1 && p_90897_ != 2) {
if (p_90897_ == 0) {
@ -38,7 +38,7 @@
}
}, "keyPressed event handler", screen.getClass().getCanonicalName());
@@ -425,22 +_,26 @@
@@ -424,22 +_,26 @@
}
}
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -247,7 +_,7 @@
@@ -249,7 +_,7 @@
import org.slf4j.Logger;
@OnlyIn(Dist.CLIENT)
@ -9,15 +9,15 @@
static Minecraft f_90981_;
private static final Logger f_90982_ = LogUtils.getLogger();
public static final boolean f_91002_ = Util.m_137581_() == Util.OS.OSX;
@@ -412,7 +_,6 @@
this.f_231339_ = SignatureValidator.m_216358_(this.f_231338_.getServicesKey());
@@ -413,7 +_,6 @@
this.f_193584_ = this.m_193585_(this.f_231338_, p_91084_);
this.f_90998_ = p_91084_.f_101905_.f_101942_;
f_90982_.info("Setting user: {}", (Object)this.f_90998_.m_92546_());
- f_90982_.debug("(Session ID is {})", (Object)this.f_90998_.m_92544_());
this.f_91033_ = p_91084_.f_101908_.f_101926_;
this.f_91034_ = !p_91084_.f_101908_.f_101929_;
this.f_91035_ = !p_91084_.f_101908_.f_101930_;
@@ -462,7 +_,7 @@
@@ -450,7 +_,7 @@
this.f_90990_.m_85380_(this.f_91066_.m_232035_().m_231551_());
this.f_91067_ = new MouseHandler(this);
@ -25,8 +25,8 @@
+ // FORGE: Move mouse handler setup further below
this.f_91068_ = new KeyboardHandler(this);
this.f_91068_.m_90887_(this.f_90990_.m_85439_());
RenderSystem.m_69580_(this.f_91066_.f_92035_, false);
@@ -470,6 +_,7 @@
RenderSystem.initRenderer(this.f_91066_.f_92035_, false);
@@ -458,6 +_,7 @@
this.f_91042_.m_83931_(0.0F, 0.0F, 0.0F, 0.0F);
this.f_91042_.m_83954_(f_91002_);
this.f_91036_ = new ReloadableResourceManager(PackType.CLIENT_RESOURCES);
@ -34,7 +34,7 @@
this.f_91038_.m_10506_();
this.f_91066_.m_92145_(this.f_91038_);
this.f_91039_ = new LanguageManager(this.f_91066_.f_92075_);
@@ -514,10 +_,13 @@
@@ -504,10 +_,13 @@
this.f_91063_ = new GameRenderer(this, this.f_90994_.m_234586_(), this.f_91036_, this.f_90993_);
this.f_91036_.m_7217_(this.f_91063_.m_247116_());
this.f_91060_ = new LevelRenderer(this, this.f_90994_, this.f_167845_, this.f_90993_);
@ -45,11 +45,11 @@
+ // this.createSearchTrees();
this.f_91036_.m_7217_(this.f_90997_);
this.f_91061_ = new ParticleEngine(this.f_91073_, this.f_90987_);
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(f_91061_);
+ net.minecraftforge.client.ForgeHooksClient.onRegisterParticleProviders(this.f_91061_);
this.f_91036_.m_7217_(this.f_91061_);
this.f_91053_ = new PaintingTextureManager(this.f_90987_);
this.f_91036_.m_7217_(this.f_91053_);
@@ -526,7 +_,9 @@
@@ -516,7 +_,9 @@
this.f_91047_ = new GpuWarnlistManager();
this.f_91036_.m_7217_(this.f_91047_);
this.f_91036_.m_7217_(this.f_205120_);
@ -58,9 +58,9 @@
+ // FORGE: Moved mouse handler setup below ingame gui creation to prevent NPEs in mouse handler.
+ this.f_91067_.m_91524_(this.f_90990_.m_85439_());
this.f_91064_ = new DebugRenderer(this);
this.f_238717_ = new RealmsDataFetcher(RealmsClient.m_239151_(this));
RenderSystem.m_69900_(this::m_91113_);
@@ -545,6 +_,7 @@
RealmsClient realmsclient = RealmsClient.m_239151_(this);
this.f_238717_ = new RealmsDataFetcher(realmsclient);
@@ -536,6 +_,7 @@
TinyFileDialogs.tinyfd_messageBox("Minecraft", stringbuilder.toString(), "ok", "error", false);
}
@ -68,52 +68,51 @@
this.f_90990_.m_85409_(this.f_91066_.m_231817_().m_231551_());
this.f_90990_.m_85424_(this.f_91066_.m_232123_().m_231551_());
this.f_90990_.m_85426_();
@@ -568,26 +_,26 @@
}
@@ -562,20 +_,23 @@
this.f_167847_.m_168556_();
+ if (net.minecraftforge.client.loading.ClientModLoader.completeModLoading()) return; // Do not overwrite the error screen
+ // FORGE: Move opening initial screen to after startup and events are enabled.
+ if (s != null) {
+ ServerAddress serveraddress = new ServerAddress(s, i);
+ ConnectScreen.m_169267_(new TitleScreen(), this, serveraddress, new ServerData(I18n.m_118938_("selectServer.defaultName"), serveraddress.toString(), false));
+ } else if (this.m_239929_()) {
+ this.m_91152_(BanNoticeScreen.m_239967_((p_238185_) -> {
+ if (p_238185_) {
this.m_286052_();
+ if (net.minecraftforge.client.loading.ClientModLoader.completeModLoading())
+ return; // Do not overwrite the error screen if there are errors
+ // FORGE: Move opening initial screen to after startup and events are enabled
+ if (this.m_239929_()) {
+ this.m_91152_(BanNoticeScreen.m_239967_((p_278873_) -> {
+ if (p_278873_) {
+ Util.m_137581_().m_137646_("https://aka.ms/mcjavamoderation");
+ }
+
+ this.m_91152_(new TitleScreen(true));
+ this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
+ }, this.m_239210_()));
+ } else if (this.f_91066_.f_263744_) {
+ this.m_91152_(new AccessibilityOnboardingScreen(this.f_91066_));
+ } else {
+ this.m_91152_(new TitleScreen(true));
+ this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
+ }
});
}, false));
- if (s != null) {
- ServerAddress serveraddress = new ServerAddress(s, i);
- reloadinstance.m_7237_().thenRunAsync(() -> {
- ConnectScreen.m_169267_(new TitleScreen(), this, serveraddress, new ServerData(I18n.m_118938_("selectServer.defaultName"), serveraddress.toString(), false));
- }, this);
- } else if (this.m_239929_()) {
- this.m_91152_(BanNoticeScreen.m_239967_((p_238185_) -> {
- if (p_238185_) {
this.f_278504_ = QuickPlayLog.m_278648_(p_91084_.f_278410_.f_278493_());
- if (this.m_239929_()) {
- this.m_91152_(BanNoticeScreen.m_239967_((p_278873_) -> {
- if (p_278873_) {
- Util.m_137581_().m_137646_("https://aka.ms/mcjavamoderation");
- }
-
- this.m_91152_(new TitleScreen(true));
- this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
- }, this.m_239210_()));
- } else if (this.f_91066_.f_263744_) {
- this.m_91152_(new AccessibilityOnboardingScreen(this.f_91066_));
- } else {
- this.m_91152_(new TitleScreen(true));
- this.m_278684_(realmsclient, reloadinstance, p_91084_.f_278410_);
- }
}
@@ -639,6 +_,8 @@
@@ -611,7 +_,7 @@
private String m_91270_() {
StringBuilder stringbuilder = new StringBuilder("Minecraft");
if (m_193589_().m_184597_()) {
- stringbuilder.append("*");
+ stringbuilder.append(' ').append(net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.BRANDING_NAME).append('*');
}
stringbuilder.append(" ");
@@ -635,6 +_,8 @@
private UserApiService m_193585_(YggdrasilAuthenticationService p_193586_, GameConfig p_193587_) {
try {
@ -122,7 +121,7 @@
return p_193586_.createUserApiService(p_193587_.f_101905_.f_101942_.m_92547_());
} catch (AuthenticationException authenticationexception) {
f_90982_.error("Failed to verify authentication", (Throwable)authenticationexception);
@@ -651,7 +_,7 @@
@@ -647,7 +_,7 @@
}
private void m_91239_(Throwable p_91240_) {
@ -131,21 +130,21 @@
this.m_91241_(p_91240_, (Component)null);
} else {
Util.m_137559_(p_91240_);
@@ -743,7 +_,10 @@
@@ -739,7 +_,10 @@
}
public void m_91271_() {
- this.f_90997_.m_235232_(SearchRegistry.f_119941_, (p_231451_) -> {
- this.f_90997_.m_235232_(SearchRegistry.f_119941_, (p_231389_) -> {
+ var nameSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getNameSearchKeys();
+ var tagSearchKeys = net.minecraftforge.client.CreativeModeTabSearchRegistry.getTagSearchKeys();
+ for (var nameSearchKey : nameSearchKeys.values())
+ this.f_90997_.m_235232_(nameSearchKey, (p_231451_) -> {
+ this.f_90997_.m_235232_(nameSearchKey, (p_231389_) -> {
return new FullTextSearchTree<>((p_210797_) -> {
return p_210797_.m_41651_((Player)null, TooltipFlag.Default.f_256752_.m_257777_()).stream().map((p_210807_) -> {
return ChatFormatting.m_126649_(p_210807_.getString()).trim();
@@ -754,7 +_,8 @@
@@ -750,7 +_,8 @@
return Stream.of(BuiltInRegistries.f_257033_.m_7981_(p_91317_.m_41720_()));
}, p_231451_);
}, p_231389_);
});
- this.f_90997_.m_235232_(SearchRegistry.f_119942_, (p_231430_) -> {
+ for (var tagSearchKey : tagSearchKeys.values())
@ -153,9 +152,9 @@
return new IdSearchTree<>((p_231353_) -> {
return p_231353_.m_204131_().map(TagKey::f_203868_);
}, p_231430_);
@@ -774,9 +_,12 @@
@@ -770,9 +_,12 @@
});
}, p_231389_);
}, p_231451_);
});
- CreativeModeTabs.m_258007_().m_257882_((p_255439_) -> {
- this.m_231374_(SearchRegistry.f_119941_, p_255439_);
@ -169,7 +168,7 @@
});
}
@@ -828,13 +_,13 @@
@@ -824,13 +_,13 @@
Bootstrap.m_135875_(p_91333_.m_127526_());
if (p_91333_.m_127527_() != null) {
Bootstrap.m_135875_("#@!@# Game crashed! Crash report saved to: #@!@# " + p_91333_.m_127527_());
@ -186,7 +185,7 @@
}
}
@@ -959,10 +_,6 @@
@@ -954,10 +_,6 @@
f_90982_.error("setScreen called from non-game thread");
}
@ -197,7 +196,7 @@
if (p_91153_ == null && this.f_91073_ == null) {
p_91153_ = new TitleScreen();
} else if (p_91153_ == null && this.f_91074_.m_21224_()) {
@@ -973,6 +_,19 @@
@@ -968,6 +_,19 @@
}
}
@ -217,8 +216,8 @@
this.f_91080_ = p_91153_;
if (this.f_91080_ != null) {
this.f_91080_.m_274333_();
@@ -1118,9 +_,12 @@
RenderSystem.m_69481_();
@@ -1113,9 +_,12 @@
RenderSystem.enableCull();
this.f_91026_.m_7238_();
if (!this.f_91079_) {
+ this.realPartialTick = this.f_91012_ ? this.f_91013_ : this.f_90991_.f_92518_; // Cache this since pause is volatile
@ -230,7 +229,7 @@
}
if (this.f_91056_ != null) {
@@ -1243,10 +_,12 @@
@@ -1240,10 +_,12 @@
this.f_90990_.m_85378_((double)i);
if (this.f_91080_ != null) {
this.f_91080_.m_6574_(this, this.f_90990_.m_85445_(), this.f_90990_.m_85446_());
@ -243,7 +242,7 @@
this.f_91063_.m_109097_(this.f_90990_.m_85441_(), this.f_90990_.m_85442_());
this.f_91067_.m_91599_();
}
@@ -1520,6 +_,7 @@
@@ -1517,6 +_,7 @@
}
public void m_91395_() {
@ -251,7 +250,7 @@
this.f_91019_ = false;
}
@@ -1549,10 +_,18 @@
@@ -1546,10 +_,18 @@
if (p_91387_ && this.f_91077_ != null && this.f_91077_.m_6662_() == HitResult.Type.BLOCK) {
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
BlockPos blockpos = blockhitresult.m_82425_();
@ -273,7 +272,7 @@
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
}
}
@@ -1581,6 +_,8 @@
@@ -1578,6 +_,8 @@
return false;
} else {
boolean flag = false;
@ -282,7 +281,7 @@
switch (this.f_91077_.m_6662_()) {
case ENTITY:
this.f_91072_.m_105223_(this.f_91074_, ((EntityHitResult)this.f_91077_).m_82443_());
@@ -1588,7 +_,7 @@
@@ -1585,7 +_,7 @@
case BLOCK:
BlockHitResult blockhitresult = (BlockHitResult)this.f_91077_;
BlockPos blockpos = blockhitresult.m_82425_();
@ -291,7 +290,7 @@
this.f_91072_.m_105269_(blockpos, blockhitresult.m_82434_());
if (this.f_91073_.m_8055_(blockpos).m_60795_()) {
flag = true;
@@ -1601,8 +_,10 @@
@@ -1598,8 +_,10 @@
}
this.f_91074_.m_36334_();
@ -302,7 +301,7 @@
this.f_91074_.m_6674_(InteractionHand.MAIN_HAND);
return flag;
}
@@ -1618,6 +_,11 @@
@@ -1615,6 +_,11 @@
}
for(InteractionHand interactionhand : InteractionHand.values()) {
@ -314,7 +313,7 @@
ItemStack itemstack = this.f_91074_.m_21120_(interactionhand);
if (!itemstack.m_246617_(this.f_91073_.m_246046_())) {
return;
@@ -1638,7 +_,7 @@
@@ -1635,7 +_,7 @@
}
if (interactionresult.m_19077_()) {
@ -323,7 +322,7 @@
this.f_91074_.m_6674_(interactionhand);
}
@@ -1650,7 +_,7 @@
@@ -1647,7 +_,7 @@
int i = itemstack.m_41613_();
InteractionResult interactionresult1 = this.f_91072_.m_233732_(this.f_91074_, interactionhand, blockhitresult);
if (interactionresult1.m_19077_()) {
@ -332,7 +331,7 @@
this.f_91074_.m_6674_(interactionhand);
if (!itemstack.m_41619_() && (itemstack.m_41613_() != i || this.f_91072_.m_105290_())) {
this.f_91063_.f_109055_.m_109320_(interactionhand);
@@ -1666,6 +_,9 @@
@@ -1663,6 +_,9 @@
}
}
@ -342,7 +341,7 @@
if (!itemstack.m_41619_()) {
InteractionResult interactionresult2 = this.f_91072_.m_233721_(this.f_91074_, interactionhand);
if (interactionresult2.m_19077_()) {
@@ -1692,6 +_,8 @@
@@ -1689,6 +_,8 @@
--this.f_91011_;
}
@ -351,7 +350,7 @@
this.f_91026_.m_6180_("gui");
this.f_240378_.m_240688_();
this.f_91065_.m_193832_(this.f_91012_);
@@ -1787,6 +_,7 @@
@@ -1780,6 +_,7 @@
this.f_91005_.m_120596_();
@ -359,7 +358,7 @@
try {
this.f_91073_.m_104726_(() -> {
return true;
@@ -1802,6 +_,7 @@
@@ -1795,6 +_,7 @@
throw new ReportedException(crashreport);
}
@ -367,7 +366,7 @@
}
this.f_91026_.m_6182_("animateTick");
@@ -1821,6 +_,8 @@
@@ -1814,6 +_,8 @@
this.f_91026_.m_6182_("keyboard");
this.f_91068_.m_90931_();
this.f_91026_.m_7238_();
@ -376,15 +375,15 @@
}
private boolean m_91278_() {
@@ -2017,6 +_,7 @@
@@ -2011,6 +_,7 @@
}
public void m_91156_(ClientLevel p_91157_) {
+ if (f_91073_ != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(f_91073_));
+ if (this.f_91073_ != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.f_91073_));
ProgressScreen progressscreen = new ProgressScreen(true);
progressscreen.m_6309_(Component.m_237115_("connect.joining"));
this.m_91362_(progressscreen);
@@ -2050,10 +_,12 @@
@@ -2044,10 +_,12 @@
IntegratedServer integratedserver = this.f_91007_;
this.f_91007_ = null;
this.f_91063_.m_109150_();
@ -393,19 +392,19 @@
this.f_240365_.m_93328_();
this.m_91362_(p_91321_);
if (this.f_91073_ != null) {
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(f_91073_));
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Unload(this.f_91073_));
if (integratedserver != null) {
this.f_91026_.m_6180_("waitForServer");
@@ -2067,6 +_,7 @@
@@ -2061,6 +_,7 @@
this.f_243981_.m_246151_();
this.f_91065_.m_93089_();
this.f_91010_ = false;
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(f_91073_);
+ net.minecraftforge.client.ForgeHooksClient.handleClientLevelClosing(this.f_91073_);
}
this.f_91073_ = null;
@@ -2173,6 +_,7 @@
@@ -2167,6 +_,7 @@
private void m_91280_() {
if (this.f_91077_ != null && this.f_91077_.m_6662_() != HitResult.Type.MISS) {
@ -413,7 +412,7 @@
boolean flag = this.f_91074_.m_150110_().f_35937_;
BlockEntity blockentity = null;
HitResult.Type hitresult$type = this.f_91077_.m_6662_();
@@ -2185,10 +_,7 @@
@@ -2179,10 +_,7 @@
}
Block block = blockstate.m_60734_();
@ -425,7 +424,7 @@
if (flag && Screen.m_96637_() && blockstate.m_155947_()) {
blockentity = this.f_91073_.m_7702_(blockpos);
@@ -2199,7 +_,7 @@
@@ -2193,7 +_,7 @@
}
Entity entity = ((EntityHitResult)this.f_91077_).m_82443_();
@ -434,7 +433,7 @@
if (itemstack == null) {
return;
}
@@ -2737,6 +_,19 @@
@@ -2732,6 +_,19 @@
public void m_91312_(int p_91313_) {
this.f_91051_.m_119410_(p_91313_);
@ -450,7 +449,7 @@
+
+ private float realPartialTick;
+ public float getPartialTick() {
+ return realPartialTick;
+ return this.realPartialTick;
}
public EntityModelSet m_167973_() {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/Options.java
+++ b/net/minecraft/client/Options.java
@@ -544,7 +_,8 @@
@@ -545,7 +_,8 @@
}, new OptionInstance.LazyEnum<>(() -> {
return Stream.concat(Stream.of(""), Minecraft.m_91087_().m_91106_().m_194525_().stream()).toList();
}, (p_232011_) -> {
@ -10,7 +10,7 @@
}, Codec.STRING), "", (p_275584_) -> {
SoundManager soundmanager = Minecraft.m_91087_().m_91106_();
soundmanager.m_194526_();
@@ -868,6 +_,7 @@
@@ -869,6 +_,7 @@
}
public Options(Minecraft p_92138_, File p_92139_) {
@ -18,10 +18,11 @@
this.f_92060_ = p_92138_;
this.f_92110_ = new File(p_92139_, "options.txt");
boolean flag = p_92138_.m_91103_();
@@ -989,11 +_,20 @@
@@ -990,11 +_,21 @@
p_168428_.m_213982_("telemetryOptInExtra", this.f_260461_);
this.f_263744_ = p_168428_.m_142682_("onboardAccessibility", this.f_263744_);
+ net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.processOptions(p_168428_);
+ processOptionsForge(p_168428_);
+ }
+ // FORGE: split off to allow reloading options after mod loading is done
@ -41,7 +42,7 @@
}
}
@@ -1012,6 +_,9 @@
@@ -1013,6 +_,9 @@
}
public void m_92140_() {
@ -51,7 +52,7 @@
try {
if (!this.f_92110_.exists()) {
return;
@@ -1040,7 +_,8 @@
@@ -1041,7 +_,8 @@
}
}
@ -61,7 +62,7 @@
@Nullable
private String m_168458_(String p_168459_) {
return compoundtag1.m_128441_(p_168459_) ? compoundtag1.m_128461_(p_168459_) : null;
@@ -1203,6 +_,7 @@
@@ -1204,6 +_,7 @@
}
public void m_92172_() {
@ -69,7 +70,7 @@
if (this.f_92060_.f_91074_ != null) {
int i = 0;
@@ -1267,6 +_,23 @@
@@ -1268,6 +_,23 @@
}
p_92146_.m_10509_(set);

View file

@ -9,9 +9,11 @@
super.m_7249_(!this.m_90857_());
}
} else {
@@ -24,4 +_,5 @@
@@ -24,6 +_,7 @@
}
}
+ @Override public boolean m_90857_() { return this.f_90817_ && (isConflictContextAndModifierActive() || f_92527_.getAsBoolean()); }
}
protected void m_289748_() {
super.m_7249_(false);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/Font.java
+++ b/net/minecraft/client/gui/Font.java
@@ -33,7 +_,7 @@
@@ -31,7 +_,7 @@
import org.joml.Vector3f;
@OnlyIn(Dist.CLIENT)
@ -9,7 +9,7 @@
private static final float f_168643_ = 0.01F;
private static final Vector3f f_92712_ = new Vector3f(0.0F, 0.0F, 0.03F);
public static final int f_193827_ = 8;
@@ -260,6 +_,8 @@
@@ -202,6 +_,8 @@
public StringSplitter m_92865_() {
return this.f_92714_;
}

View file

@ -1,26 +1,24 @@
--- a/net/minecraft/client/gui/Gui.java
+++ b/net/minecraft/client/gui/Gui.java
@@ -428,6 +_,10 @@
@@ -424,6 +_,8 @@
for(MobEffectInstance mobeffectinstance : Ordering.natural().reverse().sortedCopy(collection)) {
MobEffect mobeffect = mobeffectinstance.m_19544_();
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (!renderer.isVisibleInGui(mobeffectinstance)) continue;
+ // Rebind in case previous renderHUDEffect changed texture
+ RenderSystem.m_157456_(0, AbstractContainerScreen.f_97725_);
if (mobeffectinstance.m_19575_()) {
int i = this.f_92977_;
int j = 1;
@@ -456,6 +_,7 @@
@@ -452,6 +_,7 @@
}
}
+ if (renderer.renderGuiIcon(mobeffectinstance, this, p_93029_, i, j, 0, f)) continue;
+ if (renderer.renderGuiIcon(mobeffectinstance, this, p_282812_, i, j, 0, f)) continue;
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
int i1 = j;
float f1 = f;
@@ -583,12 +_,13 @@
public void m_93069_(PoseStack p_93070_) {
@@ -574,12 +_,13 @@
public void m_280295_(GuiGraphics p_283501_) {
this.f_92986_.m_91307_().m_6180_("selectedItemName");
if (this.f_92993_ > 0 && !this.f_92994_.m_41619_()) {
- MutableComponent mutablecomponent = Component.m_237119_().m_7220_(this.f_92994_.m_41786_()).m_130940_(this.f_92994_.m_41791_().f_43022_);
@ -35,22 +33,22 @@
int j = (this.f_92977_ - i) / 2;
int k = this.f_92978_ - 59;
if (!this.f_92986_.f_91072_.m_105205_()) {
@@ -602,7 +_,13 @@
@@ -593,7 +_,13 @@
if (l > 0) {
m_93172_(p_93070_, j - 2, k - 2, j + i + 2, k + 9 + 2, this.f_92986_.f_91066_.m_92143_(0));
- this.m_93082_().m_92763_(p_93070_, mutablecomponent, (float)j, (float)k, 16777215 + (l << 24));
p_283501_.m_280509_(j - 2, k - 2, j + i + 2, k + 9 + 2, this.f_92986_.f_91066_.m_92143_(0));
- p_283501_.m_280430_(this.m_93082_(), mutablecomponent, j, k, 16777215 + (l << 24));
+ Font font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(f_92994_).getFont(f_92994_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.SELECTED_ITEM_NAME);
+ if (font == null) {
+ this.m_93082_().m_92763_(p_93070_, highlightTip, (float)j, (float)k, 16777215 + (l << 24));
+ p_283501_.m_280430_(this.m_93082_(), highlightTip, j, k, 16777215 + (l << 24));
+ } else {
+ j = (this.f_92977_ - font.m_92852_(highlightTip)) / 2;
+ font.m_92763_(p_93070_, highlightTip, (float)j, (float)k, 16777215 + (l << 24));
+ p_283501_.m_280430_(font, highlightTip, j, k, 16777215 + (l << 24));
+ }
}
}
@@ -1054,7 +_,7 @@
@@ -1037,7 +_,7 @@
ItemStack itemstack = this.f_92986_.f_91074_.m_150109_().m_36056_();
if (itemstack.m_41619_()) {
this.f_92993_ = 0;

View file

@ -0,0 +1,140 @@
--- a/net/minecraft/client/gui/GuiGraphics.java
+++ b/net/minecraft/client/gui/GuiGraphics.java
@@ -56,7 +_,7 @@
import org.joml.Vector2ic;
@OnlyIn(Dist.CLIENT)
-public class GuiGraphics {
+public class GuiGraphics implements net.minecraftforge.client.extensions.IForgeGuiGraphics {
public static final float f_289044_ = 10000.0F;
public static final float f_289038_ = -10000.0F;
private static final int f_279564_ = 2;
@@ -270,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_) {
+ return this.drawString(p_283343_, p_281896_, (float)p_283569_, (float)p_283418_, p_281560_, p_282130_);
+ }
+
+ // Forge: Add float variant for x,y coordinates
+ public int drawString(Font p_283343_, @Nullable String p_281896_, float p_283569_, float p_283418_, int p_281560_, boolean p_282130_) {
if (p_281896_ == null) {
return 0;
} else {
@@ -284,6 +_,11 @@
}
public int m_280649_(Font p_282636_, FormattedCharSequence p_281596_, int p_281586_, int p_282816_, int p_281743_, boolean p_282394_) {
+ return this.drawString(p_282636_, p_281596_, (float)p_281586_, (float)p_282816_, p_281743_, p_282394_);
+ }
+
+ // Forge: Add float variant for x,y coordinates
+ public int drawString(Font p_282636_, FormattedCharSequence p_281596_, float p_281586_, float p_282816_, int p_281743_, boolean p_282394_) {
int i = p_282636_.m_272191_(p_281596_, (float)p_281586_, (float)p_282816_, p_281743_, p_282394_, this.f_279612_.m_85850_().m_252922_(), this.f_279627_, Font.DisplayMode.NORMAL, 0, 15728880);
this.m_286081_();
return i;
@@ -477,6 +_,7 @@
crashreportcategory.m_128165_("Item Type", () -> {
return String.valueOf((Object)p_281675_.m_41720_());
});
+ crashreportcategory.m_128165_("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(p_281675_.m_41720_())));
crashreportcategory.m_128165_("Item Damage", () -> {
return String.valueOf(p_281675_.m_41773_());
});
@@ -524,18 +_,26 @@
}
this.f_279612_.m_85849_();
+ net.minecraftforge.client.ItemDecoratorHandler.of(p_283349_).render(this, p_282005_, p_283349_, p_282641_, p_282146_);
}
}
+
+ private ItemStack tooltipStack = ItemStack.f_41583_;
public void m_280153_(Font p_282308_, ItemStack p_282781_, int p_282687_, int p_282292_) {
+ 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.tooltipStack = ItemStack.f_41583_;
+ }
+
+ public void renderTooltip(Font font, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, ItemStack stack, int mouseX, int mouseY) {
+ this.tooltipStack = stack;
+ this.m_280677_(font, textComponents, tooltipComponent, mouseX, mouseY);
+ this.tooltipStack = ItemStack.f_41583_;
}
public void m_280677_(Font p_283128_, List<Component> p_282716_, Optional<TooltipComponent> p_281682_, int p_283678_, int p_281696_) {
- List<ClientTooltipComponent> list = p_282716_.stream().map(Component::m_7532_).map(ClientTooltipComponent::m_169948_).collect(Collectors.toList());
- p_281682_.ifPresent((p_282969_) -> {
- list.add(1, ClientTooltipComponent.m_169950_(p_282969_));
- });
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_282716_, p_281682_, p_283678_, m_280182_(), m_280206_(), p_283128_);
this.m_280497_(p_283128_, list, p_283678_, p_281696_, DefaultTooltipPositioner.f_262752_);
}
@@ -544,7 +_,15 @@
}
public void m_280666_(Font p_282739_, List<Component> p_281832_, int p_282191_, int p_282446_) {
- this.m_280245_(p_282739_, Lists.transform(p_281832_, Component::m_7532_), p_282191_, p_282446_);
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_281832_, p_282191_, m_280182_(), m_280206_(), p_282739_);
+ this.m_280497_(p_282739_, components, p_282191_, p_282446_, DefaultTooltipPositioner.f_262752_);
+ }
+
+ public void renderComponentTooltip(Font font, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, ItemStack stack) {
+ this.tooltipStack = stack;
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, m_280182_(), m_280206_(), font);
+ this.m_280497_(font, components, mouseX, mouseY, DefaultTooltipPositioner.f_262752_);
+ this.tooltipStack = ItemStack.f_41583_;
}
public void m_280245_(Font p_282192_, List<? extends FormattedCharSequence> p_282297_, int p_281680_, int p_283325_) {
@@ -557,11 +_,13 @@
private void m_280497_(Font p_282675_, List<ClientTooltipComponent> p_282615_, int p_283230_, int p_283417_, ClientTooltipPositioner p_282442_) {
if (!p_282615_.isEmpty()) {
+ net.minecraftforge.client.event.RenderTooltipEvent.Pre preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(this.tooltipStack, this, p_283230_, p_283417_, m_280182_(), m_280206_(), p_282615_, p_282675_, p_282442_);
+ if (preEvent.isCanceled()) return;
int i = 0;
int j = p_282615_.size() == 1 ? -2 : 0;
for(ClientTooltipComponent clienttooltipcomponent : p_282615_) {
- int k = clienttooltipcomponent.m_142069_(p_282675_);
+ int k = clienttooltipcomponent.m_142069_(preEvent.getFont());
if (k > i) {
i = k;
}
@@ -571,20 +_,21 @@
int i2 = i;
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_.m_262814_(this.m_280182_(), this.m_280206_(), preEvent.getX(), preEvent.getY(), i2, j2);
int l = vector2ic.x();
int i1 = vector2ic.y();
this.f_279612_.m_85836_();
int j1 = 400;
this.m_286007_(() -> {
- TooltipRenderUtil.m_280205_(this, l, i1, i2, j2, 400);
+ net.minecraftforge.client.event.RenderTooltipEvent.Color colorEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipColor(this.tooltipStack, this, l, i1, preEvent.getFont(), p_282615_);
+ TooltipRenderUtil.renderTooltipBackground(this, l, i1, i2, j2, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd(), colorEvent.getBorderStart(), colorEvent.getBorderEnd());
});
this.f_279612_.m_252880_(0.0F, 0.0F, 400.0F);
int k1 = i1;
for(int l1 = 0; l1 < p_282615_.size(); ++l1) {
ClientTooltipComponent clienttooltipcomponent1 = p_282615_.get(l1);
- clienttooltipcomponent1.m_142440_(p_282675_, l, k1, this.f_279612_.m_85850_().m_252922_(), this.f_279627_);
+ clienttooltipcomponent1.m_142440_(preEvent.getFont(), l, k1, this.f_279612_.m_85850_().m_252922_(), this.f_279627_);
k1 += clienttooltipcomponent1.m_142103_() + (l1 == 0 ? 2 : 0);
}
@@ -592,7 +_,7 @@
for(int k2 = 0; k2 < p_282615_.size(); ++k2) {
ClientTooltipComponent clienttooltipcomponent2 = p_282615_.get(k2);
- clienttooltipcomponent2.m_183452_(p_282675_, l, k1, this);
+ clienttooltipcomponent2.m_183452_(preEvent.getFont(), l, k1, this);
k1 += clienttooltipcomponent2.m_142103_() + (k2 == 0 ? 2 : 0);
}

View file

@ -1,11 +1,11 @@
--- a/net/minecraft/client/gui/components/AbstractButton.java
+++ b/net/minecraft/client/gui/components/AbstractButton.java
@@ -32,7 +_,7 @@
RenderSystem.m_69482_();
m_275833_(p_275468_, this.m_252754_(), this.m_252907_(), this.m_5711_(), this.m_93694_(), 20, 4, 200, 20, 0, this.m_274533_());
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.enableDepthTest();
p_281670_.m_280027_(f_93617_, this.m_252754_(), this.m_252907_(), this.m_5711_(), this.m_93694_(), 20, 4, 200, 20, 0, this.m_274533_());
p_281670_.m_280246_(1.0F, 1.0F, 1.0F, 1.0F);
- int i = this.f_93623_ ? 16777215 : 10526880;
+ int i = getFGColor();
this.m_274375_(p_275468_, minecraft.f_91062_, i | Mth.m_14167_(this.f_93625_ * 255.0F) << 24);
this.m_280139_(p_281670_, minecraft.f_91062_, i | Mth.m_14167_(this.f_93625_ * 255.0F) << 24);
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/components/AbstractSelectionList.java
+++ b/net/minecraft/client/gui/components/AbstractSelectionList.java
@@ -515,6 +_,13 @@
@@ -514,6 +_,13 @@
return new ScreenRectangle(this.f_93393_, this.f_93390_, this.f_93392_ - this.f_93393_, this.f_93391_ - this.f_93390_);
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/components/AbstractWidget.java
+++ b/net/minecraft/client/gui/components/AbstractWidget.java
@@ -231,6 +_,10 @@
@@ -234,6 +_,10 @@
this.f_93618_ = p_93675_;
}
@ -11,7 +11,7 @@
public void m_93650_(float p_93651_) {
this.f_93625_ = p_93651_;
}
@@ -261,6 +_,19 @@
@@ -264,6 +_,19 @@
public void m_93692_(boolean p_93693_) {
this.f_93616_ = p_93693_;

View file

@ -1,21 +1,20 @@
--- a/net/minecraft/client/gui/components/BossHealthOverlay.java
+++ b/net/minecraft/client/gui/components/BossHealthOverlay.java
@@ -34,6 +_,8 @@
@@ -33,13 +_,16 @@
for(LerpingBossEvent lerpingbossevent : this.f_93699_.values()) {
int k = i / 2 - 91;
+ var event = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(p_93705_, this.f_93698_.m_91268_(), lerpingbossevent, k, j, 10 + this.f_93698_.f_91062_.f_92710_);
+ var event = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(p_283175_, this.f_93698_.m_91268_(), lerpingbossevent, k, j, 10 + this.f_93698_.f_91062_.f_92710_);
+ if (!event.isCanceled()) {
RenderSystem.m_157456_(0, f_93697_);
this.m_93706_(p_93705_, k, j, lerpingbossevent);
this.m_280106_(p_283175_, k, j, lerpingbossevent);
Component component = lerpingbossevent.m_18861_();
@@ -41,7 +_,8 @@
int l = this.f_93698_.f_91062_.m_92852_(component);
int i1 = i / 2 - l / 2;
int j1 = j - 9;
this.f_93698_.f_91062_.m_92763_(p_93705_, component, (float)i1, (float)j1, 16777215);
p_283175_.m_280430_(this.f_93698_.f_91062_, component, i1, j1, 16777215);
- j += 10 + 9;
+ }
+ j += event.getIncrement();
if (j >= this.f_93698_.m_91268_().m_85446_() / 3) {
if (j >= p_283175_.m_280206_() / 3) {
break;
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/components/DebugScreenOverlay.java
+++ b/net/minecraft/client/gui/components/DebugScreenOverlay.java
@@ -409,6 +_,7 @@
@@ -403,6 +_,7 @@
list.add("");
list.add(ChatFormatting.UNDERLINE + "Targeted Entity");
list.add(String.valueOf((Object)BuiltInRegistries.f_256780_.m_7981_(entity.m_6095_())));

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/components/toasts/ToastComponent.java
+++ b/net/minecraft/client/gui/components/toasts/ToastComponent.java
@@ -102,6 +_,7 @@
@@ -101,6 +_,7 @@
}
public void m_94922_(Toast p_94923_) {

View file

@ -1,14 +1,14 @@
--- a/net/minecraft/client/gui/screens/LoadingOverlay.java
+++ b/net/minecraft/client/gui/screens/LoadingOverlay.java
@@ -119,6 +_,7 @@
int k1 = (int)((double)this.f_96163_.m_91268_().m_85446_() * 0.8325D);
@@ -123,6 +_,7 @@
int k1 = (int)((double)p_281839_.m_280206_() * 0.8325D);
float f6 = this.f_96164_.m_7750_();
this.f_96167_ = Mth.m_14036_(this.f_96167_ * 0.95F + f6 * 0.050000012F, 0.0F, 1.0F);
+ net.minecraftforge.client.loading.ClientModLoader.renderProgressText();
if (f < 1.0F) {
this.m_96182_(p_96178_, i / 2 - j1, k1 - 5, i / 2 + j1, k1 + 5, 1.0F - Mth.m_14036_(f, 0.0F, 1.0F));
this.m_96182_(p_281839_, i / 2 - j1, k1 - 5, i / 2 + j1, k1 + 5, 1.0F - Mth.m_14036_(f, 0.0F, 1.0F));
}
@@ -128,6 +_,7 @@
@@ -132,6 +_,7 @@
}
if (this.f_96168_ == -1L && this.f_96164_.m_7746_() && (!this.f_96166_ || f1 >= 2.0F)) {
@ -16,11 +16,11 @@
try {
this.f_96164_.m_7748_();
this.f_96165_.accept(Optional.empty());
@@ -135,7 +_,6 @@
@@ -139,7 +_,6 @@
this.f_96165_.accept(Optional.of(throwable));
}
- this.f_96168_ = Util.m_137550_();
if (this.f_96163_.f_91080_ != null) {
this.f_96163_.f_91080_.m_6575_(this.f_96163_, this.f_96163_.m_91268_().m_85445_(), this.f_96163_.m_91268_().m_85446_());
this.f_96163_.f_91080_.m_6575_(this.f_96163_, p_281839_.m_280182_(), p_281839_.m_280206_());
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/MenuScreens.java
+++ b/net/minecraft/client/gui/screens/MenuScreens.java
@@ -41,6 +_,10 @@
@@ -40,6 +_,10 @@
private static final Map<MenuType<?>, MenuScreens.ScreenConstructor<?, ?>> f_96196_ = Maps.newHashMap();
public static <T extends AbstractContainerMenu> void m_96201_(@Nullable MenuType<T> p_96202_, Minecraft p_96203_, int p_96204_, Component p_96205_) {
@ -11,7 +11,7 @@
if (p_96202_ == null) {
f_96195_.warn("Trying to open invalid screen with name: {}", (Object)p_96205_.getString());
} else {
@@ -48,9 +_,10 @@
@@ -47,9 +_,10 @@
if (screenconstructor == null) {
f_96195_.warn("Failed to create screen for menu type: {}", (Object)BuiltInRegistries.f_256818_.m_7981_(p_96202_));
} else {

View file

@ -1,7 +1,7 @@
--- a/net/minecraft/client/gui/screens/OptionsScreen.java
+++ b/net/minecraft/client/gui/screens/OptionsScreen.java
@@ -151,6 +_,14 @@
super.m_86412_(p_96249_, p_96250_, p_96251_, p_96252_);
super.m_88315_(p_283520_, p_281826_, p_283378_, p_281975_);
}
+ @Override
@ -13,5 +13,5 @@
+ }
+
private Button m_260993_(Component p_261565_, Supplier<Screen> p_262119_) {
return Button.m_253074_(p_261565_, (p_261361_) -> {
return Button.m_253074_(p_261565_, (p_280808_) -> {
this.f_96541_.m_91152_(p_262119_.get());

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/Screen.java
+++ b/net/minecraft/client/gui/screens/Screen.java
@@ -214,7 +_,7 @@
@@ -205,7 +_,7 @@
}
public void m_7379_() {
@ -9,132 +9,7 @@
}
protected <T extends GuiEventListener & Renderable & NarratableEntry> T m_142416_(T p_169406_) {
@@ -251,15 +_,29 @@
this.f_169368_.clear();
}
+ private Font tooltipFont = null;
+ private ItemStack tooltipStack = ItemStack.f_41583_;
protected void m_6057_(PoseStack p_96566_, ItemStack p_96567_, int p_96568_, int p_96569_) {
+ tooltipStack = p_96567_;
this.m_169388_(p_96566_, this.m_96555_(p_96567_), p_96567_.m_150921_(), p_96568_, p_96569_);
+ tooltipStack = ItemStack.f_41583_;
}
+ public void renderTooltip(PoseStack poseStack, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, int x, int y, ItemStack stack) {
+ this.renderTooltip(poseStack, textComponents, tooltipComponent, x, y, null, stack);
+ }
+ public void renderTooltip(PoseStack poseStack, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, int x, int y, @Nullable Font font) {
+ this.renderTooltip(poseStack, textComponents, tooltipComponent, x, y, font, ItemStack.f_41583_);
+ }
+ public void renderTooltip(PoseStack poseStack, List<Component> textComponents, Optional<TooltipComponent> tooltipComponent, int x, int y, @Nullable Font font, ItemStack stack) {
+ this.tooltipFont = font;
+ this.tooltipStack = stack;
+ this.m_169388_(poseStack, textComponents, tooltipComponent, x, y);
+ this.tooltipFont = null;
+ this.tooltipStack = ItemStack.f_41583_;
+ }
public void m_169388_(PoseStack p_169389_, List<Component> p_169390_, Optional<TooltipComponent> p_169391_, int p_169392_, int p_169393_) {
- List<ClientTooltipComponent> list = p_169390_.stream().map(Component::m_7532_).map(ClientTooltipComponent::m_169948_).collect(Collectors.toList());
- p_169391_.ifPresent((p_169399_) -> {
- list.add(1, ClientTooltipComponent.m_169950_(p_169399_));
- });
+ List<ClientTooltipComponent> list = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_169390_, p_169391_, p_169392_, f_96543_, f_96544_, this.tooltipFont, this.f_96547_);
this.m_262809_(p_169389_, list, p_169392_, p_169393_, DefaultTooltipPositioner.f_262752_);
}
@@ -272,24 +_,48 @@
}
public void m_96597_(PoseStack p_96598_, List<Component> p_96599_, int p_96600_, int p_96601_) {
- this.m_96617_(p_96598_, Lists.transform(p_96599_, Component::m_7532_), p_96600_, p_96601_);
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(this.tooltipStack, p_96599_, p_96600_, f_96543_, f_96544_, this.tooltipFont, this.f_96547_);
+ this.m_262809_(p_96598_, components, p_96600_, p_96601_, DefaultTooltipPositioner.f_262752_);
+ }
+ public void renderComponentTooltip(PoseStack poseStack, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, ItemStack stack) {
+ this.renderComponentTooltip(poseStack, tooltips, mouseX, mouseY, null, stack);
+ }
+ public void renderComponentTooltip(PoseStack poseStack, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, @Nullable Font font) {
+ this.renderComponentTooltip(poseStack, tooltips, mouseX, mouseY, font, ItemStack.f_41583_);
+ }
+
+ public void renderComponentTooltip(PoseStack poseStack, List<? extends net.minecraft.network.chat.FormattedText> tooltips, int mouseX, int mouseY, @Nullable Font font, ItemStack stack) {
+ this.tooltipFont = font;
+ this.tooltipStack = stack;
+ List<ClientTooltipComponent> components = net.minecraftforge.client.ForgeHooksClient.gatherTooltipComponents(stack, tooltips, mouseX, f_96543_, f_96544_, this.tooltipFont, this.f_96547_);
+ this.m_262809_(poseStack, components, mouseX, mouseY, DefaultTooltipPositioner.f_262752_);
+ this.tooltipFont = null;
+ this.tooltipStack = ItemStack.f_41583_;
}
public void m_96617_(PoseStack p_96618_, List<? extends FormattedCharSequence> p_96619_, int p_96620_, int p_96621_) {
this.m_262809_(p_96618_, p_96619_.stream().map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()), p_96620_, p_96621_, DefaultTooltipPositioner.f_262752_);
}
+ public void renderTooltip(PoseStack poseStack, List<? extends FormattedCharSequence> lines, int x, int y, Font font) {
+ this.tooltipFont = font;
+ this.m_96617_(poseStack, lines, x, y);
+ this.tooltipFont = null;
+ }
+
private void m_262835_(PoseStack p_263080_, Screen.DeferredTooltipRendering p_262968_, int p_263034_, int p_263076_) {
this.m_262809_(p_263080_, p_262968_.f_262736_().stream().map(ClientTooltipComponent::m_169948_).collect(Collectors.toList()), p_263034_, p_263076_, p_262968_.f_262758_());
}
private void m_262809_(PoseStack p_263064_, List<ClientTooltipComponent> p_262990_, int p_263065_, int p_262996_, ClientTooltipPositioner p_262920_) {
if (!p_262990_.isEmpty()) {
+ net.minecraftforge.client.event.RenderTooltipEvent.Pre preEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipPre(this.tooltipStack, p_263064_, p_263065_, p_262996_, f_96543_, f_96544_, p_262990_, this.tooltipFont, this.f_96547_);
+ if (preEvent.isCanceled()) return;
int i = 0;
int j = p_262990_.size() == 1 ? -2 : 0;
for(ClientTooltipComponent clienttooltipcomponent : p_262990_) {
- int k = clienttooltipcomponent.m_142069_(this.f_96547_);
+ int k = clienttooltipcomponent.m_142069_(preEvent.getFont());
if (k > i) {
i = k;
}
@@ -297,7 +_,7 @@
j += clienttooltipcomponent.m_142103_();
}
- Vector2ic vector2ic = p_262920_.m_262814_(this, p_263065_, p_262996_, i, j);
+ Vector2ic vector2ic = p_262920_.m_262814_(this, preEvent.getX(), preEvent.getY(), i, j);
int l = vector2ic.x();
int i1 = vector2ic.y();
p_263064_.m_85836_();
@@ -307,9 +_,10 @@
RenderSystem.m_157427_(GameRenderer::m_172811_);
bufferbuilder.m_166779_(VertexFormat.Mode.QUADS, DefaultVertexFormat.f_85815_);
Matrix4f matrix4f = p_263064_.m_85850_().m_252922_();
- TooltipRenderUtil.m_262796_((p_262872_, p_262873_, p_262874_, p_262875_, p_262876_, p_262877_, p_262878_, p_262879_, p_262880_) -> {
+ net.minecraftforge.client.event.RenderTooltipEvent.Color colorEvent = net.minecraftforge.client.ForgeHooksClient.onRenderTooltipColor(this.tooltipStack, p_263064_, l, i1, preEvent.getFont(), p_262990_);
+ TooltipRenderUtil.renderTooltipBackground((p_262872_, p_262873_, p_262874_, p_262875_, p_262876_, p_262877_, p_262878_, p_262879_, p_262880_) -> {
GuiComponent.m_93123_(p_262872_, p_262873_, p_262874_, p_262875_, p_262876_, p_262877_, p_262878_, p_262879_, p_262880_);
- }, matrix4f, bufferbuilder, l, i1, i, j, 400);
+ }, matrix4f, bufferbuilder, l, i1, i, j, 400, colorEvent.getBackgroundStart(), colorEvent.getBackgroundEnd(), colorEvent.getBorderStart(), colorEvent.getBorderEnd());
RenderSystem.m_69482_();
RenderSystem.m_69478_();
RenderSystem.m_69453_();
@@ -320,7 +_,7 @@
for(int l1 = 0; l1 < p_262990_.size(); ++l1) {
ClientTooltipComponent clienttooltipcomponent1 = p_262990_.get(l1);
- clienttooltipcomponent1.m_142440_(this.f_96547_, l, k1, matrix4f, multibuffersource$buffersource);
+ clienttooltipcomponent1.m_142440_(preEvent.getFont(), l, k1, matrix4f, multibuffersource$buffersource);
k1 += clienttooltipcomponent1.m_142103_() + (l1 == 0 ? 2 : 0);
}
@@ -329,7 +_,7 @@
for(int i2 = 0; i2 < p_262990_.size(); ++i2) {
ClientTooltipComponent clienttooltipcomponent2 = p_262990_.get(i2);
- clienttooltipcomponent2.m_183452_(this.f_96547_, l, k1, p_263064_, this.f_96542_);
+ clienttooltipcomponent2.m_183452_(preEvent.getFont(), l, k1, p_263064_, this.f_96542_);
k1 += clienttooltipcomponent2.m_142103_() + (i2 == 0 ? 2 : 0);
}
@@ -432,7 +_,10 @@
@@ -317,7 +_,10 @@
this.f_96543_ = p_96608_;
this.f_96544_ = p_96609_;
if (!this.f_267454_) {
@ -145,7 +20,7 @@
} else {
this.m_267719_();
}
@@ -445,7 +_,10 @@
@@ -330,7 +_,10 @@
protected void m_232761_() {
this.m_169413_();
this.m_264131_();
@ -156,23 +31,23 @@
}
public List<? extends GuiEventListener> m_6702_() {
@@ -467,6 +_,7 @@
public void m_7333_(PoseStack p_96557_) {
@@ -352,6 +_,7 @@
public void m_280273_(GuiGraphics p_283688_) {
if (this.f_96541_.f_91073_ != null) {
m_93179_(p_96557_, 0, 0, this.f_96543_, this.f_96544_, -1072689136, -804253680);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, p_96557_));
p_283688_.m_280024_(0, 0, this.f_96543_, this.f_96544_, -1072689136, -804253680);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, p_283688_));
} else {
this.m_264065_(p_96557_);
this.m_280039_(p_283688_);
}
@@ -479,6 +_,7 @@
@@ -363,6 +_,7 @@
int i = 32;
m_93143_(p_265092_, 0, 0, 0, 0.0F, 0.0F, this.f_96543_, this.f_96544_, 32, 32);
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ScreenEvent.BackgroundRendered(this, p_265092_));
p_282281_.m_280398_(f_279548_, 0, 0, 0, 0.0F, 0.0F, this.f_96543_, this.f_96544_, 32, 32);
p_282281_.m_280246_(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_));
}
public boolean m_7043_() {
@@ -572,6 +_,10 @@
@@ -456,6 +_,10 @@
public void m_7400_(List<Path> p_96591_) {
}
@ -183,7 +58,7 @@
private void m_169380_(long p_169381_, boolean p_169382_) {
this.f_169377_ = Util.m_137550_() + p_169381_;
if (p_169382_) {
@@ -733,5 +_,13 @@
@@ -622,5 +_,13 @@
this.f_169421_ = p_169425_;
this.f_169422_ = p_169426_;
}

View file

@ -22,7 +22,7 @@
}
+ modUpdateNotification = net.minecraftforge.client.gui.TitleScreenModUpdateIndicator.init(this, modButton);
this.m_142416_(new ImageButton(this.f_96543_ / 2 - 124, l + 72 + 12, 20, 20, 0, 106, 20, Button.f_93617_, 256, 256, (p_96791_) -> {
this.m_142416_(new ImageButton(this.f_96543_ / 2 - 124, l + 72 + 12, 20, 20, 0, 106, 20, Button.f_93617_, 256, 256, (p_280830_) -> {
this.f_96541_.m_91152_(new LanguageSelectScreen(this, this.f_96541_.f_91066_, this.f_96541_.m_91102_()));
@@ -162,7 +_,7 @@
}).m_252987_(this.f_96543_ / 2 - 100, p_96764_ + p_96765_ * 1, 200, 20).m_257505_(tooltip).m_253136_())).f_93623_ = flag;
@ -33,35 +33,35 @@
}
@Nullable
@@ -245,6 +_,7 @@
this.f_232768_.m_232790_(p_96739_, i);
@@ -244,6 +_,7 @@
this.f_232768_.m_280409_(p_282860_, i);
}
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_96739_, this.f_96547_, this.f_96543_, this.f_96544_, i);
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, p_282860_, this.f_96547_, this.f_96543_, this.f_96544_, i);
if (this.f_96721_ != null) {
p_96739_.m_85836_();
p_96739_.m_252880_((float)(this.f_96543_ / 2 + 90), 70.0F, 0.0F);
@@ -267,7 +_,14 @@
this.f_96721_.m_280672_(p_282860_, this.f_96543_, this.f_96547_, i);
}
@@ -259,7 +_,14 @@
s = s + I18n.m_118938_("menu.modded");
}
- m_93236_(p_96739_, this.f_96547_, s, 2, this.f_96544_ - 10, 16777215 | i);
- p_282860_.m_280488_(this.f_96547_, s, 2, this.f_96544_ - 10, 16777215 | i);
+ net.minecraftforge.internal.BrandingControl.forEachLine(true, true, (brdline, brd) ->
+ m_93236_(p_96739_, this.f_96547_, brd, 2, this.f_96544_ - ( 10 + brdline * (this.f_96547_.f_92710_ + 1)), 16777215 | i)
+ p_282860_.m_280488_(this.f_96547_, brd, 2, this.f_96544_ - ( 10 + brdline * (this.f_96547_.f_92710_ + 1)), 16777215 | i)
+ );
+
+ net.minecraftforge.internal.BrandingControl.forEachAboveCopyrightLine((brdline, brd) ->
+ m_93236_(p_96739_, this.f_96547_, brd, this.f_96543_ - f_96547_.m_92895_(brd), this.f_96544_ - (10 + (brdline + 1) * ( this.f_96547_.f_92710_ + 1)), 16777215 | i)
+ 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)
+ );
+
for(GuiEventListener guieventlistener : this.m_6702_()) {
if (guieventlistener instanceof AbstractWidget) {
@@ -280,6 +_,7 @@
RenderSystem.m_69482_();
this.f_96726_.m_86412_(p_96739_, p_96740_, p_96741_, p_96742_);
@@ -272,6 +_,7 @@
RenderSystem.enableDepthTest();
this.f_96726_.m_88315_(p_282860_, p_281753_, p_283539_, p_282628_);
}
+ if (f1 >= 1.0f) modUpdateNotification.m_86412_(p_96739_, p_96740_, p_96741_, p_96742_);
+ if (f1 >= 1.0f) modUpdateNotification.m_88315_(p_282860_, p_281753_, p_283539_, p_282628_);
}
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTab.java
@@ -38,6 +_,7 @@
@@ -36,6 +_,7 @@
private int f_97141_ = Integer.MIN_VALUE;
private float f_97142_;
private boolean f_97143_;
@ -8,7 +8,7 @@
public AdvancementTab(Minecraft p_97145_, AdvancementsScreen p_97146_, AdvancementTabType p_97147_, int p_97148_, Advancement p_97149_, DisplayInfo p_97150_) {
this.f_97126_ = p_97145_;
@@ -52,6 +_,15 @@
@@ -50,6 +_,15 @@
this.m_97175_(this.f_97134_, p_97149_);
}
@ -24,7 +24,7 @@
public AdvancementTabType m_169538_() {
return this.f_97128_;
}
@@ -151,8 +_,8 @@
@@ -143,8 +_,8 @@
return null;
} else {
for(AdvancementTabType advancementtabtype : AdvancementTabType.values()) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java
+++ b/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java
@@ -14,6 +_,7 @@
@@ -12,6 +_,7 @@
LEFT(0, 64, 32, 28, 5),
RIGHT(96, 64, 32, 28, 5);

View file

@ -37,34 +37,34 @@
@@ -98,6 +_,11 @@
int i = (this.f_96543_ - 252) / 2;
int j = (this.f_96544_ - 140) / 2;
this.m_7333_(p_97361_);
this.m_280273_(p_282589_);
+ if (maxPages != 0) {
+ net.minecraft.network.chat.Component page = Component.m_237113_(String.format("%d / %d", tabPage + 1, maxPages + 1));
+ int width = this.f_96547_.m_92852_(page);
+ this.f_96547_.m_92744_(p_97361_, page.m_7532_(), i + (252 / 2) - (width / 2), j - 44, -1);
+ p_282589_.m_280648_(this.f_96547_, page.m_7532_(), i + (252 / 2) - (width / 2), j - 44, -1);
+ }
this.m_97373_(p_97361_, p_97362_, p_97363_, i, j);
this.m_97356_(p_97361_, i, j);
this.m_97381_(p_97361_, p_97362_, p_97363_, i, j);
@@ -138,10 +_,12 @@
RenderSystem.m_157456_(0, f_97330_);
this.m_97373_(p_282589_, p_282255_, p_283354_, i, j);
this.m_280088_(p_282589_, i, j);
this.m_280355_(p_282589_, p_282255_, p_283354_, i, j);
@@ -135,10 +_,12 @@
p_283395_.m_280218_(f_97329_, p_281890_, p_282532_, 0, 0, 252, 140);
if (this.f_97335_.size() > 1) {
for(AdvancementTab advancementtab : this.f_97335_.values()) {
+ if (advancementtab.getPage() == tabPage)
advancementtab.m_97165_(p_97357_, p_97358_, p_97359_, advancementtab == this.f_97336_);
advancementtab.m_280105_(p_283395_, p_281890_, p_282532_, advancementtab == this.f_97336_);
}
for(AdvancementTab advancementtab1 : this.f_97335_.values()) {
+ if (advancementtab1.getPage() == tabPage)
advancementtab1.m_274613_(p_97357_, p_97358_, p_97359_, this.f_96542_);
advancementtab1.m_280485_(p_283395_, p_281890_, p_282532_);
}
}
@@ -161,7 +_,7 @@
@@ -158,7 +_,7 @@
if (this.f_97335_.size() > 1) {
for(AdvancementTab advancementtab : this.f_97335_.values()) {
- if (advancementtab.m_97154_(p_97385_, p_97386_, (double)p_97383_, (double)p_97384_)) {
+ if (advancementtab.getPage() == tabPage && advancementtab.m_97154_(p_97385_, p_97386_, (double)p_97383_, (double)p_97384_)) {
this.m_96602_(p_97382_, advancementtab.m_97189_(), p_97383_, p_97384_);
- if (advancementtab.m_97154_(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_)) {
p_282784_.m_280557_(this.f_96547_, advancementtab.m_97189_(), p_283556_, p_282458_);
}
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/controls/KeyBindsList.java
+++ b/net/minecraft/client/gui/screens/controls/KeyBindsList.java
@@ -65,7 +_,7 @@
@@ -64,7 +_,7 @@
}
protected int m_5756_() {
@ -9,7 +9,7 @@
}
public int m_5759_() {
@@ -130,10 +_,11 @@
@@ -129,10 +_,11 @@
this.f_193912_ = Button.m_253074_(p_193917_, (p_269618_) -> {
KeyBindsList.this.f_193858_.f_193975_ = p_193916_;
KeyBindsList.this.m_269130_();
@ -22,16 +22,16 @@
KeyBindsList.this.f_93386_.f_91066_.m_92159_(p_193916_, p_193916_.m_90861_());
KeyBindsList.this.m_269130_();
}).m_252987_(0, 0, 50, 20).m_252778_((p_253313_) -> {
@@ -145,7 +_,7 @@
public void m_6311_(PoseStack p_193923_, int p_193924_, int p_193925_, int p_193926_, int p_193927_, int p_193928_, int p_193929_, int p_193930_, boolean p_193931_, float p_193932_) {
float f = (float)(p_193926_ + 90 - KeyBindsList.this.f_193859_);
KeyBindsList.this.f_93386_.f_91062_.m_92889_(p_193923_, this.f_193911_, f, (float)(p_193925_ + p_193928_ / 2 - 9 / 2), 16777215);
- this.f_193913_.m_252865_(p_193926_ + 190);
+ this.f_193913_.m_252865_(p_193926_ + 190 + 20);
this.f_193913_.m_253211_(p_193925_);
this.f_193913_.m_86412_(p_193923_, p_193929_, p_193930_, p_193932_);
this.f_193912_.m_252865_(p_193926_ + 105);
@@ -174,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_) {
int k = p_281373_ + 90 - KeyBindsList.this.f_193859_;
p_281805_.m_280614_(KeyBindsList.this.f_93386_.f_91062_, this.f_193911_, k, p_282357_ + p_281932_ / 2 - 9 / 2, 16777215, false);
- this.f_193913_.m_252865_(p_281373_ + 190);
+ this.f_193913_.m_252865_(p_281373_ + 190 + 20);
this.f_193913_.m_253211_(p_282357_);
this.f_193913_.m_88315_(p_281805_, p_282224_, p_282053_, p_281432_);
this.f_193912_.m_252865_(p_281373_ + 105);
@@ -173,7 +_,7 @@
MutableComponent mutablecomponent = Component.m_237119_();
if (!this.f_193910_.m_90862_()) {
for(KeyMapping keymapping : KeyBindsList.this.f_93386_.f_91066_.f_92059_) {

View file

@ -1,53 +1,51 @@
--- a/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java
@@ -88,6 +_,7 @@
@@ -90,6 +_,7 @@
int i = this.f_97735_;
int j = this.f_97736_;
this.m_7286_(p_97795_, p_97798_, p_97796_, p_97797_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.Render.Background(this, p_97795_, p_97796_, p_97797_));
RenderSystem.m_69465_();
super.m_86412_(p_97795_, p_97796_, p_97797_, p_97798_);
p_97795_.m_85836_();
@@ -104,11 +_,12 @@
this.f_97734_ = slot;
this.m_7286_(p_283479_, p_281886_, 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();
super.m_88315_(p_283479_, p_283661_, p_281248_, p_281886_);
p_283479_.m_280168_().m_85836_();
@@ -107,12 +_,13 @@
int l = slot.f_40220_;
int i1 = slot.f_40221_;
- m_169606_(p_97795_, l, i1, 0);
+ renderSlotHighlight(p_97795_, l, i1, 0, this.getSlotColor(k));
if (this.f_97734_.m_280329_()) {
- m_280359_(p_283479_, l, i1, 0);
+ renderSlotHighlight(p_283479_, l, i1, 0, getSlotColor(k));
}
}
}
this.m_7027_(p_97795_, p_97796_, p_97797_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.ContainerScreenEvent.Render.Foreground(this, p_97795_, p_97796_, p_97797_));
this.m_280003_(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_;
if (!itemstack.m_41619_()) {
int l1 = 8;
@@ -147,9 +_,13 @@
@@ -149,7 +_,10 @@
}
public static void m_169606_(PoseStack p_169607_, int p_169608_, int p_169609_, int p_169610_) {
+ renderSlotHighlight(p_169607_, p_169608_, p_169609_, p_169610_, -2130706433);
public static void m_280359_(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_);
+ renderSlotHighlight(p_283692_, p_281453_, p_281915_, p_283504_, -2130706433);
+ }
+
+ public static void renderSlotHighlight(PoseStack p_169607_, int p_169608_, int p_169609_, int p_169610_, int slotColor) {
RenderSystem.m_69465_();
RenderSystem.m_69444_(true, true, true, false);
- m_168740_(p_169607_, p_169608_, p_169609_, p_169608_ + 16, p_169609_ + 16, -2130706433, -2130706433, p_169610_);
+ m_168740_(p_169607_, p_169608_, p_169609_, p_169608_ + 16, p_169609_ + 16, slotColor, slotColor, p_169610_);
RenderSystem.m_69444_(true, true, true, true);
RenderSystem.m_69482_();
}
@@ -165,7 +_,8 @@
p_275498_.m_85836_();
p_275498_.m_252880_(0.0F, 0.0F, 232.0F);
this.f_96542_.m_274369_(p_275498_, p_275341_, p_275289_, p_275690_);
- this.f_96542_.m_274364_(p_275498_, this.f_96547_, p_275341_, p_275289_, p_275690_ - (this.f_97711_.m_41619_() ? 0 : 8), p_275201_);
+ var font = net.minecraftforge.client.extensions.common.IClientItemExtensions.of(p_275341_).getFont(p_275341_, net.minecraftforge.client.extensions.common.IClientItemExtensions.FontContext.ITEM_COUNT);
+ this.f_96542_.m_274364_(p_275498_, font == null ? this.f_96547_ : font, p_275341_, p_275289_, p_275690_ - (this.f_97711_.m_41619_() ? 0 : 8), p_275201_);
p_275498_.m_85849_();
+ 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_);
}
@@ -272,7 +_,8 @@
protected void m_280072_(GuiGraphics p_283594_, int p_282171_, int p_281909_) {
@@ -168,7 +_,8 @@
p_282567_.m_280168_().m_85836_();
p_282567_.m_280168_().m_252880_(0.0F, 0.0F, 232.0F);
p_282567_.m_280480_(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_);
+ 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_.m_280168_().m_85849_();
}
@@ -270,7 +_,8 @@
if (super.m_6375_(p_97748_, p_97749_, p_97750_)) {
return true;
} else {
@ -57,7 +55,7 @@
Slot slot = this.m_97744_(p_97748_, p_97749_);
long i = Util.m_137550_();
this.f_97723_ = this.f_97709_ == slot && i - this.f_97721_ < 250L && this.f_97722_ == p_97750_;
@@ -283,6 +_,7 @@
@@ -281,6 +_,7 @@
int j = this.f_97735_;
int k = this.f_97736_;
boolean flag1 = this.m_7467_(p_97748_, p_97749_, j, k, p_97750_);
@ -65,7 +63,7 @@
int l = -1;
if (slot != null) {
l = slot.f_40219_;
@@ -308,7 +_,7 @@
@@ -306,7 +_,7 @@
}
} else if (!this.f_97738_) {
if (this.f_97732_.m_142621_().m_41619_()) {
@ -74,7 +72,7 @@
this.m_6597_(slot, l, p_97750_, ClickType.CLONE);
} 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));
@@ -332,7 +_,7 @@
@@ -330,7 +_,7 @@
this.f_97717_ = 0;
} else if (p_97750_ == 1) {
this.f_97717_ = 1;
@ -83,7 +81,7 @@
this.f_97717_ = 2;
}
}
@@ -401,10 +_,13 @@
@@ -399,10 +_,13 @@
}
public boolean m_6348_(double p_97812_, double p_97813_, int p_97814_) {
@ -97,7 +95,7 @@
int k = -1;
if (slot != null) {
k = slot.f_40219_;
@@ -418,7 +_,7 @@
@@ -416,7 +_,7 @@
if (m_96638_()) {
if (!this.f_97724_.m_41619_()) {
for(Slot slot2 : this.f_97732_.f_38839_) {
@ -106,7 +104,7 @@
this.m_6597_(slot2, slot2.f_40219_, p_97814_, ClickType.QUICK_MOVE);
}
}
@@ -481,7 +_,7 @@
@@ -479,7 +_,7 @@
this.m_6597_((Slot)null, -999, AbstractContainerMenu.m_38930_(2, this.f_97717_), ClickType.QUICK_CRAFT);
} else if (!this.f_97732_.m_142621_().m_41619_()) {
@ -115,7 +113,7 @@
this.m_6597_(slot, k, p_97814_, ClickType.CLONE);
} 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));
@@ -528,34 +_,39 @@
@@ -526,34 +_,39 @@
}
public boolean m_7933_(int p_97765_, int p_97766_, int p_97767_) {
@ -162,7 +160,7 @@
this.m_6597_(this.f_97734_, this.f_97734_.f_40219_, i, ClickType.SWAP);
return true;
}
@@ -590,6 +_,18 @@
@@ -588,6 +_,18 @@
public T m_6262_() {
return this.f_97732_;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java
@@ -75,6 +_,8 @@
@@ -74,6 +_,8 @@
private boolean f_98515_;
private final Set<TagKey<Item>> f_98516_ = new HashSet<>();
private final boolean f_256872_;
@ -9,7 +9,7 @@
public CreativeModeInventoryScreen(Player p_259788_, FeatureFlagSet p_260074_, boolean p_259569_) {
super(new CreativeModeInventoryScreen.ItemPickerMenu(p_259788_), p_259788_.m_150109_(), CommonComponents.f_237098_);
@@ -109,7 +_,7 @@
@@ -107,7 +_,7 @@
private void m_257687_(Collection<ItemStack> p_261591_) {
int i = this.f_97732_.m_257485_(this.f_98508_);
(this.f_97732_).f_98639_.clear();
@ -18,7 +18,7 @@
this.m_98630_();
} else {
(this.f_97732_).f_98639_.addAll(p_261591_);
@@ -273,6 +_,34 @@
@@ -263,6 +_,34 @@
protected void m_7856_() {
if (this.f_96541_.f_91072_.m_105290_()) {
super.m_7856_();
@ -53,7 +53,7 @@
this.f_98510_ = new EditBox(this.f_96547_, this.f_97735_ + 82, this.f_97736_ + 6, 80, 9, Component.m_237115_("itemGroup.search"));
this.f_98510_.m_94199_(50);
this.f_98510_.m_94182_(false);
@@ -318,7 +_,7 @@
@@ -308,7 +_,7 @@
public boolean m_5534_(char p_98521_, int p_98522_) {
if (this.f_98514_) {
return false;
@ -62,7 +62,7 @@
return false;
} else {
String s = this.f_98510_.m_94155_();
@@ -336,7 +_,7 @@
@@ -326,7 +_,7 @@
public boolean m_7933_(int p_98547_, int p_98548_, int p_98549_) {
this.f_98514_ = false;
@ -71,7 +71,7 @@
if (this.f_96541_.f_91066_.f_92098_.m_90832_(p_98547_, p_98548_)) {
this.f_98514_ = true;
this.m_98560_(CreativeModeTabs.m_258007_());
@@ -371,6 +_,7 @@
@@ -361,6 +_,7 @@
}
private void m_98630_() {
@ -79,7 +79,7 @@
(this.f_97732_).f_98639_.clear();
this.f_98516_.clear();
String s = this.f_98510_.m_94155_();
@@ -380,10 +_,10 @@
@@ -370,10 +_,10 @@
SearchTree<ItemStack> searchtree;
if (s.startsWith("#")) {
s = s.substring(1);
@ -92,17 +92,17 @@
}
(this.f_97732_).f_98639_.addAll(searchtree.m_6293_(s.toLowerCase(Locale.ROOT)));
@@ -415,7 +_,8 @@
@@ -405,7 +_,8 @@
protected void m_7027_(PoseStack p_98616_, int p_98617_, int p_98618_) {
protected void m_280003_(GuiGraphics p_283168_, int p_281774_, int p_281466_) {
if (f_98507_.m_40789_()) {
- this.f_96547_.m_92889_(p_98616_, f_98507_.m_40786_(), 8.0F, 6.0F, 4210752);
+ RenderSystem.m_69461_();
+ this.f_96547_.m_92889_(p_98616_, f_98507_.m_40786_(), 8.0F, 6.0F, f_98507_.getLabelColor());
- p_283168_.m_280614_(this.f_96547_, f_98507_.m_40786_(), 8, 6, 4210752, false);
+ com.mojang.blaze3d.systems.RenderSystem.disableBlend();
+ p_283168_.m_280614_(this.f_96547_, f_98507_.m_40786_(), 8, 6, f_98507_.getLabelColor(), false);
}
}
@@ -425,7 +_,7 @@
@@ -415,7 +_,7 @@
double d0 = p_98531_ - (double)this.f_97735_;
double d1 = p_98532_ - (double)this.f_97736_;
@ -111,7 +111,7 @@
if (this.m_98562_(creativemodetab, d0, d1)) {
return true;
}
@@ -446,7 +_,7 @@
@@ -436,7 +_,7 @@
double d1 = p_98623_ - (double)this.f_97736_;
this.f_98509_ = false;
@ -120,7 +120,7 @@
if (this.m_98562_(creativemodetab, d0, d1)) {
this.m_98560_(creativemodetab);
return true;
@@ -464,6 +_,7 @@
@@ -454,6 +_,7 @@
private void m_98560_(CreativeModeTab p_98561_) {
CreativeModeTab creativemodetab = f_98507_;
f_98507_ = p_98561_;
@ -128,7 +128,7 @@
this.f_97737_.clear();
(this.f_97732_).f_98639_.clear();
this.m_238391_();
@@ -540,13 +_,15 @@
@@ -530,13 +_,15 @@
this.f_98511_ = null;
}
@ -145,83 +145,73 @@
this.m_98630_();
} else {
@@ -603,7 +_,7 @@
this.m_7333_(p_98577_);
super.m_86412_(p_98577_, p_98578_, p_98579_, p_98580_);
@@ -593,7 +_,7 @@
this.m_280273_(p_283000_);
super.m_88315_(p_283000_, p_281317_, p_282770_, p_281295_);
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
if (this.m_98584_(p_98577_, creativemodetab, p_98578_, p_98579_)) {
if (this.m_280537_(p_283000_, creativemodetab, p_281317_, p_282770_)) {
break;
}
@@ -613,13 +_,22 @@
this.m_96602_(p_98577_, f_98506_, p_98578_, p_98579_);
@@ -603,13 +_,22 @@
p_283000_.m_280557_(this.f_96547_, f_98506_, p_281317_, p_282770_);
}
+ if (this.pages.size() != 1) {
+ Component page = Component.m_237113_(String.format("%d / %d", this.pages.indexOf(this.currentPage) + 1, this.pages.size()));
+ p_98577_.m_85836_();
+ p_98577_.m_252880_(0F, 0F, 300F);
+ f_96547_.m_92744_(p_98577_, page.m_7532_(), f_97735_ + (f_97726_ / 2f) - (f_96547_.m_92852_(page) / 2f), f_97736_ - 44, -1);
+ p_98577_.m_85849_();
+ p_283000_.m_280168_().m_85836_();
+ p_283000_.m_280168_().m_252880_(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_.m_280168_().m_85849_();
+ }
+
+ RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
this.m_7025_(p_98577_, p_98578_, p_98579_);
+ com.mojang.blaze3d.systems.RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
this.m_280072_(p_283000_, p_281317_, p_282770_);
}
protected void m_6057_(PoseStack p_98590_, ItemStack p_98591_, int p_98592_, int p_98593_) {
public List<Component> m_280553_(ItemStack p_281769_) {
boolean flag = this.f_97734_ != null && this.f_97734_ instanceof CreativeModeInventoryScreen.CustomCreativeSlot;
boolean flag1 = f_98507_.m_257962_() == CreativeModeTab.Type.CATEGORY;
- boolean flag2 = f_98507_.m_257962_() == CreativeModeTab.Type.SEARCH;
+ boolean flag2 = f_98507_.hasSearchBar();
TooltipFlag.Default tooltipflag$default = this.f_96541_.f_91066_.f_92125_ ? TooltipFlag.Default.f_256730_ : TooltipFlag.Default.f_256752_;
TooltipFlag tooltipflag = flag ? tooltipflag$default.m_257777_() : tooltipflag$default;
List<Component> list = p_98591_.m_41651_(this.f_96541_.f_91074_, tooltipflag);
@@ -639,35 +_,36 @@
List<Component> list = p_281769_.m_41651_(this.f_96541_.f_91074_, tooltipflag);
@@ -629,7 +_,7 @@
int i = 1;
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
- if (creativemodetab.m_257962_() != CreativeModeTab.Type.SEARCH && creativemodetab.m_257694_(p_98591_)) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
+ if (!creativemodetab.hasSearchBar() && creativemodetab.m_257694_(p_98591_)) {
for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
- if (creativemodetab.m_257962_() != CreativeModeTab.Type.SEARCH && creativemodetab.m_257694_(p_281769_)) {
+ if (!creativemodetab.hasSearchBar() && creativemodetab.m_257694_(p_281769_)) {
list1.add(i++, creativemodetab.m_40786_().m_6881_().m_130940_(ChatFormatting.BLUE));
}
}
}
- this.m_169388_(p_98590_, list1, p_98591_.m_150921_(), p_98592_, p_98593_);
+ this.renderTooltip(p_98590_, list1, p_98591_.m_150921_(), p_98592_, p_98593_, null, p_98591_);
@@ -639,13 +_,13 @@
}
protected void m_7286_(PoseStack p_98572_, float p_98573_, int p_98574_, int p_98575_) {
protected void m_7286_(GuiGraphics p_282663_, float p_282504_, int p_282089_, int p_282249_) {
- for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257388_()) {
+ for(CreativeModeTab creativemodetab : currentPage.getVisibleTabs()) {
RenderSystem.m_157456_(0, f_98504_);
if (creativemodetab != f_98507_) {
this.m_98581_(p_98572_, creativemodetab);
this.m_280560_(p_282663_, creativemodetab);
}
}
- RenderSystem.m_157456_(0, new ResourceLocation("textures/gui/container/creative_inventory/tab_" + f_98507_.m_40788_()));
+ RenderSystem.m_157456_(0, f_98507_.getBackgroundLocation());
m_93228_(p_98572_, this.f_97735_, this.f_97736_, 0, 0, this.f_97726_, this.f_97727_);
this.f_98510_.m_86412_(p_98572_, p_98574_, p_98575_, p_98573_);
- 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_.m_280218_(f_98507_.getBackgroundLocation(), this.f_97735_, this.f_97736_, 0, 0, this.f_97726_, this.f_97727_);
this.f_98510_.m_88315_(p_282663_, p_282089_, p_282249_, p_282504_);
int j = this.f_97735_ + 175;
int k = this.f_97736_ + 18;
int i = k + 112;
- RenderSystem.m_157456_(0, f_98504_);
+ RenderSystem.m_157456_(0, f_98507_.getTabsImage());
if (f_98507_.m_40791_()) {
m_93228_(p_98572_, j, k + (int)((float)(i - k - 17) * this.f_98508_), 232 + (this.m_98631_() ? 0 : 12), 0, 12, 15);
@@ -654,6 +_,7 @@
p_282663_.m_280218_(f_98504_, j, k + (int)((float)(i - k - 17) * this.f_98508_), 232 + (this.m_98631_() ? 0 : 12), 0, 12, 15);
}
+ if (currentPage.getVisibleTabs().contains(f_98507_)) //Forge: only display tab selection when the selected tab is on the current page
this.m_98581_(p_98572_, f_98507_);
this.m_280560_(p_282663_, f_98507_);
if (f_98507_.m_257962_() == CreativeModeTab.Type.INVENTORY) {
InventoryScreen.m_274545_(p_98572_, this.f_97735_ + 88, this.f_97736_ + 45, 20, (float)(this.f_97735_ + 88 - p_98574_), (float)(this.f_97736_ + 45 - 30 - p_98575_), this.f_96541_.f_91074_);
@@ -676,7 +_,7 @@
InventoryScreen.m_274545_(p_282663_, this.f_97735_ + 88, this.f_97736_ + 45, 20, (float)(this.f_97735_ + 88 - p_282089_), (float)(this.f_97736_ + 45 - 30 - p_282249_), this.f_96541_.f_91074_);
@@ -662,7 +_,7 @@
}
private int m_258094_(CreativeModeTab p_260136_) {
@ -230,7 +220,7 @@
int j = 27;
int k = 27 * i;
if (p_260136_.m_6563_()) {
@@ -688,7 +_,7 @@
@@ -674,7 +_,7 @@
private int m_257995_(CreativeModeTab p_260181_) {
int i = 0;
@ -239,26 +229,26 @@
i -= 32;
} else {
i += this.f_97727_;
@@ -716,8 +_,8 @@
@@ -702,8 +_,8 @@
protected void m_98581_(PoseStack p_98582_, CreativeModeTab p_98583_) {
boolean flag = p_98583_ == f_98507_;
- boolean flag1 = p_98583_.m_258064_() == CreativeModeTab.Row.TOP;
- int i = p_98583_.m_257903_();
+ boolean flag1 = currentPage.isTop(p_98583_);
+ int i = currentPage.getColumn(p_98583_);
protected void m_280560_(GuiGraphics p_283590_, CreativeModeTab p_283489_) {
boolean flag = p_283489_ == f_98507_;
- boolean flag1 = p_283489_.m_258064_() == CreativeModeTab.Row.TOP;
- int i = p_283489_.m_257903_();
+ boolean flag1 = currentPage.isTop(p_283489_);
+ int i = currentPage.getColumn(p_283489_);
int j = i * 26;
int k = 0;
int l = this.f_97735_ + this.m_258094_(p_98583_);
@@ -734,6 +_,7 @@
int l = this.f_97735_ + this.m_258094_(p_283489_);
@@ -720,6 +_,7 @@
i1 += this.f_97727_ - 4;
}
+ RenderSystem.m_69478_(); //Forge: Make sure blend is enabled else tabs show a white border.
m_93228_(p_98582_, l, i1, j, k, 26, 32);
p_98582_.m_85836_();
p_98582_.m_252880_(0.0F, 0.0F, 100.0F);
@@ -777,6 +_,14 @@
+ com.mojang.blaze3d.systems.RenderSystem.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
p_283590_.m_280218_(f_98504_, l, i1, j, k, 26, 32);
p_283590_.m_280168_().m_85836_();
p_283590_.m_280168_().m_252880_(0.0F, 0.0F, 100.0F);
@@ -763,6 +_,14 @@
}
@ -273,7 +263,7 @@
@OnlyIn(Dist.CLIENT)
static class CustomCreativeSlot extends Slot {
public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) {
@@ -944,6 +_,22 @@
@@ -930,6 +_,22 @@
public boolean m_8010_(Player p_98665_) {
return this.f_98655_.m_8010_(p_98665_);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java
@@ -42,12 +_,17 @@
@@ -41,12 +_,17 @@
Collection<MobEffectInstance> collection = this.f_96541_.f_91074_.m_21220_();
if (!collection.isEmpty() && j >= 32) {
boolean flag = j >= 120;
@ -16,30 +16,30 @@
- Iterable<MobEffectInstance> iterable = Ordering.natural().sortedCopy(collection);
+
+ Iterable<MobEffectInstance> iterable = collection.stream().filter(net.minecraftforge.client.ForgeHooksClient::shouldRenderEffect).sorted().collect(java.util.stream.Collectors.toList());
this.m_194002_(p_194015_, i, k, iterable, flag);
this.m_194008_(p_194015_, i, k, iterable, flag);
this.m_280172_(p_281945_, i, k, iterable, flag);
this.m_280301_(p_281945_, i, k, iterable, flag);
if (flag) {
@@ -94,6 +_,11 @@
@@ -92,6 +_,11 @@
int i = this.f_97736_;
for(MobEffectInstance mobeffectinstance : p_194012_) {
for(MobEffectInstance mobeffectinstance : p_282642_) {
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (renderer.renderInventoryIcon(mobeffectinstance, this, p_194009_, p_194010_ + (p_194013_ ? 6 : 7), i, 0)) {
+ i += p_194011_;
+ if (renderer.renderInventoryIcon(mobeffectinstance, this, p_282745_, p_282521_ + (p_281536_ ? 6 : 7), i, 0)) {
+ i += p_282291_;
+ continue;
+ }
MobEffect mobeffect = mobeffectinstance.m_19544_();
TextureAtlasSprite textureatlassprite = mobeffecttexturemanager.m_118732_(mobeffect);
RenderSystem.m_157456_(0, textureatlassprite.m_247685_());
@@ -107,6 +_,11 @@
p_282745_.m_280159_(p_282521_ + (p_281536_ ? 6 : 7), i + 7, 0, 18, 18, textureatlassprite);
@@ -104,6 +_,11 @@
int i = this.f_97736_;
for(MobEffectInstance mobeffectinstance : p_98726_) {
for(MobEffectInstance mobeffectinstance : p_281986_) {
+ var renderer = net.minecraftforge.client.extensions.common.IClientMobEffectExtensions.of(mobeffectinstance);
+ if (renderer.renderInventoryText(mobeffectinstance, this, p_98723_, p_98724_, i, 0)) {
+ i += p_98725_;
+ if (renderer.renderInventoryText(mobeffectinstance, this, p_281462_, p_283484_, i, 0)) {
+ i += p_282057_;
+ continue;
+ }
Component component = this.m_194000_(mobeffectinstance);
this.f_96547_.m_92763_(p_98723_, component, (float)(p_98724_ + 10 + 18), (float)(i + 6), 16777215);
p_281462_.m_280430_(this.f_96547_, component, p_283484_ + 10 + 18, i + 6, 16777215);
Component component1 = MobEffectUtil.m_267641_(mobeffectinstance, 1.0F);

View file

@ -1,20 +1,20 @@
--- a/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java
@@ -140,7 +_,7 @@
int i2 = 86 - this.f_96547_.m_92895_(s);
FormattedText formattedtext = EnchantmentNames.m_98734_().m_98737_(this.f_96547_, i2);
int j2 = 6839882;
- if ((l < i1 + 1 || this.f_96541_.f_91074_.f_36078_ < l1) && !this.f_96541_.f_91074_.m_150110_().f_35937_) {
+ if (((l < i1 + 1 || this.f_96541_.f_91074_.f_36078_ < l1) && !this.f_96541_.f_91074_.m_150110_().f_35937_) || this.f_97732_.f_39447_[i1] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels
m_93228_(p_98762_, j1, j + 14 + 19 * i1, 0, 185, 108, 19);
m_93228_(p_98762_, j1 + 1, j + 15 + 19 * i1, 16 * i1, 239, 16, 16);
this.f_96547_.m_274535_(p_98762_, formattedtext, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1);
@@ -179,10 +_,13 @@
@@ -88,7 +_,7 @@
int l1 = 86 - this.f_96547_.m_92895_(s);
FormattedText formattedtext = EnchantmentNames.m_98734_().m_98737_(this.f_96547_, l1);
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.f_96541_.f_91074_.f_36078_ < k1) && !this.f_96541_.f_91074_.m_150110_().f_35937_) || this.f_97732_.f_39447_[i1] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels
p_282430_.m_280218_(f_98747_, i1, j + 14 + 19 * l, 0, 185, 108, 19);
p_282430_.m_280218_(f_98747_, i1 + 1, j + 15 + 19 * l, 16 * l, 239, 16, 16);
p_282430_.m_280554_(this.f_96547_, formattedtext, j1, j + 16 + 19 * l, l1, (i2 & 16711422) >> 1);
@@ -150,10 +_,13 @@
Enchantment enchantment = Enchantment.m_44697_((this.f_97732_).f_39447_[j]);
int l = (this.f_97732_).f_39448_[j];
int i1 = j + 1;
- if (this.m_6774_(60, 14 + 19 * j, 108, 17, (double)p_98768_, (double)p_98769_) && k > 0 && l >= 0 && enchantment != null) {
+ if (this.m_6774_(60, 14 + 19 * j, 108, 17, (double)p_98768_, (double)p_98769_) && k > 0) {
- if (this.m_6774_(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) {
List<Component> list = Lists.newArrayList();
- list.add(Component.m_237110_("container.enchant.clue", enchantment.m_44700_(l)).m_130940_(ChatFormatting.WHITE));
- if (!flag) {

View file

@ -1,11 +1,11 @@
--- a/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java
@@ -17,7 +_,7 @@
@@ -15,7 +_,7 @@
private static final Vector3f f_243728_ = new Vector3f(1.0F, 1.0F, 1.0F);
private static final int f_244604_ = 16;
private static final int f_244207_ = 16;
- private final ResourceLocation f_243720_ = new ResourceLocation("textures/gui/hanging_signs/" + this.f_244069_.f_61839_() + ".png");
+ private final ResourceLocation f_243720_ = new ResourceLocation(this.f_244069_.f_61839_() + ".png").m_246208_("textures/gui/hanging_signs/");
public HangingSignEditScreen(SignBlockEntity p_249425_, boolean p_250356_) {
super(p_249425_, p_250356_, Component.m_237115_("hanging_sign.edit"));
public HangingSignEditScreen(SignBlockEntity p_278017_, boolean p_277942_, boolean p_277778_) {
super(p_278017_, p_277942_, p_277778_, Component.m_237115_("hanging_sign.edit"));

View file

@ -1,14 +1,14 @@
--- a/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/InventoryScreen.java
@@ -98,6 +_,13 @@
public static void m_274545_(PoseStack p_275396_, int p_275688_, int p_275245_, int p_275535_, float p_275604_, float p_275546_, LivingEntity p_275689_) {
@@ -93,6 +_,13 @@
public static void m_274545_(GuiGraphics p_282802_, int p_275688_, int p_275245_, int p_275535_, float p_275604_, float p_275546_, LivingEntity p_275689_) {
float f = (float)Math.atan((double)(p_275604_ / 40.0F));
float f1 = (float)Math.atan((double)(p_275546_ / 40.0F));
+ // Forge: Allow passing in direct angle components instead of mouse position
+ renderEntityInInventoryFollowsAngle(p_275396_, p_275688_, p_275245_, p_275535_, f, f1, p_275689_);
+ renderEntityInInventoryFollowsAngle(p_282802_, p_275688_, p_275245_, p_275535_, f, f1, p_275689_);
+ }
+
+ public static void renderEntityInInventoryFollowsAngle(PoseStack p_275396_, int p_275688_, int p_275245_, int p_275535_, float angleXComponent, float angleYComponent, LivingEntity p_275689_) {
+ public static void renderEntityInInventoryFollowsAngle(GuiGraphics p_282802_, int p_275688_, int p_275245_, int p_275535_, float angleXComponent, float angleYComponent, LivingEntity p_275689_) {
+ float f = angleXComponent;
+ float f1 = angleYComponent;
Quaternionf quaternionf = (new Quaternionf()).rotateZ((float)Math.PI);

View file

@ -1,16 +1,16 @@
--- a/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
+++ b/net/minecraft/client/gui/screens/inventory/MerchantScreen.java
@@ -234,7 +_,12 @@
this.f_96542_.m_274412_(p_99163_, this.f_96547_, p_99164_, p_99166_, p_99167_);
@@ -229,7 +_,12 @@
p_281357_.m_280370_(this.f_96547_, p_283466_, p_282403_, p_283601_);
} else {
this.f_96542_.m_274364_(p_99163_, this.f_96547_, p_99165_, p_99166_, p_99167_, p_99165_.m_41613_() == 1 ? "1" : null);
- this.f_96542_.m_274364_(p_99163_, this.f_96547_, p_99164_, p_99166_ + 14, p_99167_, p_99164_.m_41613_() == 1 ? "1" : null);
+ // Forge: fixes Forge-8806, code for count rendering taken from ItemRenderer#renderGuiItemDecorations
+ PoseStack posestack = new PoseStack();
+ posestack.m_85837_(0.0D, 0.0D, 200F);
+ net.minecraft.client.renderer.MultiBufferSource.BufferSource bufferSource = net.minecraft.client.renderer.MultiBufferSource.m_109898_(com.mojang.blaze3d.vertex.Tesselator.m_85913_().m_85915_());
+ f_96547_.m_272078_(String.valueOf(p_99164_.m_41613_()), (float) (p_99166_ + 14) + 19 - 2 - f_96547_.m_92895_(String.valueOf(p_99164_.m_41613_())), (float)p_99167_ + 6 + 3, 0xFFFFFF, true, posestack.m_85850_().m_252922_(), bufferSource, net.minecraft.client.gui.Font.DisplayMode.NORMAL, 0, 15728880, false);
+ bufferSource.m_109911_();
RenderSystem.m_157456_(0, f_99113_);
p_99163_.m_85836_();
p_99163_.m_252880_(0.0F, 0.0F, 300.0F);
p_281357_.m_280302_(this.f_96547_, p_282046_, p_282403_, p_283601_, p_282046_.m_41613_() == 1 ? "1" : null);
- p_281357_.m_280302_(this.f_96547_, p_283466_, p_282403_ + 14, p_283601_, p_283466_.m_41613_() == 1 ? "1" : null);
+ // Forge: fixes Forge-8806, code for count rendering taken from GuiGraphics#renderGuiItemDecorations
+ p_281357_.m_280168_().m_85836_();
+ p_281357_.m_280168_().m_252880_(0.0F, 0.0F, 200.0F);
+ String count = p_283466_.m_41613_() == 1 ? "1" : String.valueOf(p_283466_.m_41613_());
+ 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);
+ p_281357_.m_280168_().m_85849_();
p_281357_.m_280168_().m_85836_();
p_281357_.m_280168_().m_252880_(0.0F, 0.0F, 300.0F);
p_281357_.m_280398_(f_99113_, p_282403_ + 7, p_283601_ + 12, 0, 0.0F, 176.0F, 9, 2, 512, 256);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java
@@ -21,6 +_,8 @@
@@ -20,6 +_,8 @@
if (p_169951_ instanceof BundleTooltip) {
return new ClientBundleTooltip((BundleTooltip)p_169951_);
} else {

View file

@ -1,49 +1,49 @@
--- a/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java
+++ b/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java
@@ -18,16 +_,21 @@
@@ -17,16 +_,22 @@
private static final int f_262743_ = 1344798847;
public static void m_262796_(TooltipRenderUtil.BlitPainter p_262929_, Matrix4f p_263052_, BufferBuilder p_263082_, int p_263046_, int p_263101_, int p_263024_, int p_262926_, int p_263038_) {
+ renderTooltipBackground(p_262929_, p_263052_, p_263082_, p_263046_, p_263101_, p_263024_, p_262926_, p_263038_, f_262744_, f_262744_, f_262725_, f_262743_);
public static void m_280205_(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_);
+ }
+
+ // Forge: Allow specifying colors for the inner border gradient and a gradient instead of a single color for the background and outer border
+ public static void renderTooltipBackground(TooltipRenderUtil.BlitPainter p_262929_, Matrix4f p_263052_, BufferBuilder p_263082_, int p_263046_, int p_263101_, int p_263024_, int p_262926_, int p_263038_, int backgroundTop, int backgroundBottom, int borderTop, int borderBottom) {
int i = p_263046_ - 3;
int j = p_263101_ - 3;
int k = p_263024_ + 3 + 3;
int l = p_262926_ + 3 + 3;
- m_262855_(p_262929_, p_263052_, p_263082_, i, j - 1, k, p_263038_, -267386864);
- m_262855_(p_262929_, p_263052_, p_263082_, i, j + l, k, p_263038_, -267386864);
- m_262805_(p_262929_, p_263052_, p_263082_, i, j, k, l, p_263038_, -267386864);
- m_262798_(p_262929_, p_263052_, p_263082_, i - 1, j, l, p_263038_, -267386864);
- m_262798_(p_262929_, p_263052_, p_263082_, i + k, j, l, p_263038_, -267386864);
- m_262846_(p_262929_, p_263052_, p_263082_, i, j + 1, k, l, p_263038_, 1347420415, 1344798847);
+ m_262855_(p_262929_, p_263052_, p_263082_, i, j - 1, k, p_263038_, backgroundTop);
+ m_262855_(p_262929_, p_263052_, p_263082_, i, j + l, k, p_263038_, backgroundBottom);
+ renderRectangle(p_262929_, p_263052_, p_263082_, i, j, k, l, p_263038_, backgroundTop, backgroundBottom);
+ m_262849_(p_262929_, p_263052_, p_263082_, i - 1, j, l, p_263038_, backgroundTop, backgroundBottom);
+ m_262849_(p_262929_, p_263052_, p_263082_, i + k, j, l, p_263038_, backgroundTop, backgroundBottom);
+ m_262846_(p_262929_, p_263052_, p_263082_, i, j + 1, k, l, p_263038_, borderTop, borderBottom);
+ public static void renderTooltipBackground(GuiGraphics p_282666_, int p_281901_, int p_281846_, int p_281559_, int p_283336_, int p_283422_, int backgroundTop, int backgroundBottom, int borderTop, int borderBottom)
+ {
int i = p_281901_ - 3;
int j = p_281846_ - 3;
int k = p_281559_ + 3 + 3;
int l = p_283336_ + 3 + 3;
- m_280217_(p_282666_, i, j - 1, k, p_283422_, -267386864);
- m_280217_(p_282666_, i, j + l, k, p_283422_, -267386864);
- m_280538_(p_282666_, i, j, k, l, p_283422_, -267386864);
- m_280387_(p_282666_, i - 1, j, l, p_283422_, -267386864);
- m_280387_(p_282666_, i + k, j, l, p_283422_, -267386864);
- m_280115_(p_282666_, i, j + 1, k, l, p_283422_, 1347420415, 1344798847);
+ m_280217_(p_282666_, i, j - 1, k, p_283422_, backgroundTop);
+ m_280217_(p_282666_, i, j + l, k, p_283422_, backgroundBottom);
+ renderRectangle(p_282666_, i, j, k, l, p_283422_, backgroundTop, backgroundBottom);
+ m_280556_(p_282666_, i - 1, j, l, p_283422_, backgroundTop, backgroundBottom);
+ m_280556_(p_282666_, i + k, j, l, p_283422_, backgroundTop, backgroundBottom);
+ m_280115_(p_282666_, i, j + 1, k, l, p_283422_, borderTop, borderBottom);
}
private static void m_262846_(TooltipRenderUtil.BlitPainter p_262974_, Matrix4f p_263030_, BufferBuilder p_263061_, int p_262982_, int p_262912_, int p_262946_, int p_263049_, int p_263118_, int p_263104_, int p_262979_) {
@@ -49,8 +_,17 @@
p_262966_.m_262815_(p_263094_, p_262943_, p_262949_, p_263068_, p_262949_ + p_263111_, p_263068_ + 1, p_263095_, p_262918_, p_262918_);
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_) {
@@ -48,7 +_,16 @@
p_282981_.m_280046_(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
private static void m_262805_(TooltipRenderUtil.BlitPainter p_262933_, Matrix4f p_263035_, BufferBuilder p_263084_, int p_262945_, int p_262955_, int p_263017_, int p_262978_, int p_262950_, int p_262931_) {
- p_262933_.m_262815_(p_263035_, p_263084_, p_262945_, p_262955_, p_262945_ + p_263017_, p_262955_ + p_262978_, p_262950_, p_262931_, p_262931_);
+ renderRectangle(p_262933_, p_263035_, p_263084_, p_262945_, p_262955_, p_263017_, p_262978_, p_262950_, p_262931_, p_262931_);
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_) {
- p_281392_.m_280046_(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_);
+ }
+
+ // Forge: Allow specifying a gradient instead of a single color for the background
+ private static void renderRectangle(TooltipRenderUtil.BlitPainter p_262933_, Matrix4f p_263035_, BufferBuilder p_263084_, int p_262945_, int p_262955_, int p_263017_, int p_262978_, int p_262950_, int p_262931_, int colorTo) {
+ p_262933_.m_262815_(p_263035_, p_263084_, p_262945_, p_262955_, p_262945_ + p_263017_, p_262955_ + p_262978_, p_262950_, p_262931_, 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);
}
@FunctionalInterface
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
+++ b/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java
@@ -281,6 +_,11 @@
@@ -283,6 +_,11 @@
}

View file

@ -1,11 +1,11 @@
--- a/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
+++ b/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java
@@ -330,6 +_,8 @@
@@ -318,6 +_,8 @@
this.f_99855_.m_99707_(list1);
}
+ net.minecraftforge.client.ForgeHooksClient.drawForgePingInfo(this.f_99855_, f_99857_, p_99879_, p_99882_, p_99881_, p_99883_, i1, j1);
+ net.minecraftforge.client.ForgeHooksClient.drawForgePingInfo(this.f_99855_, f_99857_, p_281406_, p_281363_, p_282921_, p_283596_, i1, j1);
+
if (this.f_99856_.f_91066_.m_231828_().m_231551_() || p_99887_) {
RenderSystem.m_157456_(0, ServerSelectionList.f_99759_);
GuiComponent.m_93172_(p_99879_, p_99882_, p_99881_, p_99882_ + 32, p_99881_ + 32, -1601138544);
if (this.f_99856_.f_91066_.m_231828_().m_231551_() || p_282999_) {
p_281406_.m_280509_(p_281363_, p_282921_, p_281363_ + 32, p_282921_ + 32, -1601138544);
int k1 = p_283567_ - p_281363_;

View file

@ -1,11 +1,16 @@
--- a/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java
@@ -130,7 +_,7 @@
@@ -130,10 +_,10 @@
TransferableSelectionList.PackEntry transferableselectionlist$packentry = p_100014_.m_93511_();
String s = transferableselectionlist$packentry == null ? "" : transferableselectionlist$packentry.m_264411_();
p_100014_.m_6987_((TransferableSelectionList.PackEntry)null);
- p_100015_.forEach((p_264692_) -> {
- p_100015_.forEach((p_280875_) -> {
- TransferableSelectionList.PackEntry transferableselectionlist$packentry1 = new TransferableSelectionList.PackEntry(this.f_96541_, p_100014_, p_280875_);
+ 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.f_96541_, p_100014_, p_264692_);
p_100014_.m_6702_().add(transferableselectionlist$packentry1);
if (p_264692_.m_264249_().equals(s)) {
- if (p_280875_.m_264249_().equals(s)) {
+ if (p_264692_.m_264249_().equals(s)) {
p_100014_.m_6987_(transferableselectionlist$packentry1);
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
+++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java
@@ -106,7 +_,7 @@
@@ -104,7 +_,7 @@
this.m_5674_();
this.f_100279_.clear();
@ -9,12 +9,3 @@
this.f_100279_.add(new RecipeBookTabButton(recipebookcategories));
}
@@ -297,7 +_,7 @@
}
if (itemstack != null && this.f_100272_.f_91080_ != null) {
- this.f_100272_.f_91080_.m_96597_(p_100375_, this.f_100272_.f_91080_.m_96555_(itemstack), p_100378_, p_100379_);
+ this.f_100272_.f_91080_.renderComponentTooltip(p_100375_, this.f_100272_.f_91080_.m_96555_(itemstack), p_100378_, p_100379_, itemstack);
}
}

View file

@ -1,11 +0,0 @@
--- a/net/minecraft/client/gui/screens/recipebook/RecipeBookPage.java
+++ b/net/minecraft/client/gui/screens/recipebook/RecipeBookPage.java
@@ -115,7 +_,7 @@
public void m_100417_(PoseStack p_100418_, int p_100419_, int p_100420_) {
if (this.f_100397_.f_91080_ != null && this.f_100395_ != null && !this.f_100396_.m_100212_()) {
- this.f_100397_.f_91080_.m_96597_(p_100418_, this.f_100395_.m_100477_(this.f_100397_.f_91080_), p_100419_, p_100420_);
+ this.f_100397_.f_91080_.renderComponentTooltip(p_100418_, this.f_100395_.m_100477_(this.f_100397_.f_91080_), p_100419_, p_100420_, this.f_100395_.m_100488_().m_8043_(f_100397_.f_91073_.m_9598_()));
}
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
+++ b/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java
@@ -119,6 +_,7 @@
@@ -120,6 +_,7 @@
public static void m_232896_(Minecraft p_232897_, @Nullable Screen p_232898_) {
m_232899_(p_232897_, f_232866_);
PackRepository packrepository = new PackRepository(new ServerPacksSource());
@ -8,7 +8,7 @@
WorldLoader.InitConfig worldloader$initconfig = m_245574_(packrepository, WorldDataConfiguration.f_244649_);
CompletableFuture<WorldCreationContext> completablefuture = WorldLoader.m_214362_(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_());
@@ -368,7 +_,7 @@
@@ -367,7 +_,7 @@
if (p_269627_) {
p_270552_.accept(this.f_267389_.m_267573_().f_243842_());
} else {
@ -17,7 +17,7 @@
}
}, Component.m_237115_("dataPack.validation.failed"), CommonComponents.f_237098_, Component.m_237115_("dataPack.validation.back"), Component.m_237115_("dataPack.validation.reset")));
@@ -482,6 +_,7 @@
@@ -481,6 +_,7 @@
if (path != null) {
if (this.f_100832_ == null) {
this.f_100832_ = ServerPacksSource.m_245786_(path);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java
@@ -159,13 +_,23 @@
@@ -165,13 +_,23 @@
}
private void m_233145_(Screen p_233146_, String p_233147_, boolean p_233148_, boolean p_233149_) {
@ -24,7 +24,7 @@
} catch (Exception exception) {
f_233088_.warn("Failed to load level data or datapacks, can't proceed with server load", (Throwable)exception);
if (!p_233148_) {
@@ -185,7 +_,9 @@
@@ -191,7 +_,9 @@
WorldData worlddata = worldstem.f_206895_();
boolean flag = worlddata.m_246337_().m_247070_();
boolean flag1 = worlddata.m_5754_() != Lifecycle.stable();
@ -35,7 +35,7 @@
this.f_233089_.m_247489_().m_247400_(levelstoragesource$levelstorageaccess).thenApply((p_233177_) -> {
return true;
}).exceptionallyComposeAsync((p_233183_) -> {
@@ -207,9 +_,11 @@
@@ -213,9 +_,11 @@
return null;
});
} else {

View file

@ -1,38 +1,36 @@
--- a/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
+++ b/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java
@@ -63,6 +_,7 @@
@@ -68,6 +_,7 @@
static final DateFormat f_101646_ = new SimpleDateFormat();
static final ResourceLocation f_101647_ = new ResourceLocation("textures/misc/unknown_server.png");
private static final ResourceLocation f_101647_ = new ResourceLocation("textures/misc/unknown_server.png");
static final ResourceLocation f_101648_ = new ResourceLocation("textures/gui/world_selection.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 f_101650_ = Component.m_237115_("selectWorld.tooltip.fromNewerVersion2").m_130940_(ChatFormatting.RED);
static final Component f_101651_ = Component.m_237115_("selectWorld.tooltip.snapshot1").m_130940_(ChatFormatting.GOLD);
@@ -313,6 +_,7 @@
RenderSystem.m_69478_();
GuiComponent.m_93133_(p_101721_, p_101724_, p_101723_, 0.0F, 0.0F, 32, 32, 32, 32);
RenderSystem.m_69461_();
+ renderExperimentalWarning(p_101721_, p_101727_, p_101728_, p_101723_, p_101724_);
if (this.f_101693_.f_91066_.m_231828_().m_231551_() || p_101729_) {
RenderSystem.m_157456_(0, WorldSelectionList.f_101648_);
GuiComponent.m_93172_(p_101721_, p_101724_, p_101723_, p_101724_ + 32, p_101723_ + 32, -1601138544);
@@ -545,6 +_,21 @@
@@ -361,6 +_,7 @@
RenderSystem.enableBlend();
p_281612_.m_280163_(this.f_101698_.m_289196_(), p_282820_, p_283181_, 0.0F, 0.0F, 32, 32, 32, 32);
RenderSystem.disableBlend();
+ renderExperimentalWarning(p_281612_, p_283204_, p_283025_, p_283181_, p_282820_);
if (this.f_101693_.f_91066_.m_231828_().m_231551_() || p_283396_) {
p_281612_.m_280509_(p_282820_, p_283181_, p_282820_ + 32, p_283181_ + 32, -1601138544);
int j = p_283204_ - p_282820_;
@@ -604,6 +_,19 @@
public boolean m_214209_() {
return !this.f_101695_.m_164916_();
+ }
+
+ // FORGE: Patch in experimental warning icon for worlds in the world selection screen
+ private void renderExperimentalWarning(PoseStack stack, int mouseX, int mouseY, int top, int left) {
+ private void renderExperimentalWarning(GuiGraphics guiGraphics, int mouseX, int mouseY, int top, int left) {
+ if (this.f_101695_.isLifecycleExperimental()) {
+ int leftStart = left + WorldSelectionList.this.m_5759_();
+ RenderSystem.m_157456_(0, WorldSelectionList.FORGE_EXPERIMENTAL_WARNING_ICON);
+ GuiComponent.m_93133_(stack, leftStart - 36, top, 0.0F, 0.0F, 32, 32, 32, 32);
+ // Reset texture to what it was before
+ RenderSystem.m_157456_(0, this.f_101698_ != null ? this.f_101696_ : WorldSelectionList.f_101647_);
+ guiGraphics.m_280163_(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) {
+ List<net.minecraft.util.FormattedCharSequence> tooltip = Minecraft.m_91087_().f_91062_.m_92923_(Component.m_237115_("forge.experimentalsettings.tooltip"), 200);
+ WorldSelectionList.this.f_101654_.m_96617_(stack, tooltip, mouseX, mouseY);
+ var font = Minecraft.m_91087_().f_91062_;
+ List<net.minecraft.util.FormattedCharSequence> tooltip = font.m_92923_(Component.m_237115_("forge.experimentalsettings.tooltip"), 200);
+ guiGraphics.m_280245_(font, tooltip, mouseX, mouseY);
+ }
+ }
}

View file

@ -1,11 +1,12 @@
--- a/net/minecraft/client/main/Main.java
+++ b/net/minecraft/client/main/Main.java
@@ -135,7 +_,7 @@
@@ -147,8 +_,8 @@
}
CrashReport.m_127529_();
- Bootstrap.m_135870_();
GameLoadTimesEvent.f_285635_.m_286069_(Bootstrap.f_285608_.get());
+ net.minecraftforge.fml.loading.BackgroundWaiter.runAndTick(()->Bootstrap.m_135870_(), net.minecraftforge.fml.loading.FMLLoader.progressWindowTick);
Bootstrap.m_135889_();
Util.m_137584_();
String s10 = optionspec23.value(optionset);
String s13 = optionspec25.value(optionset);

View file

@ -1,14 +1,14 @@
--- a/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
+++ b/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java
@@ -127,6 +_,7 @@
@@ -129,6 +_,7 @@
this.f_104521_.accept(Component.m_237115_("connect.joining"));
this.f_104523_ = p_104547_.m_134774_();
this.f_104522_.m_129498_(ConnectionProtocol.PLAY);
+ net.minecraftforge.network.NetworkHooks.handleClientLoginSuccess(this.f_104522_);
this.f_104522_.m_129505_(new ClientPacketListener(this.f_104519_, this.f_104520_, this.f_104522_, this.f_243717_, this.f_104523_, this.f_104519_.m_261007_().m_260825_(this.f_260722_, this.f_260612_)));
this.f_104522_.m_129505_(new ClientPacketListener(this.f_104519_, this.f_104520_, this.f_104522_, this.f_243717_, this.f_104523_, this.f_104519_.m_261007_().m_285995_(this.f_260722_, this.f_260612_, this.f_285614_)));
}
@@ -134,7 +_,7 @@
@@ -136,7 +_,7 @@
if (this.f_104520_ != null && this.f_104520_ instanceof RealmsScreen) {
this.f_104519_.m_91152_(new DisconnectedRealmsScreen(this.f_104520_, CommonComponents.f_130661_, p_104543_));
} else {
@ -17,7 +17,7 @@
}
}
@@ -155,6 +_,7 @@
@@ -157,6 +_,7 @@
}
public void m_7254_(ClientboundCustomQueryPacket p_104545_) {

View file

@ -25,7 +25,7 @@
}
public void m_194171_(Runnable p_194172_) {
@@ -261,6 +_,7 @@
@@ -265,6 +_,7 @@
this.m_46473_().m_6521_(() -> {
return BuiltInRegistries.f_256780_.m_7981_(p_104640_.m_6095_()).toString();
});
@ -33,7 +33,7 @@
p_104640_.m_8119_();
this.m_46473_().m_7238_();
@@ -323,8 +_,10 @@
@@ -327,8 +_,10 @@
}
private void m_104739_(int p_104740_, Entity p_104741_) {
@ -44,7 +44,7 @@
}
public void m_171642_(int p_171643_, Entity.RemovalReason p_171644_) {
@@ -451,6 +_,12 @@
@@ -455,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_) {
@ -57,7 +57,7 @@
if (p_263381_ == this.f_104565_.f_91074_) {
this.m_233602_(p_263372_, p_263404_, p_263365_, p_263335_.m_203334_(), p_263417_, p_263416_, p_263349_, false, p_263408_);
}
@@ -458,6 +_,12 @@
@@ -462,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_) {
@ -70,7 +70,7 @@
if (p_263514_ == this.f_104565_.f_91074_) {
this.f_104565_.m_91106_().m_120367_(new EntityBoundSoundInstance(p_263518_.m_203334_(), p_263487_, p_263538_, p_263524_, p_263536_, p_263509_));
}
@@ -902,6 +_,7 @@
@@ -899,6 +_,7 @@
}
public void m_104851_(Difficulty p_104852_) {
@ -78,7 +78,7 @@
this.f_104840_ = p_104852_;
}
@@ -939,14 +_,46 @@
@@ -936,14 +_,46 @@
ClientLevel.this.f_104566_.add((AbstractClientPlayer)p_171712_);
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/multiplayer/ClientPacketListener.java
+++ b/net/minecraft/client/multiplayer/ClientPacketListener.java
@@ -411,6 +_,7 @@
@@ -412,6 +_,7 @@
this.f_104888_.f_91064_.m_113434_();
this.f_104888_.f_91074_.m_172530_();
@ -8,15 +8,15 @@
int i = p_105030_.f_132360_();
this.f_104888_.f_91074_.m_20234_(i);
this.f_104889_.m_104630_(i, this.f_104888_.f_91074_);
@@ -423,6 +_,7 @@
this.f_104888_.f_91074_.m_219749_(p_105030_.f_238174_());
@@ -425,6 +_,7 @@
this.f_104888_.f_91074_.m_287199_(p_105030_.f_286971_());
this.f_104888_.f_91072_.m_171805_(p_105030_.f_132363_(), p_105030_.f_132364_());
this.f_104888_.f_91066_.m_193770_(p_105030_.f_132370_());
+ net.minecraftforge.network.NetworkHooks.sendMCRegistryPackets(f_104885_, "PLAY_TO_SERVER");
this.f_104888_.f_91066_.m_92172_();
this.f_104885_.m_129512_(new ServerboundCustomPayloadPacket(ServerboundCustomPayloadPacket.f_133979_, (new FriendlyByteBuf(Unpooled.buffer())).m_130070_(ClientBrandRetriever.m_129629_())));
this.f_104885_.m_129512_(new ServerboundCustomPayloadPacket(ServerboundCustomPayloadPacket.f_133979_, (new FriendlyByteBuf(Unpooled.buffer())).m_130070_(ClientBrandRetriever.getClientModName())));
this.f_252517_ = null;
@@ -1055,8 +_,10 @@
@@ -1069,8 +_,10 @@
localplayer1.m_21204_().m_22159_(localplayer.m_21204_());
}
@ -27,7 +27,7 @@
this.f_104889_.m_104630_(i, localplayer1);
localplayer1.m_146922_(-180.0F);
localplayer1.f_108618_ = new KeyboardInput(this.f_104888_.f_91066_);
@@ -1161,10 +_,7 @@
@@ -1180,10 +_,7 @@
PacketUtils.m_131363_(p_104976_, this, this.f_104888_);
BlockPos blockpos = p_104976_.m_131704_();
this.f_104888_.f_91073_.m_141902_(blockpos, p_104976_.m_195645_()).ifPresent((p_205557_) -> {
@ -39,7 +39,7 @@
if (p_205557_ instanceof CommandBlockEntity && this.f_104888_.f_91080_ instanceof CommandBlockEditScreen) {
((CommandBlockEditScreen)this.f_104888_.f_91080_).m_98398_();
@@ -1310,7 +_,9 @@
@@ -1329,7 +_,9 @@
public void m_7443_(ClientboundCommandsPacket p_104990_) {
PacketUtils.m_131363_(p_104990_, this, this.f_104888_);
@ -50,7 +50,7 @@
}
public void m_7183_(ClientboundStopSoundPacket p_105116_) {
@@ -1329,6 +_,7 @@
@@ -1348,6 +_,7 @@
ClientRecipeBook clientrecipebook = this.f_104888_.f_91074_.m_108631_();
clientrecipebook.m_266394_(this.f_104900_.m_44051_(), this.f_104888_.f_91073_.m_9598_());
this.f_104888_.m_231374_(SearchRegistry.f_119943_, clientrecipebook.m_90639_());
@ -58,7 +58,7 @@
}
public void m_7244_(ClientboundPlayerLookAtPacket p_105054_) {
@@ -1424,7 +_,8 @@
@@ -1443,7 +_,8 @@
Blocks.m_50758_();
}
@ -68,7 +68,7 @@
}
public void m_241155_(ClientboundUpdateEnabledFeaturesPacket p_251591_) {
@@ -1826,6 +_,7 @@
@@ -1855,6 +_,7 @@
}
public void m_7413_(ClientboundCustomPayloadPacket p_105004_) {
@ -76,7 +76,7 @@
PacketUtils.m_131363_(p_105004_, this, this.f_104888_);
ResourceLocation resourcelocation = p_105004_.m_132042_();
FriendlyByteBuf friendlybytebuf = null;
@@ -2023,7 +_,7 @@
@@ -2052,7 +_,7 @@
int j5 = friendlybytebuf.m_130242_();
this.f_104888_.f_91064_.f_173815_.m_173830_(positionsource, j5);
} else {
@ -85,7 +85,7 @@
}
} finally {
if (friendlybytebuf != null) {
@@ -2370,6 +_,8 @@
@@ -2399,6 +_,8 @@
}
public void m_246175_(String p_249888_) {
@ -94,7 +94,7 @@
Instant instant = Instant.now();
long i = Crypt.SaltSupplier.m_216113_();
LastSeenMessagesTracker.Update lastseenmessagestracker$update = this.f_244346_.m_246442_();
@@ -2378,6 +_,7 @@
@@ -2407,6 +_,7 @@
}
public void m_246623_(String p_250092_) {

View file

@ -44,11 +44,11 @@
+ 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 (flag && blockstate1.m_60625_(this.f_105189_.f_91074_, this.f_105189_.f_91074_.f_19853_, p_105270_) >= 1.0F) {
if (flag && blockstate1.m_60625_(this.f_105189_.f_91074_, this.f_105189_.f_91074_.m_9236_(), p_105270_) >= 1.0F) {
this.m_105267_(p_105270_);
} else {
@@ -169,7 +_,7 @@
this.f_105189_.f_91073_.m_6801_(this.f_105189_.f_91074_.m_19879_(), this.f_105191_, (int)(this.f_105193_ * 10.0F) - 1);
this.f_105189_.f_91073_.m_6801_(this.f_105189_.f_91074_.m_19879_(), this.f_105191_, this.m_287167_());
}
- return new ServerboundPlayerActionPacket(ServerboundPlayerActionPacket.Action.START_DESTROY_BLOCK, p_105270_, p_105271_, p_233728_);
@ -66,7 +66,7 @@
});
@@ -212,12 +_,13 @@
} else {
this.f_105193_ += blockstate.m_60625_(this.f_105189_.f_91074_, this.f_105189_.f_91074_.f_19853_, p_105284_);
this.f_105193_ += blockstate.m_60625_(this.f_105189_.f_91074_, this.f_105189_.f_91074_.m_9236_(), p_105284_);
if (this.f_105194_ % 4.0F == 0.0F) {
- SoundType soundtype = blockstate.m_60827_();
+ SoundType soundtype = blockstate.getSoundType(this.f_105189_.f_91073_, p_105284_, this.f_105189_.f_91074_);
@ -88,16 +88,16 @@
}
public void m_105287_() {
@@ -264,7 +_,7 @@
ItemStack itemstack = this.f_105189_.f_91074_.m_21205_();
boolean flag = this.f_105192_.m_41619_() && itemstack.m_41619_();
if (!this.f_105192_.m_41619_() && !itemstack.m_41619_()) {
- flag = itemstack.m_150930_(this.f_105192_.m_41720_()) && ItemStack.m_41658_(itemstack, this.f_105192_) && (itemstack.m_41763_() || itemstack.m_41773_() == this.f_105192_.m_41773_());
+ flag = !this.f_105192_.shouldCauseBlockBreakReset(itemstack);
}
@@ -262,7 +_,7 @@
return p_105282_.equals(this.f_105191_) && flag;
@@ -296,25 +_,38 @@
private boolean m_105281_(BlockPos p_105282_) {
ItemStack itemstack = this.f_105189_.f_91074_.m_21205_();
- return p_105282_.equals(this.f_105191_) && ItemStack.m_150942_(itemstack, this.f_105192_);
+ return p_105282_.equals(this.f_105191_) && ItemStack.m_150942_(itemstack, this.f_105192_) && !f_105192_.shouldCauseBlockBreakReset(itemstack);
}
private void m_105297_() {
@@ -291,25 +_,38 @@
private InteractionResult m_233746_(LocalPlayer p_233747_, InteractionHand p_233748_, BlockHitResult p_233749_) {
BlockPos blockpos = p_233749_.m_82425_();
ItemStack itemstack = p_233747_.m_21120_(p_233748_);
@ -140,7 +140,7 @@
InteractionResult interactionresult1;
if (this.f_105197_.m_46408_()) {
int i = itemstack.m_41613_();
@@ -345,10 +_,17 @@
@@ -340,10 +_,17 @@
mutableobject.setValue(InteractionResult.PASS);
return serverbounduseitempacket;
} else {
@ -158,7 +158,7 @@
}
mutableobject.setValue(interactionresultholder.m_19089_());
@@ -387,6 +_,9 @@
@@ -382,6 +_,9 @@
this.m_105297_();
Vec3 vec3 = p_105233_.m_82450_().m_82492_(p_105232_.m_20185_(), p_105232_.m_20186_(), p_105232_.m_20189_());
this.f_105190_.m_104955_(ServerboundInteractPacket.m_179612_(p_105232_, p_105231_.m_6144_(), p_105234_, vec3));

View file

@ -14,8 +14,8 @@
private final Queue<Particle> f_107294_ = Queues.newArrayDeque();
private final Map<ResourceLocation, ParticleEngine.MutableSpriteSet> f_107295_ = Maps.newHashMap();
private final TextureAtlas f_107296_;
@@ -191,10 +_,14 @@
this.m_107378_(ParticleTypes.f_235901_, ShriekParticle.Provider::new);
@@ -194,10 +_,14 @@
this.m_107378_(ParticleTypes.f_276512_, SuspendedTownParticle.EggCrackProvider::new);
}
+ /** @deprecated Register via {@link net.minecraftforge.client.event.RegisterParticleProvidersEvent} */
@ -30,7 +30,7 @@
public <T extends ParticleOptions> void m_272137_(ParticleType<T> p_273423_, ParticleProvider.Sprite<T> p_273134_) {
this.m_107378_(p_273423_, (p_272320_) -> {
return (p_272323_, p_272324_, p_272325_, p_272326_, p_272327_, p_272328_, p_272329_, p_272330_) -> {
@@ -208,10 +_,12 @@
@@ -211,10 +_,12 @@
});
}
@ -44,7 +44,7 @@
}
public CompletableFuture<Void> m_5540_(PreparableReloadListener.PreparationBarrier p_107305_, ResourceManager p_107306_, ProfilerFiller p_107307_, ProfilerFiller p_107308_, Executor p_107309_, Executor p_107310_) {
@@ -310,7 +_,7 @@
@@ -313,7 +_,7 @@
@Nullable
private <T extends ParticleOptions> Particle m_107395_(T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_) {
@ -53,7 +53,7 @@
return particleprovider == null ? null : particleprovider.m_6966_(p_107396_, this.f_107287_, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_);
}
@@ -391,15 +_,24 @@
@@ -394,15 +_,24 @@
}
}
@ -65,21 +65,21 @@
+
+ public void render(PoseStack p_107337_, MultiBufferSource.BufferSource p_107338_, LightTexture p_107339_, Camera p_107340_, float p_107341_, @Nullable net.minecraft.client.renderer.culling.Frustum clippingHelper) {
p_107339_.m_109896_();
RenderSystem.m_69482_();
+ RenderSystem.m_69388_(org.lwjgl.opengl.GL13.GL_TEXTURE2);
+ RenderSystem.m_69388_(org.lwjgl.opengl.GL13.GL_TEXTURE0);
PoseStack posestack = RenderSystem.m_157191_();
RenderSystem.enableDepthTest();
+ RenderSystem.activeTexture(org.lwjgl.opengl.GL13.GL_TEXTURE2);
+ RenderSystem.activeTexture(org.lwjgl.opengl.GL13.GL_TEXTURE0);
PoseStack posestack = RenderSystem.getModelViewStack();
posestack.m_85836_();
posestack.m_252931_(p_107337_.m_85850_().m_252922_());
RenderSystem.m_157182_();
RenderSystem.applyModelViewMatrix();
- for(ParticleRenderType particlerendertype : f_107288_) {
+ for(ParticleRenderType particlerendertype : this.f_107289_.keySet()) { // Forge: allow custom IParticleRenderType's
+ if (particlerendertype == ParticleRenderType.f_107434_) continue;
Iterable<Particle> iterable = this.f_107289_.get(particlerendertype);
if (iterable != null) {
RenderSystem.m_157427_(GameRenderer::m_172829_);
@@ -408,6 +_,7 @@
RenderSystem.setShader(GameRenderer::m_172829_);
@@ -411,6 +_,7 @@
particlerendertype.m_6505_(bufferbuilder, this.f_107291_);
for(Particle particle : iterable) {
@ -87,7 +87,7 @@
try {
particle.m_5744_(bufferbuilder, p_107340_, p_107341_);
} catch (Throwable throwable) {
@@ -437,7 +_,7 @@
@@ -440,7 +_,7 @@
}
public void m_107355_(BlockPos p_107356_, BlockState p_107357_) {
@ -96,7 +96,7 @@
VoxelShape voxelshape = p_107357_.m_60808_(this.f_107287_, p_107356_);
double d0 = 0.25D;
voxelshape.m_83286_((p_172273_, p_172274_, p_172275_, p_172276_, p_172277_, p_172278_) -> {
@@ -457,7 +_,7 @@
@@ -460,7 +_,7 @@
double d7 = d4 * d1 + p_172273_;
double d8 = d5 * d2 + p_172274_;
double d9 = d6 * d3 + p_172275_;
@ -105,7 +105,7 @@
}
}
}
@@ -501,12 +_,18 @@
@@ -504,12 +_,18 @@
d0 = (double)i + aabb.f_82291_ + (double)0.1F;
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/player/LocalPlayer.java
+++ b/net/minecraft/client/player/LocalPlayer.java
@@ -149,6 +_,7 @@
@@ -151,6 +_,7 @@
}
public boolean m_6469_(DamageSource p_108662_, float p_108663_) {
@ -8,7 +8,7 @@
return false;
}
@@ -275,6 +_,7 @@
@@ -277,6 +_,7 @@
public boolean m_108700_(boolean p_108701_) {
ServerboundPlayerActionPacket.Action serverboundplayeractionpacket$action = p_108701_ ? ServerboundPlayerActionPacket.Action.DROP_ALL_ITEMS : ServerboundPlayerActionPacket.Action.DROP_ITEM;
@ -16,11 +16,11 @@
ItemStack itemstack = this.m_150109_().m_182403_(p_108701_);
this.f_108617_.m_104955_(new ServerboundPlayerActionPacket(serverboundplayeractionpacket$action, BlockPos.f_121853_, Direction.DOWN));
return !itemstack.m_41619_();
@@ -456,7 +_,14 @@
@@ -459,7 +_,14 @@
}
public void m_5496_(SoundEvent p_108651_, float p_108652_, float p_108653_) {
- this.f_19853_.m_7785_(this.m_20185_(), this.m_20186_(), this.m_20189_(), p_108651_, this.m_5720_(), p_108652_, p_108653_, false);
- this.m_9236_().m_7785_(this.m_20185_(), this.m_20186_(), this.m_20189_(), p_108651_, this.m_5720_(), p_108652_, p_108653_, false);
+ net.minecraft.core.Holder<SoundEvent> holder = net.minecraft.core.registries.BuiltInRegistries.f_256894_.m_263177_(p_108651_);
+ net.minecraftforge.event.PlayLevelSoundEvent.AtEntity event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, holder, this.m_5720_(), p_108652_, p_108653_);
+ if (event.isCanceled() || event.getSound() == null) return;
@ -28,11 +28,11 @@
+ SoundSource source = event.getSource();
+ p_108652_ = event.getNewVolume();
+ p_108653_ = event.getNewPitch();
+ this.f_19853_.m_7785_(this.m_20185_(), this.m_20186_(), this.m_20189_(), p_108651_, source, p_108652_, p_108653_, false);
+ this.m_9236_().m_7785_(this.m_20185_(), this.m_20186_(), this.m_20189_(), p_108651_, source, p_108652_, p_108653_, false);
}
public void m_6330_(SoundEvent p_108655_, SoundSource p_108656_, float p_108657_, float p_108658_) {
@@ -627,6 +_,7 @@
@@ -633,6 +_,7 @@
this.f_108601_ = !this.m_150110_().f_35935_ && !this.m_6069_() && this.m_20175_(Pose.CROUCHING) && (this.m_6144_() || !this.m_5803_() && !this.m_20175_(Pose.STANDING));
float f = Mth.m_14036_(0.3F + EnchantmentHelper.m_220302_(this), 0.0F, 1.0F);
this.f_108618_.m_214106_(this.m_108635_(), f);
@ -40,16 +40,16 @@
this.f_108619_.m_91301_().m_120586_(this.f_108618_);
if (this.m_6117_() && !this.m_20159_()) {
this.f_108618_.f_108566_ *= 0.2F;
@@ -655,7 +_,7 @@
@@ -661,7 +_,7 @@
boolean flag4 = this.m_264082_();
boolean flag5 = this.m_20159_() ? this.m_20202_().m_20096_() : this.f_19861_;
boolean flag5 = this.m_20159_() ? this.m_20202_().m_20096_() : this.m_20096_();
boolean flag6 = !flag1 && !flag2;
- if ((flag5 || this.m_5842_()) && flag6 && flag4) {
+ if ((flag5 || this.m_5842_() || this.canStartSwimming()) && flag6 && flag4) {
if (this.f_108583_ <= 0 && !this.f_108619_.f_91066_.f_92091_.m_90857_()) {
this.f_108583_ = 7;
} else {
@@ -663,15 +_,15 @@
@@ -669,15 +_,15 @@
}
}
@ -63,12 +63,12 @@
- boolean flag8 = flag7 || this.f_19862_ && !this.f_185931_ || this.m_20069_() && !this.m_5842_();
+ boolean flag8 = flag7 || this.f_19862_ && !this.f_185931_ || this.m_20069_() && !this.m_5842_() || (this.isInFluidType((fluidType, height) -> this.canSwimInFluidType(fluidType)) && !this.canStartSwimming());
if (this.m_6069_()) {
- if (!this.f_19861_ && !this.f_108618_.f_108573_ && flag7 || !this.m_20069_()) {
+ if (!this.f_19861_ && !this.f_108618_.f_108573_ && flag7 || !(this.m_20069_() || this.isInFluidType((fluidType, height) -> this.canSwimInFluidType(fluidType)))) {
- if (!this.m_20096_() && !this.f_108618_.f_108573_ && flag7 || !this.m_20069_()) {
+ if (!this.m_20096_() && !this.f_108618_.f_108573_ && flag7 || !(this.m_20069_() || this.isInFluidType((fluidType, height) -> this.canSwimInFluidType(fluidType)))) {
this.m_6858_(false);
}
} else if (flag8) {
@@ -701,14 +_,15 @@
@@ -707,14 +_,15 @@
if (this.f_108618_.f_108572_ && !flag9 && !flag && !this.m_150110_().f_35935_ && !this.m_20159_() && !this.m_6147_()) {
ItemStack itemstack = this.m_6844_(EquipmentSlot.CHEST);
@ -87,7 +87,7 @@
}
if (this.m_204029_(FluidTags.f_13131_)) {
@@ -819,6 +_,7 @@
@@ -814,6 +_,7 @@
public void m_6083_() {
super.m_6083_();
@ -95,7 +95,7 @@
this.f_108611_ = false;
Entity entity = this.m_275832_();
if (entity instanceof Boat boat) {
@@ -1044,6 +_,18 @@
@@ -1046,6 +_,18 @@
} else {
return super.m_7398_(p_108758_);
}

View file

@ -10,13 +10,13 @@
+ f_109011_ = fogColor.y();
+ f_109012_ = fogColor.z();
+
RenderSystem.m_69424_(f_109010_, f_109011_, f_109012_, 0.0F);
RenderSystem.clearColor(f_109010_, f_109011_, f_109012_, 0.0F);
}
@@ -271,6 +_,7 @@
RenderSystem.m_157445_(fogrenderer$fogdata.f_234200_);
RenderSystem.m_157443_(fogrenderer$fogdata.f_234201_);
RenderSystem.m_202160_(fogrenderer$fogdata.f_234202_);
RenderSystem.setShaderFogStart(fogrenderer$fogdata.f_234200_);
RenderSystem.setShaderFogEnd(fogrenderer$fogdata.f_234201_);
RenderSystem.setShaderFogShape(fogrenderer$fogdata.f_234202_);
+ net.minecraftforge.client.ForgeHooksClient.onFogRender(p_234174_, fogtype, p_234173_, p_234177_, p_234175_, fogrenderer$fogdata.f_234200_, fogrenderer$fogdata.f_234201_, fogrenderer$fogdata.f_234202_);
}

View file

@ -1,7 +1,10 @@
--- a/net/minecraft/client/renderer/GameRenderer.java
+++ b/net/minecraft/client/renderer/GameRenderer.java
@@ -304,6 +_,8 @@
@@ -307,8 +_,11 @@
this.m_109128_(new ResourceLocation("shaders/post/creeper.json"));
} else if (p_109107_ instanceof Spider) {
this.m_109128_(new ResourceLocation("shaders/post/spider.json"));
+ this.m_109128_(new ResourceLocation("shaders/post/spider.json"));
} else if (p_109107_ instanceof EnderMan) {
this.m_109128_(new ResourceLocation("shaders/post/invert.json"));
+ } else {
@ -9,15 +12,15 @@
}
}
@@ -597,6 +_,7 @@
list1.add(Pair.of(new ShaderInstance(p_250719_, "rendertype_crumbling", DefaultVertexFormat.f_85811_), (p_234230_) -> {
f_172607_ = p_234230_;
@@ -610,6 +_,7 @@
list1.add(Pair.of(new ShaderInstance(p_250719_, "rendertype_gui_ghost_recipe_overlay", DefaultVertexFormat.f_85815_), (p_286147_) -> {
f_285569_ = p_286147_;
}));
+ net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.RegisterShadersEvent(p_250719_, list1));
} catch (IOException ioexception) {
list1.forEach((p_172729_) -> {
p_172729_.getFirst().close();
@@ -673,12 +_,13 @@
@@ -686,12 +_,13 @@
this.f_109059_.m_91307_().m_6180_("pick");
this.f_109059_.f_91076_ = null;
double d0 = (double)this.f_109059_.f_91072_.m_105286_();
@ -33,7 +36,7 @@
d1 = 6.0D;
d0 = d1;
} else {
@@ -688,10 +_,19 @@
@@ -701,10 +_,19 @@
d0 = d0;
}
@ -54,7 +57,7 @@
}
Vec3 vec31 = entity.m_20252_(1.0F);
@@ -705,7 +_,7 @@
@@ -718,7 +_,7 @@
Entity entity1 = entityhitresult.m_82443_();
Vec3 vec33 = entityhitresult.m_82450_();
double d2 = vec3.m_82557_(vec33);
@ -63,7 +66,7 @@
this.f_109059_.f_91077_ = BlockHitResult.m_82426_(vec33, Direction.m_122366_(vec31.f_82479_, vec31.f_82480_, vec31.f_82481_), BlockPos.m_274446_(vec33));
} else if (d2 < d1 || this.f_109059_.f_91077_ == null) {
this.f_109059_.f_91077_ = entityhitresult;
@@ -759,7 +_,7 @@
@@ -772,7 +_,7 @@
d0 *= Mth.m_14139_(this.f_109059_.f_91066_.m_231925_().m_231551_(), 1.0D, (double)0.85714287F);
}
@ -72,31 +75,31 @@
}
}
@@ -894,12 +_,12 @@
@@ -907,12 +_,12 @@
Window window = this.f_109059_.m_91268_();
RenderSystem.m_69421_(256, Minecraft.f_91002_);
- Matrix4f matrix4f = (new Matrix4f()).setOrtho(0.0F, (float)((double)window.m_85441_() / window.m_85449_()), (float)((double)window.m_85442_() / window.m_85449_()), 0.0F, 1000.0F, 3000.0F);
RenderSystem.clear(256, Minecraft.f_91002_);
- Matrix4f matrix4f = (new Matrix4f()).setOrtho(0.0F, (float)((double)window.m_85441_() / window.m_85449_()), (float)((double)window.m_85442_() / window.m_85449_()), 0.0F, 1000.0F, 21000.0F);
+ Matrix4f matrix4f = (new Matrix4f()).setOrtho(0.0F, (float)((double)window.m_85441_() / window.m_85449_()), (float)((double)window.m_85442_() / window.m_85449_()), 0.0F, 1000.0F, net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
RenderSystem.m_252934_(matrix4f);
PoseStack posestack = RenderSystem.m_157191_();
RenderSystem.setProjectionMatrix(matrix4f, VertexSorting.f_276633_);
PoseStack posestack = RenderSystem.getModelViewStack();
posestack.m_85836_();
posestack.m_166856_();
- posestack.m_252880_(0.0F, 0.0F, -2000.0F);
- posestack.m_252880_(0.0F, 0.0F, -11000.0F);
+ posestack.m_85837_(0.0D, 0.0D, 1000F-net.minecraftforge.client.ForgeHooksClient.getGuiFarPlane());
RenderSystem.m_157182_();
RenderSystem.applyModelViewMatrix();
Lighting.m_84931_();
PoseStack posestack1 = new PoseStack();
@@ -935,7 +_,7 @@
GuiGraphics guigraphics = new GuiGraphics(this.f_109059_, this.f_109064_.m_110104_());
@@ -948,7 +_,7 @@
}
} else if (this.f_109059_.f_91080_ != null) {
try {
- this.f_109059_.f_91080_.m_257612_(posestack1, i, j, this.f_109059_.m_91297_());
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.f_109059_.f_91080_, posestack1, i, j, this.f_109059_.m_91297_());
- this.f_109059_.f_91080_.m_280264_(guigraphics, i, j, this.f_109059_.m_91297_());
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.f_109059_.f_91080_, guigraphics, i, j, this.f_109059_.m_91297_());
} catch (Throwable throwable1) {
CrashReport crashreport1 = CrashReport.m_127521_(throwable1, "Rendering screen");
CrashReportCategory crashreportcategory1 = crashreport1.m_127514_("Screen render details");
@@ -1085,12 +_,19 @@
@@ -1099,12 +_,18 @@
Matrix4f matrix4f = posestack.m_85850_().m_252922_();
this.m_252879_(matrix4f);
camera.m_90575_(this.f_109059_.f_91073_, (Entity)(this.f_109059_.m_91288_() == null ? this.f_109059_.f_91074_ : this.f_109059_.m_91288_()), !this.f_109059_.f_91066_.m_92176_().m_90612_(), this.f_109059_.f_91066_.m_92176_().m_90613_(), p_109090_);
@ -108,11 +111,10 @@
p_109092_.m_252781_(Axis.f_252529_.m_252977_(camera.m_90589_()));
p_109092_.m_252781_(Axis.f_252436_.m_252977_(camera.m_90590_() + 180.0F));
Matrix3f matrix3f = (new Matrix3f(p_109092_.m_85850_().m_252943_())).invert();
RenderSystem.m_253212_(matrix3f);
RenderSystem.setInverseViewRotationMatrix(matrix3f);
this.f_109059_.f_91060_.m_253210_(p_109092_, camera.m_90583_(), this.m_253088_(Math.max(d0, (double)this.f_109059_.f_91066_.m_231837_().m_231551_().intValue())));
this.f_109059_.f_91060_.m_109599_(p_109092_, p_109090_, p_109091_, flag, camera, this, this.f_109074_, matrix4f);
+ this.f_109059_.m_91307_().m_6182_("forge_render_last");
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(this.f_109059_.f_91060_, p_109092_, p_109090_, matrix4f, p_109091_);
this.f_109059_.m_91307_().m_6182_("hand");
if (this.f_109070_) {
RenderSystem.m_69421_(256, Minecraft.f_91002_);
RenderSystem.clear(256, Minecraft.f_91002_);

View file

@ -5,18 +5,18 @@
@OnlyIn(Dist.CLIENT)
public class ItemBlockRenderTypes {
+ @Deprecated
private static final Map<Block, RenderType> f_109275_ = Util.m_137469_(Maps.newHashMap(), (p_272331_) -> {
private static final Map<Block, RenderType> f_109275_ = Util.m_137469_(Maps.newHashMap(), (p_277225_) -> {
RenderType rendertype = RenderType.m_110503_();
p_272331_.put(Blocks.f_50267_, rendertype);
@@ -307,6 +_,7 @@
p_272331_.put(Blocks.f_50628_, rendertype3);
p_272331_.put(Blocks.f_152498_, rendertype3);
p_277225_.put(Blocks.f_50267_, rendertype);
@@ -310,6 +_,7 @@
p_277225_.put(Blocks.f_50628_, rendertype3);
p_277225_.put(Blocks.f_152498_, rendertype3);
});
+ @Deprecated
private static final Map<Fluid, RenderType> f_109276_ = Util.m_137469_(Maps.newHashMap(), (p_109290_) -> {
RenderType rendertype = RenderType.m_110466_();
p_109290_.put(Fluids.f_76192_, rendertype);
@@ -314,6 +_,8 @@
@@ -317,6 +_,8 @@
});
private static boolean f_109277_;
@ -25,7 +25,7 @@
public static RenderType m_109282_(BlockState p_109283_) {
Block block = p_109283_.m_60734_();
if (block instanceof LeavesBlock) {
@@ -324,6 +_,8 @@
@@ -327,6 +_,8 @@
}
}
@ -34,7 +34,7 @@
public static RenderType m_109293_(BlockState p_109294_) {
Block block = p_109294_.m_60734_();
if (block instanceof LeavesBlock) {
@@ -338,6 +_,8 @@
@@ -341,6 +_,8 @@
}
}
@ -43,7 +43,7 @@
public static RenderType m_109284_(BlockState p_109285_, boolean p_109286_) {
RenderType rendertype = m_109282_(p_109285_);
if (rendertype == RenderType.m_110466_()) {
@@ -351,6 +_,8 @@
@@ -354,6 +_,8 @@
}
}
@ -52,7 +52,7 @@
public static RenderType m_109279_(ItemStack p_109280_, boolean p_109281_) {
Item item = p_109280_.m_41720_();
if (item instanceof BlockItem) {
@@ -362,8 +_,73 @@
@@ -365,8 +_,73 @@
}
public static RenderType m_109287_(FluidState p_109288_) {
@ -79,7 +79,7 @@
+ });
+
+ /** @deprecated Use {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)}. */
+ @Deprecated(forRemoval = true, since = "1.19")
+ @Deprecated(since = "1.19")
+ public static net.minecraftforge.client.ChunkRenderTypeSet getRenderLayers(BlockState state) {
+ Block block = state.m_60734_();
+ if (block instanceof LeavesBlock) {
@ -90,20 +90,20 @@
+ }
+
+ /** @deprecated Set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) or override {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)} */
+ @Deprecated(forRemoval = true, since = "1.19")
+ @Deprecated(since = "1.19")
+ public static void setRenderLayer(Block block, RenderType type) {
+ com.google.common.base.Preconditions.checkArgument(type.getChunkLayerId() >= 0, "The argument must be a valid chunk render type returned by RenderType#chunkBufferLayers().");
+ setRenderLayer(block, net.minecraftforge.client.ChunkRenderTypeSet.of(type));
+ }
+
+ /** @deprecated Set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) or override {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)} */
+ @Deprecated(forRemoval = true, since = "1.19")
+ @Deprecated(since = "1.19")
+ public static synchronized void setRenderLayer(Block block, java.util.function.Predicate<RenderType> predicate) {
+ setRenderLayer(block, createSetFromPredicate(predicate));
+ }
+
+ /** @deprecated Set your render type in your block model's JSON (eg. {@code "render_type": "cutout"}) or override {@link net.minecraft.client.resources.model.BakedModel#getRenderTypes(BlockState, net.minecraft.util.RandomSource, net.minecraftforge.client.model.data.ModelData)} */
+ @Deprecated(forRemoval = true, since = "1.19")
+ @Deprecated(since = "1.19")
+ public static synchronized void setRenderLayer(Block block, net.minecraftforge.client.ChunkRenderTypeSet layers) {
+ checkClientLoading();
+ BLOCK_RENDER_TYPES.put(net.minecraftforge.registries.ForgeRegistries.BLOCKS.getDelegateOrThrow(block), layers);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/ItemInHandRenderer.java
+++ b/net/minecraft/client/renderer/ItemInHandRenderer.java
@@ -312,12 +_,14 @@
@@ -313,12 +_,14 @@
if (iteminhandrenderer$handrenderselection.f_172921_) {
float f4 = interactionhand == InteractionHand.MAIN_HAND ? f : 0.0F;
float f5 = 1.0F - Mth.m_14179_(p_109315_, this.f_109303_, this.f_109302_);
@ -15,7 +15,7 @@
this.m_109371_(p_109318_, p_109315_, f1, InteractionHand.OFF_HAND, f6, this.f_109301_, f7, p_109316_, p_109317_, p_109319_);
}
@@ -368,7 +_,7 @@
@@ -369,7 +_,7 @@
} else {
this.m_109353_(p_109379_, p_109380_, p_109381_, p_109378_, humanoidarm, p_109376_, p_109377_);
}
@ -24,7 +24,7 @@
boolean flag1 = CrossbowItem.m_40932_(p_109377_);
boolean flag2 = humanoidarm == HumanoidArm.RIGHT;
int i = flag2 ? 1 : -1;
@@ -410,6 +_,7 @@
@@ -411,6 +_,7 @@
this.m_269530_(p_109372_, p_109377_, flag2 ? ItemDisplayContext.FIRST_PERSON_RIGHT_HAND : ItemDisplayContext.FIRST_PERSON_LEFT_HAND, !flag2, p_109379_, p_109380_, p_109381_);
} else {
boolean flag3 = humanoidarm == HumanoidArm.RIGHT;
@ -32,7 +32,7 @@
if (p_109372_.m_6117_() && p_109372_.m_21212_() > 0 && p_109372_.m_7655_() == p_109375_) {
int k = flag3 ? 1 : -1;
switch (p_109377_.m_41780_()) {
@@ -516,8 +_,16 @@
@@ -517,8 +_,16 @@
this.f_109304_ = Mth.m_14036_(this.f_109304_ - 0.4F, 0.0F, 1.0F);
} else {
float f = localplayer.m_36403_(1.0F);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/LevelRenderer.java
+++ b/net/minecraft/client/renderer/LevelRenderer.java
@@ -265,6 +_,8 @@
@@ -267,6 +_,8 @@
}
private void m_109703_(LightTexture p_109704_, float p_109705_, double p_109706_, double p_109707_, double p_109708_) {
@ -9,7 +9,7 @@
float f = this.f_109461_.f_91073_.m_46722_(p_109705_);
if (!(f <= 0.0F)) {
p_109704_.m_109896_();
@@ -384,6 +_,8 @@
@@ -386,6 +_,8 @@
}
public void m_109693_(Camera p_109694_) {
@ -18,21 +18,21 @@
float f = this.f_109461_.f_91073_.m_46722_(1.0F) / (Minecraft.m_91405_() ? 1.0F : 2.0F);
if (!(f <= 0.0F)) {
RandomSource randomsource = RandomSource.m_216335_((long)this.f_109477_ * 312987231L);
@@ -1144,11 +_,13 @@
RenderSystem.m_69421_(16640, Minecraft.f_91002_);
@@ -1145,11 +_,13 @@
RenderSystem.clear(16640, Minecraft.f_91002_);
float f = p_109605_.m_109152_();
boolean flag2 = this.f_109461_.f_91073_.m_104583_().m_5781_(Mth.m_14107_(d0), Mth.m_14107_(d1)) || this.f_109461_.f_91065_.m_93090_().m_93715_();
+ FogRenderer.m_234172_(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2, p_109601_);
boolean flag1 = this.f_109461_.f_91073_.m_104583_().m_5781_(Mth.m_14107_(d0), Mth.m_14107_(d1)) || this.f_109461_.f_91065_.m_93090_().m_93715_();
+ FogRenderer.m_234172_(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag1, p_109601_);
profilerfiller.m_6182_("sky");
RenderSystem.m_157427_(GameRenderer::m_172808_);
this.m_202423_(p_109600_, p_254120_, p_109601_, p_109604_, flag2, () -> {
FogRenderer.m_234172_(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag2, p_109601_);
RenderSystem.setShader(GameRenderer::m_172808_);
this.m_202423_(p_109600_, p_254120_, p_109601_, p_109604_, flag1, () -> {
FogRenderer.m_234172_(p_109604_, FogRenderer.FogMode.FOG_SKY, f, flag1, p_109601_);
});
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_SKY, this, p_109600_, p_254120_, this.f_109477_, p_109604_, frustum);
profilerfiller.m_6182_("fog");
FogRenderer.m_234172_(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f, 32.0F), flag2, p_109601_);
FogRenderer.m_234172_(p_109604_, FogRenderer.FogMode.FOG_TERRAIN, Math.max(f, 32.0F), flag1, p_109601_);
profilerfiller.m_6182_("terrain_setup");
@@ -1157,7 +_,9 @@
@@ -1158,7 +_,9 @@
this.m_194370_(p_109604_);
profilerfiller.m_6182_("terrain");
this.m_172993_(RenderType.m_110451_(), p_109600_, d0, d1, d2, p_254120_);
@ -42,7 +42,7 @@
this.m_172993_(RenderType.m_110463_(), p_109600_, d0, d1, d2, p_254120_);
if (this.f_109465_.m_104583_().m_108885_()) {
Lighting.m_252995_(p_109600_.m_85850_().m_252922_());
@@ -1189,7 +_,7 @@
@@ -1190,7 +_,7 @@
for(Entity entity : this.f_109465_.m_104735_()) {
if (this.f_109463_.m_114397_(entity, frustum, d0, d1, d2) || entity.m_20367_(this.f_109461_.f_91074_)) {
BlockPos blockpos = entity.m_20183_();
@ -51,17 +51,17 @@
++this.f_109439_;
if (entity.f_19797_ == 0) {
entity.f_19790_ = entity.m_20185_();
@@ -1205,6 +_,9 @@
@@ -1206,6 +_,9 @@
int i = entity.m_19876_();
outlinebuffersource.m_109929_(FastColor.ARGB32.m_13665_(i), FastColor.ARGB32.m_13667_(i), FastColor.ARGB32.m_13669_(i), 255);
} else {
+ if (this.m_109817_() && entity.hasCustomOutlineRendering(this.f_109461_.f_91074_)) { // FORGE: allow custom outline rendering
+ flag3 = true;
+ flag2 = true;
+ }
multibuffersource = multibuffersource$buffersource;
}
@@ -1219,12 +_,14 @@
@@ -1220,12 +_,14 @@
multibuffersource$buffersource.m_109912_(RenderType.m_110452_(TextureAtlas.f_118259_));
multibuffersource$buffersource.m_109912_(RenderType.m_110458_(TextureAtlas.f_118259_));
multibuffersource$buffersource.m_109912_(RenderType.m_110476_(TextureAtlas.f_118259_));
@ -76,17 +76,17 @@
BlockPos blockpos4 = blockentity1.m_58899_();
MultiBufferSource multibuffersource1 = multibuffersource$buffersource;
p_109600_.m_85836_();
@@ -1241,6 +_,9 @@
@@ -1242,6 +_,9 @@
};
}
}
+ if (this.m_109817_() && blockentity1.hasCustomOutlineRendering(this.f_109461_.f_91074_)) { // FORGE: allow custom outline rendering
+ flag3 = true;
+ flag2 = true;
+ }
this.f_172946_.m_112267_(blockentity1, p_109601_, p_109600_, multibuffersource1);
p_109600_.m_85849_();
@@ -1250,9 +_,13 @@
@@ -1251,9 +_,13 @@
synchronized(this.f_109468_) {
for(BlockEntity blockentity : this.f_109468_) {
@ -95,12 +95,12 @@
p_109600_.m_85836_();
p_109600_.m_85837_((double)blockpos3.m_123341_() - d0, (double)blockpos3.m_123342_() - d1, (double)blockpos3.m_123343_() - d2);
+ if (this.m_109817_() && blockentity.hasCustomOutlineRendering(this.f_109461_.f_91074_)) { // FORGE: allow custom outline rendering
+ flag3 = true;
+ flag2 = true;
+ }
this.f_172946_.m_112267_(blockentity, p_109601_, p_109600_, multibuffersource$buffersource);
p_109600_.m_85849_();
}
@@ -1275,6 +_,7 @@
@@ -1276,6 +_,7 @@
this.f_109461_.m_91385_().m_83947_(false);
}
@ -108,7 +108,7 @@
profilerfiller.m_6182_("destroyProgress");
for(Long2ObjectMap.Entry<SortedSet<BlockDestructionProgress>> entry : this.f_109409_.long2ObjectEntrySet()) {
@@ -1290,7 +_,8 @@
@@ -1291,7 +_,8 @@
p_109600_.m_85837_((double)blockpos2.m_123341_() - d0, (double)blockpos2.m_123342_() - d1, (double)blockpos2.m_123343_() - d2);
PoseStack.Pose posestack$pose1 = p_109600_.m_85850_();
VertexConsumer vertexconsumer1 = new SheetedDecalTextureGenerator(this.f_109464_.m_110108_().m_6299_(ModelBakery.f_119229_.get(k)), posestack$pose1.m_252922_(), posestack$pose1.m_252943_(), 1.0F);
@ -118,7 +118,7 @@
p_109600_.m_85849_();
}
}
@@ -1302,10 +_,13 @@
@@ -1303,10 +_,13 @@
profilerfiller.m_6182_("outline");
BlockPos blockpos1 = ((BlockHitResult)hitresult).m_82425_();
BlockState blockstate = this.f_109465_.m_8055_(blockpos1);
@ -132,7 +132,7 @@
}
this.f_109461_.f_91064_.m_113457_(p_109600_, multibuffersource$buffersource, d0, d1, d2);
@@ -1337,7 +_,8 @@
@@ -1338,7 +_,8 @@
this.f_109415_.m_83945_(this.f_109461_.m_91385_());
RenderStateShard.f_110126_.m_110185_();
profilerfiller.m_6182_("particles");
@ -142,7 +142,7 @@
RenderStateShard.f_110126_.m_110188_();
} else {
profilerfiller.m_6182_("translucent");
@@ -1351,7 +_,8 @@
@@ -1352,7 +_,8 @@
profilerfiller.m_6182_("string");
this.m_172993_(RenderType.m_110503_(), p_109600_, d0, d1, d2, p_254120_);
profilerfiller.m_6182_("particles");
@ -152,7 +152,7 @@
}
posestack.m_85836_();
@@ -1375,6 +_,7 @@
@@ -1376,6 +_,7 @@
RenderStateShard.f_110127_.m_110185_();
profilerfiller.m_6182_("weather");
this.m_109703_(p_109606_, p_109601_, d0, d1, d2);
@ -160,15 +160,15 @@
this.m_173012_(p_109604_);
RenderStateShard.f_110127_.m_110188_();
this.f_109418_.m_110023_(p_109601_);
@@ -1383,6 +_,7 @@
RenderSystem.m_69458_(false);
@@ -1384,6 +_,7 @@
RenderSystem.depthMask(false);
profilerfiller.m_6182_("weather");
this.m_109703_(p_109606_, p_109601_, d0, d1, d2);
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderStage(net.minecraftforge.client.event.RenderLevelStageEvent.Stage.AFTER_WEATHER, this, p_109600_, p_254120_, this.f_109477_, p_109604_, frustum);
this.m_173012_(p_109604_);
RenderSystem.m_69458_(true);
RenderSystem.depthMask(true);
}
@@ -1526,6 +_,7 @@
@@ -1527,6 +_,7 @@
shaderinstance.m_173362_();
VertexBuffer.m_85931_();
this.f_109461_.m_91307_().m_7238_();
@ -176,7 +176,7 @@
p_172994_.m_110188_();
}
@@ -1740,6 +_,8 @@
@@ -1741,6 +_,8 @@
}
public void m_202423_(PoseStack p_202424_, Matrix4f p_254034_, float p_202426_, Camera p_202427_, boolean p_202428_, Runnable p_202429_) {
@ -185,7 +185,7 @@
p_202429_.run();
if (!p_202428_) {
FogType fogtype = p_202427_.m_167685_();
@@ -1861,6 +_,8 @@
@@ -1862,6 +_,8 @@
}
public void m_253054_(PoseStack p_254145_, Matrix4f p_254537_, float p_254364_, double p_253843_, double p_253663_, double p_253795_) {
@ -193,8 +193,8 @@
+ return;
float f = this.f_109465_.m_104583_().m_108871_();
if (!Float.isNaN(f)) {
RenderSystem.m_69464_();
@@ -2047,7 +_,7 @@
RenderSystem.disableCull();
@@ -2049,7 +_,7 @@
boolean flag = false;
if (this.f_109461_.f_91066_.m_232080_().m_231551_() == PrioritizeChunkUpdates.NEARBY) {
BlockPos blockpos1 = chunkrenderdispatcher$renderchunk.m_112839_().m_7918_(8, 8, 8);
@ -203,7 +203,7 @@
} else if (this.f_109461_.f_91066_.m_232080_().m_231551_() == PrioritizeChunkUpdates.PLAYER_AFFECTED) {
flag = chunkrenderdispatcher$renderchunk.m_112842_();
}
@@ -2354,7 +_,12 @@
@@ -2396,7 +_,12 @@
this.f_109469_.m_110859_(p_109502_, p_109503_, p_109504_, p_109505_);
}
@ -216,7 +216,7 @@
SoundInstance soundinstance = this.f_109410_.get(p_109516_);
if (soundinstance != null) {
this.f_109461_.m_91106_().m_120399_(soundinstance);
@@ -2362,7 +_,7 @@
@@ -2404,7 +_,7 @@
}
if (p_109515_ != null) {
@ -225,7 +225,7 @@
if (recorditem != null) {
this.f_109461_.f_91065_.m_93055_(recorditem.m_43050_());
}
@@ -2503,7 +_,7 @@
@@ -2541,7 +_,7 @@
case 1010:
Item item = Item.m_41445_(p_234307_);
if (item instanceof RecordItem recorditem) {
@ -234,16 +234,16 @@
}
break;
case 1011:
@@ -2656,7 +_,7 @@
@@ -2694,7 +_,7 @@
case 2001:
BlockState blockstate = Block.m_49803_(p_234307_);
if (!blockstate.m_60795_()) {
- SoundType soundtype = blockstate.m_60827_();
+ SoundType soundtype = blockstate.getSoundType(this.f_109465_, p_234306_, null);
BlockState blockstate1 = Block.m_49803_(p_234307_);
if (!blockstate1.m_60795_()) {
- SoundType soundtype = blockstate1.m_60827_();
+ SoundType soundtype = blockstate1.getSoundType(this.f_109465_, p_234306_, null);
this.f_109465_.m_245747_(p_234306_, soundtype.m_56775_(), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 2.0F, soundtype.m_56774_() * 0.8F, false);
}
@@ -2875,7 +_,7 @@
@@ -2925,7 +_,7 @@
} else {
int i = p_109538_.m_45517_(LightLayer.SKY, p_109540_);
int j = p_109538_.m_45517_(LightLayer.BLOCK, p_109540_);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/client/renderer/RenderType.java
+++ b/net/minecraft/client/renderer/RenderType.java
@@ -308,7 +_,7 @@
@@ -314,7 +_,7 @@
}
public static RenderType m_110497_(ResourceLocation p_110498_) {
@ -9,7 +9,7 @@
}
public static RenderType m_269058_() {
@@ -316,19 +_,19 @@
@@ -322,19 +_,19 @@
}
public static RenderType m_173237_(ResourceLocation p_173238_) {
@ -33,7 +33,7 @@
}
public static RenderType m_269508_() {
@@ -336,7 +_,7 @@
@@ -342,7 +_,7 @@
}
public static RenderType m_173240_(ResourceLocation p_173241_) {
@ -42,7 +42,7 @@
}
public static RenderType m_110502_() {
@@ -635,4 +_,17 @@
@@ -669,4 +_,17 @@
return this.f_110696_;
}
}

View file

@ -40,8 +40,8 @@
for(int i = 0; i < 8; ++i) {
@@ -59,7 +_,7 @@
blockpos$mutableblockpos.m_122169_(d0, d1, d2);
BlockState blockstate = p_110717_.f_19853_.m_8055_(blockpos$mutableblockpos);
if (blockstate.m_60799_() != RenderShape.INVISIBLE && blockstate.m_60831_(p_110717_.f_19853_, blockpos$mutableblockpos)) {
BlockState blockstate = p_110717_.m_9236_().m_8055_(blockpos$mutableblockpos);
if (blockstate.m_60799_() != RenderShape.INVISIBLE && blockstate.m_60831_(p_110717_.m_9236_(), blockpos$mutableblockpos)) {
- return blockstate;
+ return org.apache.commons.lang3.tuple.Pair.of(blockstate, blockpos$mutableblockpos.m_7949_());
}
@ -55,9 +55,9 @@
+ }
+
+ public static void renderFluid(Minecraft p_110726_, PoseStack p_110727_, ResourceLocation texture) {
RenderSystem.m_157427_(GameRenderer::m_172817_);
- RenderSystem.m_157456_(0, f_110714_);
+ RenderSystem.m_157456_(0, texture);
RenderSystem.setShader(GameRenderer::m_172817_);
- RenderSystem.setShaderTexture(0, f_110714_);
+ RenderSystem.setShaderTexture(0, texture);
BufferBuilder bufferbuilder = Tesselator.m_85913_().m_85915_();
BlockPos blockpos = BlockPos.m_274561_(p_110726_.f_91074_.m_20185_(), p_110726_.f_91074_.m_20188_(), p_110726_.f_91074_.m_20189_());
float f = LightTexture.m_234316_(p_110726_.f_91074_.f_19853_.m_6042_(), p_110726_.f_91074_.f_19853_.m_46803_(blockpos));
float f = LightTexture.m_234316_(p_110726_.f_91074_.m_9236_().m_6042_(), p_110726_.f_91074_.m_9236_().m_46803_(blockpos));

View file

@ -9,7 +9,7 @@
this.f_110901_ = new LiquidBlockRenderer();
}
@@ -45,19 +_,30 @@
@@ -45,19 +_,27 @@
return this.f_110899_;
}
@ -31,14 +31,11 @@
+ renderBatched(p_234356_, p_234357_, p_234358_, p_234359_, p_234360_, p_234361_, p_234362_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
+ }
+ public void renderBatched(BlockState p_234356_, BlockPos p_234357_, BlockAndTintGetter p_234358_, PoseStack p_234359_, VertexConsumer p_234360_, boolean p_234361_, RandomSource p_234362_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) {
+ renderBatched(p_234356_, p_234357_, p_234358_, p_234359_, p_234360_, p_234361_, p_234362_, modelData, renderType, true);
+ }
+ public void renderBatched(BlockState p_234356_, BlockPos p_234357_, BlockAndTintGetter p_234358_, PoseStack p_234359_, VertexConsumer p_234360_, boolean p_234361_, RandomSource p_234362_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType, boolean queryModelSpecificData) { // TODO 1.20: Move to the signature above
try {
RenderShape rendershape = p_234356_.m_60799_();
if (rendershape == RenderShape.MODEL) {
- this.f_110900_.m_234379_(p_234358_, this.m_110910_(p_234356_), p_234356_, p_234357_, p_234359_, p_234360_, p_234361_, p_234362_, p_234356_.m_60726_(p_234357_), OverlayTexture.f_118083_);
+ this.f_110900_.tesselateBlock(p_234358_, this.m_110910_(p_234356_), p_234356_, p_234357_, p_234359_, p_234360_, p_234361_, p_234362_, p_234356_.m_60726_(p_234357_), OverlayTexture.f_118083_, modelData, renderType, queryModelSpecificData); // TODO 1.20: Remove last argument
+ this.f_110900_.tesselateBlock(p_234358_, this.m_110910_(p_234356_), p_234356_, p_234357_, p_234359_, p_234360_, p_234361_, p_234362_, p_234356_.m_60726_(p_234357_), OverlayTexture.f_118083_, modelData, renderType);
}
} catch (Throwable throwable) {

View file

@ -1,41 +1,30 @@
--- a/net/minecraft/client/renderer/block/ModelBlockRenderer.java
+++ b/net/minecraft/client/renderer/block/ModelBlockRenderer.java
@@ -40,72 +_,88 @@
@@ -40,16 +_,20 @@
this.f_110995_ = p_110999_;
}
+ @Deprecated //Forge: Model data and render type parameter
public void m_234379_(BlockAndTintGetter p_234380_, BakedModel p_234381_, BlockState p_234382_, BlockPos p_234383_, PoseStack p_234384_, VertexConsumer p_234385_, boolean p_234386_, RandomSource p_234387_, long p_234388_, int p_234389_) {
- boolean flag = Minecraft.m_91086_() && p_234382_.m_60791_() == 0 && p_234381_.m_7541_();
- Vec3 vec3 = p_234382_.m_60824_(p_234380_, p_234383_);
- p_234384_.m_85837_(vec3.f_82479_, vec3.f_82480_, vec3.f_82481_);
+ tesselateBlock(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_, net.minecraftforge.client.model.data.ModelData.EMPTY, null);
+ }
+ public void tesselateBlock(BlockAndTintGetter p_111048_, BakedModel p_111049_, BlockState p_111050_, BlockPos p_111051_, PoseStack p_111052_, VertexConsumer p_111053_, boolean p_111054_, RandomSource p_111055_, long p_111056_, int p_111057_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) {
+ tesselateBlock(p_111048_, p_111049_, p_111050_, p_111051_, p_111052_, p_111053_, p_111054_, p_111055_, p_111056_, p_111057_, modelData, renderType, true);
+ }
+ public void tesselateBlock(BlockAndTintGetter p_111048_, BakedModel p_111049_, BlockState p_111050_, BlockPos p_111051_, PoseStack p_111052_, VertexConsumer p_111053_, boolean p_111054_, RandomSource p_111055_, long p_111056_, int p_111057_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType, boolean queryModelSpecificData) { // TODO 1.20: Move to the signature above
+ boolean flag = Minecraft.m_91086_() && p_111050_.getLightEmission(p_111048_, p_111051_) == 0 && p_111049_.useAmbientOcclusion(p_111050_, renderType);
+ Vec3 vec3 = p_111050_.m_60824_(p_111048_, p_111051_);
+ p_111052_.m_85837_(vec3.f_82479_, vec3.f_82480_, vec3.f_82481_);
+ if (queryModelSpecificData) modelData = p_111049_.getModelData(p_111048_, p_111051_, p_111050_, modelData); // TODO 1.20: Remove this line entirely
+ public void tesselateBlock(BlockAndTintGetter p_234380_, BakedModel p_234381_, BlockState p_234382_, BlockPos p_234383_, PoseStack p_234384_, VertexConsumer p_234385_, boolean p_234386_, RandomSource p_234387_, long p_234388_, int p_234389_, net.minecraftforge.client.model.data.ModelData modelData, net.minecraft.client.renderer.RenderType renderType) {
+ boolean flag = Minecraft.m_91086_() && p_234382_.getLightEmission(p_234380_, p_234383_) == 0 && p_234381_.useAmbientOcclusion(p_234382_, renderType);
Vec3 vec3 = p_234382_.m_60824_(p_234380_, p_234383_);
p_234384_.m_85837_(vec3.f_82479_, vec3.f_82480_, vec3.f_82481_);
try {
if (flag) {
- this.m_234390_(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_);
+ this.tesselateWithAO(p_111048_, p_111049_, p_111050_, p_111051_, p_111052_, p_111053_, p_111054_, p_111055_, p_111056_, p_111057_, modelData, renderType);
+ this.tesselateWithAO(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_, modelData, renderType);
} else {
- this.m_234401_(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_);
+ this.tesselateWithoutAO(p_111048_, p_111049_, p_111050_, p_111051_, p_111052_, p_111053_, p_111054_, p_111055_, p_111056_, p_111057_, modelData, renderType);
+ this.tesselateWithoutAO(p_234380_, p_234381_, p_234382_, p_234383_, p_234384_, p_234385_, p_234386_, p_234387_, p_234388_, p_234389_, modelData, renderType);
}
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.m_127521_(throwable, "Tesselating block model");
CrashReportCategory crashreportcategory = crashreport.m_127514_("Block model being tesselated");
- CrashReportCategory.m_178950_(crashreportcategory, p_234380_, p_234383_, p_234382_);
+ CrashReportCategory.m_178950_(crashreportcategory, p_111048_, p_111051_, p_111050_);
crashreportcategory.m_128159_("Using AO", flag);
throw new ReportedException(crashreport);
@@ -61,51 +_,59 @@
}
}

View file

@ -1,11 +1,10 @@
--- a/net/minecraft/client/renderer/block/model/BlockElement.java
+++ b/net/minecraft/client/renderer/block/model/BlockElement.java
@@ -28,14 +_,22 @@
@@ -28,14 +_,21 @@
public final Map<Direction, BlockElementFace> f_111310_;
public final BlockElementRotation f_111311_;
public final boolean f_111312_;
+ @Deprecated // TODO: 1.20 - Make private. Use getter / setter methods to access.
+ public net.minecraftforge.client.model.ForgeFaceData faceData;
+ private net.minecraftforge.client.model.ForgeFaceData faceData;
public BlockElement(Vector3f p_253626_, Vector3f p_254426_, Map<Direction, BlockElementFace> p_254454_, @Nullable BlockElementRotation p_254229_, boolean p_253661_) {
+ this(p_253626_, p_254426_, p_254454_, p_254229_, p_253661_, net.minecraftforge.client.model.ForgeFaceData.DEFAULT);

Some files were not shown because too many files have changed in this diff Show more