diff --git a/.gitignore b/.gitignore index 861ac5157c..73173af0a6 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/build.gradle b/build.gradle index bd5d1462aa..99fa425030 100644 --- a/build.gradle +++ b/build.gradle @@ -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. diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 4affbef0f3..7faf142df1 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -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' } \ No newline at end of file diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodeFinder.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodeFinder.groovy index 2d5881dc21..8afa3d94bb 100644 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodeFinder.groovy +++ b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/BytecodeFinder.groovy @@ -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") }) diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/FixPatchImports.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/FixPatchImports.groovy new file mode 100644 index 0000000000..ed65bdd9aa --- /dev/null +++ b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/FixPatchImports.groovy @@ -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) + } + } + } + } +} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/Util.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/Util.groovy index ae23d34ee5..8b66408515 100644 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/Util.groovy +++ b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/Util.groovy @@ -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: [ diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckATs.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckATs.groovy index 96f557d7e5..1eacac6daa 100644 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckATs.groovy +++ b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckATs.groovy @@ -171,7 +171,7 @@ abstract class CheckATs extends CheckTask { } private static List joinBack(TreeMap lines, Map inheritance, IMappingFile mappings) { - final data = [] + final data = [] as List final remapComment = { ATParser.Entry entry -> if (!mappings || !entry || !entry.desc) return null final comment = entry.comment?.substring(1)?.trim() diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckTask.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckTask.groovy index 27548c04f3..0242d0ad26 100644 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckTask.groovy +++ b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/checks/CheckTask.groovy @@ -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") } } diff --git a/docs/README.md b/docs/README.md index b2be2bd435..f06cb378dd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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] diff --git a/fmlcore/build.gradle b/fmlcore/build.gradle index 19d73203d0..ba19ceafd0 100644 --- a/fmlcore/build.gradle +++ b/fmlcore/build.gradle @@ -44,6 +44,7 @@ ext { } jar.doFirst { + manifest.attributes['Automatic-Module-Name'] = project.name MANIFESTS.each { pkg, values -> if (pkg == '') manifest.attributes(values) diff --git a/fmlcore/src/main/java/net/minecraftforge/fml/DeferredWorkQueue.java b/fmlcore/src/main/java/net/minecraftforge/fml/DeferredWorkQueue.java index b8e918316f..8b43e4c83a 100644 --- a/fmlcore/src/main/java/net/minecraftforge/fml/DeferredWorkQueue.java +++ b/fmlcore/src/main/java/net/minecraftforge/fml/DeferredWorkQueue.java @@ -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); } diff --git a/fmlloader/build.gradle b/fmlloader/build.gradle index fffb7f172f..aa1949e855 100644 --- a/fmlloader/build.gradle +++ b/fmlloader/build.gradle @@ -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) } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLPaths.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLPaths.java index 1f2b3c5a9c..01aa8c636d 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLPaths.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FMLPaths.java @@ -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); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FileUtils.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FileUtils.java index 628c7e457c..570d8d3789 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/FileUtils.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/FileUtils.java @@ -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(); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonClientLaunchHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonClientLaunchHandler.java index 19c08bc8e4..0d2b455354 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonClientLaunchHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonClientLaunchHandler.java @@ -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); }; } diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonDevLaunchHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonDevLaunchHandler.java index 3d7aa23729..43f6c578c8 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonDevLaunchHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonDevLaunchHandler.java @@ -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; diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonLaunchHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonLaunchHandler.java index 411c4a2374..1d8b7fea7c 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonLaunchHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonLaunchHandler.java @@ -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> getModClasses() { final String modClasses = Optional.ofNullable(System.getenv("MOD_CLASSES")).orElse(""); LOGGER.debug(LogMarkers.CORE, "Got mod coordinates {} from env", modClasses); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonServerLaunchHandler.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonServerLaunchHandler.java index 24fae56c5f..c8f028709c 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonServerLaunchHandler.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/targets/CommonServerLaunchHandler.java @@ -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); }; } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832f0..943f0cbfa7 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..37aef8d3f0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/gradlew b/gradlew index a69d9cb6c2..65dcd68d65 100755 --- a/gradlew +++ b/gradlew @@ -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 diff --git a/gradlew.bat b/gradlew.bat index f127cfd49d..93e3f59f13 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -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% diff --git a/javafmllanguage/build.gradle b/javafmllanguage/build.gradle index 20434dc136..f0134a14d6 100644 --- a/javafmllanguage/build.gradle +++ b/javafmllanguage/build.gradle @@ -41,6 +41,7 @@ ext { } jar.doFirst { + manifest.attributes['Automatic-Module-Name'] = project.name MANIFESTS.each { pkg, values -> if (pkg == '') manifest.attributes(values) diff --git a/lowcodelanguage/build.gradle b/lowcodelanguage/build.gradle index 4fa108ece3..8ef4b32f19 100644 --- a/lowcodelanguage/build.gradle +++ b/lowcodelanguage/build.gradle @@ -39,6 +39,7 @@ ext { } jar.doFirst { + manifest.attributes['Automatic-Module-Name'] = project.name MANIFESTS.each { pkg, values -> if (pkg == '') manifest.attributes(values) diff --git a/mclanguage/build.gradle b/mclanguage/build.gradle index 2e386543e5..0df6fc7904 100644 --- a/mclanguage/build.gradle +++ b/mclanguage/build.gradle @@ -41,6 +41,7 @@ ext { } jar.doFirst { + manifest.attributes['Automatic-Module-Name'] = project.name MANIFESTS.each { pkg, values -> if (pkg == '') manifest.attributes(values) diff --git a/mdk/build.gradle b/mdk/build.gradle index 6a755353c7..6da6a06e0f 100644 --- a/mdk/build.gradle +++ b/mdk/build.gradle @@ -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") ]) } diff --git a/mdk/gradle.properties b/mdk/gradle.properties index 878bf1f7ec..f774ba3855 100644 --- a/mdk/gradle.properties +++ b/mdk/gradle.properties @@ -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 \ No newline at end of file +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. \ No newline at end of file diff --git a/mdk/settings.gradle b/mdk/settings.gradle index 3703f364a9..291d399dbb 100644 --- a/mdk/settings.gradle +++ b/mdk/settings.gradle @@ -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' } \ No newline at end of file diff --git a/mdk/src/main/java/com/example/examplemod/ExampleMod.java b/mdk/src/main/java/com/example/examplemod/ExampleMod.java index 44199e6750..d3453705a7 100644 --- a/mdk/src/main/java/com/example/examplemod/ExampleMod.java +++ b/mdk/src/main/java/com/example/examplemod/ExampleMod.java @@ -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 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 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 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 EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); + public static final RegistryObject 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 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 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 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); } diff --git a/mdk/src/main/resources/META-INF/mods.toml b/mdk/src/main/resources/META-INF/mods.toml index dfdb0384f3..3f5f56d7b1 100644 --- a/mdk/src/main/resources/META-INF/mods.toml +++ b/mdk/src/main/resources/META-INF/mods.toml @@ -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" diff --git a/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch b/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch index 255fa4efb3..299bd9f951 100644 --- a/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/pipeline/RenderTarget.java.patch @@ -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_; } diff --git a/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch b/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch index 989a90c8ec..4b63f12c0d 100644 --- a/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/platform/GlStateManager.java.patch @@ -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_) { diff --git a/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch b/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch index f6b8fa7f5e..16b6094da3 100644 --- a/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/platform/Window.java.patch @@ -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; diff --git a/patches/minecraft/com/mojang/blaze3d/vertex/BufferBuilder.java.patch b/patches/minecraft/com/mojang/blaze3d/vertex/BufferBuilder.java.patch index 4beead2555..c1187c06c3 100644 --- a/patches/minecraft/com/mojang/blaze3d/vertex/BufferBuilder.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/vertex/BufferBuilder.java.patch @@ -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_; } } + diff --git a/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch b/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch index 2b57d3de3d..6b9314c0b1 100644 --- a/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch +++ b/patches/minecraft/com/mojang/blaze3d/vertex/VertexFormat.java.patch @@ -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; } } diff --git a/patches/minecraft/com/mojang/math/Transformation.java.patch b/patches/minecraft/com/mojang/math/Transformation.java.patch index 6f77b734da..441d972424 100644 --- a/patches/minecraft/com/mojang/math/Transformation.java.patch +++ b/patches/minecraft/com/mojang/math/Transformation.java.patch @@ -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 f_268453_ = RecordCodecBuilder.create((p_269604_) -> { return p_269604_.group(ExtraCodecs.f_252432_.fieldOf("translation").forGetter((p_269599_) -> { diff --git a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch index fddf8f70ab..400d2f8632 100644 --- a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch +++ b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java.patch @@ -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); diff --git a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java.patch b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java.patch index 55671954eb..515f84357f 100644 --- a/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java.patch +++ b/patches/minecraft/com/mojang/realmsclient/gui/screens/RealmsNotificationsScreen.java.patch @@ -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() { diff --git a/patches/minecraft/net/minecraft/SharedConstants.java.patch b/patches/minecraft/net/minecraft/SharedConstants.java.patch index 9010dcb701..eec4c0f201 100644 --- a/patches/minecraft/net/minecraft/SharedConstants.java.patch +++ b/patches/minecraft/net/minecraft/SharedConstants.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/SharedConstants.java +++ b/net/minecraft/SharedConstants.java -@@ -205,6 +_,7 @@ +@@ -210,6 +_,7 @@ } static { diff --git a/patches/minecraft/net/minecraft/Util.java.patch b/patches/minecraft/net/minecraft/Util.java.patch index 1467c6c9ef..96a308ef35 100644 --- a/patches/minecraft/net/minecraft/Util.java.patch +++ b/patches/minecraft/net/minecraft/Util.java.patch @@ -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) { diff --git a/patches/minecraft/net/minecraft/advancements/Advancement.java.patch b/patches/minecraft/net/minecraft/advancements/Advancement.java.patch index 601c037b38..99f9099a92 100644 --- a/patches/minecraft/net/minecraft/advancements/Advancement.java.patch +++ b/patches/minecraft/net/minecraft/advancements/Advancement.java.patch @@ -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}. */ diff --git a/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch b/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch index 8e49614e08..e9505601ae 100644 --- a/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch +++ b/patches/minecraft/net/minecraft/advancements/AdvancementRewards.java.patch @@ -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_) { diff --git a/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch b/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch index a2336600d7..f455031da3 100644 --- a/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch +++ b/patches/minecraft/net/minecraft/client/ClientBrandRetriever.java.patch @@ -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(); } diff --git a/patches/minecraft/net/minecraft/client/KeyMapping.java.patch b/patches/minecraft/net/minecraft/client/KeyMapping.java.patch index 3cb1e05a53..0ba9b755a7 100644 --- a/patches/minecraft/net/minecraft/client/KeyMapping.java.patch +++ b/patches/minecraft/net/minecraft/client/KeyMapping.java.patch @@ -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 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_; } diff --git a/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch b/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch index fc160abf2b..4c2d018d8d 100644 --- a/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch +++ b/patches/minecraft/net/minecraft/client/KeyboardHandler.java.patch @@ -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 @@ } } } diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index bb7e7f43b9..b0a136b1c3 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -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_() { diff --git a/patches/minecraft/net/minecraft/client/Options.java.patch b/patches/minecraft/net/minecraft/client/Options.java.patch index a405230e79..31c95f1198 100644 --- a/patches/minecraft/net/minecraft/client/Options.java.patch +++ b/patches/minecraft/net/minecraft/client/Options.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/client/ToggleKeyMapping.java.patch b/patches/minecraft/net/minecraft/client/ToggleKeyMapping.java.patch index 89dd794f71..00765d3917 100644 --- a/patches/minecraft/net/minecraft/client/ToggleKeyMapping.java.patch +++ b/patches/minecraft/net/minecraft/client/ToggleKeyMapping.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/client/gui/Font.java.patch b/patches/minecraft/net/minecraft/client/gui/Font.java.patch index 4f198f6b3e..908208beee 100644 --- a/patches/minecraft/net/minecraft/client/gui/Font.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/Font.java.patch @@ -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_; } diff --git a/patches/minecraft/net/minecraft/client/gui/Gui.java.patch b/patches/minecraft/net/minecraft/client/gui/Gui.java.patch index 919977f651..2261c3a4b4 100644 --- a/patches/minecraft/net/minecraft/client/gui/Gui.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/Gui.java.patch @@ -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; diff --git a/patches/minecraft/net/minecraft/client/gui/GuiGraphics.java.patch b/patches/minecraft/net/minecraft/client/gui/GuiGraphics.java.patch new file mode 100644 index 0000000000..67620ea4d3 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/gui/GuiGraphics.java.patch @@ -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 textComponents, Optional 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 p_282716_, Optional p_281682_, int p_283678_, int p_281696_) { +- List 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 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 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 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 tooltips, int mouseX, int mouseY, ItemStack stack) { ++ this.tooltipStack = stack; ++ List 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 p_282297_, int p_281680_, int p_283325_) { +@@ -557,11 +_,13 @@ + + private void m_280497_(Font p_282675_, List 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); + } + diff --git a/patches/minecraft/net/minecraft/client/gui/components/AbstractButton.java.patch b/patches/minecraft/net/minecraft/client/gui/components/AbstractButton.java.patch index 367c41c254..1d8c12905a 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/AbstractButton.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/AbstractButton.java.patch @@ -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); } diff --git a/patches/minecraft/net/minecraft/client/gui/components/AbstractSelectionList.java.patch b/patches/minecraft/net/minecraft/client/gui/components/AbstractSelectionList.java.patch index d142c31c58..e904c8ddcd 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/AbstractSelectionList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/AbstractSelectionList.java.patch @@ -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_); } diff --git a/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch b/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch index 632d4d329c..ace12d969d 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/AbstractWidget.java.patch @@ -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_; diff --git a/patches/minecraft/net/minecraft/client/gui/components/BossHealthOverlay.java.patch b/patches/minecraft/net/minecraft/client/gui/components/BossHealthOverlay.java.patch index 5ff74c5bb1..3f877377da 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/BossHealthOverlay.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/BossHealthOverlay.java.patch @@ -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; } diff --git a/patches/minecraft/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch b/patches/minecraft/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch index 74947126b3..adb59159d5 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/DebugScreenOverlay.java.patch @@ -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_()))); diff --git a/patches/minecraft/net/minecraft/client/gui/components/toasts/ToastComponent.java.patch b/patches/minecraft/net/minecraft/client/gui/components/toasts/ToastComponent.java.patch index 8ffabd5e66..419b263c22 100644 --- a/patches/minecraft/net/minecraft/client/gui/components/toasts/ToastComponent.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/components/toasts/ToastComponent.java.patch @@ -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_) { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/LoadingOverlay.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/LoadingOverlay.java.patch index 3fd6dfddbe..b147df86a1 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/LoadingOverlay.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/LoadingOverlay.java.patch @@ -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_()); } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/MenuScreens.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/MenuScreens.java.patch index af1e81768d..366ec53b4e 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/MenuScreens.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/MenuScreens.java.patch @@ -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, MenuScreens.ScreenConstructor> f_96196_ = Maps.newHashMap(); public static void m_96201_(@Nullable MenuType 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 { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/OptionsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/OptionsScreen.java.patch index 291e851d3c..627561fede 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/OptionsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/OptionsScreen.java.patch @@ -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 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()); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch index c7679005d7..574caf362b 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/Screen.java.patch @@ -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 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 textComponents, Optional tooltipComponent, int x, int y, ItemStack stack) { -+ this.renderTooltip(poseStack, textComponents, tooltipComponent, x, y, null, stack); -+ } -+ public void renderTooltip(PoseStack poseStack, List textComponents, Optional 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 textComponents, Optional 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 p_169390_, Optional p_169391_, int p_169392_, int p_169393_) { -- List 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 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 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 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 tooltips, int mouseX, int mouseY, ItemStack stack) { -+ this.renderComponentTooltip(poseStack, tooltips, mouseX, mouseY, null, stack); -+ } -+ public void renderComponentTooltip(PoseStack poseStack, List tooltips, int mouseX, int mouseY, @Nullable Font font) { -+ this.renderComponentTooltip(poseStack, tooltips, mouseX, mouseY, font, ItemStack.f_41583_); -+ } -+ -+ public void renderComponentTooltip(PoseStack poseStack, List tooltips, int mouseX, int mouseY, @Nullable Font font, ItemStack stack) { -+ this.tooltipFont = font; -+ this.tooltipStack = stack; -+ List 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 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 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 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 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 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_; } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch index 99a35a1d49..4ab9762b48 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/TitleScreen.java.patch @@ -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_); } } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch index de58051e5f..70588843b8 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementTab.java.patch @@ -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()) { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java.patch index 950427740f..90fb0f7d61 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementTabType.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch index 781746a455..81626a3236 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/advancements/AdvancementsScreen.java.patch @@ -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_); } } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch index 0e96eff3de..4c37a75365 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/controls/KeyBindsList.java.patch @@ -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_) { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch index 7bd0dd8dfe..8bd2bb3881 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/AbstractContainerScreen.java.patch @@ -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_; diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch index 042be843d3..31b6f345b7 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch @@ -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> 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 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 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 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 list = p_98591_.m_41651_(this.f_96541_.f_91074_, tooltipflag); -@@ -639,35 +_,36 @@ - + List 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_); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch index d2b2a4e2ff..778c8461fc 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/EffectRenderingInventoryScreen.java.patch @@ -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 collection = this.f_96541_.f_91074_.m_21220_(); if (!collection.isEmpty() && j >= 32) { boolean flag = j >= 120; @@ -16,30 +16,30 @@ - Iterable iterable = Ordering.natural().sortedCopy(collection); + + Iterable 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); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java.patch index a2ebe76bce..e585d4edb3 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/EnchantmentScreen.java.patch @@ -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 list = Lists.newArrayList(); - list.add(Component.m_237110_("container.enchant.clue", enchantment.m_44700_(l)).m_130940_(ChatFormatting.WHITE)); - if (!flag) { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java.patch index b5d4589888..005cc1a11d 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/HangingSignEditScreen.java.patch @@ -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")); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/InventoryScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/InventoryScreen.java.patch index 147c6e9987..df988c3700 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/InventoryScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/InventoryScreen.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/MerchantScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/MerchantScreen.java.patch index 3396a62449..88a450ed5e 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/MerchantScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/MerchantScreen.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch index 627230b031..7ba003737e 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipComponent.java.patch @@ -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 { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java.patch index 6c52084b57..b52cecb27e 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.java.patch @@ -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 + } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch index f9042d2063..36b0bceb96 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/JoinMultiplayerScreen.java.patch @@ -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 @@ } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java.patch index 3768972d23..be1df6e391 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/multiplayer/ServerSelectionList.java.patch @@ -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_; diff --git a/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java.patch index fe40b5f5c1..fdcab4e002 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java.patch @@ -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); + } + diff --git a/patches/minecraft/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch index dcac82aae0..cfe96c69f4 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/recipebook/RecipeBookComponent.java.patch @@ -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); - } - - } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/recipebook/RecipeBookPage.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/recipebook/RecipeBookPage.java.patch deleted file mode 100644 index 2938450fe8..0000000000 --- a/patches/minecraft/net/minecraft/client/gui/screens/recipebook/RecipeBookPage.java.patch +++ /dev/null @@ -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_())); - } - - } diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch index dea8d75e6a..f84e4b6ec5 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/CreateWorldScreen.java.patch @@ -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 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); diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch index 61cb12c660..461e2febb5 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.java.patch @@ -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 { diff --git a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch index f55a7e6c71..60435120fe 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/worldselection/WorldSelectionList.java.patch @@ -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 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 tooltip = font.m_92923_(Component.m_237115_("forge.experimentalsettings.tooltip"), 200); ++ guiGraphics.m_280245_(font, tooltip, mouseX, mouseY); + } + } } diff --git a/patches/minecraft/net/minecraft/client/main/Main.java.patch b/patches/minecraft/net/minecraft/client/main/Main.java.patch index a937b1fc33..42168455d8 100644 --- a/patches/minecraft/net/minecraft/client/main/Main.java.patch +++ b/patches/minecraft/net/minecraft/client/main/Main.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch index e972dcb7b3..1850fe0da5 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientHandshakePacketListenerImpl.java.patch @@ -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_) { diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch index ee28723c4e..d76e41074c 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientLevel.java.patch @@ -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 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 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_); } diff --git a/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch index 617af910ef..872012aacd 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/ClientPacketListener.java.patch @@ -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_) { diff --git a/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch index 6355d0027c..396188f917 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/MultiPlayerGameMode.java.patch @@ -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)); diff --git a/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch b/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch index 5d79a30ff8..99385b8353 100644 --- a/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch +++ b/patches/minecraft/net/minecraft/client/particle/ParticleEngine.java.patch @@ -14,8 +14,8 @@ private final Queue f_107294_ = Queues.newArrayDeque(); private final Map 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 void m_272137_(ParticleType p_273423_, ParticleProvider.Sprite 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 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 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 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; } diff --git a/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch b/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch index 346597f12c..eff35cb17a 100644 --- a/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch +++ b/patches/minecraft/net/minecraft/client/player/LocalPlayer.java.patch @@ -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 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_); } diff --git a/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch index cf344eefe1..0334c37a85 100644 --- a/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/FogRenderer.java.patch @@ -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_); } diff --git a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch index 6ebd3945f9..f60dd95b61 100644 --- a/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/GameRenderer.java.patch @@ -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_); diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch index 8626fd82d7..7c4db01269 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemBlockRenderTypes.java.patch @@ -5,18 +5,18 @@ @OnlyIn(Dist.CLIENT) public class ItemBlockRenderTypes { + @Deprecated - private static final Map f_109275_ = Util.m_137469_(Maps.newHashMap(), (p_272331_) -> { + private static final Map 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 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 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); diff --git a/patches/minecraft/net/minecraft/client/renderer/ItemInHandRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ItemInHandRenderer.java.patch index 0e58401414..4df2878e02 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ItemInHandRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ItemInHandRenderer.java.patch @@ -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); diff --git a/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch index 0ec23d623c..ed5efef40a 100644 --- a/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/LevelRenderer.java.patch @@ -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> 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_); diff --git a/patches/minecraft/net/minecraft/client/renderer/RenderType.java.patch b/patches/minecraft/net/minecraft/client/renderer/RenderType.java.patch index a6b87cdf3f..b2ea1f87a5 100644 --- a/patches/minecraft/net/minecraft/client/renderer/RenderType.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/RenderType.java.patch @@ -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_; } } diff --git a/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch index c57696c14a..8e6a0899bd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/ScreenEffectRenderer.java.patch @@ -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)); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch index 7a4c7658b2..277060bdaa 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/BlockRenderDispatcher.java.patch @@ -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) { diff --git a/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch index b20d90e30a..1d90c4ade1 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/ModelBlockRenderer.java.patch @@ -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 @@ } } diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockElement.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BlockElement.java.patch index e82087f745..7057176f2f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockElement.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BlockElement.java.patch @@ -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 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 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); diff --git a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/block/model/BlockModel.java.patch index b3223973da..18806a15c8 100644 --- a/patches/minecraft/net/minecraft/client/renderer/block/model/BlockModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/block/model/BlockModel.java.patch @@ -50,7 +50,7 @@ Set set = Sets.newLinkedHashSet(); for(BlockModel blockmodel = this; blockmodel.f_111419_ != null && blockmodel.f_111418_ == null; blockmodel = blockmodel.f_111418_) { -@@ -168,11 +_,24 @@ +@@ -168,11 +_,18 @@ }); } @@ -65,13 +65,7 @@ public BakedModel m_111449_(ModelBaker p_249720_, BlockModel p_111451_, Function p_111452_, ModelState p_111453_, ResourceLocation p_111454_, boolean p_111455_) { + return net.minecraftforge.client.model.geometry.UnbakedGeometryHelper.bake(this, p_249720_, p_111451_, p_111452_, p_111453_, p_111454_, p_111455_); + } -+ -+ /** -+ * @deprecated Forge: For internal use only. Use {@link #bake(ModelBaker, BlockModel, Function, ModelState, ResourceLocation, boolean)}. -+ */ -+ @Deprecated(forRemoval = true, since = "1.19.2") // TODO: We cannot remove it since it's vanilla code, but make it private in 1.20 -+ public BakedModel bakeVanilla(ModelBaker p_249720_, BlockModel p_111451_, Function p_111452_, ModelState p_111453_, ResourceLocation p_111454_, boolean p_111455_, net.minecraftforge.client.RenderTypeGroup renderTypes) { -+ if (true) return net.minecraftforge.client.model.geometry.UnbakedGeometryHelper.bakeVanilla(this, p_249720_, p_111451_, p_111452_, p_111453_, p_111454_); // Redirected, in case anyone actually uses this ++ private BakedModel bakeVanilla(ModelBaker p_249720_, BlockModel p_111451_, Function p_111452_, ModelState p_111453_, ResourceLocation p_111454_, boolean p_111455_, net.minecraftforge.client.RenderTypeGroup renderTypes) { TextureAtlasSprite textureatlassprite = p_111452_.apply(this.m_111480_("particle")); if (this.m_111490_() == ModelBakery.f_119233_) { return new BuiltInModel(this.m_111491_(), this.m_246736_(p_249720_, p_111451_), textureatlassprite, this.m_111479_().m_111526_()); diff --git a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch index 93ac9069c8..196d9731e0 100644 --- a/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java +++ b/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java -@@ -78,12 +_,15 @@ +@@ -79,12 +_,15 @@ private Vec3 f_112683_ = Vec3.f_82478_; public ChunkRenderDispatcher(ClientLevel p_194405_, LevelRenderer p_194406_, Executor p_194407_, boolean p_194408_, ChunkBufferBuilderPack p_194409_) { @@ -17,7 +17,7 @@ this.f_112678_ = p_194409_; List list = Lists.newArrayListWithExpectedSize(l); -@@ -419,7 +_,7 @@ +@@ -420,7 +_,7 @@ if (!chunkrenderdispatcher$compiledchunk.f_112749_.contains(p_112810_)) { return false; } else { @@ -26,7 +26,7 @@ p_112811_.m_112709_(this.f_112788_); return true; } -@@ -451,7 +_,7 @@ +@@ -452,7 +_,7 @@ this.f_202433_.incrementAndGet(); } @@ -35,7 +35,7 @@ return this.f_112787_; } -@@ -484,10 +_,20 @@ +@@ -485,10 +_,20 @@ protected final double f_112847_; protected final AtomicBoolean f_112848_ = new AtomicBoolean(false); protected final boolean f_194420_; @@ -56,7 +56,7 @@ } public abstract CompletableFuture m_5869_(ChunkBufferBuilderPack p_112853_); -@@ -499,6 +_,10 @@ +@@ -500,6 +_,10 @@ public int compareTo(ChunkRenderDispatcher.RenderChunk.ChunkCompileTask p_112855_) { return Doubles.compare(this.f_112847_, p_112855_.f_112847_); } @@ -67,12 +67,12 @@ } @OnlyIn(Dist.CLIENT) -@@ -506,8 +_,13 @@ +@@ -507,8 +_,13 @@ @Nullable protected RenderChunkRegion f_112858_; + @Deprecated - public RebuildTask(@Nullable double p_194427_, RenderChunkRegion p_194428_, boolean p_194429_) { + public RebuildTask(double p_194427_, @Nullable RenderChunkRegion p_194428_, boolean p_194429_) { - super(p_194427_, p_194429_); + this(null, p_194427_, p_194428_, p_194429_); + } @@ -82,7 +82,7 @@ this.f_112858_ = p_194428_; } -@@ -604,7 +_,10 @@ +@@ -605,7 +_,10 @@ } if (blockstate.m_60799_() != RenderShape.INVISIBLE) { @@ -94,18 +94,18 @@ BufferBuilder bufferbuilder2 = p_234471_.m_108839_(rendertype2); if (set.add(rendertype2)) { RenderChunk.this.m_112805_(bufferbuilder2); -@@ -612,8 +_,9 @@ +@@ -613,8 +_,9 @@ posestack.m_85836_(); posestack.m_252880_((float)(blockpos2.m_123341_() & 15), (float)(blockpos2.m_123342_() & 15), (float)(blockpos2.m_123343_() & 15)); - blockrenderdispatcher.m_234355_(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource); -+ blockrenderdispatcher.renderBatched(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource, modelData, rendertype2, false); ++ blockrenderdispatcher.renderBatched(blockstate, blockpos2, renderchunkregion, posestack, bufferbuilder2, true, randomsource, modelData, rendertype2); posestack.m_85849_(); + } } } -@@ -642,10 +_,10 @@ +@@ -643,10 +_,10 @@ private void m_234476_(ChunkRenderDispatcher.RenderChunk.RebuildTask.CompileResults p_234477_, E p_234478_) { BlockEntityRenderer blockentityrenderer = Minecraft.m_91087_().m_167982_().m_112265_(p_234478_); if (blockentityrenderer != null) { @@ -117,7 +117,7 @@ } } -@@ -673,8 +_,13 @@ +@@ -674,8 +_,13 @@ class ResortTransparencyTask extends ChunkRenderDispatcher.RenderChunk.ChunkCompileTask { private final ChunkRenderDispatcher.CompiledChunk f_112886_; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch index 5dd7f3e9e6..27553fa4d3 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java +++ b/net/minecraft/client/renderer/entity/EntityRenderDispatcher.java -@@ -168,12 +_,12 @@ +@@ -172,12 +_,12 @@ private static void m_114441_(PoseStack p_114442_, VertexConsumer p_114443_, Entity p_114444_, float p_114445_) { AABB aabb = p_114444_.m_20191_().m_82386_(-p_114444_.m_20185_(), -p_114444_.m_20186_(), -p_114444_.m_20189_()); LevelRenderer.m_109646_(p_114442_, p_114443_, aabb, 1.0F, 1.0F, 1.0F, 1.0F); @@ -15,7 +15,7 @@ p_114442_.m_85836_(); double d3 = d0 + Mth.m_14139_((double)p_114445_, enderdragonpart.f_19790_, enderdragonpart.m_20185_()); double d4 = d1 + Mth.m_14139_((double)p_114445_, enderdragonpart.f_19791_, enderdragonpart.m_20186_()); -@@ -335,9 +_,14 @@ +@@ -351,9 +_,14 @@ return this.f_234577_; } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch index 36d5b167d1..1e8ac1bc30 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/EntityRenderer.java.patch @@ -20,5 +20,5 @@ - if (!(d0 > 4096.0D)) { + if (net.minecraftforge.client.ForgeHooksClient.isNameplateInRenderDistance(p_114498_, d0)) { boolean flag = !p_114498_.m_20163_(); - float f = p_114498_.m_20206_() + 0.5F; + float f = p_114498_.m_278726_(); int i = "deadmau5".equals(p_114499_.getString()) ? -10 : 0; diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch index 69470aa905..e3abc67c9f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemFrameRenderer.java.patch @@ -5,7 +5,7 @@ if (!itemstack.m_41619_()) { - OptionalInt optionalint = p_115076_.m_218868_(); -+ MapItemSavedData mapitemsaveddata = MapItem.m_42853_(itemstack, p_115076_.f_19853_); ++ MapItemSavedData mapitemsaveddata = MapItem.m_42853_(itemstack, p_115076_.m_9236_()); if (flag) { p_115079_.m_252880_(0.0F, 0.0F, 0.5F); } else { @@ -22,7 +22,7 @@ float f = 0.0078125F; p_115079_.m_85841_(0.0078125F, 0.0078125F, 0.0078125F); p_115079_.m_252880_(-64.0F, -64.0F, 0.0F); -- MapItemSavedData mapitemsaveddata = MapItem.m_151128_(optionalint.getAsInt(), p_115076_.f_19853_); +- MapItemSavedData mapitemsaveddata = MapItem.m_151128_(optionalint.getAsInt(), p_115076_.m_9236_()); p_115079_.m_252880_(0.0F, 0.0F, -1.0F); if (mapitemsaveddata != null) { int i = this.m_174208_(p_115076_, 15728850, p_115081_); @@ -32,7 +32,7 @@ } else { int k = this.m_174208_(p_115076_, 15728880, p_115081_); p_115079_.m_85841_(0.5F, 0.5F, 0.5F); - this.f_115047_.m_269128_(itemstack, ItemDisplayContext.FIXED, k, OverlayTexture.f_118083_, p_115079_, p_115080_, p_115076_.f_19853_, p_115076_.m_19879_()); + this.f_115047_.m_269128_(itemstack, ItemDisplayContext.FIXED, k, OverlayTexture.f_118083_, p_115079_, p_115080_, p_115076_.m_9236_(), p_115076_.m_19879_()); } + } } diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch index b3f95ea49a..a8e128ee8e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/ItemRenderer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/entity/ItemRenderer.java +++ b/net/minecraft/client/renderer/entity/ItemRenderer.java -@@ -80,7 +_,7 @@ +@@ -68,7 +_,7 @@ public ItemRenderer(Minecraft p_266926_, TextureManager p_266774_, ModelManager p_266850_, ItemColors p_267016_, BlockEntityWithoutLevelRenderer p_267049_) { this.f_265848_ = p_266926_; this.f_115096_ = p_266774_; @@ -9,7 +9,7 @@ this.f_174223_ = p_267049_; for(Item item : BuiltInRegistries.f_257033_) { -@@ -121,7 +_,7 @@ +@@ -109,7 +_,7 @@ } } @@ -18,7 +18,7 @@ p_115147_.m_252880_(-0.5F, -0.5F, -0.5F); if (!p_115151_.m_7521_() && (!p_115144_.m_150930_(Items.f_42713_) || flag)) { boolean flag1; -@@ -131,8 +_,8 @@ +@@ -119,8 +_,8 @@ } else { flag1 = true; } @@ -27,9 +27,9 @@ + for (var model : p_115151_.getRenderPasses(p_115144_, flag1)) { + for (var rendertype : model.getRenderTypes(p_115144_, flag1)) { VertexConsumer vertexconsumer; - if (p_115144_.m_204117_(ItemTags.f_215866_) && p_115144_.m_41790_()) { + if (m_285827_(p_115144_) && p_115144_.m_41790_()) { p_115147_.m_85836_(); -@@ -156,9 +_,11 @@ +@@ -144,9 +_,11 @@ vertexconsumer = m_115211_(p_115148_, rendertype, true, p_115144_.m_41790_()); } @@ -43,7 +43,7 @@ } p_115147_.m_85849_(); -@@ -202,7 +_,7 @@ +@@ -194,7 +_,7 @@ float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; @@ -52,21 +52,7 @@ } } -@@ -303,6 +_,7 @@ - crashreportcategory.m_128165_("Item Type", () -> { - return String.valueOf((Object)p_275431_.m_41720_()); - }); -+ crashreportcategory.m_128165_("Registry Name", () -> String.valueOf(net.minecraftforge.registries.ForgeRegistries.ITEMS.getKey(p_275431_.m_41720_()))); - crashreportcategory.m_128165_("Item Damage", () -> { - return String.valueOf(p_275431_.m_41773_()); - }); -@@ -356,10 +_,15 @@ - } - - p_275269_.m_85849_(); -+ net.minecraftforge.client.ItemDecoratorHandler.of(p_275590_).render(p_275269_, p_275652_, p_275590_, p_275202_, p_275508_); - } - } +@@ -227,5 +_,9 @@ public void m_6213_(ResourceManager p_115105_) { this.f_115095_.m_109403_(); diff --git a/patches/minecraft/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch b/patches/minecraft/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch index ce303e7727..aa37d021bd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java.patch @@ -1,42 +1,42 @@ --- a/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java +++ b/net/minecraft/client/renderer/entity/layers/HumanoidArmorLayer.java -@@ -56,17 +_,18 @@ +@@ -54,17 +_,17 @@ if (armoritem.m_40402_() == p_117122_) { this.m_117386_().m_102872_(p_117124_); this.m_117125_(p_117124_, p_117122_); + net.minecraft.client.model.Model model = getArmorModelHook(p_117121_, itemstack, p_117122_, p_117124_); - boolean flag1 = this.m_117128_(p_117122_); - boolean flag = itemstack.m_41790_(); + boolean flag = this.m_117128_(p_117122_); - if (armoritem instanceof DyeableArmorItem) { -- int i = ((DyeableArmorItem)armoritem).m_41121_(itemstack); +- DyeableArmorItem dyeablearmoritem = (DyeableArmorItem)armoritem; +- int i = dyeablearmoritem.m_41121_(itemstack); + if (armoritem instanceof net.minecraft.world.item.DyeableLeatherItem) { + int i = ((net.minecraft.world.item.DyeableLeatherItem)armoritem).m_41121_(itemstack); float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; -- this.m_117106_(p_117119_, p_117120_, p_117123_, armoritem, flag, p_117124_, flag1, f, f1, f2, (String)null); -- this.m_117106_(p_117119_, p_117120_, p_117123_, armoritem, flag, p_117124_, flag1, 1.0F, 1.0F, 1.0F, "overlay"); -+ this.renderModel(p_117119_, p_117120_, p_117123_, flag, model, f, f1, f2, this.getArmorResource(p_117121_, itemstack, p_117122_, null)); -+ this.renderModel(p_117119_, p_117120_, p_117123_, flag, model, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, "overlay")); +- this.m_289609_(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, f, f1, f2, (String)null); +- this.m_289609_(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, 1.0F, 1.0F, 1.0F, "overlay"); ++ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, f, f1, f2, this.getArmorResource(p_117121_, itemstack, p_117122_, null)); ++ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, "overlay")); } else { -- this.m_117106_(p_117119_, p_117120_, p_117123_, armoritem, flag, p_117124_, flag1, 1.0F, 1.0F, 1.0F, (String)null); -+ this.renderModel(p_117119_, p_117120_, p_117123_, flag, model, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, null)); +- this.m_289609_(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, 1.0F, 1.0F, 1.0F, (String)null); ++ this.renderModel(p_117119_, p_117120_, p_117123_, armoritem, p_117124_, flag, 1.0F, 1.0F, 1.0F, this.getArmorResource(p_117121_, itemstack, p_117122_, null)); } - if (p_117121_.f_19853_.m_246046_().m_245372_(FeatureFlags.f_244168_)) { -@@ -104,7 +_,10 @@ + ArmorTrim.m_266285_(p_117121_.m_9236_().m_9598_(), itemstack).ifPresent((p_289638_) -> { +@@ -103,7 +_,10 @@ } - private void m_117106_(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, ArmorItem p_117110_, boolean p_117111_, A p_117112_, boolean p_117113_, float p_117114_, float p_117115_, float p_117116_, @Nullable String p_117117_) { -- VertexConsumer vertexconsumer = ItemRenderer.m_115184_(p_117108_, RenderType.m_110431_(this.m_117080_(p_117110_, p_117113_, p_117117_)), false, p_117111_); -+ renderModel(p_117107_, p_117108_, p_117109_, p_117111_, p_117112_, p_117114_, p_117115_, p_117116_, this.m_117080_(p_117110_, p_117113_, p_117117_)); + private void m_289609_(PoseStack p_289664_, MultiBufferSource p_289689_, int p_289681_, ArmorItem p_289650_, A p_289658_, boolean p_289668_, float p_289678_, float p_289674_, float p_289693_, @Nullable String p_289682_) { +- VertexConsumer vertexconsumer = p_289689_.m_6299_(RenderType.m_110431_(this.m_117080_(p_289650_, p_289668_, p_289682_))); ++ renderModel(p_289664_, p_289689_, p_289681_, p_289650_, p_289658_, p_289668_, p_289678_, p_289674_, p_289693_, this.m_117080_(p_289650_, p_289668_, p_289682_)); + } -+ private void renderModel(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, boolean p_117111_, net.minecraft.client.model.Model p_117112_, float p_117114_, float p_117115_, float p_117116_, ResourceLocation armorResource) { -+ VertexConsumer vertexconsumer = ItemRenderer.m_115184_(p_117108_, RenderType.m_110431_(armorResource), false, p_117111_); - p_117112_.m_7695_(p_117107_, vertexconsumer, p_117109_, OverlayTexture.f_118083_, p_117114_, p_117115_, p_117116_, 1.0F); ++ private void renderModel(PoseStack p_289664_, MultiBufferSource p_289689_, int p_289681_, ArmorItem p_289650_, A p_289658_, boolean p_289668_, float p_289678_, float p_289674_, float p_289693_, ResourceLocation armorResource) { ++ VertexConsumer vertexconsumer = net.minecraft.client.renderer.entity.ItemRenderer.m_115184_(p_289689_, RenderType.m_110431_(armorResource), false, p_289668_); + p_289658_.m_7695_(p_289664_, vertexconsumer, p_289681_, OverlayTexture.f_118083_, p_289678_, p_289674_, p_289693_, 1.0F); } -@@ -122,8 +_,50 @@ +@@ -125,8 +_,50 @@ return p_117129_ == EquipmentSlot.LEGS; } diff --git a/patches/minecraft/net/minecraft/client/renderer/item/ItemProperties.java.patch b/patches/minecraft/net/minecraft/client/renderer/item/ItemProperties.java.patch index fe9ac5b760..f514fd715f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/item/ItemProperties.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/item/ItemProperties.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/client/renderer/item/ItemProperties.java +++ b/net/minecraft/client/renderer/item/ItemProperties.java -@@ -47,6 +_,9 @@ +@@ -46,6 +_,9 @@ private static final Map> f_117825_ = Maps.newHashMap(); private static ClampedItemPropertyFunction m_174581_(ResourceLocation p_174582_, ClampedItemPropertyFunction p_174583_) { @@ -10,7 +10,7 @@ f_117820_.put(p_174582_, p_174583_); return p_174583_; } -@@ -56,6 +_,9 @@ +@@ -55,6 +_,9 @@ } private static void m_174570_(Item p_174571_, ResourceLocation p_174572_, ClampedItemPropertyFunction p_174573_) { diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/AbstractTexture.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/AbstractTexture.java.patch index 8f67c13fae..e305127941 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/AbstractTexture.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/AbstractTexture.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/client/renderer/texture/AbstractTexture.java +++ b/net/minecraft/client/renderer/texture/AbstractTexture.java @@ -36,6 +_,20 @@ - GlStateManager.m_84331_(3553, 10240, j); + GlStateManager._texParameter(3553, 10240, j); } + // FORGE: This seems to have been stripped out, but we need it @@ -19,5 +19,5 @@ + } + public int m_117963_() { - RenderSystem.m_187555_(); + RenderSystem.assertOnRenderThreadOrInit(); if (this.f_117950_ == -1) { diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch index 901211b6dd..7cb145c90f 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureManager.java.patch @@ -2,9 +2,9 @@ +++ b/net/minecraft/client/renderer/texture/TextureManager.java @@ -168,6 +_,7 @@ public void m_118513_(ResourceLocation p_118514_) { - AbstractTexture abstracttexture = this.m_174786_(p_118514_, MissingTextureAtlasSprite.m_118080_()); - if (abstracttexture != MissingTextureAtlasSprite.m_118080_()) { + AbstractTexture abstracttexture = this.f_118468_.remove(p_118514_); + if (abstracttexture != null) { + this.f_118468_.remove(p_118514_); // Forge: fix MC-98707 - TextureUtil.m_85281_(abstracttexture.m_117963_()); + this.m_118508_(p_118514_, abstracttexture); } diff --git a/patches/minecraft/net/minecraft/commands/CommandSourceStack.java.patch b/patches/minecraft/net/minecraft/commands/CommandSourceStack.java.patch index be270944b5..e22ca2d173 100644 --- a/patches/minecraft/net/minecraft/commands/CommandSourceStack.java.patch +++ b/patches/minecraft/net/minecraft/commands/CommandSourceStack.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/CommandSourceStack.java +++ b/net/minecraft/commands/CommandSourceStack.java -@@ -38,7 +_,7 @@ +@@ -40,7 +_,7 @@ import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; diff --git a/patches/minecraft/net/minecraft/commands/Commands.java.patch b/patches/minecraft/net/minecraft/commands/Commands.java.patch index abc8bb5349..9163cdd6eb 100644 --- a/patches/minecraft/net/minecraft/commands/Commands.java.patch +++ b/patches/minecraft/net/minecraft/commands/Commands.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -191,7 +_,7 @@ +@@ -193,7 +_,7 @@ JfrCommand.m_183645_(this.f_82090_); } @@ -9,7 +9,7 @@ TestCommand.m_127946_(this.f_82090_); SpawnArmorTrimsCommand.m_266283_(this.f_82090_); } -@@ -216,9 +_,11 @@ +@@ -218,9 +_,11 @@ if (p_230943_.f_82144_) { PublishCommand.m_138184_(this.f_82090_); } @@ -21,7 +21,7 @@ }); } -@@ -241,7 +_,16 @@ +@@ -243,7 +_,16 @@ try { try { @@ -39,7 +39,7 @@ } catch (CommandRuntimeException commandruntimeexception) { commandsourcestack.m_81352_(commandruntimeexception.m_79226_()); return 0; -@@ -297,7 +_,8 @@ +@@ -299,7 +_,8 @@ Map, CommandNode> map = Maps.newHashMap(); RootCommandNode rootcommandnode = new RootCommandNode<>(); map.put(this.f_82090_.getRoot(), rootcommandnode); diff --git a/patches/minecraft/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java.patch b/patches/minecraft/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java.patch index 4ae38e72fe..31718aac78 100644 --- a/patches/minecraft/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java.patch +++ b/patches/minecraft/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java -@@ -31,20 +_,21 @@ - double d1 = p_123375_.m_7098_() + (double)((float)direction.m_122430_() * 1.125F); - double d2 = p_123375_.m_7094_() + (double)((float)direction.m_122431_() * 1.125F); +@@ -33,20 +_,21 @@ + double d2 = p_123375_.m_7098_() + (double)((float)direction.m_122430_() * 1.125F); + double d3 = p_123375_.m_7094_() + (double)direction.m_122431_() * d0; BlockPos blockpos = p_123375_.m_7961_().m_121945_(direction); + Boat boat = (Boat)(this.f_235889_ ? new ChestBoat(level, d0, d1, d2) : new Boat(level, d0, d1, d2)); + boat.m_28464_(this.f_123369_); + boat.m_146922_(direction.m_122435_()); - double d3; + double d4; - if (level.m_6425_(blockpos).m_205070_(FluidTags.f_13131_)) { + if (boat.canBoatInFluid(level.m_6425_(blockpos))) { - d3 = 1.0D; + d4 = 1.0D; } else { - if (!level.m_8055_(blockpos).m_60795_() || !level.m_6425_(blockpos.m_7495_()).m_205070_(FluidTags.f_13131_)) { + if (!level.m_8055_(blockpos).m_60795_() || !boat.canBoatInFluid(level.m_6425_(blockpos.m_7495_()))) { return this.f_123368_.m_6115_(p_123375_, p_123376_); } - d3 = 0.0D; + d4 = 0.0D; } -- Boat boat = (Boat)(this.f_235889_ ? new ChestBoat(level, d0, d1 + d3, d2) : new Boat(level, d0, d1 + d3, d2)); +- Boat boat = (Boat)(this.f_235889_ ? new ChestBoat(level, d1, d2 + d4, d3) : new Boat(level, d1, d2 + d4, d3)); - boat.m_28464_(this.f_123369_); - boat.m_146922_(direction.m_122435_()); -+ boat.m_6034_(d0, d1 + d3, d2); ++ boat.m_6034_(d1, d2 + d4, d3); level.m_7967_(boat); p_123376_.m_41774_(1); return p_123376_; diff --git a/patches/minecraft/net/minecraft/core/registries/BuiltInRegistries.java.patch b/patches/minecraft/net/minecraft/core/registries/BuiltInRegistries.java.patch index f783af62bf..c2e9703675 100644 --- a/patches/minecraft/net/minecraft/core/registries/BuiltInRegistries.java.patch +++ b/patches/minecraft/net/minecraft/core/registries/BuiltInRegistries.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/core/registries/BuiltInRegistries.java +++ b/net/minecraft/core/registries/BuiltInRegistries.java -@@ -111,41 +_,89 @@ +@@ -114,41 +_,89 @@ public static final DefaultedRegistry f_256726_ = m_257834_(Registries.f_256827_, "step", (p_260052_) -> { return GameEvent.f_157785_; }); @@ -102,7 +102,7 @@ return ChunkStatus.f_62314_; }); public static final Registry> f_256978_ = m_258002_(Registries.f_256947_, (p_259641_) -> { -@@ -154,42 +_,90 @@ +@@ -160,42 +_,90 @@ public static final Registry> f_256957_ = m_258002_(Registries.f_257009_, (p_259262_) -> { return PosRuleTestType.f_74205_; }); @@ -205,7 +205,7 @@ return Activity.f_37979_; }); public static final Registry f_257035_ = m_258002_(Registries.f_257032_, (p_260042_) -> { -@@ -222,10 +_,18 @@ +@@ -228,10 +_,18 @@ public static final Registry> f_256906_ = m_258002_(Registries.f_256774_, (p_260006_) -> { return BlockPredicateType.f_190444_; }); @@ -226,7 +226,7 @@ return Feature.f_65731_; }); public static final Registry> f_256950_ = m_258002_(Registries.f_256888_, (p_259179_) -> { -@@ -240,10 +_,18 @@ +@@ -246,10 +_,18 @@ public static final Registry> f_256986_ = m_258002_(Registries.f_256843_, (p_260335_) -> { return PlacementModifierType.f_191853_; }); @@ -247,7 +247,7 @@ return FoliagePlacerType.f_68591_; }); public static final Registry> f_256920_ = m_258002_(Registries.f_256963_, (p_259690_) -> { -@@ -252,7 +_,11 @@ +@@ -258,7 +_,11 @@ public static final Registry> f_256742_ = m_258002_(Registries.f_256768_, (p_259493_) -> { return RootPlacerType.f_225898_; }); @@ -260,7 +260,7 @@ return TreeDecoratorType.f_70043_; }); public static final Registry> f_256958_ = m_258002_(Registries.f_256720_, (p_259370_) -> { -@@ -282,10 +_,18 @@ +@@ -289,10 +_,18 @@ return m_258073_(p_260095_, Lifecycle.stable(), p_259057_); } @@ -279,7 +279,7 @@ private static DefaultedRegistry m_257834_(ResourceKey> p_259296_, String p_259101_, BuiltInRegistries.RegistryBootstrap p_259485_) { return m_257762_(p_259296_, p_259101_, Lifecycle.stable(), p_259485_); } -@@ -294,10 +_,19 @@ +@@ -301,10 +_,19 @@ return m_257895_(p_259121_, new MappedRegistry<>(p_259121_, p_259977_, false), p_259874_, p_259977_); } @@ -299,7 +299,7 @@ private static DefaultedRegistry m_257762_(ResourceKey> p_260010_, String p_260220_, Lifecycle p_260139_, BuiltInRegistries.RegistryBootstrap p_260185_) { return m_257895_(p_260010_, new DefaultedMappedRegistry<>(p_260220_, p_260010_, p_260139_, true), p_260185_, p_260139_); } -@@ -343,7 +_,7 @@ +@@ -350,7 +_,7 @@ if (p_259410_ instanceof DefaultedRegistry) { ResourceLocation resourcelocation = ((DefaultedRegistry)p_259410_).m_122315_(); diff --git a/patches/minecraft/net/minecraft/data/Main.java.patch b/patches/minecraft/net/minecraft/data/Main.java.patch index e7a9f857c8..bfd6ab0b05 100644 --- a/patches/minecraft/net/minecraft/data/Main.java.patch +++ b/patches/minecraft/net/minecraft/data/Main.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/Main.java +++ b/net/minecraft/data/Main.java -@@ -73,8 +_,15 @@ +@@ -66,8 +_,15 @@ OptionSpec optionspec6 = optionparser.accepts("all", "Include all generators"); OptionSpec optionspec7 = optionparser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated"); OptionSpec optionspec8 = optionparser.accepts("input", "Input folder").withRequiredArg(); @@ -17,7 +17,7 @@ Path path = Paths.get(optionspec7.value(optionset)); boolean flag = optionset.has(optionspec6); boolean flag1 = flag || optionset.has(optionspec2); -@@ -82,10 +_,14 @@ +@@ -75,10 +_,14 @@ boolean flag3 = flag || optionset.has(optionspec3); boolean flag4 = flag || optionset.has(optionspec4); boolean flag5 = flag || optionset.has(optionspec5); diff --git a/patches/minecraft/net/minecraft/data/loot/BlockLootSubProvider.java.patch b/patches/minecraft/net/minecraft/data/loot/BlockLootSubProvider.java.patch index 01a8ef2f49..398bdf0f1e 100644 --- a/patches/minecraft/net/minecraft/data/loot/BlockLootSubProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/loot/BlockLootSubProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/loot/BlockLootSubProvider.java +++ b/net/minecraft/data/loot/BlockLootSubProvider.java -@@ -260,11 +_,15 @@ +@@ -265,11 +_,15 @@ protected abstract void m_245660_(); diff --git a/patches/minecraft/net/minecraft/data/loot/LootTableProvider.java.patch b/patches/minecraft/net/minecraft/data/loot/LootTableProvider.java.patch index 305c992379..30ace02c59 100644 --- a/patches/minecraft/net/minecraft/data/loot/LootTableProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/loot/LootTableProvider.java.patch @@ -1,30 +1,30 @@ --- a/net/minecraft/data/loot/LootTableProvider.java +++ b/net/minecraft/data/loot/LootTableProvider.java -@@ -35,7 +_,7 @@ - +@@ -43,7 +_,7 @@ public CompletableFuture m_213708_(CachedOutput p_254060_) { - Map map = Maps.newHashMap(); -- this.f_124434_.forEach((p_248012_) -> { -+ this.getTables().forEach((p_248012_) -> { - p_248012_.f_243941_().get().m_245126_((p_248006_, p_248007_) -> { - if (map.put(p_248006_, p_248007_.m_79165_(p_248012_.f_244144_).m_79167_()) != null) { - throw new IllegalStateException("Duplicate loot table " + p_248006_); -@@ -46,13 +_,8 @@ - return null; - }, map::get); + final Map map = Maps.newHashMap(); + Map map1 = new Object2ObjectOpenHashMap<>(); +- this.f_124434_.forEach((p_288263_) -> { ++ this.getTables().forEach((p_288263_) -> { + p_288263_.f_243941_().get().m_245126_((p_288259_, p_288260_) -> { + ResourceLocation resourcelocation1 = map1.put(RandomSequence.m_288221_(p_288259_), p_288259_); + if (resourcelocation1 != null) { +@@ -63,13 +_,8 @@ + } + }); - for(ResourceLocation resourcelocation : Sets.difference(this.f_243940_, map.keySet())) { - validationcontext.m_79357_("Missing built-in table: " + resourcelocation); - } + validate(map, validationcontext); -- map.forEach((p_124441_, p_124442_) -> { -- LootTables.m_79202_(validationcontext, p_124441_, p_124442_); +- map.forEach((p_278897_, p_278898_) -> { +- p_278898_.m_79136_(validationcontext.m_79355_(p_278898_.m_79122_()).m_278632_("{" + p_278897_ + "}", new LootDataId<>(LootDataType.f_278413_, p_278897_))); - }); Multimap multimap = validationcontext.m_79352_(); if (!multimap.isEmpty()) { multimap.forEach((p_124446_, p_124447_) -> { -@@ -69,6 +_,20 @@ +@@ -86,6 +_,20 @@ return new CompletableFuture[p_253403_]; })); } @@ -39,8 +39,8 @@ + validationcontext.m_79357_("Missing built-in table: " + resourcelocation); + } + -+ map.forEach((p_124441_, p_124442_) -> { -+ LootTables.m_79202_(validationcontext, p_124441_, p_124442_); ++ map.forEach((p_278897_, p_278898_) -> { ++ p_278898_.m_79136_(validationcontext.m_79355_(p_278898_.m_79122_()).m_278632_("{" + p_278897_ + "}", new LootDataId<>(LootDataType.f_278413_, p_278897_))); + }); } diff --git a/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch b/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch index fba3579eac..76440e3cbe 100644 --- a/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/recipes/RecipeProvider.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/data/recipes/RecipeProvider.java +++ b/net/minecraft/data/recipes/RecipeProvider.java -@@ -88,7 +_,9 @@ +@@ -89,7 +_,9 @@ list.add(DataProvider.m_253162_(p_254020_, p_253413_.m_125966_(), this.f_236355_.m_245731_(p_253413_.m_6445_()))); JsonObject jsonobject = p_253413_.m_5860_(); if (jsonobject != null) { @@ -11,7 +11,7 @@ } } -@@ -98,13 +_,23 @@ +@@ -99,13 +_,23 @@ })); } diff --git a/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch b/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch index e960ea5e19..989c965381 100644 --- a/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch +++ b/patches/minecraft/net/minecraft/data/tags/GameEventTagsProvider.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/data/tags/GameEventTagsProvider.java +++ b/net/minecraft/data/tags/GameEventTagsProvider.java -@@ -12,10 +_,15 @@ +@@ -13,10 +_,15 @@ @VisibleForTesting - static final GameEvent[] f_236425_ = new GameEvent[]{GameEvent.f_157791_, GameEvent.f_157792_, GameEvent.f_157793_, GameEvent.f_157794_, GameEvent.f_157795_, GameEvent.f_157796_, GameEvent.f_157797_, GameEvent.f_223702_, GameEvent.f_223703_, GameEvent.f_157802_, GameEvent.f_157803_, GameEvent.f_157804_, GameEvent.f_223704_, GameEvent.f_157806_, GameEvent.f_223705_, GameEvent.f_223706_, GameEvent.f_223707_, GameEvent.f_268533_, GameEvent.f_223708_, GameEvent.f_268500_, GameEvent.f_157810_, GameEvent.f_223709_, GameEvent.f_223710_, GameEvent.f_157811_, GameEvent.f_157812_, GameEvent.f_157816_, GameEvent.f_157769_, GameEvent.f_157770_, GameEvent.f_223696_, GameEvent.f_223697_, GameEvent.f_157772_, GameEvent.f_223699_, GameEvent.f_157774_, GameEvent.f_157775_, GameEvent.f_157776_, GameEvent.f_157777_, GameEvent.f_157778_, GameEvent.f_157781_, GameEvent.f_157784_, GameEvent.f_157785_, GameEvent.f_157786_, GameEvent.f_238175_}; + static final GameEvent[] f_236425_ = new GameEvent[]{GameEvent.f_157791_, GameEvent.f_157792_, GameEvent.f_157793_, GameEvent.f_157794_, GameEvent.f_157795_, GameEvent.f_157796_, GameEvent.f_157797_, GameEvent.f_223702_, GameEvent.f_223703_, GameEvent.f_157802_, GameEvent.f_157803_, GameEvent.f_223704_, GameEvent.f_157806_, GameEvent.f_223705_, GameEvent.f_223706_, GameEvent.f_223707_, GameEvent.f_268533_, GameEvent.f_223708_, GameEvent.f_268500_, GameEvent.f_157810_, GameEvent.f_223709_, GameEvent.f_223710_, GameEvent.f_157811_, GameEvent.f_157812_, GameEvent.f_157816_, GameEvent.f_157769_, GameEvent.f_157770_, GameEvent.f_223696_, GameEvent.f_223697_, GameEvent.f_157772_, GameEvent.f_223699_, GameEvent.f_157776_, GameEvent.f_157777_, GameEvent.f_157778_, GameEvent.f_157781_, GameEvent.f_157784_, GameEvent.f_157785_, GameEvent.f_157786_, GameEvent.f_238175_}; + /** @deprecated Forge: Use the {@linkplain #GameEventTagsProvider(PackOutput, CompletableFuture, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant} */ + @Deprecated diff --git a/patches/minecraft/net/minecraft/locale/Language.java.patch b/patches/minecraft/net/minecraft/locale/Language.java.patch index 4e11b48cbc..fb3658a74f 100644 --- a/patches/minecraft/net/minecraft/locale/Language.java.patch +++ b/patches/minecraft/net/minecraft/locale/Language.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/locale/Language.java +++ b/net/minecraft/locale/Language.java -@@ -41,7 +_,8 @@ - f_128101_.error("Couldn't read strings from {}", "/assets/minecraft/lang/en_us.json", ioexception); - } - +@@ -34,7 +_,8 @@ + ImmutableMap.Builder builder = ImmutableMap.builder(); + BiConsumer biconsumer = builder::put; + m_280428_(biconsumer, "/assets/minecraft/lang/en_us.json"); - final Map map = builder.build(); + final Map map = new java.util.HashMap<>(builder.build()); + net.minecraftforge.server.LanguageHook.captureLanguageMap(map); return new Language() { public String m_118919_(String p_128127_, String p_265421_) { return map.getOrDefault(p_128127_, p_265421_); -@@ -62,6 +_,11 @@ +@@ -55,6 +_,11 @@ }, Style.f_131099_).isPresent(); }; } @@ -22,7 +22,7 @@ }; } -@@ -82,6 +_,9 @@ +@@ -84,6 +_,9 @@ public static void m_128114_(Language p_128115_) { f_128104_ = p_128115_; } diff --git a/patches/minecraft/net/minecraft/nbt/ListTag.java.patch b/patches/minecraft/net/minecraft/nbt/ListTag.java.patch deleted file mode 100644 index aba7af9e38..0000000000 --- a/patches/minecraft/net/minecraft/nbt/ListTag.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/nbt/ListTag.java -+++ b/net/minecraft/nbt/ListTag.java -@@ -224,7 +_,8 @@ - public long[] m_177991_(int p_177992_) { - if (p_177992_ >= 0 && p_177992_ < this.f_128716_.size()) { - Tag tag = this.f_128716_.get(p_177992_); -- if (tag.m_7060_() == 11) { -+ // FORGE: Fix MC-260378 by using correct constant for long array tag which is Tag.TAG_LONG_ARRAY -+ if (tag.m_7060_() == 12) { - return ((LongArrayTag)tag).m_128851_(); - } - } diff --git a/patches/minecraft/net/minecraft/network/CompressionEncoder.java.patch b/patches/minecraft/net/minecraft/network/CompressionEncoder.java.patch index 21aa59cd92..89d56692db 100644 --- a/patches/minecraft/net/minecraft/network/CompressionEncoder.java.patch +++ b/patches/minecraft/net/minecraft/network/CompressionEncoder.java.patch @@ -15,7 +15,7 @@ } else { + if (!DISABLE_PACKET_DEBUG && i > net.minecraft.network.CompressionDecoder.f_182672_) { + p_129453_.markReaderIndex(); -+ LOGGER.error("Attempted to send packet over maximum protocol size: {} > 2097152\nData:\n{}", i, ++ LOGGER.error("Attempted to send packet over maximum protocol size: {} > {}\nData:\n{}", i, net.minecraft.network.CompressionDecoder.f_182672_, + net.minecraftforge.logging.PacketDump.getContentDump(p_129453_)); + p_129453_.resetReaderIndex(); + } diff --git a/patches/minecraft/net/minecraft/network/Connection.java.patch b/patches/minecraft/net/minecraft/network/Connection.java.patch index db17bdde82..0e04ddbe9b 100644 --- a/patches/minecraft/net/minecraft/network/Connection.java.patch +++ b/patches/minecraft/net/minecraft/network/Connection.java.patch @@ -43,7 +43,7 @@ (new Bootstrap()).group(f_129464_.m_13971_()).handler(new ChannelInitializer() { protected void initChannel(Channel p_129557_) { ChannelPipeline channelpipeline = p_129557_.pipeline(); -@@ -419,6 +_,14 @@ +@@ -422,6 +_,14 @@ public float m_129543_() { return this.f_129477_; diff --git a/patches/minecraft/net/minecraft/server/Bootstrap.java.patch b/patches/minecraft/net/minecraft/server/Bootstrap.java.patch index 35ebb0c391..4bffea9c10 100644 --- a/patches/minecraft/net/minecraft/server/Bootstrap.java.patch +++ b/patches/minecraft/net/minecraft/server/Bootstrap.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/server/Bootstrap.java +++ b/net/minecraft/server/Bootstrap.java -@@ -47,6 +_,8 @@ - DispenseItemBehavior.m_123402_(); +@@ -54,6 +_,8 @@ CauldronInteraction.m_175649_(); BuiltInRegistries.m_257498_(); + CreativeModeTabs.m_280019_(); + net.minecraftforge.registries.GameData.vanillaSnapshot(); + if (false) // skip redirectOutputToLog, Forge already redirects stdout and stderr output to log so that they print with more context m_135890_(); + f_285608_.set(Duration.between(instant, Instant.now()).toMillis()); } - } -@@ -119,7 +_,6 @@ +@@ -127,7 +_,6 @@ Commands.m_82138_(); } diff --git a/patches/minecraft/net/minecraft/server/Main.java.patch b/patches/minecraft/net/minecraft/server/Main.java.patch index fa0b00183d..aa6e1e551d 100644 --- a/patches/minecraft/net/minecraft/server/Main.java.patch +++ b/patches/minecraft/net/minecraft/server/Main.java.patch @@ -57,7 +57,7 @@ + return; + } LevelStorageSource levelstoragesource = LevelStorageSource.m_78242_(file1.toPath()); - LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = levelstoragesource.m_78260_(s); + LevelStorageSource.LevelStorageAccess levelstoragesource$levelstorageaccess = levelstoragesource.m_289864_(s); + levelstoragesource$levelstorageaccess.readAdditionalLevelSaveData(); LevelSummary levelsummary = levelstoragesource$levelstorageaccess.m_78308_(); if (levelsummary != null) { diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index afb65df5a7..c4d4821c54 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -248,7 +_,7 @@ +@@ -247,7 +_,7 @@ public static S m_129872_(Function p_129873_) { AtomicReference atomicreference = new AtomicReference<>(); @@ -9,7 +9,7 @@ atomicreference.get().m_130011_(); }, "Server thread"); thread.setUncaughtExceptionHandler((p_177909_, p_177910_) -> { -@@ -341,6 +_,7 @@ +@@ -340,6 +_,7 @@ this.m_129841_(dimensiondatastorage); this.f_129732_ = new CommandStorage(dimensiondatastorage); WorldBorder worldborder = serverlevel.m_6857_(); @@ -17,15 +17,15 @@ if (!serverleveldata.m_6535_()) { try { m_177896_(serverlevel, serverleveldata, worldoptions.m_245100_(), flag); -@@ -375,6 +_,7 @@ - ServerLevel serverlevel1 = new ServerLevel(this, this.f_129738_, this.f_129744_, derivedleveldata, resourcekey1, entry.getValue(), p_129816_, flag, j, ImmutableList.of(), false); +@@ -376,6 +_,7 @@ + ServerLevel serverlevel1 = new ServerLevel(this, this.f_129738_, this.f_129744_, derivedleveldata, resourcekey1, entry.getValue(), p_129816_, flag, j, ImmutableList.of(), false, randomsequences); worldborder.m_61929_(new BorderChangeListener.DelegateBorderChangeListener(serverlevel1.m_6857_())); this.f_129762_.put(resourcekey1, serverlevel1); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.level.LevelEvent.Load(f_129762_.get(resourcekey))); } } -@@ -386,6 +_,7 @@ +@@ -387,6 +_,7 @@ p_177898_.m_7250_(BlockPos.f_121853_.m_6630_(80), 0.0F); } else { ServerChunkCache serverchunkcache = p_177897_.m_7726_(); @@ -41,7 +41,7 @@ } } -@@ -539,6 +_,8 @@ +@@ -538,6 +_,8 @@ } public void m_7041_() { @@ -50,7 +50,7 @@ if (this.f_177872_.m_142763_()) { this.m_236737_(); } -@@ -583,6 +_,7 @@ +@@ -582,6 +_,7 @@ for(ServerLevel serverlevel2 : this.m_129785_()) { if (serverlevel2 != null) { try { @@ -58,7 +58,7 @@ serverlevel2.close(); } catch (IOException ioexception1) { f_129750_.error("Exception closing the level", (Throwable)ioexception1); -@@ -631,9 +_,11 @@ +@@ -630,9 +_,11 @@ throw new IllegalStateException("Failed to initialize server"); } @@ -70,7 +70,7 @@ while(this.f_129764_) { long i = Util.m_137550_() - this.f_129726_; -@@ -662,6 +_,8 @@ +@@ -661,6 +_,8 @@ this.f_129717_ = true; JvmProfiler.f_185340_.m_183597_(this.f_129737_); } @@ -79,7 +79,7 @@ } catch (Throwable throwable1) { f_129750_.error("Encountered an unexpected exception", throwable1); CrashReport crashreport = m_206568_(throwable1); -@@ -673,6 +_,7 @@ +@@ -672,6 +_,7 @@ f_129750_.error("We were unable to save this crash report to disk."); } @@ -87,7 +87,7 @@ this.m_7268_(crashreport); } finally { try { -@@ -685,6 +_,7 @@ +@@ -684,6 +_,7 @@ this.f_236721_.f_214336_().m_196559_(); } @@ -95,7 +95,7 @@ this.m_6988_(); } -@@ -799,11 +_,13 @@ +@@ -798,11 +_,13 @@ public void m_5705_(BooleanSupplier p_129871_) { long i = Util.m_137569_(); @@ -109,7 +109,7 @@ } if (this.f_129766_ % 6000 == 0) { -@@ -820,11 +_,22 @@ +@@ -819,11 +_,22 @@ long k = Util.m_137569_(); this.f_129735_.m_13755_(k - i); this.f_129754_.m_7238_(); @@ -133,7 +133,7 @@ } private ServerStatus.Players m_271961_() { -@@ -852,7 +_,8 @@ +@@ -851,7 +_,8 @@ this.m_129890_().m_136128_(); this.f_129754_.m_6182_("levels"); @@ -143,7 +143,7 @@ this.f_129754_.m_6521_(() -> { return serverlevel + " " + serverlevel.m_46472_().m_135782_(); }); -@@ -863,6 +_,7 @@ +@@ -862,6 +_,7 @@ } this.f_129754_.m_6180_("tick"); @@ -151,7 +151,7 @@ try { serverlevel.m_8793_(p_129954_); -@@ -871,16 +_,18 @@ +@@ -870,16 +_,18 @@ serverlevel.m_6026_(crashreport); throw new ReportedException(crashreport); } @@ -171,16 +171,16 @@ GameTestTicker.f_177648_.m_127790_(); } -@@ -962,7 +_,7 @@ +@@ -961,7 +_,7 @@ @DontObfuscate - public String m_130001_() { + public String getServerModName() { - return "vanilla"; + return net.minecraftforge.internal.BrandingControl.getServerBranding(); } public SystemReport m_177935_(SystemReport p_177936_) { -@@ -1310,6 +_,7 @@ +@@ -1311,6 +_,7 @@ this.m_6846_().m_11315_(); this.f_129734_.m_136120_(this.f_129740_.f_206585_.m_206860_()); this.f_236720_.m_230370_(this.f_129740_.f_206584_); @@ -188,7 +188,7 @@ }, this); if (this.m_18695_()) { this.m_18701_(completablefuture::isDone); -@@ -1319,10 +_,13 @@ +@@ -1320,10 +_,13 @@ } public static WorldDataConfiguration m_246048_(PackRepository p_248681_, DataPackConfig p_248920_, boolean p_249869_, FeatureFlagSet p_251243_) { @@ -204,7 +204,7 @@ } else { Set set = Sets.newLinkedHashSet(); -@@ -1488,6 +_,31 @@ +@@ -1481,6 +_,31 @@ public abstract boolean m_7779_(GameProfile p_129840_); @@ -236,7 +236,7 @@ public void m_142116_(Path p_177911_) throws IOException { } -@@ -1651,6 +_,10 @@ +@@ -1644,6 +_,10 @@ public WorldData m_129910_() { return this.f_129749_; diff --git a/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch b/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch index 2eca9af311..2fa39923cc 100644 --- a/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch +++ b/patches/minecraft/net/minecraft/server/PlayerAdvancements.java.patch @@ -9,17 +9,16 @@ boolean flag = false; AdvancementProgress advancementprogress = this.m_135996_(p_135989_); boolean flag1 = advancementprogress.m_8193_(); -@@ -174,11 +_,14 @@ +@@ -174,11 +_,13 @@ this.m_136008_(p_135989_); this.f_135967_.add(p_135989_); flag = true; + net.minecraftforge.event.ForgeEventFactory.onAdvancementProgressedEvent(this.f_135968_, p_135989_, advancementprogress, p_135990_, net.minecraftforge.event.entity.player.AdvancementEvent.AdvancementProgressEvent.ProgressType.GRANT); if (!flag1 && advancementprogress.m_8193_()) { p_135989_.m_138321_().m_9989_(this.f_135968_); - if (p_135989_.m_138320_() != null && p_135989_.m_138320_().m_14996_() && this.f_135968_.f_19853_.m_46469_().m_46207_(GameRules.f_46153_)) { + if (p_135989_.m_138320_() != null && p_135989_.m_138320_().m_14996_() && this.f_135968_.m_9236_().m_46469_().m_46207_(GameRules.f_46153_)) { this.f_135962_.m_240416_(Component.m_237110_("chat.type.advancement." + p_135989_.m_138320_().m_14992_().m_15548_(), this.f_135968_.m_5446_(), p_135989_.m_138330_()), false); } -+ net.minecraftforge.common.ForgeHooks.onAdvancement(this.f_135968_, p_135989_); + net.minecraftforge.event.ForgeEventFactory.onAdvancementEarnedEvent(this.f_135968_, p_135989_); } } diff --git a/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch b/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch index 66bee160ea..0d62816ad6 100644 --- a/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch +++ b/patches/minecraft/net/minecraft/server/ReloadableServerResources.java.patch @@ -1,32 +1,30 @@ --- a/net/minecraft/server/ReloadableServerResources.java +++ b/net/minecraft/server/ReloadableServerResources.java -@@ -31,12 +_,12 @@ +@@ -29,10 +_,10 @@ private static final CompletableFuture f_206846_ = CompletableFuture.completedFuture(Unit.INSTANCE); private final CommandBuildContext.Configurable f_214300_; private final Commands f_206847_; - private final RecipeManager f_206848_ = new RecipeManager(); + private final RecipeManager f_206848_; private final TagManager f_206849_; - private final PredicateManager f_206850_ = new PredicateManager(); - private final LootTables f_206851_ = new LootTables(this.f_206850_); - private final ItemModifierManager f_206852_ = new ItemModifierManager(this.f_206850_, this.f_206851_); -- private final ServerAdvancementManager f_206853_ = new ServerAdvancementManager(this.f_206850_); + private final LootDataManager f_278467_ = new LootDataManager(); +- private final ServerAdvancementManager f_206853_ = new ServerAdvancementManager(this.f_278467_); + private final ServerAdvancementManager f_206853_; private final ServerFunctionLibrary f_206854_; public ReloadableServerResources(RegistryAccess.Frozen p_206857_, FeatureFlagSet p_250695_, Commands.CommandSelection p_206858_, int p_206859_) { -@@ -45,6 +_,10 @@ +@@ -41,6 +_,10 @@ this.f_206847_ = new Commands(p_206858_, this.f_214300_); this.f_214300_.m_254905_(CommandBuildContext.MissingTagAccessPolicy.CREATE_NEW); this.f_206854_ = new ServerFunctionLibrary(p_206859_, this.f_206847_.m_82094_()); + // Forge: Create context object and pass it to the recipe manager. + this.context = new net.minecraftforge.common.crafting.conditions.ConditionContext(this.f_206849_); + this.f_206848_ = new RecipeManager(context); -+ this.f_206853_ = new ServerAdvancementManager(this.f_206850_, context); ++ this.f_206853_ = new ServerAdvancementManager(this.f_278467_, context); } public ServerFunctionLibrary m_206860_() { -@@ -81,7 +_,9 @@ +@@ -69,7 +_,9 @@ public static CompletableFuture m_247740_(ResourceManager p_248588_, RegistryAccess.Frozen p_251163_, FeatureFlagSet p_250212_, Commands.CommandSelection p_249301_, int p_251126_, Executor p_249136_, Executor p_249601_) { ReloadableServerResources reloadableserverresources = new ReloadableServerResources(p_251163_, p_250212_, p_249301_, p_251126_); @@ -37,7 +35,7 @@ reloadableserverresources.f_214300_.m_254905_(CommandBuildContext.MissingTagAccessPolicy.FAIL); }).thenApply((p_214306_) -> { return reloadableserverresources; -@@ -93,6 +_,7 @@ +@@ -81,6 +_,7 @@ m_206870_(p_206869_, p_214315_); }); Blocks.m_50758_(); @@ -45,7 +43,7 @@ } private static void m_206870_(RegistryAccess p_206871_, TagManager.LoadResult p_206872_) { -@@ -103,5 +_,16 @@ +@@ -91,5 +_,16 @@ return List.copyOf(p_214312_.getValue()); })); p_206871_.m_175515_(resourcekey).m_203652_(map); diff --git a/patches/minecraft/net/minecraft/server/ServerAdvancementManager.java.patch b/patches/minecraft/net/minecraft/server/ServerAdvancementManager.java.patch index 64f64a5e88..edf2ca89f3 100644 --- a/patches/minecraft/net/minecraft/server/ServerAdvancementManager.java.patch +++ b/patches/minecraft/net/minecraft/server/ServerAdvancementManager.java.patch @@ -3,32 +3,32 @@ @@ -26,10 +_,18 @@ private static final Gson f_136022_ = (new GsonBuilder()).create(); private AdvancementList f_136023_ = new AdvancementList(); - private final PredicateManager f_136024_; + private final LootDataManager f_278379_; + private final net.minecraftforge.common.crafting.conditions.ICondition.IContext context; //Forge: add context -+ /** @deprecated Forge: use {@linkplain ServerAdvancementManager#ServerAdvancementManager(PredicateManager, net.minecraftforge.common.crafting.conditions.ICondition.IContext) constructor with context}. */ ++ /** @deprecated Forge: use {@linkplain ServerAdvancementManager#ServerAdvancementManager(LootDataManager, net.minecraftforge.common.crafting.conditions.ICondition.IContext) constructor with context}. */ + @Deprecated - public ServerAdvancementManager(PredicateManager p_136027_) { -+ this(p_136027_, net.minecraftforge.common.crafting.conditions.ICondition.IContext.EMPTY); + public ServerAdvancementManager(LootDataManager p_279237_) { ++ this(p_279237_, net.minecraftforge.common.crafting.conditions.ICondition.IContext.EMPTY); + } + -+ public ServerAdvancementManager(PredicateManager p_136027_, net.minecraftforge.common.crafting.conditions.ICondition.IContext context) { ++ public ServerAdvancementManager(LootDataManager p_279237_, net.minecraftforge.common.crafting.conditions.ICondition.IContext context) { super(f_136022_, "advancements"); - this.f_136024_ = p_136027_; + this.f_278379_ = p_279237_; + this.context = context; } protected void m_5787_(Map p_136034_, ResourceManager p_136035_, ProfilerFiller p_136036_) { @@ -37,7 +_,11 @@ - p_136034_.forEach((p_136039_, p_136040_) -> { + p_136034_.forEach((p_278903_, p_278904_) -> { try { - JsonObject jsonobject = GsonHelper.m_13918_(p_136040_, "advancement"); -- Advancement.Builder advancement$builder = Advancement.Builder.m_138380_(jsonobject, new DeserializationContext(p_136039_, this.f_136024_)); -+ Advancement.Builder advancement$builder = Advancement.Builder.fromJson(jsonobject, new DeserializationContext(p_136039_, this.f_136024_), this.context); + JsonObject jsonobject = GsonHelper.m_13918_(p_278904_, "advancement"); +- Advancement.Builder advancement$builder = Advancement.Builder.m_138380_(jsonobject, new DeserializationContext(p_278903_, this.f_278379_)); ++ Advancement.Builder advancement$builder = Advancement.Builder.fromJson(jsonobject, new DeserializationContext(p_278903_, this.f_278379_), this.context); + if (advancement$builder == null) { -+ f_136021_.debug("Skipping loading advancement {} as it's conditions were not met", p_136039_); ++ f_136021_.debug("Skipping loading advancement {} as its conditions were not met", p_278903_); + return; + } - map.put(p_136039_, advancement$builder); + map.put(p_278903_, advancement$builder); } catch (Exception exception) { - f_136021_.error("Parsing error loading custom advancement {}: {}", p_136039_, exception.getMessage()); + f_136021_.error("Parsing error loading custom advancement {}: {}", p_278903_, exception.getMessage()); diff --git a/patches/minecraft/net/minecraft/server/commands/SpreadPlayersCommand.java.patch b/patches/minecraft/net/minecraft/server/commands/SpreadPlayersCommand.java.patch index aa99815077..98ba203e8b 100644 --- a/patches/minecraft/net/minecraft/server/commands/SpreadPlayersCommand.java.patch +++ b/patches/minecraft/net/minecraft/server/commands/SpreadPlayersCommand.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/commands/SpreadPlayersCommand.java +++ b/net/minecraft/server/commands/SpreadPlayersCommand.java -@@ -173,7 +_,8 @@ +@@ -175,7 +_,8 @@ spreadplayerscommand$position = p_138732_[i++]; } diff --git a/patches/minecraft/net/minecraft/server/commands/TeleportCommand.java.patch b/patches/minecraft/net/minecraft/server/commands/TeleportCommand.java.patch index fdfd1adcb5..a8bd5f08f7 100644 --- a/patches/minecraft/net/minecraft/server/commands/TeleportCommand.java.patch +++ b/patches/minecraft/net/minecraft/server/commands/TeleportCommand.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/commands/TeleportCommand.java +++ b/net/minecraft/server/commands/TeleportCommand.java -@@ -124,6 +_,9 @@ +@@ -132,6 +_,9 @@ } private static void m_139014_(CommandSourceStack p_139015_, Entity p_139016_, ServerLevel p_139017_, double p_139018_, double p_139019_, double p_139020_, Set p_139021_, float p_139022_, float p_139023_, @Nullable TeleportCommand.LookAt p_139024_) throws CommandSyntaxException { diff --git a/patches/minecraft/net/minecraft/server/dedicated/Settings.java.patch b/patches/minecraft/net/minecraft/server/dedicated/Settings.java.patch index 3f0b381b62..1c1d9b0ed5 100644 --- a/patches/minecraft/net/minecraft/server/dedicated/Settings.java.patch +++ b/patches/minecraft/net/minecraft/server/dedicated/Settings.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/dedicated/Settings.java +++ b/net/minecraft/server/dedicated/Settings.java -@@ -39,7 +_,7 @@ +@@ -55,7 +_,7 @@ public void m_139876_(Path p_139877_) { - try (OutputStream outputstream = Files.newOutputStream(p_139877_)) { -- this.f_139798_.store(outputstream, "Minecraft server properties"); -+ net.minecraftforge.common.util.SortedProperties.store(this.f_139798_, outputstream, "Minecraft server properties"); + try (Writer writer = Files.newBufferedWriter(p_139877_, StandardCharsets.UTF_8)) { +- this.f_139798_.store(writer, "Minecraft server properties"); ++ net.minecraftforge.common.util.SortedProperties.store(this.f_139798_, writer, "Minecraft server properties"); } catch (IOException ioexception) { f_139797_.error("Failed to store properties to file: {}", (Object)p_139877_); } diff --git a/patches/minecraft/net/minecraft/server/level/ChunkHolder.java.patch b/patches/minecraft/net/minecraft/server/level/ChunkHolder.java.patch index 3b9d8c5b72..6368a8ef8c 100644 --- a/patches/minecraft/net/minecraft/server/level/ChunkHolder.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ChunkHolder.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/server/level/ChunkHolder.java +++ b/net/minecraft/server/level/ChunkHolder.java -@@ -67,6 +_,7 @@ +@@ -63,6 +_,7 @@ + private final ChunkHolder.LevelChangeListener f_140015_; private final ChunkHolder.PlayerProvider f_140016_; private boolean f_140017_; - private boolean f_140018_; + LevelChunk currentlyLoading; // Forge: Used to bypass future chain when loading chunks. private CompletableFuture f_142981_ = CompletableFuture.completedFuture((Void)null); diff --git a/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch b/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch index 4ce23207af..908a575135 100644 --- a/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ChunkMap.java.patch @@ -16,7 +16,7 @@ } this.m_140258_(p_203002_); -@@ -702,8 +_,14 @@ +@@ -713,8 +_,14 @@ levelchunk.m_62952_(); if (this.f_140132_.add(chunkpos.m_45588_())) { levelchunk.m_62913_(true); @@ -31,7 +31,7 @@ } return levelchunk; -@@ -806,6 +_,7 @@ +@@ -819,6 +_,7 @@ this.f_140133_.m_46473_().m_6174_("chunkSave"); CompoundTag compoundtag = ChunkSerializer.m_63454_(this.f_140133_, p_140259_); @@ -39,7 +39,7 @@ this.m_63502_(chunkpos, compoundtag); this.m_140229_(chunkpos, chunkstatus.m_62494_()); return true; -@@ -876,6 +_,7 @@ +@@ -889,6 +_,7 @@ if (!p_183759_ && p_183758_) { p_183755_.m_9088_(p_183756_); @@ -47,7 +47,7 @@ } } -@@ -1118,7 +_,7 @@ +@@ -1132,7 +_,7 @@ } protected void m_140199_(Entity p_140200_) { @@ -56,7 +56,7 @@ EntityType entitytype = p_140200_.m_6095_(); int i = entitytype.m_20681_() * 16; if (i != 0) { -@@ -1268,6 +_,7 @@ +@@ -1282,6 +_,7 @@ } } diff --git a/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch b/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch index 1400dadd3c..22f37acdd6 100644 --- a/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch +++ b/patches/minecraft/net/minecraft/server/level/DistanceManager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/DistanceManager.java +++ b/net/minecraft/server/level/DistanceManager.java -@@ -58,6 +_,8 @@ +@@ -54,6 +_,8 @@ private long f_140771_; private int f_183902_ = 10; @@ -9,7 +9,7 @@ protected DistanceManager(Executor p_140774_, Executor p_140775_) { ProcessorHandle processorhandle = ProcessorHandle.m_18714_("player ticket throttler", p_140775_::execute); ChunkTaskPriorityQueueSorter chunktaskpriorityqueuesorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(processorhandle), p_140774_, 4); -@@ -163,6 +_,10 @@ +@@ -159,6 +_,10 @@ this.f_140762_.m_140715_(p_140785_, p_140786_.m_9433_(), true); } @@ -20,7 +20,7 @@ } void m_140818_(long p_140819_, Ticket p_140820_) { -@@ -175,6 +_,13 @@ +@@ -171,6 +_,13 @@ } this.f_140762_.m_140715_(p_140819_, m_140797_(sortedarrayset), false); @@ -34,30 +34,30 @@ } public void m_140792_(TicketType p_140793_, ChunkPos p_140794_, int p_140795_, T p_140796_) { -@@ -187,14 +_,20 @@ +@@ -183,14 +_,20 @@ } public void m_140840_(TicketType p_140841_, ChunkPos p_140842_, int p_140843_, T p_140844_) { -- Ticket ticket = new Ticket<>(p_140841_, 33 - p_140843_, p_140844_); +- Ticket ticket = new Ticket<>(p_140841_, ChunkLevel.m_287154_(FullChunkStatus.FULL) - p_140843_, p_140844_); + addRegionTicket(p_140841_, p_140842_, p_140843_, p_140844_, false); + } + public void addRegionTicket(TicketType p_140841_, ChunkPos p_140842_, int p_140843_, T p_140844_, boolean forceTicks) { -+ Ticket ticket = new Ticket<>(p_140841_, 33 - p_140843_, p_140844_, forceTicks); ++ Ticket ticket = new Ticket<>(p_140841_, ChunkLevel.m_287154_(FullChunkStatus.FULL) - p_140843_, p_140844_, forceTicks); long i = p_140842_.m_45588_(); this.m_140784_(i, ticket); this.f_183901_.m_184151_(i, ticket); } public void m_140849_(TicketType p_140850_, ChunkPos p_140851_, int p_140852_, T p_140853_) { -- Ticket ticket = new Ticket<>(p_140850_, 33 - p_140852_, p_140853_); +- Ticket ticket = new Ticket<>(p_140850_, ChunkLevel.m_287154_(FullChunkStatus.FULL) - p_140852_, p_140853_); + removeRegionTicket(p_140850_, p_140851_, p_140852_, p_140853_, false); + } + public void removeRegionTicket(TicketType p_140850_, ChunkPos p_140851_, int p_140852_, T p_140853_, boolean forceTicks) { -+ Ticket ticket = new Ticket<>(p_140850_, 33 - p_140852_, p_140853_, forceTicks); ++ Ticket ticket = new Ticket<>(p_140850_, ChunkLevel.m_287154_(FullChunkStatus.FULL) - p_140852_, p_140853_, forceTicks); long i = p_140851_.m_45588_(); this.m_140818_(i, ticket); this.f_183901_.m_184165_(i, ticket); -@@ -285,6 +_,11 @@ +@@ -281,6 +_,11 @@ public String m_140837_() { return this.f_140766_.m_140558_(); diff --git a/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch b/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch index 0fedd0bd41..778b3ddfbf 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerChunkCache.java.patch @@ -8,7 +8,7 @@ Either either = chunkholder.m_140080_(ChunkStatus.f_62326_).getNow((Either)null); if (either == null) { return null; -@@ -350,7 +_,7 @@ +@@ -351,7 +_,7 @@ for(ServerChunkCache.ChunkAndHolder serverchunkcache$chunkandholder : list) { LevelChunk levelchunk1 = serverchunkcache$chunkandholder.f_184028_; ChunkPos chunkpos = levelchunk1.m_7697_(); @@ -17,7 +17,7 @@ levelchunk1.m_187632_(j); if (flag2 && (this.f_8335_ || this.f_8336_) && this.f_8329_.m_6857_().m_61927_(chunkpos)) { NaturalSpawner.m_47029_(this.f_8329_, levelchunk1, naturalspawner$spawnstate, this.f_8336_, this.f_8335_, flag1); -@@ -431,11 +_,17 @@ +@@ -432,11 +_,17 @@ } public void m_8387_(TicketType p_8388_, ChunkPos p_8389_, int p_8390_, T p_8391_) { diff --git a/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch b/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch index 3a75958cce..58a9458b73 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -96,10 +_,9 @@ +@@ -92,10 +_,9 @@ if ($$11 instanceof ItemFrame itemframe) { if (this.f_8521_ % 10 == 0) { ItemStack itemstack = itemframe.m_31822_(); @@ -14,7 +14,7 @@ for(ServerPlayer serverplayer : this.f_8509_.m_6907_()) { mapitemsaveddata.m_77918_(serverplayer, itemstack); Packet packet = mapitemsaveddata.m_164796_(integer, serverplayer); -@@ -108,11 +_,12 @@ +@@ -104,11 +_,12 @@ } } } @@ -28,7 +28,7 @@ if (this.f_8521_ % this.f_8511_ == 0 || this.f_8510_.f_19812_ || this.f_8510_.m_20088_().m_135352_()) { if (this.f_8510_.m_20159_()) { -@@ -221,6 +_,7 @@ +@@ -215,6 +_,7 @@ public void m_8534_(ServerPlayer p_8535_) { this.f_8510_.m_6452_(p_8535_); p_8535_.f_8906_.m_9829_(new ClientboundRemoveEntitiesPacket(this.f_8510_.m_19879_())); @@ -36,11 +36,11 @@ } public void m_8541_(ServerPlayer p_8542_) { -@@ -228,6 +_,7 @@ - this.m_8536_(list::add); +@@ -222,6 +_,7 @@ + this.m_289200_(p_8542_, list::add); p_8542_.f_8906_.m_9829_(new ClientboundBundlePacket(list)); this.f_8510_.m_6457_(p_8542_); + net.minecraftforge.event.ForgeEventFactory.onStartEntityTracking(this.f_8510_, p_8542_); } - public void m_8536_(Consumer> p_8537_) { + public void m_289200_(ServerPlayer p_289562_, Consumer> p_289563_) { diff --git a/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch b/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch index edf7273114..442f2a2d39 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerLevel.java.patch @@ -1,27 +1,28 @@ --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -185,10 +_,11 @@ +@@ -188,11 +_,12 @@ private final List f_8558_; @Nullable - private final EndDragonFight f_8559_; + private EndDragonFight f_8559_; - final Int2ObjectMap f_143247_ = new Int2ObjectOpenHashMap<>(); + final Int2ObjectMap> f_143247_ = new Int2ObjectOpenHashMap<>(); private final StructureManager f_214997_; private final StructureCheck f_196556_; private final boolean f_8561_; + private final RandomSequences f_286969_; + private net.minecraftforge.common.util.LevelCapabilityData capabilityData; - public ServerLevel(MinecraftServer p_214999_, Executor p_215000_, LevelStorageSource.LevelStorageAccess p_215001_, ServerLevelData p_215002_, ResourceKey p_215003_, LevelStem p_215004_, ChunkProgressListener p_215005_, boolean p_215006_, long p_215007_, List p_215008_, boolean p_215009_) { + public ServerLevel(MinecraftServer p_214999_, Executor p_215000_, LevelStorageSource.LevelStorageAccess p_215001_, ServerLevelData p_215002_, ResourceKey p_215003_, LevelStem p_215004_, ChunkProgressListener p_215005_, boolean p_215006_, long p_215007_, List p_215008_, boolean p_215009_, @Nullable RandomSequences p_288977_) { super(p_215002_, p_215003_, p_214999_.m_206579_(), p_215004_.f_63975_(), p_214999_::m_129905_, false, p_215006_, p_215007_, p_214999_.m_213994_()); -@@ -229,6 +_,7 @@ - - this.f_143245_ = new SleepStatus(); - this.f_243695_ = new GameEventDispatcher(this); +@@ -247,6 +_,7 @@ + @VisibleForTesting + public void m_287200_(@Nullable EndDragonFight p_287779_) { + this.f_8559_ = p_287779_; + this.initCapabilities(); } public void m_8606_(int p_8607_, int p_8608_, boolean p_8609_, boolean p_8610_) { -@@ -257,8 +_,8 @@ +@@ -275,8 +_,8 @@ int i = this.m_46469_().m_46215_(GameRules.f_151486_); if (this.f_143245_.m_144002_(i) && this.f_143245_.m_144004_(i, this.f_8546_)) { if (this.m_46469_().m_46207_(GameRules.f_46140_)) { @@ -32,7 +33,7 @@ } this.m_8804_(); -@@ -287,7 +_,7 @@ +@@ -305,7 +_,7 @@ this.m_8807_(); this.f_8557_ = false; profilerfiller.m_7238_(); @@ -41,7 +42,7 @@ if (flag) { this.m_8886_(); } -@@ -319,7 +_,9 @@ +@@ -337,7 +_,9 @@ } profilerfiller.m_6180_("tick"); @@ -52,7 +53,7 @@ profilerfiller.m_7238_(); } } -@@ -412,6 +_,7 @@ +@@ -430,6 +_,7 @@ BlockPos blockpos1 = this.m_5452_(Heightmap.Types.MOTION_BLOCKING, this.m_46496_(i, 0, j, 15)); BlockPos blockpos2 = blockpos1.m_7495_(); Biome biome = this.m_204166_(blockpos1).m_203334_(); @@ -60,7 +61,7 @@ if (biome.m_47477_(this, blockpos2)) { this.m_46597_(blockpos2, Blocks.f_50126_.m_49966_()); } -@@ -611,15 +_,19 @@ +@@ -633,15 +_,19 @@ this.f_8548_.m_6846_().m_11270_(new ClientboundGameEventPacket(ClientboundGameEventPacket.f_132161_, this.f_46440_), this.m_46472_()); } @@ -84,7 +85,7 @@ } } -@@ -678,6 +_,7 @@ +@@ -700,6 +_,7 @@ return BuiltInRegistries.f_256780_.m_7981_(p_8664_.m_6095_()).toString(); }); profilerfiller.m_6174_("tickPassenger"); @@ -92,7 +93,7 @@ p_8664_.m_6083_(); profilerfiller.m_7238_(); -@@ -714,6 +_,7 @@ +@@ -736,6 +_,7 @@ this.f_143244_.m_157554_(); } @@ -100,7 +101,7 @@ } } -@@ -806,6 +_,7 @@ +@@ -828,6 +_,7 @@ } private void m_8853_(ServerPlayer p_8854_) { @@ -108,7 +109,7 @@ Entity entity = this.m_142646_().m_142694_(p_8854_.m_20148_()); if (entity != null) { f_8566_.warn("Force-added player with duplicate UUID {}", (Object)p_8854_.m_20148_().toString()); -@@ -813,7 +_,8 @@ +@@ -835,7 +_,8 @@ this.m_143261_((ServerPlayer)entity, Entity.RemovalReason.DISCARDED); } @@ -118,7 +119,7 @@ } private boolean m_8872_(Entity p_8873_) { -@@ -821,7 +_,12 @@ +@@ -843,7 +_,12 @@ f_8566_.warn("Tried to add entity {} but it was marked as removed already", (Object)EntityType.m_20613_(p_8873_.m_6095_())); return false; } else { @@ -132,7 +133,7 @@ } } -@@ -858,10 +_,22 @@ +@@ -880,10 +_,22 @@ } public void m_262808_(@Nullable Player p_263330_, double p_263393_, double p_263369_, double p_263354_, Holder p_263412_, SoundSource p_263338_, float p_263352_, float p_263390_, long p_263403_) { @@ -155,7 +156,7 @@ this.f_8548_.m_6846_().m_11241_(p_263545_, p_263544_.m_20185_(), p_263544_.m_20186_(), p_263544_.m_20189_(), (double)p_263491_.m_203334_().m_215668_(p_263530_), this.m_46472_(), new ClientboundSoundEntityPacket(p_263491_, p_263542_, p_263544_, p_263530_, p_263520_, p_263490_)); } -@@ -883,6 +_,7 @@ +@@ -905,6 +_,7 @@ } public void m_214171_(GameEvent p_215041_, Vec3 p_215042_, GameEvent.Context p_215043_) { @@ -163,7 +164,7 @@ this.f_243695_.m_245905_(p_215041_, p_215042_, p_215043_); } -@@ -919,10 +_,15 @@ +@@ -941,10 +_,15 @@ } public void m_46672_(BlockPos p_215045_, Block p_215046_) { @@ -179,7 +180,7 @@ this.f_220350_.m_214152_(p_215052_, p_215053_, p_215054_); } -@@ -1358,6 +_,12 @@ +@@ -1380,6 +_,12 @@ }); } @@ -192,7 +193,7 @@ public LevelEntityGetter m_142646_() { return this.f_143244_.m_157567_(); } -@@ -1445,8 +_,8 @@ +@@ -1475,8 +_,8 @@ ServerLevel.this.f_143246_.add(mob); } @@ -203,7 +204,7 @@ ServerLevel.this.f_143247_.put(enderdragonpart.m_19879_(), enderdragonpart); } } -@@ -1470,17 +_,25 @@ +@@ -1500,17 +_,25 @@ ServerLevel.this.f_143246_.remove(mob); } diff --git a/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch b/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch index 37d678e719..6930720aa3 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerPlayer.java.patch @@ -5,7 +5,7 @@ public void m_6667_(DamageSource p_9035_) { this.m_146850_(GameEvent.f_223707_); + if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_9035_)) return; - boolean flag = this.f_19853_.m_46469_().m_46207_(GameRules.f_46142_); + boolean flag = this.m_9236_().m_46469_().m_46207_(GameRules.f_46142_); if (flag) { Component component = this.m_21231_().m_19293_(); @@ -716,11 +_,12 @@ @@ -16,12 +16,12 @@ + public Entity changeDimension(ServerLevel p_9180_, net.minecraftforge.common.util.ITeleporter teleporter) { + if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_9180_.m_46472_())) return null; this.f_8927_ = true; - ServerLevel serverlevel = this.m_9236_(); + ServerLevel serverlevel = this.m_284548_(); ResourceKey resourcekey = serverlevel.m_46472_(); - if (resourcekey == Level.f_46430_ && p_9180_.m_46472_() == Level.f_46428_) { + if (resourcekey == Level.f_46430_ && p_9180_.m_46472_() == Level.f_46428_ && teleporter.isVanilla()) { //Forge: Fix non-vanilla teleporters triggering end credits this.m_19877_(); - this.m_9236_().m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION); + this.m_284548_().m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION); if (!this.f_8944_) { @@ -737,13 +_,14 @@ PlayerList playerlist = this.f_8924_.m_6846_(); @@ -71,14 +71,14 @@ + java.util.Optional optAt = java.util.Optional.of(p_9115_); + Player.BedSleepingProblem ret = net.minecraftforge.event.ForgeEventFactory.onPlayerSleepInBed(this, optAt); + if (ret != null) return Either.left(ret); - Direction direction = this.f_19853_.m_8055_(p_9115_).m_61143_(HorizontalDirectionalBlock.f_54117_); + Direction direction = this.m_9236_().m_8055_(p_9115_).m_61143_(HorizontalDirectionalBlock.f_54117_); if (!this.m_5803_() && this.m_6084_()) { - if (!this.f_19853_.m_6042_().f_63858_()) { + if (!this.m_9236_().m_6042_().f_63858_()) { @@ -840,7 +_,7 @@ return Either.left(Player.BedSleepingProblem.OBSTRUCTED); } else { - this.m_9158_(this.f_19853_.m_46472_(), p_9115_, this.m_146908_(), false, true); -- if (this.f_19853_.m_46461_()) { + this.m_9158_(this.m_9236_().m_46472_(), p_9115_, this.m_146908_(), false, true); +- if (this.m_9236_().m_46461_()) { + if (!net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, optAt)) { return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW); } else { @@ -115,7 +115,7 @@ this.f_36096_ = this.f_36095_; } -@@ -1131,6 +_,15 @@ +@@ -1135,6 +_,15 @@ this.m_36362_(p_9016_.m_36331_()); this.m_36364_(p_9016_.m_36332_()); this.m_219749_(p_9016_.m_219759_()); @@ -131,7 +131,7 @@ } protected void m_142540_(MobEffectInstance p_143393_, @Nullable Entity p_143394_) { -@@ -1211,6 +_,8 @@ +@@ -1215,6 +_,8 @@ } public boolean m_143403_(GameType p_143404_) { @@ -140,7 +140,7 @@ if (!this.f_8941_.m_143473_(p_143404_)) { return false; } else { -@@ -1278,6 +_,7 @@ +@@ -1282,6 +_,7 @@ this.f_184127_ = p_9157_.f_195812_(); this.m_20088_().m_135381_(f_36089_, (byte)p_9157_.f_133867_()); this.m_20088_().m_135381_(f_36090_, (byte)(p_9157_.f_133868_() == HumanoidArm.LEFT ? 0 : 1)); @@ -148,7 +148,7 @@ } public boolean m_143432_() { -@@ -1337,6 +_,7 @@ +@@ -1341,6 +_,7 @@ public void m_9213_(@Nullable Entity p_9214_) { Entity entity = this.m_8954_(); this.f_8926_ = (Entity)(p_9214_ == null ? this : p_9214_); @@ -156,7 +156,7 @@ if (entity != this.f_8926_) { Level level = this.f_8926_.m_9236_(); if (level instanceof ServerLevel) { -@@ -1376,7 +_,11 @@ +@@ -1380,7 +_,11 @@ @Nullable public Component m_8957_() { @@ -169,22 +169,22 @@ } public void m_6674_(InteractionHand p_9031_) { -@@ -1401,21 +_,23 @@ +@@ -1405,21 +_,23 @@ this.m_8127_(); - if (p_9000_ == this.f_19853_) { + if (p_9000_ == this.m_9236_()) { this.f_8906_.m_9774_(p_9001_, p_9002_, p_9003_, p_9004_, p_9005_); - } else { + } else if (net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_9000_.m_46472_())) { - ServerLevel serverlevel = this.m_9236_(); + ServerLevel serverlevel = this.m_284548_(); LevelData leveldata = p_9000_.m_6106_(); - this.f_8906_.m_9829_(new ClientboundRespawnPacket(p_9000_.m_220362_(), p_9000_.m_46472_(), BiomeManager.m_47877_(p_9000_.m_7328_()), this.f_8941_.m_9290_(), this.f_8941_.m_9293_(), p_9000_.m_46659_(), p_9000_.m_8584_(), (byte)3, this.m_219759_())); + this.f_8906_.m_9829_(new ClientboundRespawnPacket(p_9000_.m_220362_(), p_9000_.m_46472_(), BiomeManager.m_47877_(p_9000_.m_7328_()), this.f_8941_.m_9290_(), this.f_8941_.m_9293_(), p_9000_.m_46659_(), p_9000_.m_8584_(), (byte)3, this.m_219759_(), this.m_287157_())); this.f_8906_.m_9829_(new ClientboundChangeDifficultyPacket(leveldata.m_5472_(), leveldata.m_5474_())); this.f_8924_.m_6846_().m_11289_(this); serverlevel.m_143261_(this, Entity.RemovalReason.CHANGED_DIMENSION); - this.m_146912_(); + this.revive(); this.m_7678_(p_9001_, p_9002_, p_9003_, p_9004_, p_9005_); - this.m_143425_(p_9000_); + this.m_284127_(p_9000_); p_9000_.m_8622_(this); this.m_9209_(serverlevel); this.f_8906_.m_9774_(p_9001_, p_9002_, p_9003_, p_9004_, p_9005_); @@ -195,7 +195,7 @@ } } -@@ -1438,6 +_,7 @@ +@@ -1442,6 +_,7 @@ } public void m_9158_(ResourceKey p_9159_, @Nullable BlockPos p_9160_, float p_9161_, boolean p_9162_, boolean p_9163_) { @@ -203,16 +203,16 @@ if (p_9160_ != null) { boolean flag = p_9160_.equals(this.f_8936_) && p_9159_.equals(this.f_8935_); if (p_9163_ && !flag) { -@@ -1489,6 +_,8 @@ +@@ -1493,6 +_,8 @@ if (itementity == null) { return null; } else { + if (captureDrops() != null) captureDrops().add(itementity); + else - this.f_19853_.m_7967_(itementity); + this.m_9236_().m_7967_(itementity); ItemStack itemstack = itementity.m_32055_(); if (p_9087_) { -@@ -1503,6 +_,76 @@ +@@ -1507,6 +_,76 @@ } } @@ -289,7 +289,7 @@ public TextFilter m_8967_() { return this.f_8939_; } -@@ -1562,11 +_,14 @@ +@@ -1566,11 +_,14 @@ public boolean m_182294_(boolean p_182295_) { Inventory inventory = this.m_150109_(); @@ -297,8 +297,8 @@ + if (selected.m_41619_() || !selected.onDroppedByPlayer(this)) return false; + if (m_6117_() && m_7655_() == InteractionHand.MAIN_HAND && (p_182295_ || selected.m_41613_() == 1)) m_5810_(); // Forge: fix MC-231097 on the serverside ItemStack itemstack = inventory.m_182403_(p_182295_); - this.f_36096_.m_182417_(inventory, inventory.f_35977_).ifPresent((p_274840_) -> { - this.f_36096_.m_150404_(p_274840_, inventory.m_36056_()); + this.f_36096_.m_182417_(inventory, inventory.f_35977_).ifPresent((p_287377_) -> { + this.f_36096_.m_150404_(p_287377_, inventory.m_36056_()); }); - return this.m_7197_(itemstack, false, true) != null; + return net.minecraftforge.common.ForgeHooks.onPlayerTossEvent(this, itemstack, true) != null; diff --git a/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch b/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch index 6938c835cf..1826e16ce2 100644 --- a/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch +++ b/patches/minecraft/net/minecraft/server/level/ServerPlayerGameMode.java.patch @@ -19,7 +19,7 @@ if (!blockstate.m_60795_()) { + if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) blockstate.m_60686_(this.f_9244_, p_215120_, this.f_9245_); - f = blockstate.m_60625_(this.f_9245_, this.f_9245_.f_19853_, p_215120_); + f = blockstate.m_60625_(this.f_9245_, this.f_9245_.m_9236_(), p_215120_); } @@ -221,7 +_,8 @@ @@ -119,7 +119,7 @@ + if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1)) { InteractionResult interactionresult = blockstate.m_60664_(p_9267_, p_9266_, p_9269_, p_9270_); if (interactionresult.m_19077_()) { - CriteriaTriggers.f_10562_.m_220040_(p_9266_, blockpos, itemstack); + CriteriaTriggers.f_10562_.m_285767_(p_9266_, blockpos, itemstack); @@ -319,8 +_,8 @@ } } diff --git a/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch index 3f69a2b4c5..a6c8d5c0c1 100644 --- a/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch +++ b/patches/minecraft/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -184,6 +_,12 @@ +@@ -185,6 +_,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, TickablePacketListener, ServerGamePacketListener { static final Logger f_9744_ = LogUtils.getLogger(); private static final int f_143608_ = 15000; @@ -13,7 +13,7 @@ public static final double f_215198_ = Mth.m_144952_(6.0D); private static final int f_215199_ = -1; private static final int f_244471_ = 4096; -@@ -428,9 +_,11 @@ +@@ -436,9 +_,11 @@ } entity.m_19890_(d3, d4, d5, f, f1); @@ -25,16 +25,7 @@ this.f_9742_.m_129512_(new ClientboundMoveVehiclePacket(entity)); return; } -@@ -447,7 +_,7 @@ - } - - private boolean m_9793_(Entity p_9794_) { -- return p_9794_.f_19853_.m_45556_(p_9794_.m_20191_().m_82400_(0.0625D).m_82363_(0.0D, -0.55D, 0.0D)).allMatch(BlockBehaviour.BlockStateBase::m_60795_); -+ return BlockPos.m_121921_(p_9794_.m_20191_().m_82400_(0.0625D).m_82363_(0.0D, -0.55D, 0.0D)).allMatch(b -> p_9794_.f_19853_.m_8055_(b).m_60795_()); - } - - public void m_7376_(ServerboundAcceptTeleportationPacket p_9835_) { -@@ -1030,7 +_,7 @@ +@@ -1035,7 +_,7 @@ Vec3 vec3 = blockhitresult.m_82450_(); BlockPos blockpos = blockhitresult.m_82425_(); Vec3 vec31 = Vec3.m_82512_(blockpos); @@ -43,16 +34,16 @@ Vec3 vec32 = vec3.m_82546_(vec31); double d0 = 1.0000001D; if (Math.abs(vec32.m_7096_()) < 1.0000001D && Math.abs(vec32.m_7098_()) < 1.0000001D && Math.abs(vec32.m_7094_()) < 1.0000001D) { -@@ -1038,7 +_,7 @@ +@@ -1043,7 +_,7 @@ this.f_9743_.m_9243_(); - int i = this.f_9743_.f_19853_.m_151558_(); + int i = this.f_9743_.m_9236_().m_151558_(); if (blockpos.m_123342_() < i) { - if (this.f_9766_ == null && this.f_9743_.m_20275_((double)blockpos.m_123341_() + 0.5D, (double)blockpos.m_123342_() + 0.5D, (double)blockpos.m_123343_() + 0.5D) < 64.0D && serverlevel.m_7966_(this.f_9743_, blockpos)) { + if (this.f_9766_ == null && serverlevel.m_7966_(this.f_9743_, blockpos)) { InteractionResult interactionresult = this.f_9743_.f_8941_.m_7179_(this.f_9743_, serverlevel, itemstack, interactionhand, blockhitresult); if (direction == Direction.UP && !interactionresult.m_19077_() && blockpos.m_123342_() >= i - 1 && m_9790_(this.f_9743_, itemstack)) { Component component = Component.m_237110_("build.tooHigh", i - 1).m_130940_(ChatFormatting.RED); -@@ -1182,10 +_,13 @@ +@@ -1187,10 +_,13 @@ } CompletableFuture completablefuture = this.m_243132_(playerchatmessage.m_245728_()); @@ -68,7 +59,7 @@ this.m_243086_(playerchatmessage1); }, p_248212_); }); -@@ -1435,7 +_,7 @@ +@@ -1440,7 +_,7 @@ } AABB aabb = entity.m_20191_(); @@ -77,7 +68,7 @@ p_9866_.m_179617_(new ServerboundInteractPacket.Handler() { private void m_143678_(InteractionHand p_143679_, ServerGamePacketListenerImpl.EntityInteraction p_143680_) { ItemStack itemstack = ServerGamePacketListenerImpl.this.f_9743_.m_21120_(p_143679_); -@@ -1458,6 +_,8 @@ +@@ -1463,6 +_,8 @@ public void m_142143_(InteractionHand p_143682_, Vec3 p_143683_) { this.m_143678_(p_143682_, (p_143686_, p_143687_, p_143688_) -> { @@ -86,7 +77,7 @@ return p_143687_.m_7111_(p_143686_, p_143683_, p_143688_); }); } -@@ -1670,6 +_,7 @@ +@@ -1659,6 +_,7 @@ } public void m_7423_(ServerboundCustomPayloadPacket p_9860_) { diff --git a/patches/minecraft/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java.patch b/patches/minecraft/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java.patch index fe30aef19e..c452550bf7 100644 --- a/patches/minecraft/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java.patch +++ b/patches/minecraft/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java +++ b/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java -@@ -45,4 +_,8 @@ +@@ -49,4 +_,8 @@ + } - return map; } + + protected ResourceLocation getPreparedPath(ResourceLocation rl) { -+ return new ResourceLocation(rl.m_135827_(), this.f_10765_ + "/" + rl.m_135815_() + ".json"); ++ return rl.m_247449_(this.f_10765_ + "/" + rl.m_135815_() + ".json"); + } } diff --git a/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch b/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch index 83fea84619..36b09578f2 100644 --- a/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch +++ b/patches/minecraft/net/minecraft/server/players/PlayerList.java.patch @@ -8,7 +8,7 @@ public PlayerList(MinecraftServer p_203842_, LayeredRegistryAccess p_251844_, PlayerDataStorage p_203844_, int p_203845_) { this.f_11195_ = p_203842_; -@@ -168,6 +_,7 @@ +@@ -174,6 +_,7 @@ LevelData leveldata = serverlevel1.m_6106_(); p_11263_.m_143427_(compoundtag); ServerGamePacketListenerImpl servergamepacketlistenerimpl = new ServerGamePacketListenerImpl(this.f_11195_, p_11262_, p_11263_); @@ -16,7 +16,7 @@ GameRules gamerules = serverlevel1.m_46469_(); boolean flag = gamerules.m_46207_(GameRules.f_46156_); boolean flag1 = gamerules.m_46207_(GameRules.f_46145_); -@@ -177,6 +_,7 @@ +@@ -183,6 +_,7 @@ servergamepacketlistenerimpl.m_9829_(new ClientboundChangeDifficultyPacket(leveldata.m_5472_(), leveldata.m_5474_())); servergamepacketlistenerimpl.m_9829_(new ClientboundPlayerAbilitiesPacket(p_11263_.m_150110_())); servergamepacketlistenerimpl.m_9829_(new ClientboundSetCarriedItemPacket(p_11263_.m_150109_().f_35977_)); @@ -24,7 +24,7 @@ servergamepacketlistenerimpl.m_9829_(new ClientboundUpdateRecipesPacket(this.f_11195_.m_129894_().m_44051_())); servergamepacketlistenerimpl.m_9829_(new ClientboundUpdateTagsPacket(TagNetworkSerialization.m_245799_(this.f_243858_))); this.m_11289_(p_11263_); -@@ -249,6 +_,7 @@ +@@ -255,6 +_,7 @@ } p_11263_.m_143429_(); @@ -32,7 +32,7 @@ } protected void m_11273_(ServerScoreboard p_11274_, ServerPlayer p_11275_) { -@@ -309,6 +_,7 @@ +@@ -315,6 +_,7 @@ compoundtag1 = compoundtag; p_11225_.m_20258_(compoundtag); f_11188_.debug("loading single player"); @@ -40,7 +40,7 @@ } else { compoundtag1 = this.f_11204_.m_78435_(p_11225_); } -@@ -317,6 +_,7 @@ +@@ -323,6 +_,7 @@ } protected void m_6765_(ServerPlayer p_11277_) { @@ -48,15 +48,15 @@ this.f_11204_.m_78433_(p_11277_); ServerStatsCounter serverstatscounter = this.f_11202_.get(p_11277_.m_20148_()); if (serverstatscounter != null) { -@@ -331,6 +_,7 @@ +@@ -337,6 +_,7 @@ } public void m_11286_(ServerPlayer p_11287_) { + net.minecraftforge.event.ForgeEventFactory.firePlayerLoggedOut(p_11287_); - ServerLevel serverlevel = p_11287_.m_9236_(); + ServerLevel serverlevel = p_11287_.m_284548_(); p_11287_.m_36220_(Stats.f_12989_); this.m_6765_(p_11287_); -@@ -472,6 +_,7 @@ +@@ -478,6 +_,7 @@ this.f_11197_.put(serverplayer.m_20148_(), serverplayer); serverplayer.m_143429_(); serverplayer.m_21153_(serverplayer.m_21223_()); @@ -64,7 +64,7 @@ if (flag2) { serverplayer.f_8906_.m_9829_(new ClientboundSoundPacket(SoundEvents.f_12377_, SoundSource.BLOCKS, (double)blockpos.m_123341_(), (double)blockpos.m_123342_(), (double)blockpos.m_123343_(), 1.0F, 1.0F, serverlevel1.m_213780_().m_188505_())); } -@@ -556,6 +_,7 @@ +@@ -562,6 +_,7 @@ } public void m_5749_(GameProfile p_11254_) { @@ -72,7 +72,7 @@ this.f_11200_.m_11381_(new ServerOpListEntry(p_11254_, this.f_11195_.m_7022_(), this.f_11200_.m_11351_(p_11254_))); ServerPlayer serverplayer = this.m_11259_(p_11254_.getId()); if (serverplayer != null) { -@@ -565,6 +_,7 @@ +@@ -571,6 +_,7 @@ } public void m_5750_(GameProfile p_11281_) { @@ -80,7 +80,7 @@ this.f_11200_.m_11393_(p_11281_); ServerPlayer serverplayer = this.m_11259_(p_11281_.getId()); if (serverplayer != null) { -@@ -779,13 +_,6 @@ +@@ -785,13 +_,6 @@ if (serverstatscounter == null) { File file1 = this.f_11195_.m_129843_(LevelResource.f_78175_).toFile(); File file2 = new File(file1, uuid + ".json"); @@ -94,7 +94,7 @@ serverstatscounter = new ServerStatsCounter(this.f_11195_, file2); this.f_11202_.put(uuid, serverstatscounter); -@@ -801,8 +_,11 @@ +@@ -807,8 +_,11 @@ Path path = this.f_11195_.m_129843_(LevelResource.f_78174_).resolve(uuid + ".json"); playeradvancements = new PlayerAdvancements(this.f_11195_.m_129933_(), this, this.f_11195_.m_129889_(), path, p_11297_); this.f_11203_.put(uuid, playeradvancements); @@ -106,7 +106,7 @@ playeradvancements.m_135979_(p_11297_); return playeradvancements; } -@@ -832,7 +_,7 @@ +@@ -838,7 +_,7 @@ } public List m_11314_() { @@ -115,7 +115,7 @@ } @Nullable -@@ -849,6 +_,7 @@ +@@ -855,6 +_,7 @@ playeradvancements.m_135981_(this.f_11195_.m_129889_()); } diff --git a/patches/minecraft/net/minecraft/tags/BlockTags.java.patch b/patches/minecraft/net/minecraft/tags/BlockTags.java.patch index c023c185b2..6ea5c4239a 100644 --- a/patches/minecraft/net/minecraft/tags/BlockTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/BlockTags.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/BlockTags.java +++ b/net/minecraft/tags/BlockTags.java -@@ -172,4 +_,8 @@ +@@ -182,4 +_,8 @@ private static TagKey m_203846_(String p_203847_) { return TagKey.m_203882_(Registries.f_256747_, new ResourceLocation(p_203847_)); } diff --git a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch index 415b856061..d239c01889 100644 --- a/patches/minecraft/net/minecraft/tags/ItemTags.java.patch +++ b/patches/minecraft/net/minecraft/tags/ItemTags.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/tags/ItemTags.java +++ b/net/minecraft/tags/ItemTags.java -@@ -108,4 +_,8 @@ +@@ -111,4 +_,8 @@ private static TagKey m_203854_(String p_203855_) { return TagKey.m_203882_(Registries.f_256913_, new ResourceLocation(p_203855_)); } diff --git a/patches/minecraft/net/minecraft/tags/TagLoader.java.patch b/patches/minecraft/net/minecraft/tags/TagLoader.java.patch index 7cc7a4d7f2..3744d3f62e 100644 --- a/patches/minecraft/net/minecraft/tags/TagLoader.java.patch +++ b/patches/minecraft/net/minecraft/tags/TagLoader.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/tags/TagLoader.java +++ b/net/minecraft/tags/TagLoader.java -@@ -143,7 +_,7 @@ - p_203899_.keySet().forEach((p_216008_) -> { - m_144523_(p_203899_, multimap, set, p_216008_, (p_215984_, p_215985_) -> { - this.m_215978_(lookup, p_215985_).ifLeft((p_215977_) -> { -- f_13445_.error("Couldn't load tag {} as it is missing following references: {}", p_215984_, p_215977_.stream().map(Objects::toString).collect(Collectors.joining(", "))); +@@ -100,7 +_,7 @@ + }); + dependencysorter.m_284430_((p_284682_, p_284683_) -> { + this.m_215978_(lookup, p_284683_.f_283922_).ifLeft((p_215977_) -> { +- f_13445_.error("Couldn't load tag {} as it is missing following references: {}", p_284682_, p_215977_.stream().map(Objects::toString).collect(Collectors.joining(", "))); + f_13445_.error("Couldn't load tag {} as it is missing following references: {}", p_215977_, p_215977_.stream().map(Objects::toString).collect(Collectors.joining(", \n\t"))); - }).ifRight((p_216001_) -> { - map.put(p_215984_, p_216001_); - }); + }).ifRight((p_216001_) -> { + map.put(p_284682_, p_216001_); + }); diff --git a/patches/minecraft/net/minecraft/util/datafix/schemas/V2832.java.patch b/patches/minecraft/net/minecraft/util/datafix/schemas/V2832.java.patch index 417a81d5e3..3c77694642 100644 --- a/patches/minecraft/net/minecraft/util/datafix/schemas/V2832.java.patch +++ b/patches/minecraft/net/minecraft/util/datafix/schemas/V2832.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/util/datafix/schemas/V2832.java +++ b/net/minecraft/util/datafix/schemas/V2832.java -@@ -19,7 +_,7 @@ - return DSL.fields("Level", DSL.optionalFields("Entities", DSL.list(References.f_16785_.in(p_185234_)), "TileEntities", DSL.list(DSL.or(References.f_16781_.in(p_185234_), DSL.remainder())), "TileTicks", DSL.list(DSL.fields("i", References.f_16787_.in(p_185234_))), "Sections", DSL.list(DSL.optionalFields("biomes", DSL.optionalFields("palette", DSL.list(References.f_16794_.in(p_185234_))), "block_states", DSL.optionalFields("palette", DSL.list(References.f_16783_.in(p_185234_))))), "Structures", DSL.optionalFields("Starts", DSL.compoundList(References.f_16790_.in(p_185234_))))); +@@ -22,7 +_,7 @@ + return DSL.constType(m_17310_()); }); p_185234_.registerType(false, References.f_16795_, () -> { - return DSL.fields("dimensions", DSL.compoundList(DSL.constType(m_17310_()), DSL.fields("generator", DSL.taggedChoiceLazy("type", DSL.string(), ImmutableMap.of("minecraft:debug", DSL::remainder, "minecraft:flat", () -> { @@ -9,7 +9,7 @@ return DSL.optionalFields("settings", DSL.optionalFields("biome", References.f_16794_.in(p_185234_), "layers", DSL.list(DSL.optionalFields("block", References.f_16787_.in(p_185234_))))); }, "minecraft:noise", () -> { return DSL.optionalFields("biome_source", DSL.taggedChoiceLazy("type", DSL.string(), ImmutableMap.of("minecraft:fixed", () -> { -@@ -29,7 +_,7 @@ +@@ -32,7 +_,7 @@ }, "minecraft:checkerboard", () -> { return DSL.fields("biomes", DSL.list(References.f_16794_.in(p_185234_))); }, "minecraft:the_end", DSL::remainder)), "settings", DSL.or(DSL.constType(DSL.string()), DSL.optionalFields("default_block", References.f_16787_.in(p_185234_), "default_fluid", References.f_16787_.in(p_185234_)))); diff --git a/patches/minecraft/net/minecraft/world/entity/Entity.java.patch b/patches/minecraft/net/minecraft/world/entity/Entity.java.patch index 79e9e4a958..78c8816fdf 100644 --- a/patches/minecraft/net/minecraft/world/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/Entity.java.patch @@ -9,7 +9,7 @@ private static final Logger f_19849_ = LogUtils.getLogger(); public static final String f_146815_ = "id"; public static final String f_146816_ = "Passengers"; -@@ -139,6 +_,7 @@ +@@ -141,6 +_,7 @@ private static final double f_146812_ = 0.0023333333333333335D; public static final String f_146824_ = "UUID"; private static double f_19846_ = 1.0D; @@ -17,7 +17,7 @@ private final EntityType f_19847_; private int f_19848_ = f_19843_.incrementAndGet(); public boolean f_19850_; -@@ -179,14 +_,17 @@ +@@ -181,14 +_,17 @@ public double f_19790_; public double f_19791_; public double f_19792_; @@ -35,7 +35,7 @@ private final Set> f_19801_ = new HashSet<>(); public int f_19802_; protected boolean f_19803_ = true; -@@ -233,6 +_,7 @@ +@@ -237,6 +_,7 @@ private BlockState f_185934_ = null; public Entity(EntityType p_19870_, Level p_19871_) { @@ -43,7 +43,7 @@ this.f_19847_ = p_19870_; this.f_19853_ = p_19871_; this.f_19815_ = p_19870_.m_20680_(); -@@ -250,7 +_,11 @@ +@@ -254,7 +_,11 @@ this.f_19804_.m_135372_(f_146800_, 0); this.m_8097_(); this.m_6034_(0.0D, 0.0D, 0.0D); @@ -56,7 +56,7 @@ } public boolean m_20039_(BlockPos p_20040_, BlockState p_20041_) { -@@ -340,6 +_,7 @@ +@@ -344,6 +_,7 @@ public void m_142687_(Entity.RemovalReason p_146834_) { this.m_142467_(p_146834_); @@ -64,7 +64,7 @@ } public void m_142036_() { -@@ -457,7 +_,7 @@ +@@ -461,7 +_,7 @@ if (this.m_20077_()) { this.m_20093_(); @@ -73,101 +73,89 @@ } this.m_146871_(); -@@ -625,7 +_,7 @@ +@@ -672,7 +_,7 @@ double d1 = vec3.f_82479_; double d2 = vec3.f_82480_; double d3 = vec3.f_82481_; - this.f_146794_ += (float)(vec3.m_82553_() * 0.6D); -+ this.f_146794_ = (float) ((double) this.f_146794_ + vec3.m_82553_() * 0.6D); - boolean flag1 = blockstate.m_204336_(BlockTags.f_13082_) || blockstate.m_60713_(Blocks.f_152499_); - if (!flag1) { - d2 = 0.0D; -@@ -664,25 +_,23 @@ ++ this.f_146794_ = (float)((double)this.f_146794_ + vec3.m_82553_() * 0.6D); + BlockPos blockpos1 = this.m_20097_(); + BlockState blockstate1 = this.m_9236_().m_8055_(blockpos1); + boolean flag1 = this.m_285776_(blockstate1); +@@ -716,16 +_,16 @@ + this.m_7311_(-this.m_6101_()); + } - this.m_146872_(); - float f2 = this.m_6041_(); -- this.m_20256_(this.m_20184_().m_82542_((double)f2, 1.0D, (double)f2)); -- if (this.f_19853_.m_46847_(this.m_20191_().m_82406_(1.0E-6D)).noneMatch((p_20127_) -> { -- return p_20127_.m_204336_(BlockTags.f_13076_) || p_20127_.m_60713_(Blocks.f_49991_); -- })) { -- if (this.f_19831_ <= 0) { -- this.m_7311_(-this.m_6101_()); -- } -- - if (this.f_146810_ && (this.f_146808_ || this.m_20071_())) { -- this.m_146873_(); -- } -- } -- ++ if (this.f_146810_ && (this.f_146808_ || this.m_20071_() || this.isInFluidType((fluidType, height) -> this.canFluidExtinguish(fluidType)))) { + this.m_146873_(); + } + } + - if (this.m_6060_() && (this.f_146808_ || this.m_20071_())) { -+ this.m_20256_(this.m_20184_().m_82542_((double) f2, 1.0D, (double) f2)); -+ } -+ if (this.f_19853_.m_46847_(this.m_20191_().m_82406_(1.0E-6D)).noneMatch((p_20127_) -> p_20127_.m_204336_(BlockTags.f_13076_) || p_20127_.m_60713_(Blocks.f_49991_))) { -+ if (this.f_19831_ <= 0) { ++ if (this.m_6060_() && (this.f_146808_ || this.m_20071_() || this.isInFluidType((fluidType, height) -> this.canFluidExtinguish(fluidType)))) { this.m_7311_(-this.m_6101_()); } -- this.f_19853_.m_46473_().m_7238_(); -- } -+ if (this.f_146810_ && (this.f_146808_ || this.m_20071_() || this.isInFluidType((fluidType, height) -> this.canFluidExtinguish(fluidType)))) { -+ this.m_146873_(); -+ } -+ } -+ -+ if (this.m_6060_() && (this.f_146808_ || this.m_20071_() || this.isInFluidType((fluidType, height) -> this.canFluidExtinguish(fluidType)))) { -+ this.m_7311_(-this.m_6101_()); -+ } -+ -+ this.f_19853_.m_46473_().m_7238_(); - } - } - -@@ -738,10 +_,10 @@ - int j = Mth.m_14107_(this.f_19825_.f_82480_ - (double)p_216987_); - int k = Mth.m_14107_(this.f_19825_.f_82481_); - BlockPos blockpos = new BlockPos(i, j, k); -- if (this.f_19853_.m_8055_(blockpos).m_60795_()) { -+ if (this.f_19853_.m_46859_(blockpos)) { - BlockPos blockpos1 = blockpos.m_7495_(); - BlockState blockstate = this.f_19853_.m_8055_(blockpos1); -- if (blockstate.m_204336_(BlockTags.f_13039_) || blockstate.m_204336_(BlockTags.f_13032_) || blockstate.m_60734_() instanceof FenceGateBlock) { -+ if (blockstate.collisionExtendsVertically(this.f_19853_, blockpos1, this)) { - return blockpos1; +- this.m_9236_().m_46473_().m_7238_(); ++ this.f_19853_.m_46473_().m_7238_(); } } -@@ -814,10 +_,11 @@ + } +@@ -813,7 +_,7 @@ + return blockpos; + } else { + BlockState blockstate = this.m_9236_().m_8055_(blockpos); +- return (!((double)p_216987_ <= 0.5D) || !blockstate.m_204336_(BlockTags.f_13039_)) && !blockstate.m_204336_(BlockTags.f_13032_) && !(blockstate.m_60734_() instanceof FenceGateBlock) ? blockpos.m_175288_(Mth.m_14107_(this.f_19825_.f_82480_ - (double)p_216987_)) : blockpos; ++ return (!((double)p_216987_ <= 0.5D) || !blockstate.collisionExtendsVertically(this.m_9236_(), blockpos, this)) ? blockpos.m_175288_(Mth.m_14107_(this.f_19825_.f_82480_ - (double)p_216987_)) : blockpos; + } + } else { + int i = Mth.m_14107_(this.f_19825_.f_82479_); +@@ -884,10 +_,11 @@ boolean flag1 = p_20273_.f_82480_ != vec3.f_82480_; boolean flag2 = p_20273_.f_82481_ != vec3.f_82481_; - boolean flag3 = this.f_19861_ || flag1 && p_20273_.f_82480_ < 0.0D; + boolean flag3 = this.m_20096_() || flag1 && p_20273_.f_82480_ < 0.0D; - if (this.m_274421_() > 0.0F && flag3 && (flag || flag2)) { -- Vec3 vec31 = m_198894_(this, new Vec3(p_20273_.f_82479_, (double)this.m_274421_(), p_20273_.f_82481_), aabb, this.f_19853_, list); -- Vec3 vec32 = m_198894_(this, new Vec3(0.0D, (double)this.m_274421_(), 0.0D), aabb.m_82363_(p_20273_.f_82479_, 0.0D, p_20273_.f_82481_), this.f_19853_, list); +- Vec3 vec31 = m_198894_(this, new Vec3(p_20273_.f_82479_, (double)this.m_274421_(), p_20273_.f_82481_), aabb, this.m_9236_(), list); +- Vec3 vec32 = m_198894_(this, new Vec3(0.0D, (double)this.m_274421_(), 0.0D), aabb.m_82363_(p_20273_.f_82479_, 0.0D, p_20273_.f_82481_), this.m_9236_(), list); - if (vec32.f_82480_ < (double)this.m_274421_()) { + float stepHeight = getStepHeight(); + if (stepHeight > 0.0F && flag3 && (flag || flag2)) { + Vec3 vec31 = m_198894_(this, new Vec3(p_20273_.f_82479_, (double)stepHeight, p_20273_.f_82481_), aabb, this.f_19853_, list); + Vec3 vec32 = m_198894_(this, new Vec3(0.0D, (double)stepHeight, 0.0D), aabb.m_82363_(p_20273_.f_82479_, 0.0D, p_20273_.f_82481_), this.f_19853_, list); + if (vec32.f_82480_ < (double)stepHeight) { - Vec3 vec33 = m_198894_(this, new Vec3(p_20273_.f_82479_, 0.0D, p_20273_.f_82481_), aabb.m_82383_(vec32), this.f_19853_, list).m_82549_(vec32); + Vec3 vec33 = m_198894_(this, new Vec3(p_20273_.f_82479_, 0.0D, p_20273_.f_82481_), aabb.m_82383_(vec32), this.m_9236_(), list).m_82549_(vec32); if (vec33.m_165925_() > vec31.m_165925_()) { vec31 = vec33; -@@ -945,7 +_,7 @@ - BlockState blockstate = this.f_19853_.m_8055_(p_20135_.m_7494_()); - boolean flag = blockstate.m_204336_(BlockTags.f_144271_); - if (flag || !p_20136_.m_60767_().m_76332_()) { -- SoundType soundtype = flag ? blockstate.m_60827_() : p_20136_.m_60827_(); -+ SoundType soundtype = flag ? blockstate.getSoundType(f_19853_, p_20135_, this) : p_20136_.getSoundType(f_19853_, p_20135_, this); - this.m_5496_(soundtype.m_56776_(), soundtype.m_56773_() * 0.15F, soundtype.m_56774_()); - } +@@ -1033,14 +_,15 @@ + return !blockstate.m_204336_(BlockTags.f_144271_) && !blockstate.m_204336_(BlockTags.f_276549_) ? p_278049_ : blockpos; } -@@ -1074,19 +_,22 @@ + +- protected void m_276961_(BlockState p_277472_, BlockState p_277630_) { +- SoundType soundtype = p_277472_.m_60827_(); ++ protected void playCombinationStepSounds(BlockState p_277472_, BlockState p_277630_, BlockPos primaryPos, BlockPos secondaryPos) { ++ SoundType soundtype = p_277472_.getSoundType(this.f_19853_, primaryPos, this); ++ SoundType soundtype1 = p_277630_.getSoundType(this.f_19853_, secondaryPos, this); + this.m_5496_(soundtype.m_56776_(), soundtype.m_56773_() * 0.15F, soundtype.m_56774_()); +- this.m_280568_(p_277630_); ++ this.playMuffledStepSound(p_277630_, secondaryPos); + } + +- protected void m_280568_(BlockState p_283110_) { +- SoundType soundtype = p_283110_.m_60827_(); ++ protected void playMuffledStepSound(BlockState p_283110_, BlockPos pos) { ++ SoundType soundtype = p_283110_.getSoundType(this.f_19853_, pos, this); + this.m_5496_(soundtype.m_56776_(), soundtype.m_56773_() * 0.05F, soundtype.m_56774_() * 0.8F); + } + +@@ -1176,19 +_,22 @@ public void m_5844_() { if (this.m_6069_()) { - this.m_20282_(this.m_20142_() && this.m_20069_() && !this.m_20159_()); + this.m_20282_(this.m_20142_() && (this.m_20069_() || this.isInFluidType((fluidType, height) -> this.canSwimInFluidType(fluidType))) && !this.m_20159_()); } else { -- this.m_20282_(this.m_20142_() && this.m_5842_() && !this.m_20159_() && this.f_19853_.m_6425_(this.f_19826_).m_205070_(FluidTags.f_13131_)); +- this.m_20282_(this.m_20142_() && this.m_5842_() && !this.m_20159_() && this.m_9236_().m_6425_(this.f_19826_).m_205070_(FluidTags.f_13131_)); + this.m_20282_(this.m_20142_() && (this.m_5842_() || this.canStartSwimming()) && !this.m_20159_()); } @@ -177,7 +165,7 @@ this.f_19799_.clear(); + this.forgeFluidTypeHeight.clear(); this.m_20074_(); -- double d0 = this.f_19853_.m_6042_().f_63857_() ? 0.007D : 0.0023333333333333335D; +- double d0 = this.m_9236_().m_6042_().f_63857_() ? 0.007D : 0.0023333333333333335D; - boolean flag = this.m_204031_(FluidTags.f_13132_, d0); - return this.m_20069_() || flag; + if (!(this.m_20202_() instanceof Boat)) { @@ -188,7 +176,7 @@ } void m_20074_() { -@@ -1115,6 +_,7 @@ +@@ -1217,6 +_,7 @@ private void m_20323_() { this.f_19800_ = this.m_204029_(FluidTags.f_13131_); this.f_19801_.clear(); @@ -196,16 +184,16 @@ double d0 = this.m_20188_() - (double)0.11111111F; Entity entity = this.m_20202_(); if (entity instanceof Boat boat) { -@@ -1127,7 +_,7 @@ - FluidState fluidstate = this.f_19853_.m_6425_(blockpos); - double d1 = (double)((float)blockpos.m_123342_() + fluidstate.m_76155_(this.f_19853_, blockpos)); +@@ -1229,7 +_,7 @@ + FluidState fluidstate = this.m_9236_().m_6425_(blockpos); + double d1 = (double)((float)blockpos.m_123342_() + fluidstate.m_76155_(this.m_9236_(), blockpos)); if (d1 > d0) { - fluidstate.m_205075_().forEach(this.f_19801_::add); + this.forgeFluidTypeOnEyes = fluidstate.getFluidType(); } } -@@ -1171,7 +_,7 @@ +@@ -1273,12 +_,13 @@ } public boolean m_5843_() { @@ -214,15 +202,18 @@ } protected void m_20076_() { -@@ -1180,19 +_,23 @@ - int k = Mth.m_14107_(this.m_20189_()); - BlockPos blockpos = new BlockPos(i, j, k); - BlockState blockstate = this.f_19853_.m_8055_(blockpos); + BlockPos blockpos = this.m_216999_(); + BlockState blockstate = this.m_9236_().m_8055_(blockpos); + if(!blockstate.addRunningEffects(f_19853_, blockpos, this)) if (blockstate.m_60799_() != RenderShape.INVISIBLE) { Vec3 vec3 = this.m_20184_(); -- this.f_19853_.m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate), this.m_20185_() + (this.f_19796_.m_188500_() - 0.5D) * (double)this.f_19815_.f_20377_, this.m_20186_() + 0.1D, this.m_20189_() + (this.f_19796_.m_188500_() - 0.5D) * (double)this.f_19815_.f_20377_, vec3.f_82479_ * -4.0D, 1.5D, vec3.f_82481_ * -4.0D); -+ this.f_19853_.m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate).setPos(blockpos), this.m_20185_() + (this.f_19796_.m_188500_() - 0.5D) * (double)this.f_19815_.f_20377_, this.m_20186_() + 0.1D, this.m_20189_() + (this.f_19796_.m_188500_() - 0.5D) * (double)this.f_19815_.f_20377_, vec3.f_82479_ * -4.0D, 1.5D, vec3.f_82481_ * -4.0D); + BlockPos blockpos1 = this.m_20183_(); +@@ -1292,17 +_,20 @@ + d1 = Mth.m_14008_(d1, (double)blockpos.m_123343_(), (double)blockpos.m_123343_() + 1.0D); + } + +- this.m_9236_().m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate), d0, this.m_20186_() + 0.1D, d1, vec3.f_82479_ * -4.0D, 1.5D, vec3.f_82481_ * -4.0D); ++ this.m_9236_().m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate).setPos(blockpos), d0, this.m_20186_() + 0.1D, d1, vec3.f_82479_ * -4.0D, 1.5D, vec3.f_82481_ * -4.0D); } } @@ -240,7 +231,7 @@ } public void m_19920_(float p_19921_, Vec3 p_19922_) { -@@ -1510,6 +_,8 @@ +@@ -1620,6 +_,8 @@ p_20241_.m_128379_("HasVisualFire", this.f_146813_); } @@ -249,7 +240,7 @@ if (!this.f_19841_.isEmpty()) { ListTag listtag = new ListTag(); -@@ -1520,6 +_,10 @@ +@@ -1630,6 +_,10 @@ p_20241_.m_128365_("Tags", listtag); } @@ -260,7 +251,7 @@ this.m_7380_(p_20241_); if (this.m_20160_()) { ListTag listtag1 = new ListTag(); -@@ -1595,6 +_,9 @@ +@@ -1705,6 +_,9 @@ this.m_146915_(p_20259_.m_128471_("Glowing")); this.m_146917_(p_20259_.m_128451_("TicksFrozen")); this.f_146813_ = p_20259_.m_128471_("HasVisualFire"); @@ -270,16 +261,16 @@ if (p_20259_.m_128425_("Tags", 9)) { this.f_19841_.clear(); ListTag listtag3 = p_20259_.m_128437_("Tags", 8); -@@ -1683,6 +_,8 @@ +@@ -1793,6 +_,8 @@ } else { - ItemEntity itementity = new ItemEntity(this.f_19853_, this.m_20185_(), this.m_20186_() + (double)p_19986_, this.m_20189_(), p_19985_); + ItemEntity itementity = new ItemEntity(this.m_9236_(), this.m_20185_(), this.m_20186_() + (double)p_19986_, this.m_20189_(), p_19985_); itementity.m_32060_(); + if (captureDrops() != null) captureDrops().add(itementity); + else - this.f_19853_.m_7967_(itementity); + this.m_9236_().m_7967_(itementity); return itementity; } -@@ -1719,6 +_,7 @@ +@@ -1829,6 +_,7 @@ public void m_6083_() { this.m_20256_(Vec3.f_82478_); @@ -287,7 +278,7 @@ this.m_8119_(); if (this.m_20159_()) { this.m_20202_().m_7332_(this); -@@ -1767,6 +_,7 @@ +@@ -1877,6 +_,7 @@ } } @@ -295,7 +286,7 @@ if (p_19967_ || this.m_7341_(p_19966_) && p_19966_.m_7310_(this)) { if (this.m_20159_()) { this.m_8127_(); -@@ -1805,6 +_,7 @@ +@@ -1915,6 +_,7 @@ public void m_6038_() { if (this.f_19824_ != null) { Entity entity = this.f_19824_; @@ -303,7 +294,7 @@ this.f_19824_ = null; entity.m_20351_(this); } -@@ -1857,6 +_,8 @@ +@@ -1967,6 +_,8 @@ return this.f_19823_.isEmpty(); } @@ -312,7 +303,7 @@ protected boolean m_269011_() { return true; } -@@ -2038,7 +_,7 @@ +@@ -2148,7 +_,7 @@ } public boolean m_20143_() { @@ -321,7 +312,7 @@ } public void m_20282_(boolean p_20283_) { -@@ -2144,7 +_,7 @@ +@@ -2258,7 +_,7 @@ this.m_20254_(8); } @@ -330,7 +321,7 @@ } public void m_6845_(boolean p_20313_) { -@@ -2240,7 +_,7 @@ +@@ -2354,7 +_,7 @@ } protected Component m_5677_() { @@ -339,7 +330,7 @@ } public boolean m_7306_(Entity p_20356_) { -@@ -2296,14 +_,20 @@ +@@ -2410,14 +_,20 @@ @Nullable public Entity m_5489_(ServerLevel p_20118_) { @@ -348,20 +339,20 @@ + @Nullable + public Entity changeDimension(ServerLevel p_20118_, net.minecraftforge.common.util.ITeleporter teleporter) { + if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_20118_.m_46472_())) return null; - if (this.f_19853_ instanceof ServerLevel && !this.m_213877_()) { - this.f_19853_.m_46473_().m_6180_("changeDimension"); + if (this.m_9236_() instanceof ServerLevel && !this.m_213877_()) { + this.m_9236_().m_46473_().m_6180_("changeDimension"); this.m_19877_(); - this.f_19853_.m_46473_().m_6180_("reposition"); + this.m_9236_().m_46473_().m_6180_("reposition"); - PortalInfo portalinfo = this.m_7937_(p_20118_); + PortalInfo portalinfo = teleporter.getPortalInfo(this, p_20118_, this::m_7937_); if (portalinfo == null) { return null; } else { + Entity transportedEntity = teleporter.placeEntity(this, (ServerLevel) this.f_19853_, p_20118_, this.f_19857_, spawnPortal -> { //Forge: Start vanilla logic - this.f_19853_.m_46473_().m_6182_("reloading"); + this.m_9236_().m_46473_().m_6182_("reloading"); Entity entity = this.m_6095_().m_20615_(p_20118_); if (entity != null) { -@@ -2311,17 +_,19 @@ +@@ -2425,17 +_,19 @@ entity.m_7678_(portalinfo.f_77676_.f_82479_, portalinfo.f_77676_.f_82480_, portalinfo.f_77676_.f_82481_, portalinfo.f_77678_, entity.m_146909_()); entity.m_20256_(portalinfo.f_77677_); p_20118_.m_143334_(entity); @@ -374,16 +365,16 @@ + }); //Forge: End vanilla logic this.m_6089_(); - this.f_19853_.m_46473_().m_7238_(); - ((ServerLevel)this.f_19853_).m_8886_(); + this.m_9236_().m_46473_().m_7238_(); + ((ServerLevel)this.m_9236_()).m_8886_(); p_20118_.m_8886_(); - this.f_19853_.m_46473_().m_7238_(); + this.m_9236_().m_46473_().m_7238_(); - return entity; + return transportedEntity; } } else { return null; -@@ -2443,6 +_,7 @@ +@@ -2557,6 +_,7 @@ return this.f_19821_; } @@ -391,7 +382,7 @@ public boolean m_6063_() { return true; } -@@ -2560,8 +_,10 @@ +@@ -2679,8 +_,10 @@ EntityDimensions entitydimensions = this.f_19815_; Pose pose = this.m_20089_(); EntityDimensions entitydimensions1 = this.m_6972_(pose); @@ -402,19 +393,19 @@ + this.f_19816_ = sizeEvent.getNewEyeHeight(); this.m_20090_(); boolean flag = (double)entitydimensions1.f_20377_ <= 4.0D && (double)entitydimensions1.f_20378_ <= 4.0D; - if (!this.f_19853_.f_46443_ && !this.f_19803_ && !this.f_19794_ && flag && (entitydimensions1.f_20377_ > entitydimensions.f_20377_ || entitydimensions1.f_20378_ > entitydimensions.f_20378_) && !(this instanceof Player)) { -@@ -2569,8 +_,9 @@ + if (!this.m_9236_().f_46443_ && !this.f_19803_ && !this.f_19794_ && flag && (entitydimensions1.f_20377_ > entitydimensions.f_20377_ || entitydimensions1.f_20378_ > entitydimensions.f_20378_) && !(this instanceof Player)) { +@@ -2688,8 +_,9 @@ double d0 = (double)Math.max(0.0F, entitydimensions1.f_20377_ - entitydimensions.f_20377_) + 1.0E-6D; double d1 = (double)Math.max(0.0F, entitydimensions1.f_20378_ - entitydimensions.f_20378_) + 1.0E-6D; VoxelShape voxelshape = Shapes.m_83064_(AABB.m_165882_(vec3, d0, d1, d0)); + EntityDimensions finalEntitydimensions = entitydimensions1; - this.f_19853_.m_151418_(this, voxelshape, vec3, (double)entitydimensions1.f_20377_, (double)entitydimensions1.f_20378_, (double)entitydimensions1.f_20377_).ifPresent((p_185956_) -> { + this.m_9236_().m_151418_(this, voxelshape, vec3, (double)entitydimensions1.f_20377_, (double)entitydimensions1.f_20378_, (double)entitydimensions1.f_20377_).ifPresent((p_185956_) -> { - this.m_146884_(p_185956_.m_82520_(0.0D, (double)(-entitydimensions1.f_20378_) / 2.0D, 0.0D)); + this.m_146884_(p_185956_.m_82520_(0.0D, (double)(-finalEntitydimensions.f_20378_) / 2.0D, 0.0D)); }); } -@@ -2861,9 +_,17 @@ +@@ -2980,9 +_,17 @@ this.f_19859_ = this.m_146908_(); } @@ -433,7 +424,7 @@ } else { AABB aabb = this.m_20191_().m_82406_(0.001D); int i = Mth.m_14107_(aabb.f_82288_); -@@ -2878,25 +_,28 @@ +@@ -2997,25 +_,28 @@ Vec3 vec3 = Vec3.f_82478_; int k1 = 0; BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); @@ -443,11 +434,11 @@ for(int i2 = k; i2 < l; ++i2) { for(int j2 = i1; j2 < j1; ++j2) { blockpos$mutableblockpos.m_122178_(l1, i2, j2); - FluidState fluidstate = this.f_19853_.m_6425_(blockpos$mutableblockpos); + FluidState fluidstate = this.m_9236_().m_6425_(blockpos$mutableblockpos); - if (fluidstate.m_205070_(p_204032_)) { + net.minecraftforge.fluids.FluidType fluidType = fluidstate.getFluidType(); + if (!fluidType.isAir()) { - double d1 = (double)((float)i2 + fluidstate.m_76155_(this.f_19853_, blockpos$mutableblockpos)); + double d1 = (double)((float)i2 + fluidstate.m_76155_(this.m_9236_(), blockpos$mutableblockpos)); if (d1 >= aabb.f_82289_) { flag1 = true; - d0 = Math.max(d1 - aabb.f_82289_, d0); @@ -455,7 +446,7 @@ + org.apache.commons.lang3.tuple.MutableTriple interim = interimCalcs.computeIfAbsent(fluidType, t -> org.apache.commons.lang3.tuple.MutableTriple.of(0.0D, Vec3.f_82478_, 0)); + interim.setLeft(Math.max(d1 - aabb.f_82289_, interim.getLeft())); + if (this.isPushedByFluid(fluidType)) { - Vec3 vec31 = fluidstate.m_76179_(this.f_19853_, blockpos$mutableblockpos); + Vec3 vec31 = fluidstate.m_76179_(this.m_9236_(), blockpos$mutableblockpos); - if (d0 < 0.4D) { - vec31 = vec31.m_82490_(d0); + if (interim.getLeft() < 0.4D) { @@ -469,7 +460,7 @@ } } } -@@ -2904,27 +_,28 @@ +@@ -3023,27 +_,28 @@ } } @@ -508,8 +499,8 @@ } } -@@ -2937,7 +_,10 @@ - return !this.f_19853_.m_151572_(i, k, j, l); +@@ -3056,7 +_,10 @@ + return !this.m_9236_().m_151572_(i, k, j, l); } + @Deprecated // Forge: Use getFluidTypeHeight instead @@ -519,7 +510,7 @@ return this.f_19799_.getDouble(p_204037_); } -@@ -3069,6 +_,7 @@ +@@ -3192,6 +_,7 @@ this.f_146801_.m_142044_(); } @@ -527,7 +518,7 @@ } -@@ -3196,6 +_,103 @@ +@@ -3319,6 +_,103 @@ public boolean m_142265_(Level p_146843_, BlockPos p_146844_) { return true; } diff --git a/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch b/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch index f3090e1499..17179df652 100644 --- a/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ExperienceOrb.java.patch @@ -3,30 +3,30 @@ @@ -90,7 +_,8 @@ this.m_6478_(MoverType.SELF, this.m_20184_()); float f = 0.98F; - if (this.f_19861_) { -- f = this.f_19853_.m_8055_(BlockPos.m_274561_(this.m_20185_(), this.m_20186_() - 1.0D, this.m_20189_())).m_60734_().m_49958_() * 0.98F; -+ BlockPos pos = BlockPos.m_274561_(this.m_20185_(), this.m_20186_() - 1.0D, this.m_20189_()); -+ f = this.f_19853_.m_8055_(pos).getFriction(this.f_19853_, pos, this) * 0.98F; + if (this.m_20096_()) { +- f = this.m_9236_().m_8055_(this.m_20099_()).m_60734_().m_49958_() * 0.98F; ++ BlockPos pos = m_20099_(); ++ f = this.m_9236_().m_8055_(pos).getFriction(this.m_9236_(), pos, this) * 0.98F; } this.m_20256_(this.m_20184_().m_82542_((double)f, 0.98D, (double)f)); -@@ -168,6 +_,7 @@ +@@ -172,6 +_,7 @@ } public boolean m_6469_(DamageSource p_20785_, float p_20786_) { -+ if (this.f_19853_.f_46443_ || this.m_213877_()) return false; //Forge: Fixes MC-53850 ++ if (this.m_9236_().f_46443_ || this.m_213877_()) return false; //Forge: Fixes MC-53850 if (this.m_6673_(p_20785_)) { return false; - } else if (this.f_19853_.f_46443_) { -@@ -200,6 +_,7 @@ + } else if (this.m_9236_().f_46443_) { +@@ -204,6 +_,7 @@ public void m_6123_(Player p_20792_) { - if (!this.f_19853_.f_46443_) { + if (!this.m_9236_().f_46443_) { if (p_20792_.f_36101_ == 0) { + if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerXpEvent.PickupXp(p_20792_, this))) return; p_20792_.f_36101_ = 2; p_20792_.m_7938_(this, 1); int i = this.m_147092_(p_20792_, this.f_20770_); -@@ -220,7 +_,7 @@ +@@ -224,7 +_,7 @@ Map.Entry entry = EnchantmentHelper.m_44839_(Enchantments.f_44962_, p_147093_, ItemStack::m_41768_); if (entry != null) { ItemStack itemstack = entry.getValue(); diff --git a/patches/minecraft/net/minecraft/world/entity/FlyingMob.java.patch b/patches/minecraft/net/minecraft/world/entity/FlyingMob.java.patch index fc4c60a7b5..71dd06a417 100644 --- a/patches/minecraft/net/minecraft/world/entity/FlyingMob.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/FlyingMob.java.patch @@ -4,18 +4,18 @@ this.m_6478_(MoverType.SELF, this.m_20184_()); this.m_20256_(this.m_20184_().m_82490_(0.5D)); } else { -+ BlockPos ground = BlockPos.m_274561_(this.m_20185_(), this.m_20186_() - 1.0D, this.m_20189_()); ++ BlockPos ground = m_20099_(); float f = 0.91F; - if (this.f_19861_) { -- f = this.f_19853_.m_8055_(BlockPos.m_274561_(this.m_20185_(), this.m_20186_() - 1.0D, this.m_20189_())).m_60734_().m_49958_() * 0.91F; -+ f = this.f_19853_.m_8055_(ground).getFriction(this.f_19853_, ground, this) * 0.91F; + if (this.m_20096_()) { +- f = this.m_9236_().m_8055_(this.m_20099_()).m_60734_().m_49958_() * 0.91F; ++ f = this.m_9236_().m_8055_(ground).getFriction(this.m_9236_(), ground, this) * 0.91F; } float f1 = 0.16277137F / (f * f * f); f = 0.91F; - if (this.f_19861_) { -- f = this.f_19853_.m_8055_(BlockPos.m_274561_(this.m_20185_(), this.m_20186_() - 1.0D, this.m_20189_())).m_60734_().m_49958_() * 0.91F; -+ f = this.f_19853_.m_8055_(ground).getFriction(this.f_19853_, ground, this) * 0.91F; + if (this.m_20096_()) { +- f = this.m_9236_().m_8055_(this.m_20099_()).m_60734_().m_49958_() * 0.91F; ++ f = this.m_9236_().m_8055_(ground).getFriction(this.m_9236_(), ground, this) * 0.91F; } - this.m_19920_(this.f_19861_ ? 0.1F * f1 : 0.02F, p_20818_); + this.m_19920_(this.m_20096_() ? 0.1F * f1 : 0.02F, p_20818_); diff --git a/patches/minecraft/net/minecraft/world/entity/LightningBolt.java.patch b/patches/minecraft/net/minecraft/world/entity/LightningBolt.java.patch index 371fc67937..2811158d08 100644 --- a/patches/minecraft/net/minecraft/world/entity/LightningBolt.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/LightningBolt.java.patch @@ -24,10 +24,10 @@ super.m_8119_(); if (this.f_20860_ == 2) { @@ -121,6 +_,7 @@ - List list1 = this.f_19853_.m_6249_(this, new AABB(this.m_20185_() - 3.0D, this.m_20186_() - 3.0D, this.m_20189_() - 3.0D, this.m_20185_() + 3.0D, this.m_20186_() + 6.0D + 3.0D, this.m_20189_() + 3.0D), Entity::m_6084_); + List list1 = this.m_9236_().m_6249_(this, new AABB(this.m_20185_() - 3.0D, this.m_20186_() - 3.0D, this.m_20189_() - 3.0D, this.m_20185_() + 3.0D, this.m_20186_() + 6.0D + 3.0D, this.m_20189_() + 3.0D), Entity::m_6084_); for(Entity entity : list1) { + if (!net.minecraftforge.event.ForgeEventFactory.onEntityStruckByLightning(entity, this)) - entity.m_8038_((ServerLevel)this.f_19853_, this); + entity.m_8038_((ServerLevel)this.m_9236_(), this); } diff --git a/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch index 272670ce2a..f554f09574 100644 --- a/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -117,12 +_,14 @@ +@@ -119,12 +_,14 @@ import net.minecraft.world.scores.PlayerTeam; import org.slf4j.Logger; @@ -16,7 +16,7 @@ public static final int f_147166_ = 2; public static final int f_147167_ = 4; public static final int f_147168_ = 98; -@@ -270,7 +_,7 @@ +@@ -273,7 +_,7 @@ } public static AttributeSupplier.Builder m_21183_() { @@ -25,49 +25,50 @@ } protected void m_7840_(double p_20990_, boolean p_20991_, BlockState p_20992_, BlockPos p_20993_) { -@@ -288,13 +_,15 @@ - if (!p_20992_.m_60795_()) { - double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D); - int i = (int)(150.0D * d0); -- ((ServerLevel)this.f_19853_).m_8767_(new BlockParticleOption(ParticleTypes.f_123794_, p_20992_), this.m_20185_(), this.m_20186_(), this.m_20189_(), i, 0.0D, 0.0D, 0.0D, (double)0.15F); -+ if (!p_20992_.addLandingEffects((ServerLevel)this.f_19853_, p_20993_, p_20992_, this, i)) -+ ((ServerLevel)this.f_19853_).m_8767_(new BlockParticleOption(ParticleTypes.f_123794_, p_20992_).setPos(p_20993_), this.m_20185_(), this.m_20186_(), this.m_20189_(), i, 0.0D, 0.0D, 0.0D, (double)0.15F); - } +@@ -302,7 +_,8 @@ + float f = (float)Mth.m_14167_(this.f_19789_ - 3.0F); + double d4 = Math.min((double)(0.2F + f / 15.0F), 2.5D); + int i = (int)(150.0D * d4); +- ((ServerLevel)this.m_9236_()).m_8767_(new BlockParticleOption(ParticleTypes.f_123794_, p_20992_), d0, d1, d2, i, 0.0D, 0.0D, 0.0D, (double)0.15F); ++ if (!p_20992_.addLandingEffects((ServerLevel) this.m_9236_(), p_20993_, p_20992_, this, i)) ++ ((ServerLevel)this.m_9236_()).m_8767_(new BlockParticleOption(ParticleTypes.f_123794_, p_20992_).setPos(p_20993_), d0, d1, d2, i, 0.0D, 0.0D, 0.0D, (double)0.15F); } super.m_7840_(p_20990_, p_20991_, p_20992_, p_20993_); +@@ -312,6 +_,7 @@ + } + @Deprecated //FORGE: Use canDrownInFluidType instead public boolean m_6040_() { return this.m_6336_() == MobType.f_21641_; } -@@ -335,8 +_,8 @@ +@@ -352,8 +_,8 @@ } } -- if (this.m_204029_(FluidTags.f_13131_) && !this.f_19853_.m_8055_(BlockPos.m_274561_(this.m_20185_(), this.m_20188_(), this.m_20189_())).m_60713_(Blocks.f_50628_)) { +- if (this.m_204029_(FluidTags.f_13131_) && !this.m_9236_().m_8055_(BlockPos.m_274561_(this.m_20185_(), this.m_20188_(), this.m_20189_())).m_60713_(Blocks.f_50628_)) { - boolean flag1 = !this.m_6040_() && !MobEffectUtil.m_19588_(this) && (!flag || !((Player)this).m_150110_().f_35934_); -+ if (!this.getEyeInFluidType().isAir() && !this.f_19853_.m_8055_(BlockPos.m_274561_(this.m_20185_(), this.m_20188_(), this.m_20189_())).m_60713_(Blocks.f_50628_)) { ++ if (!this.getEyeInFluidType().isAir() && !this.m_9236_().m_8055_(BlockPos.m_274561_(this.m_20185_(), this.m_20188_(), this.m_20189_())).m_60713_(Blocks.f_50628_)) { + boolean flag1 = this.canDrownInFluidType(this.getEyeInFluidType()) && !MobEffectUtil.m_19588_(this) && (!flag || !((Player)this).m_150110_().f_35934_); if (flag1) { this.m_20301_(this.m_7302_(this.m_20146_())); if (this.m_20146_() == -20) { -@@ -354,10 +_,11 @@ +@@ -371,10 +_,11 @@ } } -- if (!this.f_19853_.f_46443_ && this.m_20159_() && this.m_20202_() != null && this.m_20202_().m_275843_()) { -+ if (!this.f_19853_.f_46443_ && this.m_20159_() && this.m_20202_() != null && !this.m_20202_().canBeRiddenUnderFluidType(this.getEyeInFluidType(), this)) { +- if (!this.m_9236_().f_46443_ && this.m_20159_() && this.m_20202_() != null && this.m_20202_().m_275843_()) { ++ if (!this.m_9236_().f_46443_ && this.m_20159_() && this.m_20202_() != null && !this.m_20202_().canBeRiddenUnderFluidType(this.getEyeInFluidType(), this)) { this.m_8127_(); } - } else if (this.m_20146_() < this.m_6062_()) { + } // Forge: Move to if statement since we need to increase the air supply if in bubble column or can't drown -+ if (this.m_20146_() < this.m_6062_() && (!this.canDrownInFluidType(this.getEyeInFluidType()) || this.f_19853_.m_8055_(BlockPos.m_274561_(this.m_20185_(), this.m_20188_(), this.m_20189_())).m_60713_(Blocks.f_50628_))) { ++ if (this.m_20146_() < this.m_6062_() && (!this.canDrownInFluidType(this.getEyeInFluidType()) || this.m_9236_().m_8055_(BlockPos.m_274561_(this.m_20185_(), this.m_20188_(), this.m_20189_())).m_60713_(Blocks.f_50628_))) { this.m_20301_(this.m_7305_(this.m_20146_())); } -@@ -370,7 +_,7 @@ +@@ -387,7 +_,7 @@ } } @@ -76,16 +77,16 @@ this.m_252836_(); } -@@ -732,7 +_,7 @@ +@@ -749,7 +_,7 @@ if (!mobeffectinstance.m_19552_(this, () -> { this.m_141973_(mobeffectinstance, true, (Entity)null); })) { -- if (!this.f_19853_.f_46443_) { -+ if (!this.f_19853_.f_46443_ && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.MobEffectEvent.Expired(this, mobeffectinstance))) { +- if (!this.m_9236_().f_46443_) { ++ if (!this.m_9236_().f_46443_ && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.living.MobEffectEvent.Expired(this, mobeffectinstance))) { iterator.remove(); this.m_7285_(mobeffectinstance); } -@@ -782,8 +_,10 @@ +@@ -799,8 +_,10 @@ this.m_6842_(false); } else { Collection collection = this.f_20945_.values(); @@ -98,7 +99,7 @@ this.m_6842_(this.m_21023_(MobEffects.f_19609_)); } -@@ -819,7 +_,7 @@ +@@ -836,7 +_,7 @@ d0 *= 0.5D; } } @@ -107,7 +108,7 @@ return d0; } -@@ -862,7 +_,9 @@ +@@ -879,7 +_,9 @@ boolean flag; for(flag = false; iterator.hasNext(); flag = true) { @@ -118,7 +119,7 @@ iterator.remove(); } -@@ -896,6 +_,7 @@ +@@ -913,6 +_,7 @@ return false; } else { MobEffectInstance mobeffectinstance = this.f_20945_.get(p_147208_.m_19544_()); @@ -126,7 +127,7 @@ if (mobeffectinstance == null) { this.f_20945_.put(p_147208_.m_19544_(), p_147208_); this.m_142540_(p_147208_, p_147209_); -@@ -910,6 +_,9 @@ +@@ -927,6 +_,9 @@ } public boolean m_7301_(MobEffectInstance p_21197_) { @@ -136,7 +137,7 @@ if (this.m_6336_() == MobType.f_21641_) { MobEffect mobeffect = p_21197_.m_19544_(); if (mobeffect == MobEffects.f_19605_ || mobeffect == MobEffects.f_19614_) { -@@ -942,6 +_,7 @@ +@@ -959,6 +_,7 @@ } public boolean m_21195_(MobEffect p_21196_) { @@ -144,7 +145,7 @@ MobEffectInstance mobeffectinstance = this.m_6234_(p_21196_); if (mobeffectinstance != null) { this.m_7285_(mobeffectinstance); -@@ -978,6 +_,8 @@ +@@ -1016,6 +_,8 @@ } public void m_5634_(float p_21116_) { @@ -153,15 +154,15 @@ float f = this.m_21223_(); if (f > 0.0F) { this.m_21153_(f + p_21116_); -@@ -998,6 +_,7 @@ +@@ -1036,6 +_,7 @@ } public boolean m_6469_(DamageSource p_21016_, float p_21017_) { + if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, p_21016_, p_21017_)) return false; if (this.m_6673_(p_21016_)) { return false; - } else if (this.f_19853_.f_46443_) { -@@ -1016,9 +_,11 @@ + } else if (this.m_9236_().f_46443_) { +@@ -1054,9 +_,11 @@ boolean flag = false; float f1 = 0.0F; if (p_21017_ > 0.0F && this.m_21275_(p_21016_)) { @@ -176,7 +177,7 @@ if (!p_21016_.m_269533_(DamageTypeTags.f_268524_)) { Entity entity = p_21016_.m_7640_(); if (entity instanceof LivingEntity) { -@@ -1033,6 +_,7 @@ +@@ -1071,6 +_,7 @@ if (p_21016_.m_269533_(DamageTypeTags.f_268419_) && this.m_6095_().m_204039_(EntityTypeTags.f_144295_)) { p_21017_ *= 5.0F; } @@ -184,7 +185,7 @@ this.f_267362_.m_267771_(1.5F); boolean flag1 = true; -@@ -1070,11 +_,10 @@ +@@ -1108,11 +_,10 @@ Player player1 = (Player)entity1; this.f_20889_ = 100; this.f_20888_ = player1; @@ -199,7 +200,7 @@ if (livingentity2 instanceof Player) { Player player = (Player)livingentity2; this.f_20888_ = player; -@@ -1133,7 +_,7 @@ +@@ -1171,7 +_,7 @@ if (this instanceof ServerPlayer) { CriteriaTriggers.f_10574_.m_35174_((ServerPlayer)this, p_21016_, f, p_21017_, flag); if (f1 > 0.0F && f1 < 3.4028235E37F) { @@ -208,7 +209,7 @@ } } -@@ -1161,7 +_,7 @@ +@@ -1199,7 +_,7 @@ for(InteractionHand interactionhand : InteractionHand.values()) { ItemStack itemstack1 = this.m_21120_(interactionhand); @@ -217,7 +218,7 @@ itemstack = itemstack1.m_41777_(); itemstack1.m_41774_(1); break; -@@ -1171,7 +_,7 @@ +@@ -1209,7 +_,7 @@ if (itemstack != null) { if (this instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)this; @@ -226,7 +227,7 @@ CriteriaTriggers.f_10551_.m_74431_(serverplayer, itemstack); } -@@ -1240,6 +_,7 @@ +@@ -1278,6 +_,7 @@ } public void m_6667_(DamageSource p_21014_) { @@ -234,20 +235,20 @@ if (!this.m_213877_() && !this.f_20890_) { Entity entity = p_21014_.m_7639_(); LivingEntity livingentity = this.m_21232_(); -@@ -1275,10 +_,10 @@ - if (!this.f_19853_.f_46443_) { +@@ -1315,10 +_,10 @@ + if (!this.m_9236_().f_46443_) { boolean flag = false; if (p_21269_ instanceof WitherBoss) { -- if (this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, p_21269_)) { +- if (this.m_9236_().m_46469_().m_46207_(GameRules.f_46132_)) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.m_9236_(), p_21269_)) { BlockPos blockpos = this.m_20183_(); BlockState blockstate = Blocks.f_50070_.m_49966_(); -- if (this.f_19853_.m_8055_(blockpos).m_60795_() && blockstate.m_60710_(this.f_19853_, blockpos)) { -+ if (this.f_19853_.m_46859_(blockpos) && blockstate.m_60710_(this.f_19853_, blockpos)) { - this.f_19853_.m_7731_(blockpos, blockstate, 3); +- if (this.m_9236_().m_8055_(blockpos).m_60795_() && blockstate.m_60710_(this.m_9236_(), blockpos)) { ++ if (this.m_9236_().m_46859_(blockpos) && blockstate.m_60710_(this.m_9236_(), blockpos)) { + this.m_9236_().m_7731_(blockpos, blockstate, 3); flag = true; } -@@ -1295,12 +_,9 @@ +@@ -1335,12 +_,9 @@ protected void m_6668_(DamageSource p_21192_) { Entity entity = p_21192_.m_7639_(); @@ -262,39 +263,29 @@ + this.captureDrops(new java.util.ArrayList<>()); boolean flag = this.f_20889_ > 0; - if (this.m_6125_() && this.f_19853_.m_46469_().m_46207_(GameRules.f_46135_)) { -@@ -1310,6 +_,10 @@ + if (this.m_6125_() && this.m_9236_().m_46469_().m_46207_(GameRules.f_46135_)) { +@@ -1350,6 +_,10 @@ this.m_5907_(); this.m_21226_(); + + Collection drops = captureDrops(null); + if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_21192_, drops, i, f_20889_ > 0)) -+ drops.forEach(e -> f_19853_.m_7967_(e)); ++ drops.forEach(e -> m_9236_().m_7967_(e)); } protected void m_5907_() { -@@ -1317,7 +_,8 @@ +@@ -1357,7 +_,8 @@ protected void m_21226_() { - if (this.f_19853_ instanceof ServerLevel && !this.m_217046_() && (this.m_6124_() || this.f_20889_ > 0 && this.m_6149_() && this.f_19853_.m_46469_().m_46207_(GameRules.f_46135_))) { -- ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), this.m_213860_()); + if (this.m_9236_() instanceof ServerLevel && !this.m_217046_() && (this.m_6124_() || this.f_20889_ > 0 && this.m_6149_() && this.m_9236_().m_46469_().m_46207_(GameRules.f_46135_))) { +- ExperienceOrb.m_147082_((ServerLevel)this.m_9236_(), this.m_20182_(), this.m_213860_()); + int reward = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.f_20888_, this.m_213860_()); -+ ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), reward); ++ ExperienceOrb.m_147082_((ServerLevel) this.m_9236_(), this.m_20182_(), reward); } } -@@ -1333,7 +_,8 @@ - ResourceLocation resourcelocation = this.m_5743_(); - LootTable loottable = this.f_19853_.m_7654_().m_129898_().m_79217_(resourcelocation); - LootContext.Builder lootcontext$builder = this.m_7771_(p_21022_, p_21021_); -- loottable.m_79148_(lootcontext$builder.m_78975_(LootContextParamSets.f_81415_), this::m_19983_); -+ LootContext ctx = lootcontext$builder.m_78975_(LootContextParamSets.f_81415_); -+ loottable.m_230922_(ctx).forEach(this::m_19983_); - } - - protected LootContext.Builder m_7771_(boolean p_21105_, DamageSource p_21106_) { -@@ -1346,6 +_,11 @@ +@@ -1386,6 +_,11 @@ } public void m_147240_(double p_147241_, double p_147242_, double p_147243_) { @@ -306,7 +297,7 @@ p_147241_ *= 1.0D - this.m_21133_(Attributes.f_22278_); if (!(p_147241_ <= 0.0D)) { this.f_19812_ = true; -@@ -1423,15 +_,9 @@ +@@ -1455,15 +_,9 @@ } else { BlockPos blockpos = this.m_20183_(); BlockState blockstate = this.m_146900_(); @@ -319,13 +310,13 @@ - } else { - return false; - } -+ Optional ladderPos = net.minecraftforge.common.ForgeHooks.isLivingOnLadder(blockstate, f_19853_, blockpos, this); ++ Optional ladderPos = net.minecraftforge.common.ForgeHooks.isLivingOnLadder(blockstate, m_9236_(), blockpos, this); + if (ladderPos.isPresent()) this.f_20957_ = ladderPos; + return ladderPos.isPresent(); } } -@@ -1451,6 +_,11 @@ +@@ -1483,6 +_,11 @@ } public boolean m_142535_(float p_147187_, float p_147188_, DamageSource p_147189_) { @@ -337,20 +328,20 @@ boolean flag = super.m_142535_(p_147187_, p_147188_, p_147189_); int i = this.m_5639_(p_147187_, p_147188_); if (i > 0) { -@@ -1478,9 +_,10 @@ +@@ -1510,9 +_,10 @@ int i = Mth.m_14107_(this.m_20185_()); int j = Mth.m_14107_(this.m_20186_() - (double)0.2F); int k = Mth.m_14107_(this.m_20189_()); -- BlockState blockstate = this.f_19853_.m_8055_(new BlockPos(i, j, k)); +- BlockState blockstate = this.m_9236_().m_8055_(new BlockPos(i, j, k)); + BlockPos pos = new BlockPos(i, j, k); -+ BlockState blockstate = this.f_19853_.m_8055_(pos); ++ BlockState blockstate = this.m_9236_().m_8055_(pos); if (!blockstate.m_60795_()) { - SoundType soundtype = blockstate.m_60827_(); -+ SoundType soundtype = blockstate.getSoundType(f_19853_, pos, this); ++ SoundType soundtype = blockstate.getSoundType(m_9236_(), pos, this); this.m_5496_(soundtype.m_56779_(), soundtype.m_56773_() * 0.5F, soundtype.m_56774_() * 0.75F); } -@@ -1527,9 +_,9 @@ +@@ -1559,9 +_,9 @@ float f2 = f1 - p_21194_; if (f2 > 0.0F && f2 < 3.4028235E37F) { if (this instanceof ServerPlayer) { @@ -362,7 +353,7 @@ } } } -@@ -1551,6 +_,8 @@ +@@ -1583,6 +_,8 @@ protected void m_6475_(DamageSource p_21240_, float p_21241_) { if (!this.m_6673_(p_21240_)) { @@ -371,15 +362,15 @@ p_21241_ = this.m_21161_(p_21240_, p_21241_); p_21241_ = this.m_6515_(p_21240_, p_21241_); float f1 = Math.max(p_21241_ - this.m_6103_(), 0.0F); -@@ -1564,6 +_,7 @@ +@@ -1596,6 +_,7 @@ } } + f1 = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_21240_, f1); if (f1 != 0.0F) { - float f2 = this.m_21223_(); - this.m_21231_().m_19289_(p_21240_, f2, f1); -@@ -1622,6 +_,8 @@ + this.m_21231_().m_289194_(p_21240_, f1); + this.m_21153_(this.m_21223_() - f1); +@@ -1651,6 +_,8 @@ } public void m_21011_(InteractionHand p_21012_, boolean p_21013_) { @@ -388,7 +379,7 @@ if (!this.f_20911_ || this.f_20913_ >= this.m_21304_() / 2 || this.f_20913_ < 0) { this.f_20913_ = -1; this.f_20911_ = true; -@@ -1927,14 +_,17 @@ +@@ -1955,14 +_,17 @@ } this.f_19812_ = true; @@ -408,7 +399,7 @@ } protected float m_6108_() { -@@ -1948,14 +_,19 @@ +@@ -1976,13 +_,18 @@ public void m_7023_(Vec3 p_21280_) { if (this.m_6109_()) { double d0 = 0.08D; @@ -417,20 +408,19 @@ if (flag && this.m_21023_(MobEffects.f_19591_)) { - d0 = 0.01D; + if (!gravity.m_22109_(SLOW_FALLING)) gravity.m_22118_(SLOW_FALLING); - this.m_183634_(); + } else if (gravity.m_22109_(SLOW_FALLING)) { + gravity.m_22130_(SLOW_FALLING); } + d0 = gravity.m_22135_(); - FluidState fluidstate = this.f_19853_.m_6425_(this.m_20183_()); + FluidState fluidstate = this.m_9236_().m_6425_(this.m_20183_()); - if (this.m_20069_() && this.m_6129_() && !this.m_203441_(fluidstate)) { + if ((this.m_20069_() || (this.isInFluidType(fluidstate) && fluidstate.getFluidType() != net.minecraftforge.common.ForgeMod.LAVA_TYPE.get())) && this.m_6129_() && !this.m_203441_(fluidstate)) { + if (this.m_20069_() || (this.isInFluidType(fluidstate) && !this.moveInFluid(fluidstate, p_21280_, d0))) { double d9 = this.m_20186_(); float f4 = this.m_20142_() ? 0.9F : this.m_6108_(); float f5 = 0.02F; -@@ -1977,6 +_,7 @@ +@@ -2004,6 +_,7 @@ f4 = 0.96F; } @@ -438,7 +428,7 @@ this.m_19920_(f5, p_21280_); this.m_6478_(MoverType.SELF, this.m_20184_()); Vec3 vec36 = this.m_20184_(); -@@ -1990,6 +_,7 @@ +@@ -2017,6 +_,7 @@ if (this.f_19862_ && this.m_20229_(vec32.f_82479_, vec32.f_82480_ + (double)0.6F - this.m_20186_() + d9, vec32.f_82481_)) { this.m_20334_(vec32.f_82479_, (double)0.3F, vec32.f_82481_); } @@ -446,16 +436,16 @@ } else if (this.m_20077_() && this.m_6129_() && !this.m_203441_(fluidstate)) { double d8 = this.m_20186_(); this.m_19920_(0.02F, p_21280_); -@@ -2052,7 +_,7 @@ +@@ -2079,7 +_,7 @@ } } else { BlockPos blockpos = this.m_20099_(); -- float f2 = this.f_19853_.m_8055_(blockpos).m_60734_().m_49958_(); -+ float f2 = this.f_19853_.m_8055_(this.m_20099_()).getFriction(f_19853_, this.m_20099_(), this); - float f3 = this.f_19861_ ? f2 * 0.91F : 0.91F; +- float f2 = this.m_9236_().m_8055_(blockpos).m_60734_().m_49958_(); ++ float f2 = this.m_9236_().m_8055_(this.m_20099_()).getFriction(m_9236_(), this.m_20099_(), this); + float f3 = this.m_20096_() ? f2 * 0.91F : 0.91F; Vec3 vec35 = this.m_21074_(p_21280_, f2); double d2 = vec35.f_82480_; -@@ -2149,7 +_,7 @@ +@@ -2175,7 +_,7 @@ double d0 = Mth.m_14008_(p_21298_.f_82479_, (double)-0.15F, (double)0.15F); double d1 = Mth.m_14008_(p_21298_.f_82481_, (double)-0.15F, (double)0.15F); double d2 = Math.max(p_21298_.f_82480_, (double)-0.15F); @@ -464,7 +454,7 @@ d2 = 0.0D; } -@@ -2181,6 +_,7 @@ +@@ -2207,6 +_,7 @@ } public void m_8119_() { @@ -472,7 +462,7 @@ super.m_8119_(); this.m_21329_(); this.m_21333_(); -@@ -2332,6 +_,7 @@ +@@ -2358,6 +_,7 @@ ItemStack itemstack1 = this.m_6844_(equipmentslot); if (this.m_246525_(itemstack, itemstack1)) { @@ -480,8 +470,8 @@ if (map == null) { map = Maps.newEnumMap(EquipmentSlot.class); } -@@ -2477,6 +_,9 @@ - this.f_19853_.m_46473_().m_6180_("jump"); +@@ -2503,6 +_,9 @@ + this.m_9236_().m_46473_().m_6180_("jump"); if (this.f_20899_ && this.m_6129_()) { double d7; + net.minecraftforge.fluids.FluidType fluidType = this.getMaxHeightFluidType(); @@ -490,12 +480,12 @@ if (this.m_20077_()) { d7 = this.m_204036_(FluidTags.f_13132_); } else { -@@ -2487,15 +_,17 @@ +@@ -2513,15 +_,17 @@ double d8 = this.m_20204_(); - if (!flag || this.f_19861_ && !(d7 > d8)) { - if (!this.m_20077_() || this.f_19861_ && !(d7 > d8)) { -+ if (fluidType.isAir() || this.f_19861_ && !(d7 > d8)) { - if ((this.f_19861_ || flag && d7 <= d8) && this.f_20954_ == 0) { + if (!flag || this.m_20096_() && !(d7 > d8)) { + if (!this.m_20077_() || this.m_20096_() && !(d7 > d8)) { ++ if (fluidType.isAir() || this.m_20096_() && !(d7 > d8)) { + if ((this.m_20096_() || flag && d7 <= d8) && this.f_20954_ == 0) { this.m_6135_(); this.f_20954_ = 10; } @@ -510,20 +500,20 @@ } } else { this.f_20954_ = 0; -@@ -2555,6 +_,8 @@ +@@ -2590,6 +_,8 @@ boolean flag = this.m_20291_(7); - if (flag && !this.f_19861_ && !this.m_20159_() && !this.m_21023_(MobEffects.f_19620_)) { + if (flag && !this.m_20096_() && !this.m_20159_() && !this.m_21023_(MobEffects.f_19620_)) { ItemStack itemstack = this.m_6844_(EquipmentSlot.CHEST); + flag = itemstack.canElytraFly(this) && itemstack.elytraFlightTick(this, this.f_20937_); + if (false) //Forge: Moved to ElytraItem if (itemstack.m_150930_(Items.f_42741_) && ElytraItem.m_41140_(itemstack)) { flag = true; int i = this.f_20937_ + 1; -@@ -2786,8 +_,11 @@ +@@ -2821,8 +_,11 @@ private void m_21329_() { if (this.m_6117_()) { -- if (ItemStack.m_41746_(this.m_21120_(this.m_7655_()), this.f_20935_)) { +- if (ItemStack.m_41656_(this.m_21120_(this.m_7655_()), this.f_20935_)) { - this.f_20935_ = this.m_21120_(this.m_7655_()); + ItemStack itemStack = this.m_21120_(this.m_7655_()); + if (net.minecraftforge.common.ForgeHooks.canContinueUsing(this.f_20935_, itemStack)) { @@ -533,24 +523,24 @@ this.m_142106_(this.f_20935_); } else { this.m_5810_(); -@@ -2797,12 +_,15 @@ +@@ -2832,12 +_,15 @@ } protected void m_142106_(ItemStack p_147201_) { + if (!p_147201_.m_41619_()) + this.f_20936_ = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, p_147201_, this.m_21212_()); + if (this.m_21212_() > 0) - p_147201_.m_41731_(this.f_19853_, this, this.m_21212_()); + p_147201_.m_41731_(this.m_9236_(), this, this.m_21212_()); if (this.m_21332_()) { this.m_21137_(p_147201_, 5); } -- if (--this.f_20936_ == 0 && !this.f_19853_.f_46443_ && !p_147201_.m_41781_()) { -+ if (--this.f_20936_ <= 0 && !this.f_19853_.f_46443_ && !p_147201_.m_41781_()) { +- if (--this.f_20936_ == 0 && !this.m_9236_().f_46443_ && !p_147201_.m_41781_()) { ++ if (--this.f_20936_ <= 0 && !this.m_9236_().f_46443_ && !p_147201_.m_41781_()) { this.m_8095_(); } -@@ -2810,7 +_,7 @@ +@@ -2845,7 +_,7 @@ private boolean m_21332_() { int i = this.m_21212_(); @@ -559,7 +549,7 @@ boolean flag = foodproperties != null && foodproperties.m_38748_(); flag |= i <= this.f_20935_.m_41779_() - 7; return flag && i % 4 == 0; -@@ -2840,8 +_,10 @@ +@@ -2875,8 +_,10 @@ public void m_6672_(InteractionHand p_21159_) { ItemStack itemstack = this.m_21120_(p_21159_); if (!itemstack.m_41619_() && !this.m_6117_()) { @@ -568,101 +558,101 @@ this.f_20935_ = itemstack; - this.f_20936_ = itemstack.m_41779_(); + this.f_20936_ = duration; - if (!this.f_19853_.f_46443_) { + if (!this.m_9236_().f_46443_) { this.m_21155_(1, true); this.m_21155_(2, p_21159_ == InteractionHand.OFF_HAND); -@@ -2902,6 +_,9 @@ +@@ -2937,6 +_,9 @@ vec31 = vec31.m_82496_(-this.m_146909_() * ((float)Math.PI / 180F)); vec31 = vec31.m_82524_(-this.m_146908_() * ((float)Math.PI / 180F)); vec31 = vec31.m_82520_(this.m_20185_(), this.m_20188_(), this.m_20189_()); -+ if (this.f_19853_ instanceof ServerLevel) //Forge: Fix MC-2518 spawnParticle is nooped on server, need to use server specific variant -+ ((ServerLevel)this.f_19853_).m_8767_(new ItemParticleOption(ParticleTypes.f_123752_, p_21061_), vec31.f_82479_, vec31.f_82480_, vec31.f_82481_, 1, vec3.f_82479_, vec3.f_82480_ + 0.05D, vec3.f_82481_, 0.0D); ++ if (this.m_9236_() instanceof ServerLevel) //Forge: Fix MC-2518 spawnParticle is nooped on server, need to use server specific variant ++ ((ServerLevel) this.m_9236_()).m_8767_(new ItemParticleOption(ParticleTypes.f_123752_, p_21061_), vec31.f_82479_, vec31.f_82480_, vec31.f_82481_, 1, vec3.f_82479_, vec3.f_82480_ + 0.05D, vec3.f_82481_, 0.0D); + else - this.f_19853_.m_7106_(new ItemParticleOption(ParticleTypes.f_123752_, p_21061_), vec31.f_82479_, vec31.f_82480_, vec31.f_82481_, vec3.f_82479_, vec3.f_82480_ + 0.05D, vec3.f_82481_); + this.m_9236_().m_7106_(new ItemParticleOption(ParticleTypes.f_123752_, p_21061_), vec31.f_82479_, vec31.f_82480_, vec31.f_82481_, vec3.f_82479_, vec3.f_82480_ + 0.05D, vec3.f_82481_); } -@@ -2915,7 +_,8 @@ +@@ -2950,7 +_,8 @@ } else { if (!this.f_20935_.m_41619_() && this.m_6117_()) { this.m_21137_(this.f_20935_, 16); -- ItemStack itemstack = this.f_20935_.m_41671_(this.f_19853_, this); +- ItemStack itemstack = this.f_20935_.m_41671_(this.m_9236_(), this); + ItemStack copy = this.f_20935_.m_41777_(); -+ ItemStack itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, copy, m_21212_(), this.f_20935_.m_41671_(this.f_19853_, this)); ++ ItemStack itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, copy, m_21212_(), this.f_20935_.m_41671_(this.m_9236_(), this)); if (itemstack != this.f_20935_) { this.m_21008_(interactionhand, itemstack); } -@@ -2941,7 +_,11 @@ +@@ -2976,7 +_,11 @@ public void m_21253_() { if (!this.f_20935_.m_41619_()) { + if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, f_20935_, this.m_21212_())) { + ItemStack copy = this instanceof Player ? f_20935_.m_41777_() : null; - this.f_20935_.m_41674_(this.f_19853_, this, this.m_21212_()); + this.f_20935_.m_41674_(this.m_9236_(), this, this.m_21212_()); + if (copy != null && f_20935_.m_41619_()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem((Player)this, copy, m_7655_()); + } if (this.f_20935_.m_41781_()) { this.m_21329_(); } -@@ -2951,6 +_,7 @@ +@@ -2986,6 +_,7 @@ } public void m_5810_() { + if (this.m_6117_() && !this.f_20935_.m_41619_()) this.f_20935_.onStopUsing(this, f_20936_); - if (!this.f_19853_.f_46443_) { + if (!this.m_9236_().f_46443_) { boolean flag = this.m_6117_(); this.m_21155_(1, false); -@@ -2966,7 +_,7 @@ +@@ -3001,7 +_,7 @@ public boolean m_21254_() { if (this.m_6117_() && !this.f_20935_.m_41619_()) { Item item = this.f_20935_.m_41720_(); - if (item.m_6164_(this.f_20935_) != UseAnim.BLOCK) { -+ if (item.m_6164_(this.f_20935_) != UseAnim.BLOCK && !this.f_20935_.canPerformAction(net.minecraftforge.common.ToolActions.SHIELD_BLOCK)) { // TODO 1.20 only use the tool action ++ if (!this.f_20935_.canPerformAction(net.minecraftforge.common.ToolActions.SHIELD_BLOCK)) { return false; } else { return item.m_8105_(this.f_20935_) - this.f_20936_ >= 5; -@@ -3092,8 +_,8 @@ +@@ -3127,8 +_,8 @@ } - BlockState blockstate = this.f_19853_.m_8055_(p_21141_); + BlockState blockstate = this.m_9236_().m_8055_(p_21141_); - if (blockstate.m_60734_() instanceof BedBlock) { -- this.f_19853_.m_7731_(p_21141_, blockstate.m_61124_(BedBlock.f_49441_, Boolean.valueOf(true)), 3); -+ if (blockstate.isBed(f_19853_, p_21141_, this)) { -+ blockstate.setBedOccupied(f_19853_, p_21141_, this, true); +- this.m_9236_().m_7731_(p_21141_, blockstate.m_61124_(BedBlock.f_49441_, Boolean.valueOf(true)), 3); ++ if (blockstate.isBed(m_9236_(), p_21141_, this)) { ++ blockstate.setBedOccupied(m_9236_(), p_21141_, this, true); } this.m_20124_(Pose.SLEEPING); -@@ -3109,16 +_,16 @@ +@@ -3144,16 +_,16 @@ private boolean m_21334_() { - return this.m_21257_().map((p_269792_) -> { -- return this.f_19853_.m_8055_(p_269792_).m_60734_() instanceof BedBlock; -+ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, p_269792_); + return this.m_21257_().map((p_289310_) -> { +- return this.m_9236_().m_8055_(p_289310_).m_60734_() instanceof BedBlock; ++ return net.minecraftforge.event.ForgeEventFactory.fireSleepingLocationCheck(this, p_289310_); }).orElse(false); } public void m_5796_() { - this.m_21257_().filter(this.f_19853_::m_46805_).ifPresent((p_261435_) -> { - BlockState blockstate = this.f_19853_.m_8055_(p_261435_); + this.m_21257_().filter(this.m_9236_()::m_46805_).ifPresent((p_261435_) -> { + BlockState blockstate = this.m_9236_().m_8055_(p_261435_); - if (blockstate.m_60734_() instanceof BedBlock) { -+ if (blockstate.isBed(f_19853_, p_261435_, this)) { ++ if (blockstate.isBed(m_9236_(), p_261435_, this)) { Direction direction = blockstate.m_61143_(BedBlock.f_54117_); -- this.f_19853_.m_7731_(p_261435_, blockstate.m_61124_(BedBlock.f_49441_, Boolean.valueOf(false)), 3); -+ blockstate.setBedOccupied(f_19853_, p_261435_, this, false); - Vec3 vec31 = BedBlock.m_260958_(this.m_6095_(), this.f_19853_, p_261435_, direction, this.m_146908_()).orElseGet(() -> { +- this.m_9236_().m_7731_(p_261435_, blockstate.m_61124_(BedBlock.f_49441_, Boolean.valueOf(false)), 3); ++ blockstate.setBedOccupied(m_9236_(), p_261435_, this, false); + Vec3 vec31 = BedBlock.m_260958_(this.m_6095_(), this.m_9236_(), p_261435_, direction, this.m_146908_()).orElseGet(() -> { BlockPos blockpos = p_261435_.m_7494_(); return new Vec3((double)blockpos.m_123341_() + 0.5D, (double)blockpos.m_123342_() + 0.1D, (double)blockpos.m_123343_() + 0.5D); -@@ -3140,7 +_,9 @@ +@@ -3175,7 +_,9 @@ @Nullable public Direction m_21259_() { BlockPos blockpos = this.m_21257_().orElse((BlockPos)null); -- return blockpos != null ? BedBlock.m_49485_(this.f_19853_, blockpos) : null; +- return blockpos != null ? BedBlock.m_49485_(this.m_9236_(), blockpos) : null; + if (blockpos == null) return Direction.UP; -+ BlockState state = this.f_19853_.m_8055_(blockpos); -+ return !state.isBed(f_19853_, blockpos, this) ? Direction.UP : state.getBedDirection(f_19853_, blockpos); ++ BlockState state = this.m_9236_().m_8055_(blockpos); ++ return !state.isBed(m_9236_(), blockpos, this) ? Direction.UP : state.getBedDirection(m_9236_(), blockpos); } public boolean m_5830_() { -@@ -3156,7 +_,7 @@ +@@ -3191,7 +_,7 @@ } public ItemStack m_6298_(ItemStack p_21272_) { @@ -671,7 +661,7 @@ } public ItemStack m_5584_(Level p_21067_, ItemStack p_21068_) { -@@ -3176,7 +_,7 @@ +@@ -3211,7 +_,7 @@ private void m_21063_(ItemStack p_21064_, Level p_21065_, LivingEntity p_21066_) { Item item = p_21064_.m_41720_(); if (item.m_41472_()) { @@ -680,7 +670,7 @@ if (!p_21065_.f_46443_ && pair.getFirst() != null && p_21065_.f_46441_.m_188501_() < pair.getSecond()) { p_21066_.m_7292_(new MobEffectInstance(pair.getFirst())); } -@@ -3212,6 +_,64 @@ +@@ -3247,6 +_,64 @@ this.m_21166_(p_21191_ == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND); } @@ -690,7 +680,7 @@ + * @param curativeItem The itemstack we are using to cure potion effects + */ + public boolean curePotionEffects(ItemStack curativeItem) { -+ if (this.f_19853_.f_46443_) ++ if (this.m_9236_().f_46443_) + return false; + boolean ret = false; + Iterator itr = this.f_20945_.values().iterator(); @@ -745,7 +735,7 @@ public AABB m_6921_() { if (this.m_6844_(EquipmentSlot.HEAD).m_150930_(Items.f_42683_)) { float f = 0.5F; -@@ -3222,6 +_,8 @@ +@@ -3257,6 +_,8 @@ } public static EquipmentSlot m_147233_(ItemStack p_147234_) { diff --git a/patches/minecraft/net/minecraft/world/entity/Mob.java.patch b/patches/minecraft/net/minecraft/world/entity/Mob.java.patch index 5e2b43e39a..b35b97d533 100644 --- a/patches/minecraft/net/minecraft/world/entity/Mob.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/Mob.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -116,6 +_,9 @@ +@@ -115,6 +_,9 @@ private CompoundTag f_21359_; private BlockPos f_21360_ = BlockPos.f_121853_; private float f_21341_ = -1.0F; @@ -10,7 +10,7 @@ protected Mob(EntityType p_21368_, Level p_21369_) { super(p_21368_, p_21369_); -@@ -224,7 +_,11 @@ +@@ -229,7 +_,10 @@ } public void m_6710_(@Nullable LivingEntity p_21544_) { @@ -18,12 +18,11 @@ + net.minecraftforge.event.entity.living.LivingChangeTargetEvent changeTargetEvent = net.minecraftforge.common.ForgeHooks.onLivingChangeTarget(this, p_21544_, net.minecraftforge.event.entity.living.LivingChangeTargetEvent.LivingTargetType.MOB_TARGET); + if(!changeTargetEvent.isCanceled()) { + this.f_21362_ = changeTargetEvent.getNewTarget(); -+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, this.f_21362_); // TODO: Remove in 1.20 + } } public boolean m_6549_(EntityType p_21399_) { -@@ -422,6 +_,9 @@ +@@ -427,6 +_,9 @@ p_21484_.m_128379_("NoAI", this.m_21525_()); } @@ -33,11 +32,11 @@ } public void m_7378_(CompoundTag p_21450_) { -@@ -474,6 +_,14 @@ +@@ -479,6 +_,14 @@ } this.m_21557_(p_21450_.m_128471_("NoAI")); -+ ++ + if (p_21450_.m_128441_("forge:spawn_type")) { + try { + this.spawnType = MobSpawnType.valueOf(p_21450_.m_128461_("forge:spawn_type")); @@ -48,22 +47,22 @@ } protected void m_7625_(DamageSource p_21389_, boolean p_21390_) { -@@ -513,9 +_,9 @@ +@@ -518,9 +_,9 @@ public void m_8107_() { super.m_8107_(); - this.f_19853_.m_46473_().m_6180_("looting"); -- if (!this.f_19853_.f_46443_ && this.m_21531_() && this.m_6084_() && !this.f_20890_ && this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { + this.m_9236_().m_46473_().m_6180_("looting"); +- if (!this.m_9236_().f_46443_ && this.m_21531_() && this.m_6084_() && !this.f_20890_ && this.m_9236_().m_46469_().m_46207_(GameRules.f_46132_)) { Vec3i vec3i = this.m_213552_(); -+ if (!this.f_19853_.f_46443_ && this.m_21531_() && this.m_6084_() && !this.f_20890_ && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, this)) { - for(ItemEntity itementity : this.f_19853_.m_45976_(ItemEntity.class, this.m_20191_().m_82377_((double)vec3i.m_123341_(), (double)vec3i.m_123342_(), (double)vec3i.m_123343_()))) { ++ if (!this.m_9236_().f_46443_ && this.m_21531_() && this.m_6084_() && !this.f_20890_ && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.m_9236_(), this)) { + for(ItemEntity itementity : this.m_9236_().m_45976_(ItemEntity.class, this.m_20191_().m_82377_((double)vec3i.m_123341_(), (double)vec3i.m_123342_(), (double)vec3i.m_123343_()))) { if (!itementity.m_213877_() && !itementity.m_32055_().m_41619_() && !itementity.m_32063_() && this.m_7243_(itementity.m_32055_())) { this.m_7581_(itementity); -@@ -687,6 +_,14 @@ +@@ -692,6 +_,14 @@ this.m_146870_(); } else if (!this.m_21532_() && !this.m_8023_()) { - Entity entity = this.f_19853_.m_45930_(this, -1.0D); -+ net.minecraftforge.eventbus.api.Event.Result result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this, (ServerLevel) this.f_19853_); + Entity entity = this.m_9236_().m_45930_(this, -1.0D); ++ net.minecraftforge.eventbus.api.Event.Result result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this, (ServerLevel) this.m_9236_()); + if (result == net.minecraftforge.eventbus.api.Event.Result.DENY) { + f_20891_ = 0; + entity = null; @@ -74,7 +73,7 @@ if (entity != null) { double d0 = entity.m_20280_(this); int i = this.m_6095_().m_20674_().m_21611_(); -@@ -1020,6 +_,16 @@ +@@ -1025,6 +_,16 @@ } @@ -91,7 +90,7 @@ @Nullable public SpawnGroupData m_6518_(ServerLevelAccessor p_21434_, DifficultyInstance p_21435_, MobSpawnType p_21436_, @Nullable SpawnGroupData p_21437_, @Nullable CompoundTag p_21438_) { RandomSource randomsource = p_21434_.m_213780_(); -@@ -1030,6 +_,7 @@ +@@ -1035,6 +_,7 @@ this.m_21559_(false); } @@ -99,7 +98,7 @@ return p_21437_; } -@@ -1410,15 +_,25 @@ +@@ -1414,15 +_,25 @@ return false; } @@ -126,7 +125,7 @@ public void m_147272_() { this.m_262441_((p_262562_) -> { return true; -@@ -1442,5 +_,40 @@ +@@ -1449,5 +_,40 @@ public ItemStack m_142340_() { SpawnEggItem spawneggitem = SpawnEggItem.m_43213_(this.m_6095_()); return spawneggitem == null ? null : new ItemStack(spawneggitem); @@ -144,7 +143,7 @@ + } + + /** -+ * This method exists so that spawns can be cancelled from the {@link net.minecraftforge.event.entity.living.MobSpawnEvent.FinalizeSpawn FinalizeSpawnEvent} ++ * This method exists so that spawns can be cancelled from the {@link net.minecraftforge.event.entity.living.MobSpawnEvent.FinalizeSpawn FinalizeSpawnEvent} + * without needing to hook up an additional handler for the {@link net.minecraftforge.event.entity.EntityJoinLevelEvent EntityJoinLevelEvent}. + * @return if this mob will be blocked from spawning during {@link Level#addFreshEntity(Entity)} + * @apiNote Not public-facing API. @@ -156,7 +155,7 @@ + + /** + * Marks this mob as being disallowed to spawn during {@link Level#addFreshEntity(Entity)}.

-+ * @throws UnsupportedOperationException if this entity has already been {@link Entity#isAddedToWorld() added to the world}. ++ * @throws UnsupportedOperationException if this entity has already been {@link Entity#isAddedToWorld() added to the world}. + * @apiNote Not public-facing API. + */ + @org.jetbrains.annotations.ApiStatus.Internal diff --git a/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch b/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch index 8b8c8c0573..b76396aa5d 100644 --- a/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/TamableAnimal.java.patch @@ -9,7 +9,7 @@ + super.m_6667_(p_21809_); + + if (this.f_20890_) - if (!this.f_19853_.f_46443_ && this.f_19853_.m_46469_().m_46207_(GameRules.f_46142_) && this.m_269323_() instanceof ServerPlayer) { + if (!this.m_9236_().f_46443_ && this.m_9236_().m_46469_().m_46207_(GameRules.f_46142_) && this.m_269323_() instanceof ServerPlayer) { - this.m_269323_().m_213846_(this.m_21231_().m_19293_()); + this.m_269323_().m_213846_(deathMessage); } diff --git a/patches/minecraft/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch index f47297f228..7066827da1 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java +++ b/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java -@@ -39,7 +_,7 @@ +@@ -40,7 +_,7 @@ } protected boolean m_6114_(ServerLevel p_23174_, Villager p_23175_) { @@ -9,9 +9,9 @@ return false; } else if (p_23175_.m_7141_().m_35571_() != VillagerProfession.f_35590_) { return false; -@@ -127,6 +_,11 @@ - p_23196_.m_46597_(this.f_23159_, blockstate4); - p_23196_.m_220407_(GameEvent.f_157797_, this.f_23159_, GameEvent.Context.m_223719_(p_23197_, blockstate4)); +@@ -115,6 +_,11 @@ + p_23196_.m_46597_(this.f_23159_, blockstate1); + p_23196_.m_220407_(GameEvent.f_157797_, this.f_23159_, GameEvent.Context.m_223719_(p_23197_, blockstate1)); flag = true; + } else if (itemstack.m_41720_() instanceof net.minecraftforge.common.IPlantable) { + if (((net.minecraftforge.common.IPlantable)itemstack.m_41720_()).getPlantType(p_23196_, f_23159_) == net.minecraftforge.common.PlantType.CROP) { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch index 04fc081e99..6c17f95f94 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/behavior/StartAttacking.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/behavior/StartAttacking.java +++ b/net/minecraft/world/entity/ai/behavior/StartAttacking.java -@@ -30,8 +_,13 @@ +@@ -30,7 +_,11 @@ if (!p_258774_.m_6779_(livingentity)) { return false; } else { @@ -11,7 +11,5 @@ + + p_258778_.m_257512_(changeTargetEvent.getNewTarget()); p_258779_.m_257971_(); -+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(p_258774_, changeTargetEvent.getNewTarget(), net.minecraftforge.event.entity.living.LivingChangeTargetEvent.LivingTargetType.BEHAVIOR_TARGET); // TODO: Remove in 1.20 return true; } - } diff --git a/patches/minecraft/net/minecraft/world/entity/ai/control/MoveControl.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/control/MoveControl.java.patch index cc20556194..54fd414bda 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/control/MoveControl.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/control/MoveControl.java.patch @@ -2,8 +2,8 @@ +++ b/net/minecraft/world/entity/ai/control/MoveControl.java @@ -99,7 +_,7 @@ BlockPos blockpos = this.f_24974_.m_20183_(); - BlockState blockstate = this.f_24974_.f_19853_.m_8055_(blockpos); - VoxelShape voxelshape = blockstate.m_60812_(this.f_24974_.f_19853_, blockpos); + BlockState blockstate = this.f_24974_.m_9236_().m_8055_(blockpos); + VoxelShape voxelshape = blockstate.m_60812_(this.f_24974_.m_9236_(), blockpos); - if (d2 > (double)this.f_24974_.m_274421_() && d0 * d0 + d1 * d1 < (double)Math.max(1.0F, this.f_24974_.m_20205_()) || !voxelshape.m_83281_() && this.f_24974_.m_20186_() < voxelshape.m_83297_(Direction.Axis.Y) + (double)blockpos.m_123342_() && !blockstate.m_204336_(BlockTags.f_13103_) && !blockstate.m_204336_(BlockTags.f_13039_)) { + if (d2 > (double)this.f_24974_.getStepHeight() && d0 * d0 + d1 * d1 < (double)Math.max(1.0F, this.f_24974_.m_20205_()) || !voxelshape.m_83281_() && this.f_24974_.m_20186_() < voxelshape.m_83297_(Direction.Axis.Y) + (double)blockpos.m_123342_() && !blockstate.m_204336_(BlockTags.f_13103_) && !blockstate.m_204336_(BlockTags.f_13039_)) { this.f_24974_.m_21569_().m_24901_(); diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java.patch index 3cd5bbca50..0895ac5c37 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java.patch @@ -4,8 +4,8 @@ public boolean m_8036_() { if (!super.m_8036_()) { return false; -- } else if (!this.f_25189_.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { -+ } else if (!net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.f_25189_.f_19853_, this.f_25190_, this.f_25189_)) { +- } else if (!this.f_25189_.m_9236_().m_46469_().m_46207_(GameRules.f_46132_)) { ++ } else if (!net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.f_25189_.m_9236_(), this.f_25190_, this.f_25189_)) { return false; } else { - return this.m_25094_(this.f_25189_.f_19853_.m_46791_()) && !this.m_25200_(); + return this.m_25094_(this.f_25189_.m_9236_().m_46791_()) && !this.m_25200_(); diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java.patch index 29c76db065..63a42ab44a 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java +++ b/net/minecraft/world/entity/ai/goal/RangedBowAttackGoal.java -@@ -8,7 +_,7 @@ +@@ -10,7 +_,7 @@ import net.minecraft.world.item.BowItem; import net.minecraft.world.item.Items; @@ -9,7 +9,7 @@ private final T f_25782_; private final double f_25783_; private int f_25784_; -@@ -19,6 +_,10 @@ +@@ -21,6 +_,10 @@ private boolean f_25789_; private int f_25790_ = -1; @@ -20,7 +20,7 @@ public RangedBowAttackGoal(T p_25792_, double p_25793_, int p_25794_, float p_25795_) { this.f_25782_ = p_25792_; this.f_25783_ = p_25793_; -@@ -36,7 +_,7 @@ +@@ -38,7 +_,7 @@ } protected boolean m_25803_() { @@ -29,7 +29,7 @@ } public boolean m_8045_() { -@@ -121,7 +_,7 @@ +@@ -129,7 +_,7 @@ } } } else if (--this.f_25786_ <= 0 && this.f_25787_ >= -60) { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch index 76f975036b..d086d94d13 100644 --- a/patches/minecraft/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch @@ -4,8 +4,8 @@ } public boolean m_8036_() { -- if (!this.f_25837_.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_25837_.f_19853_, this.f_25837_)) { +- if (!this.f_25837_.m_9236_().m_46469_().m_46207_(GameRules.f_46132_)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_25837_.m_9236_(), this.f_25837_)) { return false; } else if (this.f_25600_ > 0) { --this.f_25600_; diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Animal.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Animal.java.patch index b4ecacfa7c..ef3495118d 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Animal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Animal.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Animal.java +++ b/net/minecraft/world/entity/animal/Animal.java -@@ -205,6 +_,17 @@ +@@ -206,6 +_,17 @@ public void m_27563_(ServerLevel p_27564_, Animal p_27565_) { AgeableMob ageablemob = this.m_142606_(p_27564_, p_27565_); @@ -16,5 +16,5 @@ + return; + } if (ageablemob != null) { - ServerPlayer serverplayer = this.m_27592_(); - if (serverplayer == null && p_27565_.m_27592_() != null) { + ageablemob.m_6863_(true); + ageablemob.m_7678_(this.m_20185_(), this.m_20186_(), this.m_20189_(), 0.0F, 0.0F); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Bee.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Bee.java.patch index d73a32a75b..1a23d7232d 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Bee.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Bee.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/entity/animal/Bee.java +++ b/net/minecraft/world/entity/animal/Bee.java -@@ -474,7 +_,7 @@ +@@ -473,7 +_,7 @@ return false; } else { - BlockEntity blockentity = this.f_19853_.m_7702_(this.f_27698_); + BlockEntity blockentity = this.m_9236_().m_7702_(this.f_27698_); - return blockentity != null && blockentity.m_58903_() == BlockEntityType.f_58912_; + return blockentity instanceof BeehiveBlockEntity; } } -@@ -613,8 +_,18 @@ +@@ -612,8 +_,18 @@ return MobType.f_21642_; } diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch index 6955ebed62..79de3ff689 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Cat.java.patch @@ -18,4 +18,4 @@ + if (this.f_19796_.m_188503_(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_28153_)) { this.m_21828_(p_28153_); this.m_21839_(true); - this.f_19853_.m_7605_(this, (byte)7); + this.m_9236_().m_7605_(this, (byte)7); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Fox.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Fox.java.patch index 893fc0b355..749f4c39df 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Fox.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Fox.java.patch @@ -40,9 +40,9 @@ } protected void m_28686_() { -- if (Fox.this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(Fox.this.f_19853_, Fox.this)) { - BlockState blockstate = Fox.this.f_19853_.m_8055_(this.f_25602_); +- if (Fox.this.m_9236_().m_46469_().m_46207_(GameRules.f_46132_)) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(Fox.this.m_9236_(), Fox.this)) { + BlockState blockstate = Fox.this.m_9236_().m_8055_(this.f_25602_); if (blockstate.m_60713_(Blocks.f_50685_)) { this.m_148928_(blockstate); @@ -935,7 +_,7 @@ diff --git a/patches/minecraft/net/minecraft/world/entity/animal/IronGolem.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/IronGolem.java.patch deleted file mode 100644 index 310d5d4c51..0000000000 --- a/patches/minecraft/net/minecraft/world/entity/animal/IronGolem.java.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/net/minecraft/world/entity/animal/IronGolem.java -+++ b/net/minecraft/world/entity/animal/IronGolem.java -@@ -119,9 +_,10 @@ - int i = Mth.m_14107_(this.m_20185_()); - int j = Mth.m_14107_(this.m_20186_() - (double)0.2F); - int k = Mth.m_14107_(this.m_20189_()); -- BlockState blockstate = this.f_19853_.m_8055_(new BlockPos(i, j, k)); -+ BlockPos pos = new BlockPos(i, j, k); -+ BlockState blockstate = this.f_19853_.m_8055_(pos); - if (!blockstate.m_60795_()) { -- this.f_19853_.m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate), this.m_20185_() + ((double)this.f_19796_.m_188501_() - 0.5D) * (double)this.m_20205_(), this.m_20186_() + 0.1D, this.m_20189_() + ((double)this.f_19796_.m_188501_() - 0.5D) * (double)this.m_20205_(), 4.0D * ((double)this.f_19796_.m_188501_() - 0.5D), 0.5D, ((double)this.f_19796_.m_188501_() - 0.5D) * 4.0D); -+ this.f_19853_.m_7106_(new BlockParticleOption(ParticleTypes.f_123794_, blockstate).setPos(pos), this.m_20185_() + ((double)this.f_19796_.m_188501_() - 0.5D) * (double)this.m_20205_(), this.m_20186_() + 0.1D, this.m_20189_() + ((double)this.f_19796_.m_188501_() - 0.5D) * (double)this.m_20205_(), 4.0D * ((double)this.f_19796_.m_188501_() - 0.5D), 0.5D, ((double)this.f_19796_.m_188501_() - 0.5D) * 4.0D); - } - } - diff --git a/patches/minecraft/net/minecraft/world/entity/animal/MushroomCow.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/MushroomCow.java.patch index 69ec6d5bbc..b4ec460db4 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/MushroomCow.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/MushroomCow.java.patch @@ -12,12 +12,12 @@ @@ -103,7 +_,7 @@ this.m_5496_(soundevent, 1.0F, 1.0F); - return InteractionResult.m_19078_(this.f_19853_.f_46443_); + return InteractionResult.m_19078_(this.m_9236_().f_46443_); - } else if (itemstack.m_150930_(Items.f_42574_) && this.m_6220_()) { + } else if (false && itemstack.m_41720_() == Items.f_42574_ && this.m_6220_()) { //Forge: Moved to onSheared this.m_5851_(SoundSource.PLAYERS); this.m_146852_(GameEvent.f_157781_, p_28941_); - if (!this.f_19853_.f_46443_) { + if (!this.m_9236_().f_46443_) { @@ -144,7 +_,17 @@ } } @@ -29,20 +29,20 @@ + } + public void m_5851_(SoundSource p_28924_) { -+ shearInternal(p_28924_).forEach(s -> this.f_19853_.m_7967_(new ItemEntity(this.f_19853_, this.m_20185_(), this.m_20227_(1.0D), this.m_20189_(), s))); ++ shearInternal(p_28924_).forEach(s -> this.m_9236_().m_7967_(new ItemEntity(this.m_9236_(), this.m_20185_(), this.m_20227_(1.0D), this.m_20189_(), s))); + } + + private java.util.List shearInternal(SoundSource p_28924_) { - this.f_19853_.m_6269_((Player)null, this, SoundEvents.f_12075_, p_28924_, 1.0F, 1.0F); - if (!this.f_19853_.m_5776_()) { - Cow cow = EntityType.f_20557_.m_20615_(this.f_19853_); + this.m_9236_().m_6269_((Player)null, this, SoundEvents.f_12075_, p_28924_, 1.0F, 1.0F); + if (!this.m_9236_().m_5776_()) { + Cow cow = EntityType.f_20557_.m_20615_(this.m_9236_()); @@ -166,11 +_,14 @@ cow.m_20331_(this.m_20147_()); - this.f_19853_.m_7967_(cow); + this.m_9236_().m_7967_(cow); + java.util.List items = new java.util.ArrayList<>(); for(int i = 0; i < 5; ++i) { -- this.f_19853_.m_7967_(new ItemEntity(this.f_19853_, this.m_20185_(), this.m_20227_(1.0D), this.m_20189_(), new ItemStack(this.m_28554_().f_28961_.m_60734_()))); +- this.m_9236_().m_7967_(new ItemEntity(this.m_9236_(), this.m_20185_(), this.m_20227_(1.0D), this.m_20189_(), new ItemStack(this.m_28554_().f_28961_.m_60734_()))); + items.add(new ItemStack(this.m_28554_().f_28961_.m_60734_())); } + return items; @@ -62,12 +62,12 @@ @@ -193,6 +_,7 @@ this.m_28464_(MushroomCow.MushroomType.m_28976_(p_28936_.m_128461_("Type"))); - if (p_28936_.m_128425_("EffectId", 1)) { + if (p_28936_.m_128425_("EffectId", 99)) { this.f_28909_ = MobEffect.m_19453_(p_28936_.m_128451_("EffectId")); + this.f_28909_ = net.minecraftforge.common.ForgeHooks.loadMobEffect(p_28936_, "forge:effect_id", this.f_28909_); } - if (p_28936_.m_128425_("EffectDuration", 3)) { + if (p_28936_.m_128425_("EffectDuration", 99)) { @@ -235,6 +_,11 @@ } diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Ocelot.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Ocelot.java.patch index a7d0920ef8..7562580986 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Ocelot.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Ocelot.java.patch @@ -3,9 +3,9 @@ @@ -160,7 +_,7 @@ if ((this.f_28984_ == null || this.f_28984_.m_25955_()) && !this.m_29038_() && this.m_6898_(itemstack) && p_29021_.m_20280_(this) < 9.0D) { this.m_142075_(p_29021_, p_29022_, itemstack); - if (!this.f_19853_.f_46443_) { + if (!this.m_9236_().f_46443_) { - if (this.f_19796_.m_188503_(3) == 0) { + if (this.f_19796_.m_188503_(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_29021_)) { this.m_29045_(true); this.m_29047_(true); - this.f_19853_.m_7605_(this, (byte)41); + this.m_9236_().m_7605_(this, (byte)41); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Parrot.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Parrot.java.patch index d854203ff8..d092695100 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Parrot.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Parrot.java.patch @@ -3,9 +3,9 @@ @@ -245,7 +_,7 @@ } - if (!this.f_19853_.f_46443_) { + if (!this.m_9236_().f_46443_) { - if (this.f_19796_.m_188503_(10) == 0) { + if (this.f_19796_.m_188503_(10) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_29414_)) { this.m_21828_(p_29414_); - this.f_19853_.m_7605_(this, (byte)7); + this.m_9236_().m_7605_(this, (byte)7); } else { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Rabbit.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Rabbit.java.patch index e0f1810709..daa618894f 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Rabbit.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Rabbit.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/animal/Rabbit.java +++ b/net/minecraft/world/entity/animal/Rabbit.java -@@ -519,7 +_,7 @@ +@@ -524,7 +_,7 @@ public boolean m_8036_() { if (this.f_25600_ <= 0) { -- if (!this.f_29778_.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_29778_.f_19853_, this.f_29778_)) { +- if (!this.f_29778_.m_9236_().m_46469_().m_46207_(GameRules.f_46132_)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_29778_.m_9236_(), this.f_29778_)) { return false; } diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Sheep.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Sheep.java.patch index 4112d73969..9f22bf0c0d 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Sheep.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Sheep.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/Sheep.java +++ b/net/minecraft/world/entity/animal/Sheep.java -@@ -60,7 +_,7 @@ +@@ -61,7 +_,7 @@ import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.storage.loot.BuiltInLootTables; @@ -9,16 +9,16 @@ private static final int f_149039_ = 40; private static final EntityDataAccessor f_29799_ = SynchedEntityData.m_135353_(Sheep.class, EntityDataSerializers.f_135027_); private static final Map f_29800_ = Util.m_137469_(Maps.newEnumMap(DyeColor.class), (p_29841_) -> { -@@ -232,7 +_,7 @@ +@@ -233,7 +_,7 @@ public InteractionResult m_6071_(Player p_29853_, InteractionHand p_29854_) { ItemStack itemstack = p_29853_.m_21120_(p_29854_); - if (itemstack.m_150930_(Items.f_42574_)) { + if (false && itemstack.m_41720_() == Items.f_42574_) { //Forge: Moved to onSheared - if (!this.f_19853_.f_46443_ && this.m_6220_()) { + if (!this.m_9236_().f_46443_ && this.m_6220_()) { this.m_5851_(SoundSource.PLAYERS); this.m_146852_(GameEvent.f_157781_, p_29853_); -@@ -385,5 +_,28 @@ +@@ -386,5 +_,28 @@ protected float m_6431_(Pose p_29850_, EntityDimensions p_29851_) { return 0.95F * p_29851_.f_20378_; diff --git a/patches/minecraft/net/minecraft/world/entity/animal/SnowGolem.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/SnowGolem.java.patch index e57c04d2c4..ea0ae0f665 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/SnowGolem.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/SnowGolem.java.patch @@ -13,8 +13,8 @@ this.m_6469_(this.m_269291_().m_269549_(), 1.0F); } -- if (!this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { -+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, this)) { +- if (!this.m_9236_().m_46469_().m_46207_(GameRules.f_46132_)) { ++ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.m_9236_(), this)) { return; } @@ -22,10 +22,10 @@ int k = Mth.m_14107_(this.m_20186_()); int l = Mth.m_14107_(this.m_20189_() + (double)((float)(i / 2 % 2 * 2 - 1) * 0.25F)); BlockPos blockpos = new BlockPos(j, k, l); -- if (this.f_19853_.m_8055_(blockpos).m_60795_() && blockstate.m_60710_(this.f_19853_, blockpos)) { -+ if (this.f_19853_.m_46859_(blockpos) && blockstate.m_60710_(this.f_19853_, blockpos)) { - this.f_19853_.m_46597_(blockpos, blockstate); - this.f_19853_.m_220407_(GameEvent.f_157797_, blockpos, GameEvent.Context.m_223719_(this, blockstate)); +- if (this.m_9236_().m_8055_(blockpos).m_60795_() && blockstate.m_60710_(this.m_9236_(), blockpos)) { ++ if (this.m_9236_().m_46859_(blockpos) && blockstate.m_60710_(this.m_9236_(), blockpos)) { + this.m_9236_().m_46597_(blockpos, blockstate); + this.m_9236_().m_220407_(GameEvent.f_157797_, blockpos, GameEvent.Context.m_223719_(this, blockstate)); } @@ -130,7 +_,7 @@ @@ -35,7 +35,7 @@ + if (false && itemstack.m_41720_() == Items.f_42574_ && this.m_6220_()) { //Forge: Moved to onSheared this.m_5851_(SoundSource.PLAYERS); this.m_146852_(GameEvent.f_157781_, p_29920_); - if (!this.f_19853_.f_46443_) { + if (!this.m_9236_().f_46443_) { @@ -189,5 +_,22 @@ public Vec3 m_7939_() { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch index debda0b2d6..d5f5f4b7d2 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/Wolf.java.patch @@ -1,29 +1,29 @@ --- a/net/minecraft/world/entity/animal/Wolf.java +++ b/net/minecraft/world/entity/animal/Wolf.java -@@ -325,11 +_,12 @@ - } else { - if (this.m_21824_()) { - if (this.m_6898_(itemstack) && this.m_21223_() < this.m_21233_()) { -+ this.m_5634_((float)itemstack.getFoodProperties(this).m_38744_()); - if (!p_30412_.m_150110_().f_35937_) { - itemstack.m_41774_(1); - } - -- this.m_5634_((float)item.m_41473_().m_38744_()); -+ this.m_146852_(GameEvent.f_157806_, this); - return InteractionResult.SUCCESS; - } - -@@ -360,7 +_,7 @@ +@@ -324,11 +_,12 @@ + return flag ? InteractionResult.CONSUME : InteractionResult.PASS; + } else if (this.m_21824_()) { + if (this.m_6898_(itemstack) && this.m_21223_() < this.m_21233_()) { ++ this.m_5634_((float)itemstack.getFoodProperties(this).m_38744_()); + if (!p_30412_.m_150110_().f_35937_) { itemstack.m_41774_(1); } -- if (this.f_19796_.m_188503_(3) == 0) { -+ if (this.f_19796_.m_188503_(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_30412_)) { - this.m_21828_(p_30412_); - this.f_21344_.m_26573_(); - this.m_6710_((LivingEntity)null); -@@ -400,7 +_,7 @@ +- this.m_5634_((float)item.m_41473_().m_38744_()); ++ this.m_146852_(GameEvent.f_157806_, this); + return InteractionResult.SUCCESS; + } else { + if (item instanceof DyeItem) { +@@ -364,7 +_,7 @@ + itemstack.m_41774_(1); + } + +- if (this.f_19796_.m_188503_(3) == 0) { ++ if (this.f_19796_.m_188503_(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, p_30412_)) { + this.m_21828_(p_30412_); + this.f_21344_.m_26573_(); + this.m_6710_((LivingEntity)null); +@@ -403,7 +_,7 @@ public boolean m_6898_(ItemStack p_30440_) { Item item = p_30440_.m_41720_(); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/allay/Allay.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/allay/Allay.java.patch index 2a1d7e6521..e899b951d5 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/allay/Allay.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/allay/Allay.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/entity/animal/allay/Allay.java +++ b/net/minecraft/world/entity/animal/allay/Allay.java -@@ -325,7 +_,7 @@ +@@ -324,7 +_,7 @@ public boolean m_7243_(ItemStack p_218387_) { ItemStack itemstack = this.m_21120_(InteractionHand.MAIN_HAND); -- return !itemstack.m_41619_() && this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_) && this.f_218303_.m_19183_(p_218387_) && this.m_245613_(itemstack, p_218387_); -+ return !itemstack.m_41619_() && this.f_218303_.m_19183_(p_218387_) && this.m_245613_(itemstack, p_218387_) && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, this); +- return !itemstack.m_41619_() && this.m_9236_().m_46469_().m_46207_(GameRules.f_46132_) && this.f_218303_.m_19183_(p_218387_) && this.m_245613_(itemstack, p_218387_); ++ return !itemstack.m_41619_() && this.f_218303_.m_19183_(p_218387_) && this.m_245613_(itemstack, p_218387_) && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.m_9236_(), this); } private boolean m_245613_(ItemStack p_252278_, ItemStack p_250405_) { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch index 526a3b1d5a..bbcf25cee7 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/horse/AbstractHorse.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/horse/AbstractHorse.java +++ b/net/minecraft/world/entity/animal/horse/AbstractHorse.java -@@ -331,6 +_,7 @@ +@@ -327,6 +_,7 @@ this.f_30520_.m_19164_(this); this.m_7493_(); @@ -8,15 +8,15 @@ } protected void m_7493_() { -@@ -378,9 +_,9 @@ +@@ -374,9 +_,9 @@ protected void m_7355_(BlockPos p_30584_, BlockState p_30585_) { - if (!p_30585_.m_60767_().m_76332_()) { - BlockState blockstate = this.f_19853_.m_8055_(p_30584_.m_7494_()); + if (!p_30585_.m_278721_()) { + BlockState blockstate = this.m_9236_().m_8055_(p_30584_.m_7494_()); - SoundType soundtype = p_30585_.m_60827_(); -+ SoundType soundtype = p_30585_.getSoundType(f_19853_, p_30584_, this); ++ SoundType soundtype = p_30585_.getSoundType(m_9236_(), p_30584_, this); if (blockstate.m_60713_(Blocks.f_50125_)) { - soundtype = blockstate.m_60827_(); -+ soundtype = blockstate.getSoundType(f_19853_, p_30584_, this); ++ soundtype = blockstate.getSoundType(m_9236_(), p_30584_, this); } if (this.m_20160_() && this.f_30523_) { @@ -28,7 +28,7 @@ if (p_275435_.f_82481_ > 0.0D) { float f = Mth.m_14031_(this.m_146908_() * ((float)Math.PI / 180F)); float f1 = Mth.m_14089_(this.m_146908_() * ((float)Math.PI / 180F)); -@@ -1119,6 +_,25 @@ +@@ -1120,6 +_,25 @@ this.m_214179_(p_30555_.m_213780_()); return super.m_6518_(p_30555_, p_30556_, p_30557_, p_30558_, p_30559_); diff --git a/patches/minecraft/net/minecraft/world/entity/animal/horse/Horse.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/horse/Horse.java.patch index 28e5f3bd41..e62f7952a9 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/horse/Horse.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/horse/Horse.java.patch @@ -5,7 +5,7 @@ } + ItemStack stack = this.f_30520_.m_8020_(1); -+ if (m_6010_(stack)) stack.onHorseArmorTick(f_19853_, this); ++ if (m_6010_(stack)) stack.onHorseArmorTick(m_9236_(), this); } protected SoundEvent m_7515_() { diff --git a/patches/minecraft/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch b/patches/minecraft/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch index fa0cf19ae1..4c6bc60d84 100644 --- a/patches/minecraft/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java.patch @@ -3,7 +3,7 @@ @@ -28,6 +_,10 @@ public void m_8037_() { - ServerLevel serverlevel = (ServerLevel)this.f_30925_.f_19853_; + ServerLevel serverlevel = (ServerLevel)this.f_30925_.m_9236_(); + // Forge: Trigger the trap in a tick task to avoid crashes when mods add goals to skeleton horses + // (MC-206338/Forge PR #7509) + serverlevel.m_7654_().m_6937_(new net.minecraft.server.TickTask(serverlevel.m_7654_().m_129921_(), () -> { diff --git a/patches/minecraft/net/minecraft/world/entity/boss/EnderDragonPart.java.patch b/patches/minecraft/net/minecraft/world/entity/boss/EnderDragonPart.java.patch index dce2131dbc..3203eededf 100644 --- a/patches/minecraft/net/minecraft/world/entity/boss/EnderDragonPart.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/boss/EnderDragonPart.java.patch @@ -11,7 +11,7 @@ private final EntityDimensions f_31012_; public EnderDragonPart(EnderDragon p_31014_, String p_31015_, float p_31016_, float p_31017_) { -- super(p_31014_.m_6095_(), p_31014_.f_19853_); +- super(p_31014_.m_6095_(), p_31014_.m_9236_()); + super(p_31014_); this.f_31012_ = EntityDimensions.m_20395_(p_31016_, p_31017_); this.m_6210_(); diff --git a/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch b/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch index 092f12636a..9cab680f8e 100644 --- a/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -107,6 +_,14 @@ - } - +@@ -102,6 +_,14 @@ + this.f_19794_ = true; + this.f_19811_ = true; this.f_31074_ = new EnderDragonPhaseManager(this); + this.m_20234_(f_19843_.getAndAdd(this.f_31089_.length + 1) + 1); // Forge: Fix MC-158205: Make sure part ids are successors of parent mob id + } @@ -14,8 +14,8 @@ + this.f_31089_[i].m_20234_(p_20235_ + i + 1); } - public static AttributeSupplier.Builder m_31167_() { -@@ -150,7 +_,11 @@ + public void m_287231_(EndDragonFight p_287736_) { +@@ -157,7 +_,11 @@ return adouble; } @@ -25,38 +25,38 @@ + if (this.f_20888_ != null) this.unlimitedLastHurtByPlayer = f_20888_; + if (this.unlimitedLastHurtByPlayer != null && this.unlimitedLastHurtByPlayer.m_213877_()) this.unlimitedLastHurtByPlayer = null; this.m_146874_(); - if (this.f_19853_.f_46443_) { + if (this.m_9236_().f_46443_) { this.m_21153_(this.m_21223_()); -@@ -420,7 +_,7 @@ +@@ -438,7 +_,7 @@ BlockPos blockpos = new BlockPos(k1, l1, i2); - BlockState blockstate = this.f_19853_.m_8055_(blockpos); + BlockState blockstate = this.m_9236_().m_8055_(blockpos); if (!blockstate.m_60795_() && !blockstate.m_204336_(BlockTags.f_215822_)) { -- if (this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_) && !blockstate.m_204336_(BlockTags.f_13069_)) { -+ if (net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.f_19853_, blockpos, this) && !blockstate.m_204336_(BlockTags.f_13069_)) { - flag1 = this.f_19853_.m_7471_(blockpos, false) || flag1; +- if (this.m_9236_().m_46469_().m_46207_(GameRules.f_46132_) && !blockstate.m_204336_(BlockTags.f_13069_)) { ++ if (net.minecraftforge.common.ForgeHooks.canEntityDestroy(this.m_9236_(), blockpos, this) && !blockstate.m_204336_(BlockTags.f_13069_)) { + flag1 = this.m_9236_().m_7471_(blockpos, false) || flag1; } else { flag = true; -@@ -511,7 +_,8 @@ +@@ -529,7 +_,8 @@ - if (this.f_19853_ instanceof ServerLevel) { + if (this.m_9236_() instanceof ServerLevel) { if (this.f_31084_ > 150 && this.f_31084_ % 5 == 0 && flag) { -- ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), Mth.m_14143_((float)i * 0.08F)); +- ExperienceOrb.m_147082_((ServerLevel)this.m_9236_(), this.m_20182_(), Mth.m_14143_((float)i * 0.08F)); + int award = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.unlimitedLastHurtByPlayer, Mth.m_14143_((float)i * 0.08F)); -+ ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), award); ++ ExperienceOrb.m_147082_((ServerLevel) this.m_9236_(), this.m_20182_(), award); } if (this.f_31084_ == 1 && !this.m_20067_()) { -@@ -522,7 +_,8 @@ +@@ -540,7 +_,8 @@ this.m_6478_(MoverType.SELF, new Vec3(0.0D, (double)0.1F, 0.0D)); - if (this.f_31084_ == 200 && this.f_19853_ instanceof ServerLevel) { + if (this.f_31084_ == 200 && this.m_9236_() instanceof ServerLevel) { if (flag) { -- ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), Mth.m_14143_((float)i * 0.2F)); +- ExperienceOrb.m_147082_((ServerLevel)this.m_9236_(), this.m_20182_(), Mth.m_14143_((float)i * 0.2F)); + int award = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.unlimitedLastHurtByPlayer, Mth.m_14143_((float)i * 0.2F)); -+ ExperienceOrb.m_147082_((ServerLevel)this.f_19853_, this.m_20182_(), award); ++ ExperienceOrb.m_147082_((ServerLevel) this.m_9236_(), this.m_20182_(), award); } if (this.f_31073_ != null) { -@@ -845,8 +_,19 @@ +@@ -863,8 +_,19 @@ return false; } diff --git a/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch b/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch index 548805cb11..c4516a5180 100644 --- a/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch @@ -4,18 +4,18 @@ if (this.f_31429_ > 0) { --this.f_31429_; -- if (this.f_31429_ == 0 && this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { -+ if (this.f_31429_ == 0 && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, this)) { +- if (this.f_31429_ == 0 && this.m_9236_().m_46469_().m_46207_(GameRules.f_46132_)) { ++ if (this.f_31429_ == 0 && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.m_9236_(), this)) { int j1 = Mth.m_14107_(this.m_20186_()); int i2 = Mth.m_14107_(this.m_20185_()); int j2 = Mth.m_14107_(this.m_20189_()); @@ -293,7 +_,7 @@ int i1 = j2 + k2; BlockPos blockpos = new BlockPos(l2, l, i1); - BlockState blockstate = this.f_19853_.m_8055_(blockpos); + BlockState blockstate = this.m_9236_().m_8055_(blockpos); - if (m_31491_(blockstate)) { -+ if (blockstate.canEntityDestroy(this.f_19853_, blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, blockstate)) { - flag = this.f_19853_.m_46953_(blockpos, true, this) || flag; ++ if (blockstate.canEntityDestroy(this.m_9236_(), blockpos, this) && net.minecraftforge.event.ForgeEventFactory.onEntityDestroyBlock(this, blockpos, blockstate)) { + flag = this.m_9236_().m_46953_(blockpos, true, this) || flag; } } @@ -314,6 +_,10 @@ diff --git a/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch index 515aa7a697..80dfd2eee5 100644 --- a/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/decoration/HangingEntity.java.patch @@ -3,9 +3,9 @@ @@ -121,6 +_,8 @@ int j1 = (j - 1) / -2; blockpos$mutableblockpos.m_122190_(blockpos).m_122175_(direction, k + i1).m_122175_(Direction.UP, l + j1); - BlockState blockstate = this.f_19853_.m_8055_(blockpos$mutableblockpos); -+ if (net.minecraft.world.level.block.Block.m_49863_(this.f_19853_, blockpos$mutableblockpos, this.f_31699_)) + BlockState blockstate = this.m_9236_().m_8055_(blockpos$mutableblockpos); ++ if (net.minecraft.world.level.block.Block.m_49863_(this.m_9236_(), blockpos$mutableblockpos, this.f_31699_)) + continue; - if (!blockstate.m_60767_().m_76333_() && !DiodeBlock.m_52586_(blockstate)) { + if (!blockstate.m_280296_() && !DiodeBlock.m_52586_(blockstate)) { return false; } diff --git a/patches/minecraft/net/minecraft/world/entity/item/FallingBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/item/FallingBlockEntity.java.patch index 33c817c97e..9b80205c49 100644 --- a/patches/minecraft/net/minecraft/world/entity/item/FallingBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/item/FallingBlockEntity.java.patch @@ -1,16 +1,16 @@ --- a/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java @@ -120,11 +_,11 @@ - if (!this.f_19853_.f_46443_) { + if (!this.m_9236_().f_46443_) { BlockPos blockpos = this.m_20183_(); boolean flag = this.f_31946_.m_60734_() instanceof ConcretePowderBlock; -- boolean flag1 = flag && this.f_19853_.m_6425_(blockpos).m_205070_(FluidTags.f_13131_); -+ boolean flag1 = flag && this.f_31946_.canBeHydrated(this.f_19853_, blockpos, this.f_19853_.m_6425_(blockpos), blockpos); +- boolean flag1 = flag && this.m_9236_().m_6425_(blockpos).m_205070_(FluidTags.f_13131_); ++ boolean flag1 = flag && this.f_31946_.canBeHydrated(this.m_9236_(), blockpos, this.m_9236_().m_6425_(blockpos), blockpos); double d0 = this.m_20184_().m_82556_(); if (flag && d0 > 1.0D) { - BlockHitResult blockhitresult = this.f_19853_.m_45547_(new ClipContext(new Vec3(this.f_19854_, this.f_19855_, this.f_19856_), this.m_20182_(), ClipContext.Block.COLLIDER, ClipContext.Fluid.SOURCE_ONLY, this)); -- if (blockhitresult.m_6662_() != HitResult.Type.MISS && this.f_19853_.m_6425_(blockhitresult.m_82425_()).m_205070_(FluidTags.f_13131_)) { -+ if (blockhitresult.m_6662_() != HitResult.Type.MISS && this.f_31946_.canBeHydrated(this.f_19853_, blockpos, this.f_19853_.m_6425_(blockhitresult.m_82425_()), blockhitresult.m_82425_())) { + BlockHitResult blockhitresult = this.m_9236_().m_45547_(new ClipContext(new Vec3(this.f_19854_, this.f_19855_, this.f_19856_), this.m_20182_(), ClipContext.Block.COLLIDER, ClipContext.Fluid.SOURCE_ONLY, this)); +- if (blockhitresult.m_6662_() != HitResult.Type.MISS && this.m_9236_().m_6425_(blockhitresult.m_82425_()).m_205070_(FluidTags.f_13131_)) { ++ if (blockhitresult.m_6662_() != HitResult.Type.MISS && this.f_31946_.canBeHydrated(this.m_9236_(), blockpos, this.m_9236_().m_6425_(blockhitresult.m_82425_()), blockhitresult.m_82425_())) { blockpos = blockhitresult.m_82425_(); flag1 = true; } diff --git a/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch index a420b70932..48f6d0864c 100644 --- a/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/item/ItemEntity.java.patch @@ -45,12 +45,13 @@ if (this.m_20069_() && this.m_204036_(FluidTags.f_13131_) > (double)f) { this.m_32067_(); } else if (this.m_20077_() && this.m_204036_(FluidTags.f_13132_) > (double)f) { -@@ -128,7 +_,7 @@ +@@ -128,7 +_,8 @@ this.m_6478_(MoverType.SELF, this.m_20184_()); float f1 = 0.98F; - if (this.f_19861_) { -- f1 = this.f_19853_.m_8055_(BlockPos.m_274561_(this.m_20185_(), this.m_20186_() - 1.0D, this.m_20189_())).m_60734_().m_49958_() * 0.98F; -+ f1 = this.f_19853_.m_8055_(BlockPos.m_274561_(this.m_20185_(), this.m_20186_() - 1.0D, this.m_20189_())).getFriction(f_19853_, BlockPos.m_274561_(this.m_20185_(), this.m_20186_() - 1.0D, this.m_20189_()), this) * 0.98F; + if (this.m_20096_()) { +- f1 = this.m_9236_().m_8055_(this.m_20099_()).m_60734_().m_49958_() * 0.98F; ++ BlockPos groundPos = m_20099_(); ++ f1 = this.m_9236_().m_8055_(groundPos).getFriction(m_9236_(), groundPos, this) * 0.98F; } this.m_20256_(this.m_20184_().m_82542_((double)f1, 0.98D, (double)f1)); @@ -58,9 +59,9 @@ } } -- if (!this.f_19853_.f_46443_ && this.f_31985_ >= 6000) { +- if (!this.m_9236_().f_46443_ && this.f_31985_ >= 6000) { + ItemStack item = this.m_32055_(); -+ if (!this.f_19853_.f_46443_ && this.f_31985_ >= lifespan) { ++ if (!this.m_9236_().f_46443_ && this.f_31985_ >= lifespan) { + int hook = net.minecraftforge.event.ForgeEventFactory.onItemExpire(this, item); + if (hook < 0) { + this.m_146870_(); @@ -72,7 +73,7 @@ this.m_146870_(); } -@@ -216,6 +_,8 @@ +@@ -220,6 +_,8 @@ return false; } else if (p_32028_.m_41782_() ^ p_32027_.m_41782_()) { return false; @@ -81,7 +82,7 @@ } else { return !p_32028_.m_41782_() || p_32028_.m_41783_().equals(p_32027_.m_41783_()); } -@@ -262,7 +_,7 @@ +@@ -265,7 +_,7 @@ this.f_31987_ = (int)((float)this.f_31987_ - p_32014_); this.m_146852_(GameEvent.f_223706_, p_32013_.m_7639_()); if (this.f_31987_ <= 0) { @@ -90,7 +91,7 @@ this.m_146870_(); } -@@ -274,6 +_,7 @@ +@@ -277,6 +_,7 @@ p_32050_.m_128376_("Health", (short)this.f_31987_); p_32050_.m_128376_("Age", (short)this.f_31985_); p_32050_.m_128376_("PickupDelay", (short)this.f_31986_); @@ -98,7 +99,7 @@ if (this.f_31988_ != null) { p_32050_.m_128362_("Thrower", this.f_31988_); } -@@ -294,6 +_,9 @@ +@@ -297,6 +_,9 @@ if (p_32034_.m_128441_("PickupDelay")) { this.f_31986_ = p_32034_.m_128448_("PickupDelay"); } @@ -108,10 +109,10 @@ if (p_32034_.m_128403_("Owner")) { this.f_265881_ = p_32034_.m_128342_("Owner"); -@@ -313,10 +_,17 @@ +@@ -316,10 +_,17 @@ public void m_6123_(Player p_32040_) { - if (!this.f_19853_.f_46443_) { + if (!this.m_9236_().f_46443_) { + if (this.f_31986_ > 0) return; ItemStack itemstack = this.m_32055_(); Item item = itemstack.m_41720_(); @@ -127,7 +128,7 @@ p_32040_.m_7938_(this, i); if (itemstack.m_41619_()) { this.m_146870_(); -@@ -340,8 +_,8 @@ +@@ -343,8 +_,8 @@ } @Nullable @@ -135,15 +136,15 @@ - Entity entity = super.m_5489_(p_32042_); + public Entity changeDimension(ServerLevel p_32042_, net.minecraftforge.common.util.ITeleporter teleporter) { + Entity entity = super.changeDimension(p_32042_, teleporter); - if (!this.f_19853_.f_46443_ && entity instanceof ItemEntity) { + if (!this.m_9236_().f_46443_ && entity instanceof ItemEntity) { ((ItemEntity)entity).m_32069_(); } -@@ -407,7 +_,7 @@ +@@ -410,7 +_,7 @@ public void m_32065_() { this.m_32062_(); - this.f_31985_ = 5999; -+ this.f_31985_ = m_32055_().getEntityLifespan(this.f_19853_) - 1; ++ this.f_31985_ = m_32055_().getEntityLifespan(this.m_9236_()) - 1; } public float m_32008_(float p_32009_) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch index fa2161d50e..e63e4fadb4 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/net/minecraft/world/entity/monster/AbstractSkeleton.java @@ -155,7 +_,7 @@ - if (this.f_19853_ != null && !this.f_19853_.f_46443_) { + if (this.m_9236_() != null && !this.m_9236_().f_46443_) { this.f_21345_.m_25363_(this.f_32131_); this.f_21345_.m_25363_(this.f_32130_); - ItemStack itemstack = this.m_21120_(ProjectileUtil.m_37297_(this, Items.f_42411_)); + ItemStack itemstack = this.m_21120_(ProjectileUtil.getWeaponHoldingHand(this, item -> item instanceof net.minecraft.world.item.BowItem)); if (itemstack.m_150930_(Items.f_42411_)) { int i = 20; - if (this.f_19853_.m_46791_() != Difficulty.HARD) { + if (this.m_9236_().m_46791_() != Difficulty.HARD) { @@ -172,8 +_,10 @@ } diff --git a/patches/minecraft/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch index dfa98e8a18..cf2e2fbfb1 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/CrossbowAttackMob.java.patch @@ -9,6 +9,6 @@ ItemStack itemstack = p_32337_.m_21120_(interactionhand); - if (p_32337_.m_21055_(Items.f_42717_)) { + if (p_32337_.m_21093_(is -> is.m_41720_() instanceof CrossbowItem)) { - CrossbowItem.m_40887_(p_32337_.f_19853_, p_32337_, interactionhand, itemstack, p_32338_, (float)(14 - p_32337_.f_19853_.m_46791_().m_19028_() * 4)); + CrossbowItem.m_40887_(p_32337_.m_9236_(), p_32337_, interactionhand, itemstack, p_32338_, (float)(14 - p_32337_.m_9236_().m_46791_().m_19028_() * 4)); } diff --git a/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch index baa035de64..4aef8d1e09 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/EnderMan.java.patch @@ -26,7 +26,7 @@ } else { Vec3 vec3 = p_32535_.m_20252_(1.0F).m_82541_(); @@ -278,8 +_,10 @@ - boolean flag = blockstate.m_60767_().m_76334_(); + boolean flag = blockstate.m_280555_(); boolean flag1 = blockstate.m_60819_().m_205070_(FluidTags.f_13131_); if (flag && !flag1) { + net.minecraftforge.event.entity.EntityTeleportEvent.EnderEntity event = net.minecraftforge.event.ForgeEventFactory.onEnderTeleport(this, p_32544_, p_32545_, p_32546_); @@ -35,21 +35,21 @@ - boolean flag2 = this.m_20984_(p_32544_, p_32545_, p_32546_, true); + boolean flag2 = this.m_20984_(event.getTargetX(), event.getTargetY(), event.getTargetZ(), true); if (flag2) { - this.f_19853_.m_214171_(GameEvent.f_238175_, vec3, GameEvent.Context.m_223717_(this)); + this.m_9236_().m_214171_(GameEvent.f_238175_, vec3, GameEvent.Context.m_223717_(this)); if (!this.m_20067_()) { @@ -419,7 +_,7 @@ public boolean m_8036_() { if (this.f_32554_.m_32530_() == null) { return false; -- } else if (!this.f_32554_.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { -+ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_32554_.f_19853_, this.f_32554_)) { +- } else if (!this.f_32554_.m_9236_().m_46469_().m_46207_(GameRules.f_46132_)) { ++ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_32554_.m_9236_(), this.f_32554_)) { return false; } else { return this.f_32554_.m_217043_().m_188503_(m_186073_(2000)) == 0; @@ -439,7 +_,7 @@ BlockState blockstate2 = this.f_32554_.m_32530_(); if (blockstate2 != null) { - blockstate2 = Block.m_49931_(blockstate2, this.f_32554_.f_19853_, blockpos); + blockstate2 = Block.m_49931_(blockstate2, this.f_32554_.m_9236_(), blockpos); - if (this.m_32558_(level, blockpos, blockstate2, blockstate, blockstate1, blockpos1)) { + if (this.m_32558_(level, blockpos, blockstate2, blockstate, blockstate1, blockpos1) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(f_32554_, net.minecraftforge.common.util.BlockSnapshot.create(level.m_46472_(), level, blockpos1), net.minecraft.core.Direction.UP)) { level.m_7731_(blockpos, blockstate2, 3); @@ -68,8 +68,8 @@ public boolean m_8036_() { if (this.f_32583_.m_32530_() != null) { return false; -- } else if (!this.f_32583_.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { -+ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_32583_.f_19853_, this.f_32583_)) { +- } else if (!this.f_32583_.m_9236_().m_46469_().m_46207_(GameRules.f_46132_)) { ++ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_32583_.m_9236_(), this.f_32583_)) { return false; } else { return this.f_32583_.m_217043_().m_188503_(m_186073_(20)) == 0; diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Evoker.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Evoker.java.patch index bf54090d65..710f303f8a 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Evoker.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Evoker.java.patch @@ -4,8 +4,8 @@ return false; } else if (Evoker.this.f_19797_ < this.f_33775_) { return false; -- } else if (!Evoker.this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { -+ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(Evoker.this.f_19853_, Evoker.this)) { +- } else if (!Evoker.this.m_9236_().m_46469_().m_46207_(GameRules.f_46132_)) { ++ } else if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(Evoker.this.m_9236_(), Evoker.this)) { return false; } else { - List list = Evoker.this.f_19853_.m_45971_(Sheep.class, this.f_32705_, Evoker.this, Evoker.this.m_20191_().m_82377_(16.0D, 4.0D, 16.0D)); + List list = Evoker.this.m_9236_().m_45971_(Sheep.class, this.f_32705_, Evoker.this, Evoker.this.m_20191_().m_82377_(16.0D, 4.0D, 16.0D)); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch index 13d7d20ec2..27cdaed37a 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/MagmaCube.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/entity/monster/MagmaCube.java +++ b/net/minecraft/world/entity/monster/MagmaCube.java -@@ -66,17 +_,28 @@ - Vec3 vec3 = this.m_20184_(); - this.m_20334_(vec3.f_82479_, (double)(this.m_6118_() + (float)this.m_33632_() * 0.1F), vec3.f_82481_); +@@ -67,17 +_,28 @@ + float f = (float)this.m_33632_() * 0.1F; + this.m_20334_(vec3.f_82479_, (double)(this.m_6118_() + f), vec3.f_82481_); this.f_19812_ = true; + net.minecraftforge.common.ForgeHooks.onLivingJump(this); } diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch index 0525ed421b..c9f4e58680 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Ravager.java.patch @@ -4,8 +4,8 @@ this.m_21051_(Attributes.f_22279_).m_22100_(Mth.m_14139_(0.1D, d1, d0)); } -- if (this.f_19862_ && this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { -+ if (this.f_19862_ && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, this)) { +- if (this.f_19862_ && this.m_9236_().m_46469_().m_46207_(GameRules.f_46132_)) { ++ if (this.f_19862_ && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.m_9236_(), this)) { boolean flag = false; AABB aabb = this.m_20191_().m_82400_(0.2D); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Shulker.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Shulker.java.patch index 3f2b71907e..c33ad79152 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Shulker.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Shulker.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/monster/Shulker.java +++ b/net/minecraft/world/entity/monster/Shulker.java @@ -360,6 +_,12 @@ - if (blockpos1.m_123342_() > this.f_19853_.m_141937_() && this.f_19853_.m_46859_(blockpos1) && this.f_19853_.m_6857_().m_61937_(blockpos1) && this.f_19853_.m_45756_(this, (new AABB(blockpos1)).m_82406_(1.0E-6D))) { + if (blockpos1.m_123342_() > this.m_9236_().m_141937_() && this.m_9236_().m_46859_(blockpos1) && this.m_9236_().m_6857_().m_61937_(blockpos1) && this.m_9236_().m_45756_(this, (new AABB(blockpos1)).m_82406_(1.0E-6D))) { Direction direction = this.m_149810_(blockpos1); if (direction != null) { + net.minecraftforge.event.entity.EntityTeleportEvent.EnderEntity event = net.minecraftforge.event.ForgeEventFactory.onEnderTeleport(this, blockpos1.m_123341_(), blockpos1.m_123342_(), blockpos1.m_123343_()); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch index c7202b3120..a83fcdfec2 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Silverfish.java.patch @@ -4,11 +4,11 @@ return false; } else { RandomSource randomsource = this.f_25725_.m_217043_(); -- if (this.f_25725_.f_19853_.m_46469_().m_46207_(GameRules.f_46132_) && randomsource.m_188503_(m_186073_(10)) == 0) { -+ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_25725_.f_19853_, this.f_25725_) && randomsource.m_188503_(m_186073_(10)) == 0) { +- if (this.f_25725_.m_9236_().m_46469_().m_46207_(GameRules.f_46132_) && randomsource.m_188503_(m_186073_(10)) == 0) { ++ if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_25725_.m_9236_(), this.f_25725_) && randomsource.m_188503_(m_186073_(10)) == 0) { this.f_33555_ = Direction.m_235672_(randomsource); BlockPos blockpos = BlockPos.m_274561_(this.f_25725_.m_20185_(), this.f_25725_.m_20186_() + 0.5D, this.f_25725_.m_20189_()).m_121945_(this.f_33555_); - BlockState blockstate = this.f_25725_.f_19853_.m_8055_(blockpos); + BlockState blockstate = this.f_25725_.m_9236_().m_8055_(blockpos); @@ -209,7 +_,7 @@ BlockState blockstate = level.m_8055_(blockpos1); Block block = blockstate.m_60734_(); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch index 6671356d66..ca767902fe 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Slime.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/monster/Slime.java +++ b/net/minecraft/world/entity/monster/Slime.java @@ -124,6 +_,8 @@ - if (this.f_19861_ && !this.f_33583_) { + if (this.m_20096_() && !this.f_33583_) { int i = this.m_33632_(); + // Forge: Don't spawn particles if it's handled by the implementation itself diff --git a/patches/minecraft/net/minecraft/world/entity/monster/Zombie.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/Zombie.java.patch index 8ebf03a1b4..0d5cf69d17 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/Zombie.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/Zombie.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/entity/monster/Zombie.java +++ b/net/minecraft/world/entity/monster/Zombie.java @@ -192,7 +_,7 @@ - if (!this.f_19853_.f_46443_ && this.m_6084_() && !this.m_21525_()) { + if (!this.m_9236_().f_46443_ && this.m_6084_() && !this.m_21525_()) { if (this.m_34329_()) { --this.f_34266_; - if (this.f_34266_ < 0) { @@ -11,36 +11,37 @@ } else if (this.m_7593_()) { @@ -254,6 +_,7 @@ if (zombie != null) { - zombie.m_34339_(zombie.f_19853_.m_6436_(zombie.m_20183_()).m_19057_()); + zombie.m_34339_(zombie.m_9236_().m_6436_(zombie.m_20183_()).m_19057_()); zombie.m_34336_(zombie.m_7586_() && this.m_34330_()); + net.minecraftforge.event.ForgeEventFactory.onLivingConvert(this, zombie); } } -@@ -274,11 +_,14 @@ +@@ -274,11 +_,15 @@ livingentity = (LivingEntity)p_34288_.m_7639_(); } -- if (livingentity != null && this.f_19853_.m_46791_() == Difficulty.HARD && (double)this.f_19796_.m_188501_() < this.m_21133_(Attributes.f_22287_) && this.f_19853_.m_46469_().m_46207_(GameRules.f_46134_)) { +- if (livingentity != null && this.m_9236_().m_46791_() == Difficulty.HARD && (double)this.f_19796_.m_188501_() < this.m_21133_(Attributes.f_22287_) && this.m_9236_().m_46469_().m_46207_(GameRules.f_46134_)) { int i = Mth.m_14107_(this.m_20185_()); int j = Mth.m_14107_(this.m_20186_()); int k = Mth.m_14107_(this.m_20189_()); -- Zombie zombie = new Zombie(this.f_19853_); -+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, f_19853_, i, j, k, livingentity, this.m_21051_(Attributes.f_22287_).m_22135_()); +- Zombie zombie = new Zombie(this.m_9236_()); ++ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, m_9236_(), i, j, k, livingentity, this.m_21051_(Attributes.f_22287_).m_22135_()); + if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true; + if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW || -+ livingentity != null && this.f_19853_.m_46791_() == Difficulty.HARD && (double)this.f_19796_.m_188501_() < this.m_21051_(Attributes.f_22287_).m_22135_() && this.f_19853_.m_46469_().m_46207_(GameRules.f_46134_)) { -+ Zombie zombie = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : EntityType.f_20501_.m_20615_(this.f_19853_); ++ livingentity != null && this.m_9236_().m_46791_() == Difficulty.HARD && (double)this.f_19796_.m_188501_() < this.m_21051_(Attributes.f_22287_).m_22135_() && this.m_9236_() ++ .m_46469_().m_46207_(GameRules.f_46134_)) { ++ Zombie zombie = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : EntityType.f_20501_.m_20615_(this.m_9236_()); for(int l = 0; l < 50; ++l) { int i1 = i + Mth.m_216271_(this.f_19796_, 7, 40) * Mth.m_216271_(this.f_19796_, -1, 1); @@ -290,6 +_,7 @@ - if (NaturalSpawner.m_47051_(spawnplacements$type, this.f_19853_, blockpos, entitytype) && SpawnPlacements.m_217074_(entitytype, serverlevel, MobSpawnType.REINFORCEMENT, blockpos, this.f_19853_.f_46441_)) { + if (NaturalSpawner.m_47051_(spawnplacements$type, this.m_9236_(), blockpos, entitytype) && SpawnPlacements.m_217074_(entitytype, serverlevel, MobSpawnType.REINFORCEMENT, blockpos, this.m_9236_().f_46441_)) { zombie.m_6034_((double)i1, (double)j1, (double)k1); - if (!this.f_19853_.m_45914_((double)i1, (double)j1, (double)k1, 7.0D) && this.f_19853_.m_45784_(zombie) && this.f_19853_.m_45786_(zombie) && !this.f_19853_.m_46855_(zombie.m_20191_())) { + if (!this.m_9236_().m_45914_((double)i1, (double)j1, (double)k1, 7.0D) && this.m_9236_().m_45784_(zombie) && this.m_9236_().m_45786_(zombie) && !this.m_9236_().m_46855_(zombie.m_20191_())) { + if (livingentity != null) zombie.m_6710_(livingentity); - zombie.m_6518_(serverlevel, this.f_19853_.m_6436_(zombie.m_20183_()), MobSpawnType.REINFORCEMENT, (SpawnGroupData)null, (CompoundTag)null); + zombie.m_6518_(serverlevel, this.m_9236_().m_6436_(zombie.m_20183_()), MobSpawnType.REINFORCEMENT, (SpawnGroupData)null, (CompoundTag)null); serverlevel.m_47205_(zombie); @@ -375,7 +_,7 @@ diff --git a/patches/minecraft/net/minecraft/world/entity/monster/ZombieVillager.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/ZombieVillager.java.patch index aff72237a2..4dcedc9e3c 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/ZombieVillager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/ZombieVillager.java.patch @@ -1,12 +1,12 @@ --- a/net/minecraft/world/entity/monster/ZombieVillager.java +++ b/net/minecraft/world/entity/monster/ZombieVillager.java @@ -126,7 +_,7 @@ - if (!this.f_19853_.f_46443_ && this.m_6084_() && this.m_34408_()) { + if (!this.m_9236_().f_46443_ && this.m_6084_() && this.m_34408_()) { int i = this.m_34410_(); this.f_34365_ -= i; - if (this.f_34365_ <= 0) { + if (this.f_34365_ <= 0 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.f_20492_, (timer) -> this.f_34365_ = timer)) { - this.m_34398_((ServerLevel)this.f_19853_); + this.m_34398_((ServerLevel)this.m_9236_()); } } @@ -228,7 +_,7 @@ diff --git a/patches/minecraft/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch index 567d9e7a1f..c5ab012bb2 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch @@ -7,7 +7,7 @@ - if (this.f_34484_ > 300) { + if (this.f_34484_ > 300 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.f_20500_, (timer) -> this.f_34484_ = timer)) { this.m_219179_(SoundEvents.f_11959_); - this.m_34531_((ServerLevel)this.f_19853_); + this.m_34531_((ServerLevel)this.m_9236_()); } @@ -219,6 +_,7 @@ Zoglin zoglin = this.m_21406_(EntityType.f_20500_, true); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch index f189f01e3c..37347773e3 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java.patch @@ -10,7 +10,7 @@ - if (this.f_34649_ > 300) { + if (this.f_34649_ > 300 && net.minecraftforge.event.ForgeEventFactory.canLivingConvert(this, EntityType.f_20531_, (timer) -> this.f_34649_ = timer)) { this.m_7580_(); - this.m_8063_((ServerLevel)this.f_19853_); + this.m_8063_((ServerLevel)this.m_9236_()); } @@ -104,6 +_,7 @@ ZombifiedPiglin zombifiedpiglin = this.m_21406_(EntityType.f_20531_, true); diff --git a/patches/minecraft/net/minecraft/world/entity/monster/piglin/Piglin.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/piglin/Piglin.java.patch index 8de2645992..90fbc82ec3 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/piglin/Piglin.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/piglin/Piglin.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java -@@ -297,7 +_,7 @@ +@@ -293,7 +_,7 @@ } else if (this.m_34773_()) { return PiglinArmPose.CROSSBOW_CHARGE; } else { @@ -9,7 +9,7 @@ } } -@@ -339,7 +_,7 @@ +@@ -335,7 +_,7 @@ } protected void m_34785_(ItemStack p_34786_) { @@ -18,12 +18,12 @@ this.m_8061_(EquipmentSlot.OFFHAND, p_34786_); this.m_21508_(EquipmentSlot.OFFHAND); } else { -@@ -349,7 +_,7 @@ +@@ -345,7 +_,7 @@ } public boolean m_7243_(ItemStack p_34777_) { -- return this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_) && this.m_21531_() && PiglinAi.m_34857_(this, p_34777_); -+ return net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, this) && this.m_21531_() && PiglinAi.m_34857_(this, p_34777_); +- return this.m_9236_().m_46469_().m_46207_(GameRules.f_46132_) && this.m_21531_() && PiglinAi.m_34857_(this, p_34777_); ++ return net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.m_9236_(), this) && this.m_21531_() && PiglinAi.m_34857_(this, p_34777_); } protected boolean m_34787_(ItemStack p_34788_) { diff --git a/patches/minecraft/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java.patch b/patches/minecraft/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java.patch index de4fecfe70..150b54e0a1 100644 --- a/patches/minecraft/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/monster/piglin/StopHoldingItemIfNoLongerAdmiring.java.patch @@ -3,9 +3,9 @@ @@ -10,7 +_,7 @@ return BehaviorBuilder.m_258034_((p_259197_) -> { return p_259197_.group(p_259197_.m_258080_(MemoryModuleType.f_26336_)).apply(p_259197_, (p_259512_) -> { - return (p_275996_, p_275997_, p_275998_) -> { -- if (!p_275997_.m_21206_().m_41619_() && !p_275997_.m_21206_().m_150930_(Items.f_42740_)) { -+ if (!p_275997_.m_21206_().m_41619_() && !p_275997_.m_21206_().canPerformAction(net.minecraftforge.common.ToolActions.SHIELD_BLOCK)) { - PiglinAi.m_34867_(p_275997_, true); + return (p_289481_, p_289482_, p_289483_) -> { +- if (!p_289482_.m_21206_().m_41619_() && !p_289482_.m_21206_().m_150930_(Items.f_42740_)) { ++ if (!p_289482_.m_21206_().m_41619_() && !p_289482_.m_21206_().canPerformAction(net.minecraftforge.common.ToolActions.SHIELD_BLOCK)) { + PiglinAi.m_34867_(p_289482_, true); return true; } else { diff --git a/patches/minecraft/net/minecraft/world/entity/npc/Villager.java.patch b/patches/minecraft/net/minecraft/world/entity/npc/Villager.java.patch index daf93f99cc..0f7a16feaf 100644 --- a/patches/minecraft/net/minecraft/world/entity/npc/Villager.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/npc/Villager.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/npc/Villager.java +++ b/net/minecraft/world/entity/npc/Villager.java -@@ -254,7 +_,7 @@ +@@ -255,7 +_,7 @@ public InteractionResult m_6071_(Player p_35472_, InteractionHand p_35473_) { ItemStack itemstack = p_35472_.m_21120_(p_35473_); @@ -8,8 +8,8 @@ + if (itemstack.m_41720_() != Items.f_42601_ && this.m_6084_() && !this.m_35306_() && !this.m_5803_() && !p_35472_.m_36341_()) { if (this.m_6162_()) { this.m_35518_(); - return InteractionResult.m_19078_(this.f_19853_.f_46443_); -@@ -668,7 +_,8 @@ + return InteractionResult.m_19078_(this.m_9236_().f_46443_); +@@ -669,7 +_,8 @@ } protected Component m_5677_() { @@ -19,7 +19,7 @@ } public void m_7822_(byte p_35391_) { -@@ -721,7 +_,7 @@ +@@ -722,7 +_,7 @@ } public void m_8038_(ServerLevel p_35409_, LightningBolt p_35410_) { @@ -28,7 +28,7 @@ f_201976_.info("Villager {} was struck by lightning {}.", this, p_35410_); Witch witch = EntityType.f_20495_.m_20615_(p_35409_); if (witch != null) { -@@ -734,6 +_,7 @@ +@@ -735,6 +_,7 @@ } witch.m_21530_(); diff --git a/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch b/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch index 88b6c7fae2..e53ae82ac7 100644 --- a/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/player/Inventory.java.patch @@ -24,11 +24,11 @@ } } - -+ f_35975_.forEach(e -> e.onArmorTick(f_35978_.f_19853_, f_35978_)); ++ f_35975_.forEach(e -> e.onArmorTick(f_35978_.m_9236_(), f_35978_)); } public boolean m_36054_(ItemStack p_36055_) { -@@ -278,6 +_,8 @@ +@@ -277,6 +_,8 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.m_127521_(throwable, "Adding item to inventory"); CrashReportCategory crashreportcategory = crashreport.m_127514_("Item being added"); diff --git a/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch b/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch index 0e4c49cc25..8111ee9fcb 100644 --- a/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java -@@ -114,7 +_,8 @@ +@@ -115,7 +_,8 @@ import net.minecraft.world.scores.Team; import org.slf4j.Logger; @@ -10,7 +10,7 @@ private static final Logger f_219722_ = LogUtils.getLogger(); public static final int f_150082_ = 16; public static final int f_150083_ = 20; -@@ -167,6 +_,9 @@ +@@ -168,6 +_,9 @@ @Nullable public FishingHook f_36083_; protected float f_263750_; @@ -20,7 +20,7 @@ public Player(Level p_250508_, BlockPos p_250289_, float p_251702_, GameProfile p_252153_) { super(EntityType.f_20532_, p_250508_); -@@ -192,7 +_,7 @@ +@@ -193,7 +_,7 @@ } public static AttributeSupplier.Builder m_36340_() { @@ -29,24 +29,24 @@ } protected void m_8097_() { -@@ -206,6 +_,7 @@ +@@ -207,6 +_,7 @@ } public void m_8119_() { + net.minecraftforge.event.ForgeEventFactory.onPlayerPreTick(this); this.f_19794_ = this.m_5833_(); if (this.m_5833_()) { - this.f_19861_ = false; -@@ -221,7 +_,7 @@ + this.m_6853_(false); +@@ -222,7 +_,7 @@ this.f_36110_ = 100; } -- if (!this.f_19853_.f_46443_ && this.f_19853_.m_46461_()) { -+ if (!this.f_19853_.f_46443_ && !net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, m_21257_())) { +- if (!this.m_9236_().f_46443_ && this.m_9236_().m_46461_()) { ++ if (!this.m_9236_().f_46443_ && !net.minecraftforge.event.ForgeEventFactory.fireSleepingTimeCheck(this, m_21257_())) { this.m_6145_(false, true); } } else if (this.f_36110_ > 0) { -@@ -276,6 +_,7 @@ +@@ -277,6 +_,7 @@ this.m_36372_(); this.f_36087_.m_41518_(); this.m_7594_(); @@ -54,7 +54,7 @@ } public boolean m_36341_() { -@@ -351,6 +_,10 @@ +@@ -352,6 +_,10 @@ } protected void m_7594_() { @@ -65,7 +65,7 @@ if (this.m_20175_(Pose.SWIMMING)) { Pose pose; if (this.m_21255_()) { -@@ -572,6 +_,7 @@ +@@ -573,6 +_,7 @@ } public void m_6667_(DamageSource p_36152_) { @@ -73,7 +73,7 @@ super.m_6667_(p_36152_); this.m_20090_(); if (!this.m_5833_()) { -@@ -621,7 +_,7 @@ +@@ -622,7 +_,7 @@ @Nullable public ItemEntity m_36176_(ItemStack p_36177_, boolean p_36178_) { @@ -82,7 +82,7 @@ } @Nullable -@@ -659,7 +_,12 @@ +@@ -660,7 +_,12 @@ } } @@ -95,7 +95,7 @@ float f = this.f_36093_.m_36020_(p_36282_); if (f > 1.0F) { int i = EnchantmentHelper.m_44926_(this); -@@ -701,11 +_,12 @@ +@@ -702,11 +_,12 @@ f /= 5.0F; } @@ -109,7 +109,7 @@ } public void m_7378_(CompoundTag p_36215_) { -@@ -791,6 +_,7 @@ +@@ -792,6 +_,7 @@ } public boolean m_6469_(DamageSource p_36154_, float p_36155_) { @@ -117,7 +117,7 @@ if (this.m_6673_(p_36154_)) { return false; } else if (this.f_36077_.f_35934_ && !p_36154_.m_269533_(DamageTypeTags.f_268738_)) { -@@ -825,7 +_,7 @@ +@@ -826,7 +_,7 @@ protected void m_6728_(LivingEntity p_36295_) { super.m_6728_(p_36295_); @@ -126,16 +126,16 @@ this.m_36384_(true); } -@@ -854,7 +_,7 @@ +@@ -855,7 +_,7 @@ } protected void m_7909_(float p_36383_) { - if (this.f_20935_.m_150930_(Items.f_42740_)) { + if (this.f_20935_.canPerformAction(net.minecraftforge.common.ToolActions.SHIELD_BLOCK)) { - if (!this.f_19853_.f_46443_) { + if (!this.m_9236_().f_46443_) { this.m_36246_(Stats.f_12982_.m_12902_(this.f_20935_.m_41720_())); } -@@ -864,6 +_,8 @@ +@@ -865,6 +_,8 @@ InteractionHand interactionhand = this.m_7655_(); this.f_20935_.m_41622_(i, this, (p_219739_) -> { p_219739_.m_21190_(interactionhand); @@ -144,7 +144,7 @@ }); if (this.f_20935_.m_41619_()) { if (interactionhand == InteractionHand.MAIN_HAND) { -@@ -882,10 +_,13 @@ +@@ -883,10 +_,13 @@ protected void m_6475_(DamageSource p_36312_, float p_36313_) { if (!this.m_6673_(p_36312_)) { @@ -152,22 +152,13 @@ + if (p_36313_ <= 0) return; p_36313_ = this.m_21161_(p_36312_, p_36313_); p_36313_ = this.m_6515_(p_36312_, p_36313_); - float f2 = Math.max(p_36313_ - this.m_6103_(), 0.0F); - this.m_7911_(this.m_6103_() - (p_36313_ - f2)); -+ f2 = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_36312_, f2); - float f = p_36313_ - f2; + float f1 = Math.max(p_36313_ - this.m_6103_(), 0.0F); + this.m_7911_(this.m_6103_() - (p_36313_ - f1)); ++ f1 = net.minecraftforge.common.ForgeHooks.onLivingDamage(this, p_36312_, f1); + float f = p_36313_ - f1; if (f > 0.0F && f < 3.4028235E37F) { this.m_36222_(Stats.f_12933_, Math.round(f * 10.0F)); -@@ -895,7 +_,7 @@ - this.m_36399_(p_36312_.m_19377_()); - float f1 = this.m_21223_(); - this.m_21231_().m_19289_(p_36312_, f1, f2); -- this.m_21153_(this.m_21223_() - f2); -+ this.m_21153_(f1 - f2); // Forge: moved to fix MC-121048 - if (f2 < 3.4028235E37F) { - this.m_36222_(Stats.f_12931_, Math.round(f2 * 10.0F)); - } -@@ -948,6 +_,8 @@ +@@ -949,6 +_,8 @@ return InteractionResult.PASS; } else { @@ -176,7 +167,7 @@ ItemStack itemstack = this.m_21120_(p_36159_); ItemStack itemstack1 = itemstack.m_41777_(); InteractionResult interactionresult = p_36158_.m_6096_(this, p_36159_); -@@ -956,6 +_,9 @@ +@@ -957,6 +_,9 @@ itemstack.m_41764_(itemstack1.m_41613_()); } @@ -186,15 +177,15 @@ return interactionresult; } else { if (!itemstack.m_41619_() && p_36158_ instanceof LivingEntity) { -@@ -967,6 +_,7 @@ +@@ -968,6 +_,7 @@ if (interactionresult1.m_19077_()) { - this.f_19853_.m_214171_(GameEvent.f_223708_, p_36158_.m_20182_(), GameEvent.Context.m_223717_(this)); + this.m_9236_().m_214171_(GameEvent.f_223708_, p_36158_.m_20182_(), GameEvent.Context.m_223717_(this)); if (itemstack.m_41619_() && !this.f_36077_.f_35937_) { + net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, p_36159_); this.m_21008_(p_36159_, ItemStack.f_41583_); } -@@ -996,6 +_,7 @@ +@@ -997,6 +_,7 @@ return !this.f_36077_.f_35935_; } @@ -202,13 +193,13 @@ protected Vec3 m_5763_(Vec3 p_36201_, MoverType p_36202_) { if (!this.f_36077_.f_35935_ && p_36201_.f_82480_ <= 0.0D && (p_36202_ == MoverType.SELF || p_36202_ == MoverType.PLAYER) && this.m_36343_() && this.m_36386_()) { double d0 = p_36201_.f_82479_; -@@ -1046,11 +_,13 @@ +@@ -1047,11 +_,13 @@ return p_36201_; } + // Forge: Don't update this method to use IForgeEntity#getStepHeight() - https://github.com/MinecraftForge/MinecraftForge/issues/9376 private boolean m_36386_() { - return this.f_19861_ || this.f_19789_ < this.m_274421_() && !this.f_19853_.m_45756_(this, this.m_20191_().m_82386_(0.0D, (double)(this.f_19789_ - this.m_274421_()), 0.0D)); + return this.m_20096_() || this.f_19789_ < this.m_274421_() && !this.m_9236_().m_45756_(this, this.m_20191_().m_82386_(0.0D, (double)(this.f_19789_ - this.m_274421_()), 0.0D)); } public void m_5706_(Entity p_36347_) { @@ -216,7 +207,7 @@ if (p_36347_.m_6097_()) { if (!p_36347_.m_7313_(this)) { float f = (float)this.m_21133_(Attributes.f_22281_); -@@ -1064,11 +_,10 @@ +@@ -1065,11 +_,10 @@ float f2 = this.m_36403_(0.5F); f *= 0.2F + f2 * f2 * 0.8F; f1 *= f2; @@ -228,10 +219,10 @@ + float i = (float)this.m_21133_(Attributes.f_22282_); // Forge: Initialize this value to the attack knockback attribute of the player, which is by default 0 i += EnchantmentHelper.m_44894_(this); if (this.m_20142_() && flag) { - this.f_19853_.m_6263_((Player)null, this.m_20185_(), this.m_20186_(), this.m_20189_(), SoundEvents.f_12314_, this.m_5720_(), 1.0F, 1.0F); -@@ -1078,8 +_,10 @@ + this.m_9236_().m_6263_((Player)null, this.m_20185_(), this.m_20186_(), this.m_20189_(), SoundEvents.f_12314_, this.m_5720_(), 1.0F, 1.0F); +@@ -1079,8 +_,10 @@ - boolean flag2 = flag && this.f_19789_ > 0.0F && !this.f_19861_ && !this.m_6147_() && !this.m_20069_() && !this.m_21023_(MobEffects.f_19610_) && !this.m_20159_() && p_36347_ instanceof LivingEntity; + boolean flag2 = flag && this.f_19789_ > 0.0F && !this.m_20096_() && !this.m_6147_() && !this.m_20069_() && !this.m_21023_(MobEffects.f_19610_) && !this.m_20159_() && p_36347_ instanceof LivingEntity; flag2 = flag2 && !this.m_20142_(); + net.minecraftforge.event.entity.player.CriticalHitEvent hitResult = net.minecraftforge.common.ForgeHooks.getCriticalHit(this, p_36347_, flag2, flag2 ? 1.5F : 1.0F); + flag2 = hitResult != null; @@ -241,9 +232,9 @@ } f += f1; -@@ -1087,9 +_,7 @@ +@@ -1088,9 +_,7 @@ double d0 = (double)(this.f_19787_ - this.f_19867_); - if (flag && !flag2 && !flag1 && this.f_19861_ && d0 < (double)this.m_6113_()) { + if (flag && !flag2 && !flag1 && this.m_20096_() && d0 < (double)this.m_6113_()) { ItemStack itemstack = this.m_21120_(InteractionHand.MAIN_HAND); - if (itemstack.m_41720_() instanceof SwordItem) { - flag3 = true; @@ -252,19 +243,19 @@ } float f4 = 0.0F; -@@ -1120,8 +_,9 @@ +@@ -1121,8 +_,9 @@ if (flag3) { float f3 = 1.0F + EnchantmentHelper.m_44821_(this) * f; -- for(LivingEntity livingentity : this.f_19853_.m_45976_(LivingEntity.class, p_36347_.m_20191_().m_82377_(1.0D, 0.25D, 1.0D))) { +- for(LivingEntity livingentity : this.m_9236_().m_45976_(LivingEntity.class, p_36347_.m_20191_().m_82377_(1.0D, 0.25D, 1.0D))) { - if (livingentity != this && livingentity != p_36347_ && !this.m_7307_(livingentity) && (!(livingentity instanceof ArmorStand) || !((ArmorStand)livingentity).m_31677_()) && this.m_20280_(livingentity) < 9.0D) { -+ for(LivingEntity livingentity : this.f_19853_.m_45976_(LivingEntity.class, this.m_21120_(InteractionHand.MAIN_HAND).getSweepHitBox(this, p_36347_))) { ++ for(LivingEntity livingentity : this.m_9236_().m_45976_(LivingEntity.class, this.m_21120_(InteractionHand.MAIN_HAND).getSweepHitBox(this, p_36347_))) { + double entityReachSq = Mth.m_144952_(this.getEntityReach()); // Use entity reach instead of constant 9.0. Vanilla uses bottom center-to-center checks here, so don't update this to use canReach, since it uses closest-corner checks. + if (livingentity != this && livingentity != p_36347_ && !this.m_7307_(livingentity) && (!(livingentity instanceof ArmorStand) || !((ArmorStand)livingentity).m_31677_()) && this.m_20280_(livingentity) < entityReachSq) { livingentity.m_147240_((double)0.4F, (double)Mth.m_14031_(this.m_146908_() * ((float)Math.PI / 180F)), (double)(-Mth.m_14089_(this.m_146908_() * ((float)Math.PI / 180F)))); livingentity.m_6469_(this.m_269291_().m_269075_(this), f3); } -@@ -1162,13 +_,15 @@ +@@ -1163,13 +_,15 @@ EnchantmentHelper.m_44896_(this, p_36347_); ItemStack itemstack1 = this.m_21205_(); Entity entity = p_36347_; @@ -274,7 +265,7 @@ + entity = ((net.minecraftforge.entity.PartEntity) p_36347_).getParent(); } - if (!this.f_19853_.f_46443_ && !itemstack1.m_41619_() && entity instanceof LivingEntity) { + if (!this.m_9236_().f_46443_ && !itemstack1.m_41619_() && entity instanceof LivingEntity) { + ItemStack copy = itemstack1.m_41777_(); itemstack1.m_41640_((LivingEntity)entity, this); if (itemstack1.m_41619_()) { @@ -282,7 +273,7 @@ this.m_21008_(InteractionHand.MAIN_HAND, ItemStack.f_41583_); } } -@@ -1194,6 +_,7 @@ +@@ -1195,6 +_,7 @@ } } } @@ -290,33 +281,33 @@ } } -@@ -1210,7 +_,7 @@ +@@ -1211,7 +_,7 @@ } if (this.f_19796_.m_188501_() < f) { - this.m_36335_().m_41524_(Items.f_42740_, 100); + this.m_36335_().m_41524_(this.m_21211_().m_41720_(), 100); this.m_5810_(); - this.f_19853_.m_7605_(this, (byte)30); + this.m_9236_().m_7605_(this, (byte)30); } -@@ -1274,6 +_,7 @@ +@@ -1275,6 +_,7 @@ } public void m_6145_(boolean p_36226_, boolean p_36227_) { + net.minecraftforge.event.ForgeEventFactory.onPlayerWakeup(this, p_36226_, p_36227_); super.m_5796_(); - if (this.f_19853_ instanceof ServerLevel && p_36227_) { - ((ServerLevel)this.f_19853_).m_8878_(); -@@ -1299,7 +_,7 @@ + if (this.m_9236_() instanceof ServerLevel && p_36227_) { + ((ServerLevel)this.m_9236_()).m_8878_(); +@@ -1300,7 +_,7 @@ } else if (block instanceof BedBlock && BedBlock.m_49488_(p_36131_)) { return BedBlock.m_260958_(EntityType.f_20532_, p_36131_, p_36132_, blockstate.m_61143_(BedBlock.f_54117_), p_36133_); } else if (!p_36134_) { - return Optional.empty(); + return blockstate.getRespawnPosition(EntityType.f_20532_, p_36131_, p_36132_, p_36133_, null); } else { - boolean flag = block.m_5568_(); - boolean flag1 = p_36131_.m_8055_(p_36132_.m_7494_()).m_60734_().m_5568_(); -@@ -1476,6 +_,7 @@ + boolean flag = block.m_48673_(blockstate); + BlockState blockstate1 = p_36131_.m_8055_(p_36132_.m_7494_()); +@@ -1481,6 +_,7 @@ public boolean m_142535_(float p_150093_, float p_150094_, DamageSource p_150095_) { if (this.f_36077_.f_35936_) { @@ -324,16 +315,32 @@ return false; } else { if (p_150093_ >= 2.0F) { -@@ -1489,7 +_,7 @@ +@@ -1494,7 +_,7 @@ public boolean m_36319_() { - if (!this.f_19861_ && !this.m_21255_() && !this.m_20069_() && !this.m_21023_(MobEffects.f_19620_)) { + if (!this.m_20096_() && !this.m_21255_() && !this.m_20069_() && !this.m_21023_(MobEffects.f_19620_)) { ItemStack itemstack = this.m_6844_(EquipmentSlot.CHEST); - if (itemstack.m_150930_(Items.f_42741_) && ElytraItem.m_41140_(itemstack)) { + if (itemstack.canElytraFly(this)) { this.m_36320_(); return true; } -@@ -1531,6 +_,10 @@ +@@ -1522,13 +_,13 @@ + protected void m_7355_(BlockPos p_282121_, BlockState p_282194_) { + if (this.m_20069_()) { + this.m_280447_(); +- this.m_280568_(p_282194_); ++ this.playMuffledStepSound(p_282194_, p_282121_); + } else { + BlockPos blockpos = this.m_276951_(p_282121_); + if (!p_282121_.equals(blockpos)) { + BlockState blockstate = this.m_9236_().m_8055_(blockpos); + if (blockstate.m_204336_(BlockTags.f_276549_)) { +- this.m_276961_(blockstate, p_282194_); ++ this.playCombinationStepSounds(blockstate, p_282194_, blockpos, p_282121_); + } else { + super.m_7355_(blockpos, blockstate); + } +@@ -1556,6 +_,10 @@ } public void m_6756_(int p_36291_) { @@ -344,7 +351,7 @@ this.m_36401_(p_36291_); this.f_36080_ += (float)p_36291_ / (float)this.m_36323_(); this.f_36079_ = Mth.m_14045_(this.f_36079_ + p_36291_, 0, Integer.MAX_VALUE); -@@ -1559,7 +_,7 @@ +@@ -1584,7 +_,7 @@ } public void m_7408_(ItemStack p_36172_, int p_36173_) { @@ -353,7 +360,7 @@ if (this.f_36078_ < 0) { this.f_36078_ = 0; this.f_36080_ = 0.0F; -@@ -1570,6 +_,10 @@ +@@ -1595,6 +_,10 @@ } public void m_6749_(int p_36276_) { @@ -364,7 +371,7 @@ this.f_36078_ += p_36276_; if (this.f_36078_ < 0) { this.f_36078_ = 0; -@@ -1765,7 +_,11 @@ +@@ -1790,7 +_,11 @@ } public Component m_5446_() { @@ -377,7 +384,7 @@ return this.m_36218_(mutablecomponent); } -@@ -1902,24 +_,24 @@ +@@ -1927,24 +_,24 @@ Predicate predicate = ((ProjectileWeaponItem)p_36349_.m_41720_()).m_6442_(); ItemStack itemstack = ProjectileWeaponItem.m_43010_(this, predicate); if (!itemstack.m_41619_()) { @@ -406,7 +413,7 @@ this.m_36246_(Stats.f_12982_.m_12902_(p_36186_.m_41720_())); p_36185_.m_6263_((Player)null, this.m_20185_(), this.m_20186_(), this.m_20189_(), SoundEvents.f_12321_, SoundSource.PLAYERS, 0.5F, p_36185_.f_46441_.m_188501_() * 0.1F + 0.9F); if (this instanceof ServerPlayer) { -@@ -2027,5 +_,63 @@ +@@ -2052,5 +_,63 @@ public Component m_36423_() { return this.f_36413_; } diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch index 3e99d16dbf..48936a5218 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch @@ -3,7 +3,7 @@ @@ -65,7 +_,7 @@ } - HitResult hitresult = ProjectileUtil.m_37294_(this, this::m_5603_); + HitResult hitresult = ProjectileUtil.m_278158_(this, this::m_5603_); - if (hitresult.m_6662_() != HitResult.Type.MISS) { + if (hitresult.m_6662_() != HitResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitresult)) { this.m_6532_(hitresult); diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch index 11b1da7b41..b781be4ff2 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/FireworkRocketEntity.java.patch @@ -12,5 +12,5 @@ + } + private void m_37080_() { - this.f_19853_.m_7605_(this, (byte)17); + this.m_9236_().m_7605_(this, (byte)17); this.m_146852_(GameEvent.f_157812_, this.m_19749_()); diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch index 9cf881cf5d..e50379df55 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/FishingHook.java.patch @@ -14,46 +14,28 @@ @@ -241,7 +_,7 @@ private void m_37171_() { - HitResult hitresult = ProjectileUtil.m_37294_(this, this::m_5603_); + HitResult hitresult = ProjectileUtil.m_278158_(this, this::m_5603_); - this.m_6532_(hitresult); + if (hitresult.m_6662_() == HitResult.Type.MISS || !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitresult)) this.m_6532_(hitresult); } protected boolean m_5603_(Entity p_37135_) { -@@ -296,7 +_,7 @@ - double d1 = (double)((float)Mth.m_14107_(this.m_20186_()) + 1.0F); - double d2 = this.m_20189_() + (double)(f2 * (float)this.f_37091_ * 0.1F); - BlockState blockstate = serverlevel.m_8055_(BlockPos.m_274561_(d0, d1 - 1.0D, d2)); -- if (blockstate.m_60713_(Blocks.f_49990_)) { -+ if (serverlevel.m_8055_(new BlockPos((int)d0, (int)d1 - 1, (int)d2)).m_60767_() == net.minecraft.world.level.material.Material.f_76305_) { - if (this.f_19796_.m_188501_() < 0.15F) { - serverlevel.m_8767_(ParticleTypes.f_123795_, d0, d1 - (double)0.1F, d2, 1, (double)f1, 0.1D, (double)f2, 0.0D); - } -@@ -332,7 +_,7 @@ - double d5 = (double)((float)Mth.m_14107_(this.m_20186_()) + 1.0F); - double d6 = this.m_20189_() + (double)(Mth.m_14089_(f6) * f7) * 0.1D; - BlockState blockstate1 = serverlevel.m_8055_(BlockPos.m_274561_(d4, d5 - 1.0D, d6)); -- if (blockstate1.m_60713_(Blocks.f_49990_)) { -+ if (blockstate1.m_60767_() == net.minecraft.world.level.material.Material.f_76305_) { - serverlevel.m_8767_(ParticleTypes.f_123769_, d4, d5, d6, 2 + this.f_19796_.m_188503_(2), (double)0.1F, 0.0D, (double)0.1F, 0.0D); - } - } -@@ -403,6 +_,7 @@ +@@ -403,15 +_,22 @@ Player player = this.m_37168_(); - if (!this.f_19853_.f_46443_ && player != null && !this.m_37136_(player)) { + if (!this.m_9236_().f_46443_ && player != null && !this.m_37136_(player)) { int i = 0; + net.minecraftforge.event.entity.player.ItemFishedEvent event = null; if (this.f_37094_ != null) { this.m_150155_(this.f_37094_); CriteriaTriggers.f_10553_.m_40416_((ServerPlayer)player, p_37157_, this, Collections.emptyList()); -@@ -410,8 +_,15 @@ + this.m_9236_().m_7605_(this, (byte)31); i = this.f_37094_ instanceof ItemEntity ? 3 : 5; } else if (this.f_37089_ > 0) { - LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerLevel)this.f_19853_)).m_78972_(LootContextParams.f_81460_, this.m_20182_()).m_78972_(LootContextParams.f_81463_, p_37157_).m_78972_(LootContextParams.f_81455_, this).m_230911_(this.f_19796_).m_78963_((float)this.f_37096_ + player.m_36336_()); -+ lootcontext$builder.m_78972_(LootContextParams.f_81458_, this.m_19749_()).m_78972_(LootContextParams.f_81455_, this); - LootTable loottable = this.f_19853_.m_7654_().m_129898_().m_79217_(BuiltInLootTables.f_78720_); - List list = loottable.m_230922_(lootcontext$builder.m_78975_(LootContextParamSets.f_81414_)); -+ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(list, this.f_19861_ ? 2 : 1, this); +- LootParams lootparams = (new LootParams.Builder((ServerLevel)this.m_9236_())).m_287286_(LootContextParams.f_81460_, this.m_20182_()).m_287286_(LootContextParams.f_81463_, p_37157_).m_287286_(LootContextParams.f_81455_, this).m_287239_((float)this.f_37096_ + player.m_36336_()).m_287235_(LootContextParamSets.f_81414_); ++ LootParams lootparams = (new LootParams.Builder((ServerLevel)this.m_9236_())).m_287286_(LootContextParams.f_81460_, this.m_20182_()).m_287286_(LootContextParams.f_81463_, p_37157_).m_287286_(LootContextParams.f_81455_, this).m_287286_(LootContextParams.f_81458_, this.m_19749_()).m_287286_(LootContextParams.f_81455_, this).m_287239_((float)this.f_37096_ + player.m_36336_()).m_287235_(LootContextParamSets.f_81414_); + LootTable loottable = this.m_9236_().m_7654_().m_278653_().m_278676_(BuiltInLootTables.f_78720_); + List list = loottable.m_287195_(lootparams); ++ event = new net.minecraftforge.event.entity.player.ItemFishedEvent(list, this.m_20096_() ? 2 : 1, this); + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); + if (event.isCanceled()) { + this.m_146870_(); diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/LargeFireball.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/LargeFireball.java.patch index bfd00ca250..75f8acaea4 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/LargeFireball.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/LargeFireball.java.patch @@ -3,10 +3,10 @@ @@ -24,7 +_,8 @@ protected void m_6532_(HitResult p_37218_) { super.m_6532_(p_37218_); - if (!this.f_19853_.f_46443_) { -- boolean flag = this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_); + if (!this.m_9236_().f_46443_) { +- boolean flag = this.m_9236_().m_46469_().m_46207_(GameRules.f_46132_); + // TODO 1.19.3: The creation of Level.ExplosionInteraction means this code path will fire EntityMobGriefingEvent twice. Should we try and fix it? -SS -+ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, this.m_19749_()); - this.f_19853_.m_255391_(this, this.m_20185_(), this.m_20186_(), this.m_20189_(), (float)this.f_37197_, flag, Level.ExplosionInteraction.MOB); ++ boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.m_9236_(), this.m_19749_()); + this.m_9236_().m_255391_(this, this.m_20185_(), this.m_20186_(), this.m_20189_(), (float)this.f_37197_, flag, Level.ExplosionInteraction.MOB); this.m_146870_(); } diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/LlamaSpit.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/LlamaSpit.java.patch index 0565b0215a..e09e52fd55 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/LlamaSpit.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/LlamaSpit.java.patch @@ -3,7 +3,7 @@ @@ -29,6 +_,7 @@ super.m_8119_(); Vec3 vec3 = this.m_20184_(); - HitResult hitresult = ProjectileUtil.m_37294_(this, this::m_5603_); + HitResult hitresult = ProjectileUtil.m_278158_(this, this::m_5603_); + if (hitresult.m_6662_() != HitResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitresult)) this.m_6532_(hitresult); double d0 = this.m_20185_() + vec3.f_82479_; diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/Projectile.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/Projectile.java.patch index 5ed12bc06f..c6ac8486be 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/Projectile.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/Projectile.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/Projectile.java +++ b/net/minecraft/world/entity/projectile/Projectile.java -@@ -213,7 +_,7 @@ +@@ -214,7 +_,7 @@ if (entity instanceof Player) { return entity.m_142265_(p_150167_, p_150168_); } else { diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/ProjectileUtil.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/ProjectileUtil.java.patch index ce834c7c77..3867c26570 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/ProjectileUtil.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/ProjectileUtil.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/projectile/ProjectileUtil.java +++ b/net/minecraft/world/entity/projectile/ProjectileUtil.java -@@ -57,7 +_,7 @@ +@@ -68,7 +_,7 @@ Vec3 vec31 = optional.get(); double d1 = p_37289_.m_82557_(vec31); if (d1 < d0 || d0 == 0.0D) { @@ -9,7 +9,7 @@ if (d0 == 0.0D) { entity = entity1; vec3 = vec31; -@@ -127,8 +_,13 @@ +@@ -138,8 +_,13 @@ } } diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch index 31fba1a948..d02d7b16c5 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/ShulkerBullet.java.patch @@ -3,7 +3,7 @@ @@ -212,7 +_,7 @@ } - HitResult hitresult = ProjectileUtil.m_37294_(this, this::m_5603_); + HitResult hitresult = ProjectileUtil.m_278158_(this, this::m_5603_); - if (hitresult.m_6662_() != HitResult.Type.MISS) { + if (hitresult.m_6662_() != HitResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, hitresult)) { this.m_6532_(hitresult); diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/SmallFireball.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/SmallFireball.java.patch index fb83e39184..c6548a8d74 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/SmallFireball.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/SmallFireball.java.patch @@ -2,10 +2,10 @@ +++ b/net/minecraft/world/entity/projectile/SmallFireball.java @@ -46,7 +_,7 @@ super.m_8060_(p_37384_); - if (!this.f_19853_.f_46443_) { + if (!this.m_9236_().f_46443_) { Entity entity = this.m_19749_(); -- if (!(entity instanceof Mob) || this.f_19853_.m_46469_().m_46207_(GameRules.f_46132_)) { -+ if (!(entity instanceof Mob) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.f_19853_, entity)) { +- if (!(entity instanceof Mob) || this.m_9236_().m_46469_().m_46207_(GameRules.f_46132_)) { ++ if (!(entity instanceof Mob) || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.m_9236_(), entity)) { BlockPos blockpos = p_37384_.m_82425_().m_121945_(p_37384_.m_82434_()); - if (this.f_19853_.m_46859_(blockpos)) { - this.f_19853_.m_46597_(blockpos, BaseFireBlock.m_49245_(this.f_19853_, blockpos)); + if (this.m_9236_().m_46859_(blockpos)) { + this.m_9236_().m_46597_(blockpos, BaseFireBlock.m_49245_(this.m_9236_(), blockpos)); diff --git a/patches/minecraft/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch b/patches/minecraft/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch index b680796a03..2216ff08ef 100644 --- a/patches/minecraft/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/projectile/ThrownEnderpearl.java.patch @@ -3,11 +3,11 @@ @@ -46,6 +_,8 @@ if (entity instanceof ServerPlayer) { ServerPlayer serverplayer = (ServerPlayer)entity; - if (serverplayer.f_8906_.m_6198_() && serverplayer.f_19853_ == this.f_19853_ && !serverplayer.m_5803_()) { + if (serverplayer.f_8906_.m_6198_() && serverplayer.m_9236_() == this.m_9236_() && !serverplayer.m_5803_()) { + net.minecraftforge.event.entity.EntityTeleportEvent.EnderPearl event = net.minecraftforge.event.ForgeEventFactory.onEnderPearlLand(serverplayer, this.m_20185_(), this.m_20186_(), this.m_20189_(), this, 5.0F, p_37504_); + if (!event.isCanceled()) { // Don't indent to lower patch size - if (this.f_19796_.m_188501_() < 0.05F && this.f_19853_.m_46469_().m_46207_(GameRules.f_46134_)) { - Endermite endermite = EntityType.f_20567_.m_20615_(this.f_19853_); + if (this.f_19796_.m_188501_() < 0.05F && this.m_9236_().m_46469_().m_46207_(GameRules.f_46134_)) { + Endermite endermite = EntityType.f_20567_.m_20615_(this.m_9236_()); if (endermite != null) { @@ -60,8 +_,10 @@ entity.m_6021_(this.m_20185_(), this.m_20186_(), this.m_20189_()); @@ -28,7 +28,7 @@ - public Entity m_5489_(ServerLevel p_37506_) { + public Entity changeDimension(ServerLevel p_37506_, net.minecraftforge.common.util.ITeleporter teleporter) { Entity entity = this.m_19749_(); - if (entity != null && entity.f_19853_.m_46472_() != p_37506_.m_46472_()) { + if (entity != null && entity.m_9236_().m_46472_() != p_37506_.m_46472_()) { this.m_5602_((Entity)null); } diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch index 3929ff026f..ece0a0d49b 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/AbstractMinecart.java.patch @@ -9,7 +9,7 @@ private static final EntityDataAccessor f_38079_ = SynchedEntityData.m_135353_(AbstractMinecart.class, EntityDataSerializers.f_135028_); private static final EntityDataAccessor f_38080_ = SynchedEntityData.m_135353_(AbstractMinecart.class, EntityDataSerializers.f_135028_); private static final EntityDataAccessor f_38081_ = SynchedEntityData.m_135353_(AbstractMinecart.class, EntityDataSerializers.f_135029_); -@@ -75,6 +_,7 @@ +@@ -76,6 +_,7 @@ p_38135_.put(RailShape.NORTH_WEST, Pair.of(vec3i2, vec3i)); p_38135_.put(RailShape.NORTH_EAST, Pair.of(vec3i2, vec3i1)); }); @@ -17,7 +17,7 @@ private int f_38070_; private double f_38071_; private double f_38072_; -@@ -84,6 +_,7 @@ +@@ -85,6 +_,7 @@ private double f_38076_; private double f_38077_; private double f_38078_; @@ -25,7 +25,7 @@ protected AbstractMinecart(EntityType p_38087_, Level p_38088_) { super(p_38087_, p_38088_); -@@ -98,6 +_,14 @@ +@@ -99,6 +_,14 @@ this.f_19856_ = p_38094_; } @@ -40,7 +40,7 @@ public static AbstractMinecart m_38119_(Level p_38120_, double p_38121_, double p_38122_, double p_38123_, AbstractMinecart.Type p_38124_) { if (p_38124_ == AbstractMinecart.Type.CHEST) { return new MinecartChest(p_38120_, p_38121_, p_38122_, p_38123_); -@@ -132,7 +_,7 @@ +@@ -133,7 +_,7 @@ } public boolean m_6094_() { @@ -49,50 +49,50 @@ } protected Vec3 m_7643_(Direction.Axis p_38132_, BlockUtil.FoundRectangle p_38133_) { -@@ -301,9 +_,9 @@ - +@@ -303,9 +_,9 @@ BlockPos blockpos = new BlockPos(k, i, j); - BlockState blockstate = this.f_19853_.m_8055_(blockpos); -- if (BaseRailBlock.m_49416_(blockstate)) { -+ if (canUseRail() && BaseRailBlock.m_49416_(blockstate)) { + BlockState blockstate = this.m_9236_().m_8055_(blockpos); + this.f_287786_ = BaseRailBlock.m_49416_(blockstate); +- if (this.f_287786_) { ++ if (canUseRail() && this.f_287786_) { this.m_6401_(blockpos, blockstate); - if (blockstate.m_60713_(Blocks.f_50285_)) { + if (blockstate.m_60734_() instanceof PoweredRailBlock && ((PoweredRailBlock) blockstate.m_60734_()).isActivatorRail()) { this.m_6025_(k, i, j, blockstate.m_61143_(PoweredRailBlock.f_55215_)); } } else { -@@ -328,8 +_,11 @@ +@@ -330,8 +_,11 @@ } this.m_19915_(this.m_146908_(), this.m_146909_()); - if (this.m_6064_() == AbstractMinecart.Type.RIDEABLE && this.m_20184_().m_165925_() > 0.01D) { -- List list = this.f_19853_.m_6249_(this, this.m_20191_().m_82377_((double)0.2F, 0.0D, (double)0.2F), EntitySelector.m_20421_(this)); +- List list = this.m_9236_().m_6249_(this, this.m_20191_().m_82377_((double)0.2F, 0.0D, (double)0.2F), EntitySelector.m_20421_(this)); + AABB box; + if (getCollisionHandler() != null) box = getCollisionHandler().getMinecartCollisionBox(this); + else box = this.m_20191_().m_82377_(0.2F, 0.0D, 0.2F); + if (canBeRidden() && this.m_20184_().m_165925_() > 0.01D) { -+ List list = this.f_19853_.m_6249_(this, box, EntitySelector.m_20421_(this)); ++ List list = this.m_9236_().m_6249_(this, box, EntitySelector.m_20421_(this)); if (!list.isEmpty()) { for(int l = 0; l < list.size(); ++l) { Entity entity1 = list.get(l); -@@ -341,7 +_,7 @@ +@@ -343,7 +_,7 @@ } } } else { -- for(Entity entity : this.f_19853_.m_45933_(this, this.m_20191_().m_82377_((double)0.2F, 0.0D, (double)0.2F))) { -+ for(Entity entity : this.f_19853_.m_45933_(this, box)) { +- for(Entity entity : this.m_9236_().m_45933_(this, this.m_20191_().m_82377_((double)0.2F, 0.0D, (double)0.2F))) { ++ for(Entity entity : this.m_9236_().m_45933_(this, box)) { if (!this.m_20363_(entity) && entity.m_6094_() && entity instanceof AbstractMinecart) { entity.m_7334_(this); } -@@ -366,16 +_,23 @@ +@@ -368,16 +_,23 @@ } protected void m_38163_() { - double d0 = this.m_7097_(); -+ double d0 = f_19861_ ? this.m_7097_() : getMaxSpeedAirLateral(); ++ double d0 = this.m_20096_() ? this.m_7097_() : getMaxSpeedAirLateral(); Vec3 vec3 = this.m_20184_(); this.m_20334_(Mth.m_14008_(vec3.f_82479_, -d0, d0), vec3.f_82480_, Mth.m_14008_(vec3.f_82481_, -d0, d0)); - if (this.f_19861_) { + if (this.m_20096_()) { this.m_20256_(this.m_20184_().m_82490_(0.5D)); } @@ -104,13 +104,13 @@ + } + this.m_6478_(MoverType.SELF, this.m_20184_()); - if (!this.f_19861_) { + if (!this.m_20096_()) { - this.m_20256_(this.m_20184_().m_82490_(0.95D)); + this.m_20256_(this.m_20184_().m_82490_(getDragAir())); } } -@@ -389,18 +_,19 @@ +@@ -391,18 +_,19 @@ d1 = (double)p_38156_.m_123342_(); boolean flag = false; boolean flag1 = false; @@ -129,11 +129,11 @@ Vec3 vec31 = this.m_20184_(); - RailShape railshape = p_38157_.m_61143_(((BaseRailBlock)p_38157_.m_60734_()).m_7978_()); -+ RailShape railshape = ((BaseRailBlock)p_38157_.m_60734_()).getRailDirection(p_38157_, this.f_19853_, p_38156_, this); ++ RailShape railshape = ((BaseRailBlock)p_38157_.m_60734_()).getRailDirection(p_38157_, this.m_9236_(), p_38156_, this); switch (railshape) { case ASCENDING_EAST: this.m_20256_(vec31.m_82520_(-d3, 0.0D, 0.0D)); -@@ -446,7 +_,7 @@ +@@ -448,7 +_,7 @@ } } @@ -142,7 +142,7 @@ double d22 = this.m_20184_().m_165924_(); if (d22 < 0.03D) { this.m_20256_(Vec3.f_82478_); -@@ -475,10 +_,7 @@ +@@ -477,10 +_,7 @@ d0 = d23 + d4 * d14; d2 = d10 + d5 * d14; this.m_6034_(d0, d1, d2); @@ -154,37 +154,37 @@ if (vec3i.m_123342_() != 0 && Mth.m_14107_(this.m_20185_()) - p_38156_.m_123341_() == vec3i.m_123341_() && Mth.m_14107_(this.m_20189_()) - p_38156_.m_123343_() == vec3i.m_123343_()) { this.m_6034_(this.m_20185_(), this.m_20186_() + (double)vec3i.m_123342_(), this.m_20189_()); } else if (vec3i1.m_123342_() != 0 && Mth.m_14107_(this.m_20185_()) - p_38156_.m_123341_() == vec3i1.m_123341_() && Mth.m_14107_(this.m_20189_()) - p_38156_.m_123343_() == vec3i1.m_123343_()) { -@@ -506,7 +_,10 @@ +@@ -508,7 +_,10 @@ this.m_20334_(d26 * (double)(j - p_38156_.m_123341_()), vec35.f_82480_, d26 * (double)(i - p_38156_.m_123343_())); } - if (flag) { + if (shouldDoRailFunctions()) -+ baserailblock.onMinecartPass(p_38157_, f_19853_, p_38156_, this); ++ baserailblock.onMinecartPass(p_38157_, m_9236_(), p_38156_, this); + + if (flag && shouldDoRailFunctions()) { Vec3 vec36 = this.m_20184_(); double d27 = vec36.m_165924_(); if (d27 > 0.01D) { -@@ -566,7 +_,7 @@ +@@ -572,7 +_,7 @@ - BlockState blockstate = this.f_19853_.m_8055_(new BlockPos(i, j, k)); + BlockState blockstate = this.m_9236_().m_8055_(new BlockPos(i, j, k)); if (BaseRailBlock.m_49416_(blockstate)) { - RailShape railshape = blockstate.m_61143_(((BaseRailBlock)blockstate.m_60734_()).m_7978_()); -+ RailShape railshape = ((BaseRailBlock)blockstate.m_60734_()).getRailDirection(blockstate, this.f_19853_, new BlockPos(i, j, k), this); ++ RailShape railshape = ((BaseRailBlock)blockstate.m_60734_()).getRailDirection(blockstate, this.m_9236_(), new BlockPos(i, j, k), this); p_38098_ = (double)j; if (railshape.m_61745_()) { p_38098_ = (double)(j + 1); -@@ -605,7 +_,7 @@ +@@ -611,7 +_,7 @@ - BlockState blockstate = this.f_19853_.m_8055_(new BlockPos(i, j, k)); + BlockState blockstate = this.m_9236_().m_8055_(new BlockPos(i, j, k)); if (BaseRailBlock.m_49416_(blockstate)) { - RailShape railshape = blockstate.m_61143_(((BaseRailBlock)blockstate.m_60734_()).m_7978_()); -+ RailShape railshape = ((BaseRailBlock)blockstate.m_60734_()).getRailDirection(blockstate, this.f_19853_, new BlockPos(i, j, k), this); ++ RailShape railshape = ((BaseRailBlock)blockstate.m_60734_()).getRailDirection(blockstate, this.m_9236_(), new BlockPos(i, j, k), this); Pair pair = m_38125_(railshape); Vec3i vec3i = pair.getFirst(); Vec3i vec3i1 = pair.getSecond(); -@@ -667,6 +_,10 @@ +@@ -673,6 +_,10 @@ } public void m_7334_(Entity p_38165_) { @@ -192,10 +192,10 @@ + getCollisionHandler().onEntityCollision(this, p_38165_); + return; + } - if (!this.f_19853_.f_46443_) { + if (!this.m_9236_().f_46443_) { if (!p_38165_.f_19794_ && !this.f_19794_) { if (!this.m_20363_(p_38165_)) { -@@ -700,11 +_,11 @@ +@@ -706,11 +_,11 @@ Vec3 vec32 = this.m_20184_(); Vec3 vec33 = p_38165_.m_20184_(); @@ -209,7 +209,7 @@ p_38165_.m_20256_(vec33.m_82542_(0.2D, 1.0D, 0.2D)); p_38165_.m_5997_(vec32.f_82479_ + d0, 0.0D, vec32.f_82481_ + d1); this.m_20256_(vec32.m_82542_(0.95D, 1.0D, 0.95D)); -@@ -803,6 +_,42 @@ +@@ -809,6 +_,42 @@ public void m_38138_(boolean p_38139_) { this.m_20088_().m_135381_(f_38084_, p_38139_); } @@ -234,10 +234,10 @@ + public double getMaxSpeedWithRail() { //Non-default because getMaximumSpeed is protected + if (!canUseRail()) return m_7097_(); + BlockPos pos = this.getCurrentRailPosition(); -+ BlockState state = this.f_19853_.m_8055_(pos); ++ BlockState state = this.m_9236_().m_8055_(pos); + if (!state.m_204336_(BlockTags.f_13034_)) return m_7097_(); + -+ float railMaxSpeed = ((BaseRailBlock)state.m_60734_()).getRailMaxSpeed(state, this.f_19853_, pos, this); ++ float railMaxSpeed = ((BaseRailBlock)state.m_60734_()).getRailMaxSpeed(state, this.m_9236_(), pos, this); + return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail()); + } + @Override diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/Boat.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/Boat.java.patch index c6e2761d1d..79bf0d6dcd 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/Boat.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/Boat.java.patch @@ -12,36 +12,36 @@ @@ -455,7 +_,7 @@ for(int i2 = i1; i2 < j1; ++i2) { blockpos$mutableblockpos.m_122178_(l1, k1, i2); - FluidState fluidstate = this.f_19853_.m_6425_(blockpos$mutableblockpos); + FluidState fluidstate = this.m_9236_().m_6425_(blockpos$mutableblockpos); - if (fluidstate.m_205070_(FluidTags.f_13131_)) { + if (this.canBoatInFluid(fluidstate)) { - f = Math.max(f, fluidstate.m_76155_(this.f_19853_, blockpos$mutableblockpos)); + f = Math.max(f, fluidstate.m_76155_(this.m_9236_(), blockpos$mutableblockpos)); } @@ -496,7 +_,7 @@ blockpos$mutableblockpos.m_122178_(l1, k2, i2); - BlockState blockstate = this.f_19853_.m_8055_(blockpos$mutableblockpos); - if (!(blockstate.m_60734_() instanceof WaterlilyBlock) && Shapes.m_83157_(blockstate.m_60812_(this.f_19853_, blockpos$mutableblockpos).m_83216_((double)l1, (double)k2, (double)i2), voxelshape, BooleanOp.f_82689_)) { + BlockState blockstate = this.m_9236_().m_8055_(blockpos$mutableblockpos); + if (!(blockstate.m_60734_() instanceof WaterlilyBlock) && Shapes.m_83157_(blockstate.m_60812_(this.m_9236_(), blockpos$mutableblockpos).m_83216_((double)l1, (double)k2, (double)i2), voxelshape, BooleanOp.f_82689_)) { - f += blockstate.m_60734_().m_49958_(); -+ f += blockstate.getFriction(this.f_19853_, blockpos$mutableblockpos, this); ++ f += blockstate.getFriction(this.m_9236_(), blockpos$mutableblockpos, this); ++k1; } } @@ -525,7 +_,7 @@ for(int i2 = i1; i2 < j1; ++i2) { blockpos$mutableblockpos.m_122178_(k1, l1, i2); - FluidState fluidstate = this.f_19853_.m_6425_(blockpos$mutableblockpos); + FluidState fluidstate = this.m_9236_().m_6425_(blockpos$mutableblockpos); - if (fluidstate.m_205070_(FluidTags.f_13131_)) { + if (this.canBoatInFluid(fluidstate)) { - float f = (float)l1 + fluidstate.m_76155_(this.f_19853_, blockpos$mutableblockpos); + float f = (float)l1 + fluidstate.m_76155_(this.m_9236_(), blockpos$mutableblockpos); this.f_38277_ = Math.max((double)f, this.f_38277_); flag |= aabb.f_82289_ < (double)f; @@ -555,7 +_,7 @@ for(int i2 = i1; i2 < j1; ++i2) { blockpos$mutableblockpos.m_122178_(k1, l1, i2); - FluidState fluidstate = this.f_19853_.m_6425_(blockpos$mutableblockpos); -- if (fluidstate.m_205070_(FluidTags.f_13131_) && d0 < (double)((float)blockpos$mutableblockpos.m_123342_() + fluidstate.m_76155_(this.f_19853_, blockpos$mutableblockpos))) { -+ if (this.canBoatInFluid(fluidstate) && d0 < (double)((float)blockpos$mutableblockpos.m_123342_() + fluidstate.m_76155_(this.f_19853_, blockpos$mutableblockpos))) { + FluidState fluidstate = this.m_9236_().m_6425_(blockpos$mutableblockpos); +- if (fluidstate.m_205070_(FluidTags.f_13131_) && d0 < (double)((float)blockpos$mutableblockpos.m_123342_() + fluidstate.m_76155_(this.m_9236_(), blockpos$mutableblockpos))) { ++ if (this.canBoatInFluid(fluidstate) && d0 < (double)((float)blockpos$mutableblockpos.m_123342_() + fluidstate.m_76155_(this.m_9236_(), blockpos$mutableblockpos))) { if (!fluidstate.m_76170_()) { return Boat.Status.UNDER_FLOWING_WATER; } @@ -49,8 +49,8 @@ } this.m_183634_(); -- } else if (!this.f_19853_.m_6425_(this.m_20183_().m_7495_()).m_205070_(FluidTags.f_13131_) && p_38307_ < 0.0D) { -+ } else if (!this.canBoatInFluid(this.f_19853_.m_6425_(this.m_20183_().m_7495_())) && p_38307_ < 0.0D) { +- } else if (!this.m_9236_().m_6425_(this.m_20183_().m_7495_()).m_205070_(FluidTags.f_13131_) && p_38307_ < 0.0D) { ++ } else if (!this.canBoatInFluid(this.m_9236_().m_6425_(this.m_20183_().m_7495_())) && p_38307_ < 0.0D) { this.f_19789_ -= (float)p_38307_; } diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/ChestBoat.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/ChestBoat.java.patch index 3009347203..aed87bec80 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/ChestBoat.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/ChestBoat.java.patch @@ -27,5 +27,5 @@ + } + public void m_5785_(Player p_270286_) { - this.f_19853_.m_214171_(GameEvent.f_157802_, this.m_20182_(), GameEvent.Context.m_223717_(p_270286_)); + this.m_9236_().m_214171_(GameEvent.f_157802_, this.m_20182_(), GameEvent.Context.m_223717_(p_270286_)); } diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch index 35e1c302f4..e73bdff861 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch @@ -3,10 +3,10 @@ @@ -103,6 +_,9 @@ this.m_214199_((ResourceLocation)null); - LootContext.Builder lootcontext$builder = (new LootContext.Builder((ServerLevel)this.m_9236_())).m_78972_(LootContextParams.f_81460_, this.m_20182_()).m_78965_(this.m_213803_()); + LootParams.Builder lootparams$builder = (new LootParams.Builder((ServerLevel)this.m_9236_())).m_287286_(LootContextParams.f_81460_, this.m_20182_()); + // Forge: set the chest to killer_entity for loot context. + if (this instanceof AbstractMinecartContainer entityContainer) -+ lootcontext$builder.m_78972_(LootContextParams.f_81458_, entityContainer); ++ lootparams$builder.m_287286_(LootContextParams.f_81458_, entityContainer); if (p_219950_ != null) { - lootcontext$builder.m_78963_(p_219950_.m_36336_()).m_78972_(LootContextParams.f_81455_, p_219950_); + lootparams$builder.m_287239_(p_219950_.m_36336_()).m_287286_(LootContextParams.f_81455_, p_219950_); } diff --git a/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch b/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch index f1b31a5d14..66e69481a2 100644 --- a/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/vehicle/MinecartFurnace.java.patch @@ -12,7 +12,7 @@ @@ -125,6 +_,11 @@ } - return InteractionResult.m_19078_(this.f_19853_.f_46443_); + return InteractionResult.m_19078_(this.m_9236_().f_46443_); + } + + @Override diff --git a/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch index 44acdcacb8..0745dcfdb4 100644 --- a/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/AbstractContainerMenu.java.patch @@ -10,14 +10,14 @@ } } @@ -401,6 +_,7 @@ - ItemStack itemstack11 = this.m_142621_(); - p_150434_.m_141945_(itemstack11, slot7.m_7993_(), clickaction); - if (!this.m_246200_(p_150434_, clickaction, slot7, itemstack10, itemstack11)) { -+ if (!net.minecraftforge.common.ForgeHooks.onItemStackedOn(itemstack11, itemstack10, slot7, clickaction, p_150434_, m_150446_())) - if (itemstack10.m_41619_()) { - if (!itemstack11.m_41619_()) { - int l2 = clickaction == ClickAction.PRIMARY ? itemstack11.m_41613_() : 1; -@@ -611,14 +_,15 @@ + ItemStack itemstack10 = this.m_142621_(); + p_150434_.m_141945_(itemstack10, slot7.m_7993_(), clickaction); + if (!this.m_246200_(p_150434_, clickaction, slot7, itemstack9, itemstack10)) { ++ if (!net.minecraftforge.common.ForgeHooks.onItemStackedOn(itemstack9, itemstack10, slot7, clickaction, p_150434_, m_150446_())) + if (itemstack9.m_41619_()) { + if (!itemstack10.m_41619_()) { + int i3 = clickaction == ClickAction.PRIMARY ? itemstack10.m_41613_() : 1; +@@ -610,14 +_,15 @@ ItemStack itemstack = slot.m_7993_(); if (!itemstack.m_41619_() && ItemStack.m_150942_(p_38904_, itemstack)) { int j = itemstack.m_41613_() + p_38904_.m_41613_(); @@ -38,11 +38,11 @@ flag = true; } @@ -718,7 +_,7 @@ - p_38925_.m_41764_(1); + i = 1; break; case 2: -- p_38925_.m_41764_(p_38925_.m_41720_().m_41459_()); -+ p_38925_.m_41764_(p_38925_.m_41741_()); - } - - p_38925_.m_41769_(p_38926_); +- i = p_279172_.m_41720_().m_41459_(); ++ i = p_279172_.m_41741_(); + break; + default: + i = p_279172_.m_41613_(); diff --git a/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch b/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch index 5fc26a4bba..f630e3dbdc 100644 --- a/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/AnvilMenu.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/AnvilMenu.java +++ b/net/minecraft/world/inventory/AnvilMenu.java -@@ -68,6 +_,8 @@ +@@ -71,6 +_,8 @@ p_150474_.m_6749_(-this.f_39002_.m_6501_()); } @@ -9,7 +9,7 @@ this.f_39769_.m_6836_(0, ItemStack.f_41583_); if (this.f_39000_ > 0) { ItemStack itemstack = this.f_39769_.m_8020_(1); -@@ -84,7 +_,7 @@ +@@ -87,7 +_,7 @@ this.f_39002_.m_6422_(0); this.f_39770_.m_39292_((p_150479_, p_150480_) -> { BlockState blockstate = p_150479_.m_8055_(p_150480_); @@ -18,7 +18,7 @@ BlockState blockstate1 = AnvilBlock.m_48824_(blockstate); if (blockstate1 == null) { p_150479_.m_7471_(p_150480_, false); -@@ -115,8 +_,11 @@ +@@ -118,8 +_,11 @@ Map map = EnchantmentHelper.m_44831_(itemstack1); j += itemstack.m_41610_() + (itemstack2.m_41619_() ? 0 : itemstack2.m_41610_()); this.f_39000_ = 0; @@ -31,15 +31,15 @@ if (itemstack1.m_41763_() && itemstack1.m_41720_().m_6832_(itemstack, itemstack2)) { int l2 = Math.min(itemstack1.m_41773_(), itemstack1.m_41776_() / 4); if (l2 <= 0) { -@@ -233,6 +_,7 @@ +@@ -236,6 +_,7 @@ i += k; - itemstack1.m_41714_(Component.m_237113_(this.f_39001_)); + itemstack1.m_41787_(); } + if (flag && !itemstack1.isBookEnchantable(itemstack2)) itemstack1 = ItemStack.f_41583_; this.f_39002_.m_6422_(j + i); if (i <= 0) { -@@ -286,5 +_,9 @@ +@@ -301,5 +_,9 @@ public int m_39028_() { return this.f_39002_.m_6501_(); diff --git a/patches/minecraft/net/minecraft/world/inventory/FurnaceResultSlot.java.patch b/patches/minecraft/net/minecraft/world/inventory/FurnaceResultSlot.java.patch index 4075320550..6df97e6451 100644 --- a/patches/minecraft/net/minecraft/world/inventory/FurnaceResultSlot.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/FurnaceResultSlot.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/FurnaceResultSlot.java +++ b/net/minecraft/world/inventory/FurnaceResultSlot.java -@@ -44,5 +_,6 @@ +@@ -48,5 +_,6 @@ } this.f_39540_ = 0; diff --git a/patches/minecraft/net/minecraft/world/inventory/MenuType.java.patch b/patches/minecraft/net/minecraft/world/inventory/MenuType.java.patch index 46395d76e0..939dc5f2b4 100644 --- a/patches/minecraft/net/minecraft/world/inventory/MenuType.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/MenuType.java.patch @@ -9,7 +9,7 @@ public static final MenuType f_39957_ = m_39988_("generic_9x1", ChestMenu::m_39234_); public static final MenuType f_39958_ = m_39988_("generic_9x2", ChestMenu::m_39243_); public static final MenuType f_39959_ = m_39988_("generic_9x3", ChestMenu::m_39255_); -@@ -54,6 +_,14 @@ +@@ -53,6 +_,14 @@ public T m_39985_(int p_39986_, Inventory p_39987_) { return this.f_39981_.m_39994_(p_39986_, p_39987_); diff --git a/patches/minecraft/net/minecraft/world/inventory/ResultSlot.java.patch b/patches/minecraft/net/minecraft/world/inventory/ResultSlot.java.patch index aa5506c92f..e37cf3a6c3 100644 --- a/patches/minecraft/net/minecraft/world/inventory/ResultSlot.java.patch +++ b/patches/minecraft/net/minecraft/world/inventory/ResultSlot.java.patch @@ -3,17 +3,17 @@ @@ -41,6 +_,7 @@ protected void m_5845_(ItemStack p_40185_) { if (this.f_40164_ > 0) { - p_40185_.m_41678_(this.f_40163_.f_19853_, this.f_40163_, this.f_40164_); + p_40185_.m_41678_(this.f_40163_.m_9236_(), this.f_40163_, this.f_40164_); + net.minecraftforge.event.ForgeEventFactory.firePlayerCraftingEvent(this.f_40163_, p_40185_, this.f_40162_); } - if (this.f_40218_ instanceof RecipeHolder) { -@@ -52,8 +_,9 @@ + Container container = this.f_40218_; +@@ -53,8 +_,9 @@ public void m_142406_(Player p_150638_, ItemStack p_150639_) { this.m_5845_(p_150639_); + net.minecraftforge.common.ForgeHooks.setCraftingPlayer(p_150638_); - NonNullList nonnulllist = p_150638_.f_19853_.m_7465_().m_44069_(RecipeType.f_44107_, this.f_40162_, p_150638_.f_19853_); + NonNullList nonnulllist = p_150638_.m_9236_().m_7465_().m_44069_(RecipeType.f_44107_, this.f_40162_, p_150638_.m_9236_()); - + net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); for(int i = 0; i < nonnulllist.size(); ++i) { diff --git a/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch b/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch index 12af7c0140..95adade708 100644 --- a/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BlockItem.java.patch @@ -1,17 +1,16 @@ --- a/net/minecraft/world/item/BlockItem.java +++ b/net/minecraft/world/item/BlockItem.java -@@ -82,9 +_,9 @@ +@@ -82,8 +_,8 @@ } } - SoundType soundtype = blockstate1.m_60827_(); - level.m_5594_(player, blockpos, this.m_40587_(blockstate1), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 2.0F, soundtype.m_56774_() * 0.8F); - level.m_220407_(GameEvent.f_157797_, blockpos, GameEvent.Context.m_223719_(player, blockstate1)); + SoundType soundtype = blockstate1.getSoundType(level, blockpos, p_40577_.m_43723_()); + level.m_5594_(player, blockpos, this.getPlaceSound(blockstate1, level, blockpos, p_40577_.m_43723_()), SoundSource.BLOCKS, (soundtype.m_56773_() + 1.0F) / 2.0F, soundtype.m_56774_() * 0.8F); + level.m_220407_(GameEvent.f_157797_, blockpos, GameEvent.Context.m_223719_(player, blockstate1)); if (player == null || !player.m_150110_().f_35937_) { itemstack.m_41774_(1); - } @@ -95,10 +_,16 @@ } } diff --git a/patches/minecraft/net/minecraft/world/item/BrushItem.java.patch b/patches/minecraft/net/minecraft/world/item/BrushItem.java.patch deleted file mode 100644 index 85db2a9963..0000000000 --- a/patches/minecraft/net/minecraft/world/item/BrushItem.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/item/BrushItem.java -+++ b/net/minecraft/world/item/BrushItem.java -@@ -76,6 +_,7 @@ - } else { - p_273619_.m_21253_(); - } -+ super.m_5929_(p_273467_, p_273619_, p_273316_, p_273101_); //TODO: Remove in 1.20, this is only here to trigger Forge's old onUseingTick method - } - - public void m_271895_(Level p_272701_, BlockHitResult p_273758_, BlockState p_272753_, Vec3 p_272912_) { diff --git a/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch b/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch index 97a8dc1b74..f1aec6cf6c 100644 --- a/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/BucketItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/BucketItem.java +++ b/net/minecraft/world/item/BucketItem.java -@@ -32,14 +_,28 @@ +@@ -31,14 +_,28 @@ public class BucketItem extends Item implements DispensibleContainerItem { private final Fluid f_40687_; @@ -29,7 +29,7 @@ if (blockhitresult.m_6662_() == HitResult.Type.MISS) { return InteractionResultHolder.m_19098_(itemstack); } else if (blockhitresult.m_6662_() != HitResult.Type.BLOCK) { -@@ -56,7 +_,7 @@ +@@ -55,7 +_,7 @@ ItemStack itemstack1 = bucketpickup.m_142598_(p_40703_, blockpos, blockstate1); if (!itemstack1.m_41619_()) { p_40704_.m_36246_(Stats.f_12982_.m_12902_(this)); @@ -38,7 +38,7 @@ p_40704_.m_5496_(p_150709_, 1.0F, 1.0F); }); p_40703_.m_142346_(p_40704_, GameEvent.f_157816_, blockpos); -@@ -72,8 +_,8 @@ +@@ -71,8 +_,8 @@ return InteractionResultHolder.m_19100_(itemstack); } else { BlockState blockstate = p_40703_.m_8055_(blockpos); @@ -48,8 +48,8 @@ + if (this.emptyContents(p_40704_, p_40703_, blockpos2, blockhitresult, itemstack)) { this.m_142131_(p_40704_, p_40703_, itemstack, blockpos2); if (p_40704_ instanceof ServerPlayer) { - CriteriaTriggers.f_10591_.m_59469_((ServerPlayer)p_40704_, blockpos2, itemstack); -@@ -98,7 +_,12 @@ + CriteriaTriggers.f_10591_.m_285767_((ServerPlayer)p_40704_, blockpos2, itemstack); +@@ -97,7 +_,12 @@ public void m_142131_(@Nullable Player p_150711_, Level p_150712_, ItemStack p_150713_, BlockPos p_150714_) { } @@ -62,8 +62,8 @@ if (!(this.f_40687_ instanceof FlowingFluid)) { return false; } else { -@@ -107,8 +_,12 @@ - Material material = blockstate.m_60767_(); +@@ -105,8 +_,12 @@ + Block block = blockstate.m_60734_(); boolean flag = blockstate.m_60722_(this.f_40687_); boolean flag1 = blockstate.m_60795_() || flag || block instanceof LiquidBlockContainer && ((LiquidBlockContainer)block).m_6044_(p_150717_, p_150718_, blockstate, this.f_40687_); + java.util.Optional containedFluidStack = java.util.Optional.ofNullable(container).flatMap(net.minecraftforge.fluids.FluidUtil::getFluidContained); @@ -76,7 +76,7 @@ } else if (p_150717_.m_6042_().f_63857_() && this.f_40687_.m_205067_(FluidTags.f_13131_)) { int i = p_150718_.m_123341_(); int j = p_150718_.m_123342_(); -@@ -120,7 +_,7 @@ +@@ -118,7 +_,7 @@ } return true; @@ -85,7 +85,7 @@ ((LiquidBlockContainer)block).m_7361_(p_150717_, p_150718_, blockstate, ((FlowingFluid)this.f_40687_).m_76068_(false)); this.m_7718_(p_150716_, p_150717_, p_150718_); return true; -@@ -140,8 +_,25 @@ +@@ -138,8 +_,25 @@ } protected void m_7718_(@Nullable Player p_40696_, LevelAccessor p_40697_, BlockPos p_40698_) { diff --git a/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch b/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch index c38cfa3e4f..af30b642bf 100644 --- a/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch +++ b/patches/minecraft/net/minecraft/world/item/CreativeModeTab.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/CreativeModeTab.java +++ b/net/minecraft/world/item/CreativeModeTab.java -@@ -29,14 +_,30 @@ +@@ -31,16 +_,40 @@ private Consumer> f_256965_; private final Supplier f_256912_; private final CreativeModeTab.DisplayItemsGenerator f_256824_; @@ -10,29 +10,41 @@ + private final net.minecraft.resources.ResourceLocation tabsImage; + private final int labelColor; + private final int slotColor; ++ public final List tabsBefore; ++ public final List tabsAfter; - CreativeModeTab(CreativeModeTab.Row p_260217_, int p_259557_, CreativeModeTab.Type p_260176_, Component p_260100_, Supplier p_259543_, CreativeModeTab.DisplayItemsGenerator p_259085_) { -+ CreativeModeTab(CreativeModeTab.Row p_260217_, int p_259557_, CreativeModeTab.Type p_260176_, Component p_260100_, Supplier p_259543_, CreativeModeTab.DisplayItemsGenerator p_259085_, net.minecraft.resources.ResourceLocation backgroundLocation, boolean hasSearchBar, int searchBarWidth, net.minecraft.resources.ResourceLocation tabsImage, int labelColor, int slotColor) { ++ CreativeModeTab(CreativeModeTab.Row p_260217_, int p_259557_, CreativeModeTab.Type p_260176_, Component p_260100_, Supplier p_259543_, CreativeModeTab.DisplayItemsGenerator p_259085_, net.minecraft.resources.ResourceLocation backgroundLocation, boolean hasSearchBar, int searchBarWidth, net.minecraft.resources.ResourceLocation tabsImage, int labelColor, int slotColor, List tabsBefore, List tabsAfter) { this.f_256931_ = p_260217_; this.f_256967_ = p_259557_; this.f_40764_ = p_260100_; this.f_256912_ = p_259543_; this.f_256824_ = p_259085_; this.f_256819_ = p_260176_; +- } +- + this.backgroundLocation = backgroundLocation; + this.hasSearchBar = hasSearchBar; + this.searchBarWidth = searchBarWidth; + this.tabsImage = tabsImage; + this.labelColor = labelColor; + this.slotColor = slotColor; ++ this.tabsBefore = List.copyOf(tabsBefore); ++ this.tabsAfter = List.copyOf(tabsAfter); + } + + protected CreativeModeTab(CreativeModeTab.Builder builder) { -+ this(builder.f_256796_, builder.f_256977_, builder.f_256847_, builder.f_256856_, builder.f_256981_, builder.f_256953_, builder.backgroundLocation, builder.hasSearchBar, builder.searchBarWidth, builder.tabsImage, builder.labelColor, builder.slotColor); - } - ++ this(builder.f_256796_, builder.f_256977_, builder.f_256847_, builder.f_256856_, builder.f_256981_, builder.f_256953_, builder.backgroundLocation, builder.hasSearchBar, builder.searchBarWidth, builder.tabsImage, builder.labelColor, builder.slotColor, builder.tabsBefore, builder.tabsAfter); ++ } ++ ++ public static CreativeModeTab.Builder builder() { ++ return new CreativeModeTab.Builder(Row.TOP, 0); ++ } ++ /** @deprecated Forge: use {@link #builder()} **/ @Deprecated public static CreativeModeTab.Builder m_257815_(CreativeModeTab.Row p_259342_, int p_260312_) { -@@ -55,6 +_,10 @@ + return new CreativeModeTab.Builder(p_259342_, p_260312_); + } +@@ -57,6 +_,10 @@ return this.f_40770_; } @@ -43,16 +55,16 @@ public String m_40788_() { return this.f_40766_; } -@@ -93,7 +_,7 @@ - - public void m_269498_(CreativeModeTab.ItemDisplayParameters p_270156_) { - CreativeModeTab.ItemDisplayBuilder creativemodetab$itemdisplaybuilder = new CreativeModeTab.ItemDisplayBuilder(this, p_270156_.f_268709_); +@@ -98,7 +_,7 @@ + ResourceKey resourcekey = BuiltInRegistries.f_279662_.m_7854_(this).orElseThrow(() -> { + return new IllegalStateException("Unregistered creative tab: " + this); + }); - this.f_256824_.m_257865_(p_270156_, creativemodetab$itemdisplaybuilder); -+ net.minecraftforge.client.ForgeHooksClient.onCreativeModeTabBuildContents(this, this.f_256824_, p_270156_, creativemodetab$itemdisplaybuilder); ++ net.minecraftforge.client.ForgeHooksClient.onCreativeModeTabBuildContents(this, resourcekey, this.f_256824_, p_270156_, creativemodetab$itemdisplaybuilder); this.f_243839_ = creativemodetab$itemdisplaybuilder.f_244363_; this.f_243841_ = creativemodetab$itemdisplaybuilder.f_244585_; this.m_257466_(); -@@ -122,9 +_,34 @@ +@@ -127,9 +_,34 @@ } @@ -87,7 +99,7 @@ private final CreativeModeTab.Row f_256796_; private final int f_256977_; private Component f_256856_ = Component.m_237119_(); -@@ -137,6 +_,14 @@ +@@ -142,6 +_,16 @@ private boolean f_256854_ = false; private CreativeModeTab.Type f_256847_ = CreativeModeTab.Type.CATEGORY; private String f_257036_ = "items.png"; @@ -99,10 +111,12 @@ + private int labelColor = 4210752; + private int slotColor = -2130706433; + private java.util.function.Function tabFactory = CreativeModeTab::new; ++ private final List tabsBefore = new java.util.ArrayList<>(); ++ private final List tabsAfter = new java.util.ArrayList<>(); public Builder(CreativeModeTab.Row p_259171_, int p_259661_) { this.f_256796_ = p_259171_; -@@ -175,11 +_,49 @@ +@@ -180,11 +_,95 @@ protected CreativeModeTab.Builder m_257623_(CreativeModeTab.Type p_259283_) { this.f_256847_ = p_259283_; @@ -116,11 +130,18 @@ + return withBackgroundLocation(new net.minecraft.resources.ResourceLocation("textures/gui/container/creative_inventory/tab_" + p_259981_)); + } + ++ /** ++ * Sets the location of the tab background. ++ */ + public CreativeModeTab.Builder withBackgroundLocation(net.minecraft.resources.ResourceLocation background) { + this.backgroundLocation = background; + return this; + } + ++ /** ++ * Gives this tab a search bar. ++ *

Note that, if using a custom {@link #withBackgroundLocation(net.minecraft.resources.ResourceLocation) background image}, you will need to make sure that your image contains the input box and the scroll bar.

++ */ + public CreativeModeTab.Builder withSearchBar() { + this.hasSearchBar = true; + if (this.backgroundLocation == null) @@ -128,21 +149,34 @@ + return this; + } + ++ /** ++ * Gives this tab a search bar, with a specific width. ++ * @param searchBarWidth the width of the search bar ++ */ + public CreativeModeTab.Builder withSearchBar(int searchBarWidth) { + this.searchBarWidth = searchBarWidth; + return withSearchBar(); + } + ++ /** ++ * Sets the image of the tab to a custom resource location, instead of an item's texture. ++ */ + public CreativeModeTab.Builder withTabsImage(net.minecraft.resources.ResourceLocation tabsImage) { + this.tabsImage = tabsImage; + return this; + } + ++ /** ++ * Sets the color of the tab label. ++ */ + public CreativeModeTab.Builder withLabelColor(int labelColor) { + this.labelColor = labelColor; + return this; + } + ++ /** ++ * Sets the color of tab's slots. ++ */ + public CreativeModeTab.Builder withSlotColor(int slotColor) { + this.slotColor = slotColor; + return this; @@ -150,10 +184,36 @@ + + public CreativeModeTab.Builder withTabFactory(java.util.function.Function tabFactory) { + this.tabFactory = tabFactory; ++ return this; ++ } ++ ++ /** Define tabs that should come before this tab. This tab will be placed after the {@code tabs}. **/ ++ public CreativeModeTab.Builder withTabsBefore(net.minecraft.resources.ResourceLocation... tabs) { ++ this.tabsBefore.addAll(List.of(tabs)); ++ return this; ++ } ++ ++ /** Define tabs that should come after this tab. This tab will be placed before the {@code tabs}.**/ ++ public CreativeModeTab.Builder withTabsAfter(net.minecraft.resources.ResourceLocation... tabs) { ++ this.tabsAfter.addAll(List.of(tabs)); ++ return this; ++ } ++ ++ /** Define tabs that should come before this tab. This tab will be placed after the {@code tabs}. **/ ++ @SafeVarargs ++ public final CreativeModeTab.Builder withTabsBefore(net.minecraft.resources.ResourceKey... tabs) { ++ java.util.stream.Stream.of(tabs).map(net.minecraft.resources.ResourceKey::m_135782_).forEach(this.tabsBefore::add); ++ return this; ++ } ++ ++ /** Define tabs that should come after this tab. This tab will be placed before the {@code tabs}.**/ ++ @SafeVarargs ++ public final CreativeModeTab.Builder withTabsAfter(net.minecraft.resources.ResourceKey... tabs) { ++ java.util.stream.Stream.of(tabs).map(net.minecraft.resources.ResourceKey::m_135782_).forEach(this.tabsAfter::add); return this; } -@@ -187,11 +_,12 @@ +@@ -192,11 +_,12 @@ if ((this.f_256847_ == CreativeModeTab.Type.HOTBAR || this.f_256847_ == CreativeModeTab.Type.INVENTORY) && this.f_256953_ != f_256756_) { throw new IllegalStateException("Special tabs can't have display items"); } else { diff --git a/patches/minecraft/net/minecraft/world/item/CreativeModeTabs.java.patch b/patches/minecraft/net/minecraft/world/item/CreativeModeTabs.java.patch index 2f84b2469d..e01be76956 100644 --- a/patches/minecraft/net/minecraft/world/item/CreativeModeTabs.java.patch +++ b/patches/minecraft/net/minecraft/world/item/CreativeModeTabs.java.patch @@ -1,39 +1,6 @@ --- a/net/minecraft/world/item/CreativeModeTabs.java +++ b/net/minecraft/world/item/CreativeModeTabs.java -@@ -1063,7 +_,7 @@ - }).m_257501_((p_270987_, p_261441_) -> { - Set set = ItemStackLinkedSet.m_261170_(); - -- for(CreativeModeTab creativemodetab : CreativeModeTabs.f_243931_) { -+ for(CreativeModeTab creativemodetab : CreativeModeTabs.m_257478_()) { - if (creativemodetab.m_257962_() != CreativeModeTab.Type.SEARCH) { - set.addAll(creativemodetab.m_261235_()); - } -@@ -1524,10 +_,14 @@ - private static final Comparator> f_268478_ = Comparator.comparing(Holder::m_203334_, Comparator.comparingInt((p_270004_) -> { - return p_270004_.m_218909_() * p_270004_.m_218908_(); - }).thenComparing(PaintingVariant::m_218908_)); -+ private static final List DEFAULT_TABS = com.google.common.collect.ImmutableList.of(f_256917_, f_256750_, f_256837_, f_257039_); - @Nullable - private static CreativeModeTab.ItemDisplayParameters f_268496_; -+ private static final List FORGE_TABS_VIEW = net.minecraftforge.common.util.ConcatenatedListView.of(net.minecraftforge.common.CreativeModeTabRegistry.getSortedCreativeModeTabs(), DEFAULT_TABS); - - private static List m_257615_(CreativeModeTab... p_259856_) { -+ if (true) -+ return List.of(p_259856_); // Forge: We do not validate vanilla tabs here, we have our own mechanism for that. This should only be invoked when the field TABS is initialized, whose use-cases are patched out. - Map, String> map = new HashMap<>(); - - for(CreativeModeTab creativemodetab : p_259856_) { -@@ -1542,7 +_,7 @@ - } - - public static CreativeModeTab m_257543_() { -- return f_256788_; -+ return net.minecraftforge.common.CreativeModeTabRegistry.getSortedCreativeModeTabs().stream().filter(CreativeModeTab::m_257497_).findFirst().orElse(f_256788_); - } - - private static void m_269246_(CreativeModeTab.Output p_270129_, HolderLookup p_270334_, Item p_270968_, CreativeModeTab.TabVisibility p_270778_) { -@@ -1557,7 +_,7 @@ +@@ -1612,7 +_,7 @@ private static void m_269182_(CreativeModeTab.Output p_270868_, HolderLookup p_270903_, Set p_270380_, CreativeModeTab.TabVisibility p_270407_) { p_270903_.m_214062_().map(Holder::m_203334_).filter((p_270008_) -> { @@ -42,7 +9,7 @@ }).map((p_270038_) -> { return EnchantedBookItem.m_41161_(new EnchantmentInstance(p_270038_, p_270038_.m_6586_())); }).forEach((p_269989_) -> { -@@ -1567,7 +_,7 @@ +@@ -1622,7 +_,7 @@ private static void m_269335_(CreativeModeTab.Output p_270961_, HolderLookup p_270628_, Set p_271024_, CreativeModeTab.TabVisibility p_270805_) { p_270628_.m_214062_().map(Holder::m_203334_).filter((p_269991_) -> { @@ -51,42 +18,3 @@ }).flatMap((p_270024_) -> { return IntStream.rangeClosed(p_270024_.m_44702_(), p_270024_.m_6586_()).mapToObj((p_270006_) -> { return EnchantedBookItem.m_41161_(new EnchantmentInstance(p_270024_, p_270006_)); -@@ -1619,11 +_,11 @@ - } - - public static List m_257388_() { -- return f_243931_.stream().filter(CreativeModeTab::m_257497_).toList(); -+ return FORGE_TABS_VIEW.stream().filter(CreativeModeTab::m_257497_).toList(); - } - - public static List m_257478_() { -- return f_243931_; -+ return FORGE_TABS_VIEW; - } - - public static CreativeModeTab m_258007_() { -@@ -1631,12 +_,12 @@ - } - - private static void m_269421_(CreativeModeTab.ItemDisplayParameters p_270447_) { -- f_243931_.stream().filter((p_259647_) -> { -+ m_257478_().stream().filter((p_259647_) -> { - return p_259647_.m_257962_() == CreativeModeTab.Type.CATEGORY; - }).forEach((p_269997_) -> { - p_269997_.m_269498_(p_270447_); - }); -- f_243931_.stream().filter((p_260124_) -> { -+ m_257478_().stream().filter((p_260124_) -> { - return p_260124_.m_257962_() != CreativeModeTab.Type.CATEGORY; - }).forEach((p_270002_) -> { - p_270002_.m_269498_(p_270447_); -@@ -1651,5 +_,9 @@ - m_269421_(f_268496_); - return true; - } -+ } -+ -+ public static List defaultTabs() { -+ return DEFAULT_TABS; - } - } diff --git a/patches/minecraft/net/minecraft/world/item/CrossbowItem.java.patch b/patches/minecraft/net/minecraft/world/item/CrossbowItem.java.patch index 775c70cfce..8344f232cd 100644 --- a/patches/minecraft/net/minecraft/world/item/CrossbowItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/CrossbowItem.java.patch @@ -4,15 +4,7 @@ } public static void m_40887_(Level p_40888_, LivingEntity p_40889_, InteractionHand p_40890_, ItemStack p_40891_, float p_40892_, float p_40893_) { -+ if (p_40889_ instanceof Player player && net.minecraftforge.event.ForgeEventFactory.onArrowLoose(p_40891_, p_40889_.f_19853_, player, 1, true) < 0) return; ++ if (p_40889_ instanceof Player player && net.minecraftforge.event.ForgeEventFactory.onArrowLoose(p_40891_, p_40889_.m_9236_(), player, 1, true) < 0) return; List list = m_40941_(p_40891_); float[] afloat = m_220023_(p_40889_.m_217043_()); -@@ -304,6 +_,7 @@ - p_40910_.m_6263_((Player)null, p_40911_.m_20185_(), p_40911_.m_20186_(), p_40911_.m_20189_(), soundevent1, SoundSource.PLAYERS, 0.5F, 1.0F); - } - } -+ super.m_5929_(p_40910_, p_40911_, p_40912_, p_40913_); //TODO: Remove in 1.20, this is only here to trigger Forge's old onUseingTick method - - } - diff --git a/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch b/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch index 5a26be0c10..6d0893ca4b 100644 --- a/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch +++ b/patches/minecraft/net/minecraft/world/item/DyeColor.java.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/world/item/DyeColor.java +++ b/net/minecraft/world/item/DyeColor.java @@ -40,6 +_,7 @@ - private final MaterialColor f_41036_; + private final MapColor f_283766_; private final float[] f_41039_; private final int f_41040_; + private final net.minecraft.tags.TagKey tag; private final int f_41041_; - private DyeColor(int p_41046_, String p_41047_, int p_41048_, MaterialColor p_41049_, int p_41050_, int p_41051_) { + private DyeColor(int p_41046_, String p_41047_, int p_41048_, MapColor p_285297_, int p_41050_, int p_41051_) { @@ -50,6 +_,7 @@ int i = (p_41048_ & 16711680) >> 16; int j = (p_41048_ & '\uff00') >> 8; diff --git a/patches/minecraft/net/minecraft/world/item/ElytraItem.java.patch b/patches/minecraft/net/minecraft/world/item/ElytraItem.java.patch index 4950d40030..b9c94ba474 100644 --- a/patches/minecraft/net/minecraft/world/item/ElytraItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ElytraItem.java.patch @@ -11,7 +11,7 @@ + + @Override + public boolean elytraFlightTick(ItemStack stack, net.minecraft.world.entity.LivingEntity entity, int flightTicks) { -+ if (!entity.f_19853_.f_46443_) { ++ if (!entity.m_9236_().f_46443_) { + int nextFlightTick = flightTicks + 1; + if (nextFlightTick % 10 == 0) { + if (nextFlightTick % 20 == 0) { diff --git a/patches/minecraft/net/minecraft/world/item/Item.java.patch b/patches/minecraft/net/minecraft/world/item/Item.java.patch index 15fa5f1e89..cc89b21953 100644 --- a/patches/minecraft/net/minecraft/world/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/world/item/Item.java.patch @@ -22,11 +22,8 @@ } /** @deprecated */ -@@ -109,8 +_,11 @@ - } - +@@ -111,6 +_,8 @@ public void m_5929_(Level p_41428_, LivingEntity p_41429_, ItemStack p_41430_, int p_41431_) { -+ p_41430_.onUsingTick(p_41429_, p_41431_); } + /** @deprecated Forge: {@link net.minecraftforge.common.extensions.IForgeItem#onDestroyed(ItemEntity, DamageSource) Use damage source sensitive version} */ diff --git a/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch index cf2346cd2f..cd8605e719 100644 --- a/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ItemStack.java.patch @@ -1,45 +1,49 @@ --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -74,7 +_,7 @@ +@@ -75,12 +_,16 @@ import net.minecraft.world.level.block.state.pattern.BlockInWorld; import org.slf4j.Logger; -public final class ItemStack { +public final class ItemStack extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeItemStack { public static final Codec f_41582_ = RecordCodecBuilder.create((p_258963_) -> { - return p_258963_.group(BuiltInRegistries.f_257033_.m_194605_().fieldOf("id").forGetter((p_150946_) -> { - return p_150946_.f_41589_; -@@ -84,6 +_,9 @@ - return Optional.ofNullable(p_150939_.f_41590_); + return p_258963_.group(BuiltInRegistries.f_257033_.m_194605_().fieldOf("id").forGetter(ItemStack::m_41720_), Codec.INT.fieldOf("Count").forGetter(ItemStack::m_41613_), CompoundTag.f_128325_.optionalFieldOf("tag").forGetter((p_281115_) -> { + return Optional.ofNullable(p_281115_.m_41783_()); })).apply(p_258963_, ItemStack::new); }); ++ @org.jetbrains.annotations.Nullable + private final net.minecraft.core.Holder.Reference delegate; + private CompoundTag capNBT; + private static final Logger f_41585_ = LogUtils.getLogger(); - public static final ItemStack f_41583_ = new ItemStack((Item)null); + public static final ItemStack f_41583_ = new ItemStack((Void)null); public static final DecimalFormat f_41584_ = Util.m_137469_(new DecimalFormat("#.##"), (p_41704_) -> { -@@ -139,10 +_,15 @@ +@@ -136,28 +_,40 @@ this(p_220155_.m_203334_(), p_220156_); } - public ItemStack(ItemLike p_41601_, int p_41602_) { -- this.f_41589_ = p_41601_ == null ? null : p_41601_.m_5456_(); +- this.f_41589_ = p_41601_.m_5456_(); - this.f_41587_ = p_41602_; -- if (this.f_41589_ != null && this.f_41589_.m_41465_()) { +- if (this.f_41589_.m_41465_()) { + public ItemStack(ItemLike p_41601_, int p_41602_) { this(p_41601_, p_41602_, (CompoundTag) null); } + public ItemStack(ItemLike p_41604_, int p_41605_, @Nullable CompoundTag p_41606_) { + super(ItemStack.class, true); + this.capNBT = p_41606_; -+ this.f_41589_ = p_41604_ == null ? null : p_41604_.m_5456_(); -+ this.delegate = p_41604_ == null ? null : net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(p_41604_.m_5456_()); ++ this.f_41589_ = p_41604_.m_5456_(); ++ this.delegate = net.minecraftforge.registries.ForgeRegistries.ITEMS.getDelegateOrThrow(p_41604_.m_5456_()); + this.f_41587_ = p_41605_; + this.forgeInit(); -+ if (this.f_41589_ != null && this.f_41589_.isDamageable(this)) { ++ if (this.f_41589_.isDamageable(this)) { this.m_41721_(this.m_41773_()); } -@@ -155,14 +_,19 @@ + } + + private ItemStack(@Nullable Void p_282703_) { ++ super(ItemStack.class, true); + this.f_41589_ = null; ++ this.delegate = null; } private ItemStack(CompoundTag p_41608_) { @@ -60,16 +64,25 @@ this.m_41721_(this.m_41773_()); } -@@ -201,7 +_,7 @@ +@@ -173,7 +_,7 @@ + } + + public boolean m_41619_() { +- return this == f_41583_ || this.f_41589_ == Items.f_41852_ || this.f_41587_ <= 0; ++ return this == f_41583_ || this.f_41587_ <= 0 || this.delegate.get() == Items.f_41852_; + } + + public boolean m_246617_(FeatureFlagSet p_250869_) { +@@ -198,7 +_,7 @@ } public Item m_41720_() { -- return this.f_41591_ ? Items.f_41852_ : this.f_41589_; -+ return this.f_41591_ || this.delegate == null ? Items.f_41852_ : this.delegate.get(); +- return this.m_41619_() ? Items.f_41852_ : this.f_41589_; ++ return this.m_41619_() ? Items.f_41852_ : this.delegate.get(); } public Holder m_220173_() { -@@ -229,6 +_,15 @@ +@@ -226,6 +_,15 @@ } public InteractionResult m_41661_(UseOnContext p_41662_) { @@ -85,7 +98,7 @@ Player player = p_41662_.m_43723_(); BlockPos blockpos = p_41662_.m_8083_(); BlockInWorld blockinworld = new BlockInWorld(p_41662_.m_43725_(), blockpos, false); -@@ -236,7 +_,7 @@ +@@ -233,7 +_,7 @@ return InteractionResult.PASS; } else { Item item = this.m_41720_(); @@ -94,7 +107,7 @@ if (player != null && interactionresult.m_146666_()) { player.m_36246_(Stats.f_12982_.m_12902_(item)); } -@@ -265,11 +_,15 @@ +@@ -262,11 +_,15 @@ p_41740_.m_128365_("tag", this.f_41590_.m_6426_()); } @@ -111,16 +124,16 @@ } public boolean m_41753_() { -@@ -277,7 +_,7 @@ +@@ -274,7 +_,7 @@ } public boolean m_41763_() { -- if (!this.f_41591_ && this.m_41720_().m_41462_() > 0) { -+ if (!this.f_41591_ && this.m_41720_().isDamageable(this)) { +- if (!this.m_41619_() && this.m_41720_().m_41462_() > 0) { ++ if (!this.m_41619_() && this.m_41720_().isDamageable(this)) { CompoundTag compoundtag = this.m_41783_(); return compoundtag == null || !compoundtag.m_128471_("Unbreakable"); } else { -@@ -286,19 +_,19 @@ +@@ -283,19 +_,19 @@ } public boolean m_41768_() { @@ -144,15 +157,15 @@ } public boolean m_220157_(int p_220158_, RandomSource p_220159_, @Nullable ServerPlayer p_220160_) { -@@ -334,6 +_,7 @@ +@@ -331,6 +_,7 @@ public void m_41622_(int p_41623_, T p_41624_, Consumer p_41625_) { - if (!p_41624_.f_19853_.f_46443_ && (!(p_41624_ instanceof Player) || !((Player)p_41624_).m_150110_().f_35937_)) { + if (!p_41624_.m_9236_().f_46443_ && (!(p_41624_ instanceof Player) || !((Player)p_41624_).m_150110_().f_35937_)) { if (this.m_41763_()) { + p_41623_ = this.m_41720_().damageItem(this, p_41623_, p_41624_, p_41625_); if (this.m_220157_(p_41623_, p_41624_.m_217043_(), p_41624_ instanceof ServerPlayer ? (ServerPlayer)p_41624_ : null)) { p_41625_.accept(p_41624_); Item item = this.m_41720_(); -@@ -386,7 +_,7 @@ +@@ -383,7 +_,7 @@ } public boolean m_41735_(BlockState p_41736_) { @@ -161,7 +174,7 @@ } public InteractionResult m_41647_(Player p_41648_, LivingEntity p_41649_, InteractionHand p_41650_) { -@@ -397,7 +_,7 @@ +@@ -394,7 +_,7 @@ if (this.m_41619_()) { return f_41583_; } else { @@ -170,25 +183,16 @@ itemstack.m_41754_(this.m_41612_()); if (this.f_41590_ != null) { itemstack.f_41590_ = this.f_41590_.m_6426_(); -@@ -420,7 +_,7 @@ - if (p_41659_.f_41590_ == null && p_41660_.f_41590_ != null) { - return false; - } else { -- return p_41659_.f_41590_ == null || p_41659_.f_41590_.equals(p_41660_.f_41590_); -+ return (p_41659_.f_41590_ == null || p_41659_.f_41590_.equals(p_41660_.f_41590_)) && p_41659_.areCapsCompatible(p_41660_); - } - } else { - return false; -@@ -443,7 +_,7 @@ - } else if (this.f_41590_ == null && p_41745_.f_41590_ != null) { +@@ -430,7 +_,7 @@ + if (!p_150943_.m_150930_(p_150944_.m_41720_())) { return false; } else { -- return this.f_41590_ == null || this.f_41590_.equals(p_41745_.f_41590_); -+ return (this.f_41590_ == null || this.f_41590_.equals(p_41745_.f_41590_)) && this.areCapsCompatible(p_41745_); +- return p_150943_.m_41619_() && p_150944_.m_41619_() ? true : Objects.equals(p_150943_.f_41590_, p_150944_.f_41590_); ++ return p_150943_.m_41619_() && p_150944_.m_41619_() ? true : Objects.equals(p_150943_.f_41590_, p_150944_.f_41590_) && p_150943_.areCapsCompatible(p_150944_); } } -@@ -551,7 +_,7 @@ +@@ -522,7 +_,7 @@ public void m_41751_(@Nullable CompoundTag p_41752_) { this.f_41590_ = p_41752_; @@ -197,7 +201,7 @@ this.m_41721_(this.m_41773_()); } -@@ -612,7 +_,7 @@ +@@ -583,7 +_,7 @@ public List m_41651_(@Nullable Player p_41652_, TooltipFlag p_41653_) { List list = Lists.newArrayList(); @@ -206,7 +210,7 @@ if (this.m_41788_()) { mutablecomponent.m_130940_(ChatFormatting.ITALIC); } -@@ -759,6 +_,7 @@ +@@ -730,6 +_,7 @@ list.add(f_243862_); } @@ -214,7 +218,7 @@ return list; } -@@ -767,7 +_,7 @@ +@@ -738,7 +_,7 @@ } private int m_41618_() { @@ -223,7 +227,7 @@ } public void m_41654_(ItemStack.TooltipPart p_41655_) { -@@ -882,9 +_,10 @@ +@@ -853,9 +_,10 @@ } } } else { @@ -235,20 +239,20 @@ return multimap; } -@@ -912,7 +_,7 @@ +@@ -883,7 +_,7 @@ MutableComponent mutablecomponent1 = ComponentUtils.m_130748_(mutablecomponent); - if (!this.f_41591_) { + if (!this.m_41619_()) { - mutablecomponent1.m_130940_(this.m_41791_().f_43022_).m_130938_((p_220170_) -> { + mutablecomponent1.m_130938_(this.m_41791_().getStyleModifier()).m_130938_((p_220170_) -> { return p_220170_.m_131144_(new HoverEvent(HoverEvent.Action.f_130832_, new HoverEvent.ItemStackInfo(this))); }); } -@@ -965,12 +_,31 @@ +@@ -935,12 +_,31 @@ this.m_41720_().m_5929_(p_41732_, p_41733_, this, p_41734_); } -+ /** @deprecated Forge: {@link net.minecraftforge.common.extensions.IForgeItemStack#onDestroyed(ItemEntity, DamageSource) Use damage source sensitive version} */ ++ /** @deprecated Forge: Use {@linkplain net.minecraftforge.common.extensions.IForgeItemStack#onDestroyed(ItemEntity, net.minecraft.world.damagesource.DamageSource) damage source sensitive version} */ + @Deprecated public void m_150924_(ItemEntity p_150925_) { this.m_41720_().m_142023_(p_150925_); diff --git a/patches/minecraft/net/minecraft/world/item/Items.java.patch b/patches/minecraft/net/minecraft/world/item/Items.java.patch index 91adca6647..cc781b65a0 100644 --- a/patches/minecraft/net/minecraft/world/item/Items.java.patch +++ b/patches/minecraft/net/minecraft/world/item/Items.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/world/item/Items.java +++ b/net/minecraft/world/item/Items.java -@@ -1252,11 +_,23 @@ +@@ -1279,11 +_,23 @@ } - private static Item m_245048_(Block p_252092_, Block... p_248886_) { + public static Item m_245048_(Block p_252092_, Block... p_248886_) { - BlockItem blockitem = new BlockItem(p_252092_, new Item.Properties()); + BlockItem blockitem = new BlockItem(p_252092_, new Item.Properties()) { + @Override diff --git a/patches/minecraft/net/minecraft/world/item/ShearsItem.java.patch b/patches/minecraft/net/minecraft/world/item/ShearsItem.java.patch index c6187a45cf..12e1b525e0 100644 --- a/patches/minecraft/net/minecraft/world/item/ShearsItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/ShearsItem.java.patch @@ -7,10 +7,10 @@ + @Override + public net.minecraft.world.InteractionResult m_6880_(ItemStack stack, net.minecraft.world.entity.player.Player playerIn, LivingEntity entity, net.minecraft.world.InteractionHand hand) { + if (entity instanceof net.minecraftforge.common.IForgeShearable target) { -+ if (entity.f_19853_.f_46443_) return net.minecraft.world.InteractionResult.SUCCESS; ++ if (entity.m_9236_().f_46443_) return net.minecraft.world.InteractionResult.SUCCESS; + BlockPos pos = BlockPos.m_274446_(entity.m_20182_()); -+ if (target.isShearable(stack, entity.f_19853_, pos)) { -+ java.util.List drops = target.onSheared(playerIn, stack, entity.f_19853_, pos, ++ if (target.isShearable(stack, entity.m_9236_(), pos)) { ++ java.util.List drops = target.onSheared(playerIn, stack, entity.m_9236_(), pos, + net.minecraft.world.item.enchantment.EnchantmentHelper.m_44843_(net.minecraft.world.item.enchantment.Enchantments.f_44987_, stack)); + java.util.Random rand = new java.util.Random(); + drops.forEach(d -> { diff --git a/patches/minecraft/net/minecraft/world/item/SpawnEggItem.java.patch b/patches/minecraft/net/minecraft/world/item/SpawnEggItem.java.patch index d65d126dc7..3c1b83c719 100644 --- a/patches/minecraft/net/minecraft/world/item/SpawnEggItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/SpawnEggItem.java.patch @@ -15,7 +15,7 @@ f_43201_.put(p_43207_, this); } -@@ -128,6 +_,8 @@ +@@ -127,6 +_,8 @@ return p_43212_ == 0 ? this.f_151200_ : this.f_151201_; } @@ -24,7 +24,7 @@ @Nullable public static SpawnEggItem m_43213_(@Nullable EntityType p_43214_) { return f_43201_.get(p_43214_); -@@ -141,15 +_,15 @@ +@@ -140,15 +_,15 @@ if (p_43229_ != null && p_43229_.m_128425_("EntityTag", 10)) { CompoundTag compoundtag = p_43229_.m_128469_("EntityTag"); if (compoundtag.m_128425_("id", 8)) { @@ -43,7 +43,7 @@ } public Optional m_43215_(Player p_43216_, Mob p_43217_, EntityType p_43218_, ServerLevel p_43219_, Vec3 p_43220_, ItemStack p_43221_) { -@@ -184,5 +_,9 @@ +@@ -183,5 +_,9 @@ } } } diff --git a/patches/minecraft/net/minecraft/world/item/SwordItem.java.patch b/patches/minecraft/net/minecraft/world/item/SwordItem.java.patch index 49174e79cf..62282c6d5f 100644 --- a/patches/minecraft/net/minecraft/world/item/SwordItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/SwordItem.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/SwordItem.java +++ b/net/minecraft/world/item/SwordItem.java -@@ -69,4 +_,9 @@ +@@ -67,4 +_,9 @@ public Multimap m_7167_(EquipmentSlot p_43274_) { return p_43274_ == EquipmentSlot.MAINHAND ? this.f_43267_ : super.m_7167_(p_43274_); } diff --git a/patches/minecraft/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch index 3e46b76332..06f8621a46 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java +++ b/net/minecraft/world/item/crafting/BannerDuplicateRecipe.java -@@ -82,8 +_,8 @@ +@@ -80,8 +_,8 @@ for(int i = 0; i < nonnulllist.size(); ++i) { ItemStack itemstack = p_43791_.m_8020_(i); if (!itemstack.m_41619_()) { @@ -9,5 +9,5 @@ + if (itemstack.hasCraftingRemainingItem()) { + nonnulllist.set(i, itemstack.getCraftingRemainingItem()); } else if (itemstack.m_41782_() && BannerBlockEntity.m_58504_(itemstack) > 0) { - ItemStack itemstack1 = itemstack.m_41777_(); - itemstack1.m_41764_(1); + nonnulllist.set(i, itemstack.m_255036_(1)); + } diff --git a/patches/minecraft/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch index c1ffeaea66..ececeab5ad 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/BookCloningRecipe.java.patch @@ -9,5 +9,5 @@ + if (itemstack.hasCraftingRemainingItem()) { + nonnulllist.set(i, itemstack.getCraftingRemainingItem()); } else if (itemstack.m_41720_() instanceof WrittenBookItem) { - ItemStack itemstack1 = itemstack.m_41777_(); - itemstack1.m_41764_(1); + nonnulllist.set(i, itemstack.m_255036_(1)); + break; diff --git a/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch index 50cff6945c..9b5c7138b8 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/Ingredient.java.patch @@ -80,7 +80,7 @@ public static Ingredient m_43938_(Stream p_43939_) { Ingredient ingredient = new Ingredient(p_43939_); return ingredient.m_43947_() ? f_43901_ : ingredient; -@@ -136,11 +_,15 @@ +@@ -136,7 +_,9 @@ } public static Ingredient m_43940_(FriendlyByteBuf p_43941_) { @@ -91,13 +91,16 @@ } public static Ingredient m_43917_(@Nullable JsonElement p_43918_) { - if (p_43918_ != null && !p_43918_.isJsonNull()) { -+ Ingredient ret = net.minecraftforge.common.crafting.CraftingHelper.getIngredient(p_43918_); +@@ -145,6 +_,8 @@ + + public static Ingredient m_288218_(@Nullable JsonElement p_289022_, boolean p_288974_) { + if (p_289022_ != null && !p_289022_.isJsonNull()) { ++ Ingredient ret = net.minecraftforge.common.crafting.CraftingHelper.getIngredient(p_289022_, p_288974_); + if (ret != null) return ret; - if (p_43918_.isJsonObject()) { - return m_43938_(Stream.of(m_43919_(p_43918_.getAsJsonObject()))); - } else if (p_43918_.isJsonArray()) { -@@ -175,6 +_,12 @@ + if (p_289022_.isJsonObject()) { + return m_43938_(Stream.of(m_43919_(p_289022_.getAsJsonObject()))); + } else if (p_289022_.isJsonArray()) { +@@ -179,6 +_,12 @@ } } @@ -110,7 +113,7 @@ public static class ItemValue implements Ingredient.Value { private final ItemStack f_43951_; -@@ -207,6 +_,9 @@ +@@ -211,6 +_,9 @@ list.add(new ItemStack(holder)); } diff --git a/patches/minecraft/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java.patch deleted file mode 100644 index 3c70ba118d..0000000000 --- a/patches/minecraft/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java -+++ b/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java -@@ -72,7 +_,7 @@ - - public boolean m_142505_() { - return Stream.of(this.f_265911_, this.f_265910_).anyMatch((p_267290_) -> { -- return p_267290_.m_43908_().length == 0; -+ return net.minecraftforge.common.ForgeHooks.hasNoElements(p_267290_); - }); - } - diff --git a/patches/minecraft/net/minecraft/world/item/crafting/RecipeSerializer.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/RecipeSerializer.java.patch index 00db70dd3b..31b3244f62 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/RecipeSerializer.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/RecipeSerializer.java.patch @@ -9,11 +9,11 @@ RecipeSerializer f_44076_ = m_44098_("crafting_shaped", new ShapedRecipe.Serializer()); RecipeSerializer f_44077_ = m_44098_("crafting_shapeless", new ShapelessRecipe.Serializer()); RecipeSerializer f_44078_ = m_44098_("crafting_special_armordye", new SimpleCraftingRecipeSerializer<>(ArmorDyeRecipe::new)); -@@ -32,8 +_,10 @@ +@@ -31,8 +_,10 @@ RecipeSerializer f_265968_ = m_44098_("smithing_trim", new SmithingTrimRecipe.Serializer()); RecipeSerializer f_271437_ = m_44098_("crafting_decorated_pot", new SimpleCraftingRecipeSerializer<>(DecoratedPotRecipe::new)); -+ //Forge: use fromJson with IContext if you need the context ++ // Forge: use fromJson with IContext if you need the context T m_6729_(ResourceLocation p_44103_, JsonObject p_44104_); + @org.jetbrains.annotations.Nullable diff --git a/patches/minecraft/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch index 8b806e91b5..8b6e94c6ca 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/ShapelessRecipe.java.patch @@ -59,7 +59,7 @@ @@ -96,7 +_,7 @@ for(int i = 0; i < p_44276_.size(); ++i) { - Ingredient ingredient = Ingredient.m_43917_(p_44276_.get(i)); + Ingredient ingredient = Ingredient.m_288218_(p_44276_.get(i), false); - if (!ingredient.m_43947_()) { + if (true || !ingredient.m_43947_()) { // FORGE: Skip checking if an ingredient is empty during shapeless recipe deserialization to prevent complex ingredients from caching tags too early. Can not be done using a config value due to sync issues. nonnulllist.add(ingredient); diff --git a/patches/minecraft/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch index 39a41ee075..d5d6a23fdd 100644 --- a/patches/minecraft/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch +++ b/patches/minecraft/net/minecraft/world/item/crafting/SimpleCookingSerializer.java.patch @@ -3,7 +3,7 @@ @@ -22,11 +_,17 @@ CookingBookCategory cookingbookcategory = CookingBookCategory.f_244271_.m_262792_(GsonHelper.m_13851_(p_44348_, "category", (String)null), CookingBookCategory.MISC); JsonElement jsonelement = (JsonElement)(GsonHelper.m_13885_(p_44348_, "ingredient") ? GsonHelper.m_13933_(p_44348_, "ingredient") : GsonHelper.m_13930_(p_44348_, "ingredient")); - Ingredient ingredient = Ingredient.m_43917_(jsonelement); + Ingredient ingredient = Ingredient.m_288218_(jsonelement, false); + //Forge: Check if primitive string to keep vanilla or a object which can contain a count field. + if (!p_44348_.has("result")) throw new com.google.gson.JsonSyntaxException("Missing result, expected to find a string or object"); + ItemStack itemstack; diff --git a/patches/minecraft/net/minecraft/world/item/crafting/SmithingTransformRecipe.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/SmithingTransformRecipe.java.patch new file mode 100644 index 0000000000..767aff5a9a --- /dev/null +++ b/patches/minecraft/net/minecraft/world/item/crafting/SmithingTransformRecipe.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/item/crafting/SmithingTransformRecipe.java ++++ b/net/minecraft/world/item/crafting/SmithingTransformRecipe.java +@@ -65,7 +_,7 @@ + } + + public boolean m_142505_() { +- return Stream.of(this.f_265949_, this.f_265888_, this.f_265907_).anyMatch(Ingredient::m_43947_); ++ return Stream.of(this.f_265949_, this.f_265888_, this.f_265907_).anyMatch(net.minecraftforge.common.ForgeHooks::hasNoElements); + } + + public static class Serializer implements RecipeSerializer { diff --git a/patches/minecraft/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch b/patches/minecraft/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch new file mode 100644 index 0000000000..4af798fd99 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/item/crafting/SmithingTrimRecipe.java ++++ b/net/minecraft/world/item/crafting/SmithingTrimRecipe.java +@@ -94,7 +_,7 @@ + } + + public boolean m_142505_() { +- return Stream.of(this.f_265958_, this.f_266040_, this.f_266053_).anyMatch(Ingredient::m_43947_); ++ return Stream.of(this.f_265958_, this.f_266040_, this.f_266053_).anyMatch(net.minecraftforge.common.ForgeHooks::hasNoElements); + } + + public static class Serializer implements RecipeSerializer { diff --git a/patches/minecraft/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch b/patches/minecraft/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch index 9de9496610..a356d2b6a1 100644 --- a/patches/minecraft/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch +++ b/patches/minecraft/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java.patch @@ -1,12 +1,11 @@ --- a/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java +++ b/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java -@@ -44,7 +_,8 @@ +@@ -43,7 +_,7 @@ BlockState blockstate1 = p_45020_.m_8055_(blockpos$mutableblockpos); if (blockstate1.m_60795_()) { BlockState blockstate2 = p_45020_.m_8055_(blockpos); -- if (blockstate2.m_60767_() == Material.f_76305_ && blockstate2.m_61143_(LiquidBlock.f_54688_) == 0 && blockstate.m_60710_(p_45020_, blockpos) && p_45020_.m_45752_(blockstate, blockpos, CollisionContext.m_82749_())) { -+ boolean isFull = blockstate2.m_60734_() == Blocks.f_49990_ && blockstate2.m_61143_(LiquidBlock.f_54688_) == 0; //TODO: Forge, modded waters? -+ if (blockstate2.m_60767_() == Material.f_76305_ && isFull && blockstate.m_60710_(p_45020_, blockpos) && p_45020_.m_45752_(blockstate, blockpos, CollisionContext.m_82749_()) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(p_45019_, net.minecraftforge.common.util.BlockSnapshot.create(p_45020_.m_46472_(), p_45020_, blockpos), net.minecraft.core.Direction.UP)) { +- if (blockstate2 == FrostedIceBlock.m_278844_() && blockstate.m_60710_(p_45020_, blockpos) && p_45020_.m_45752_(blockstate, blockpos, CollisionContext.m_82749_())) { ++ if (blockstate2 == FrostedIceBlock.m_278844_() && blockstate.m_60710_(p_45020_, blockpos) && p_45020_.m_45752_(blockstate, blockpos, CollisionContext.m_82749_()) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(p_45019_, net.minecraftforge.common.util.BlockSnapshot.create(p_45020_.m_46472_(), p_45020_, blockpos), net.minecraft.core.Direction.UP)) { p_45020_.m_46597_(blockpos, blockstate); p_45020_.m_186460_(blockpos, Blocks.f_50449_, Mth.m_216271_(p_45019_.m_217043_(), 60, 120)); } diff --git a/patches/minecraft/net/minecraft/world/item/trading/MerchantOffer.java.patch b/patches/minecraft/net/minecraft/world/item/trading/MerchantOffer.java.patch index 64e78ca2cb..0d653da167 100644 --- a/patches/minecraft/net/minecraft/world/item/trading/MerchantOffer.java.patch +++ b/patches/minecraft/net/minecraft/world/item/trading/MerchantOffer.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/item/trading/MerchantOffer.java +++ b/net/minecraft/world/item/trading/MerchantOffer.java -@@ -75,7 +_,7 @@ - int i = this.f_45310_.m_41613_(); - ItemStack itemstack = this.f_45310_.m_41777_(); - int j = Math.max(0, Mth.m_14143_((float)(i * this.f_45317_) * this.f_45318_)); -- itemstack.m_41764_(Mth.m_14045_(i + j + this.f_45316_, 1, this.f_45310_.m_41720_().m_41459_())); -+ itemstack.m_41764_(Mth.m_14045_(i + j + this.f_45316_, 1, this.f_45310_.m_41741_())); - return itemstack; +@@ -77,7 +_,7 @@ + } else { + int i = this.f_45310_.m_41613_(); + int j = Math.max(0, Mth.m_14143_((float)(i * this.f_45317_) * this.f_45318_)); +- return this.f_45310_.m_255036_(Mth.m_14045_(i + j + this.f_45316_, 1, this.f_45310_.m_41720_().m_41459_())); ++ return this.f_45310_.m_255036_(Mth.m_14045_(i + j + this.f_45316_, 1, this.f_45310_.m_41741_())); + } } -@@ -179,7 +_,7 @@ +@@ -181,7 +_,7 @@ return true; } else { ItemStack itemstack = p_45366_.m_41777_(); diff --git a/patches/minecraft/net/minecraft/world/level/Level.java.patch b/patches/minecraft/net/minecraft/world/level/Level.java.patch index 45fa364f39..4eeb72f468 100644 --- a/patches/minecraft/net/minecraft/world/level/Level.java.patch +++ b/patches/minecraft/net/minecraft/world/level/Level.java.patch @@ -9,7 +9,7 @@ public static final Codec> f_46427_ = ResourceKey.m_195966_(Registries.f_256858_); public static final ResourceKey f_46428_ = ResourceKey.m_135785_(Registries.f_256858_, new ResourceLocation("overworld")); public static final ResourceKey f_46429_ = ResourceKey.m_135785_(Registries.f_256858_, new ResourceLocation("the_nether")); -@@ -111,8 +_,14 @@ +@@ -110,8 +_,14 @@ private final RegistryAccess f_268710_; private final DamageSources f_268497_; private long f_186455_; @@ -24,7 +24,7 @@ this.f_46446_ = p_270692_; this.f_46442_ = p_270739_; this.f_204147_ = p_270240_; -@@ -199,17 +_,45 @@ +@@ -198,11 +_,40 @@ } else { LevelChunk levelchunk = this.m_46745_(p_46605_); Block block = p_46606_.m_60734_(); @@ -46,13 +46,7 @@ return false; } else { BlockState blockstate1 = this.m_8055_(p_46605_); -- if ((p_46607_ & 128) == 0 && blockstate1 != blockstate && (blockstate1.m_60739_(this, p_46605_) != blockstate.m_60739_(this, p_46605_) || blockstate1.m_60791_() != blockstate.m_60791_() || blockstate1.m_60787_() || blockstate.m_60787_())) { -+ if ((p_46607_ & 128) == 0 && blockstate1 != blockstate && (blockstate1.m_60739_(this, p_46605_) != oldOpacity || blockstate1.getLightEmission(this, p_46605_) != oldLight || blockstate1.m_60787_() || blockstate.m_60787_())) { - this.m_46473_().m_6180_("queueCheckLight"); - this.m_7726_().m_7827_().m_7174_(p_46605_); - this.m_46473_().m_7238_(); - } - ++ + if (blockSnapshot == null) { // Don't notify clients or update physics while capturing blockstates + this.markAndNotifyBlock(p_46605_, levelchunk, blockstate, p_46606_, p_46607_, p_46608_); + } @@ -71,7 +65,7 @@ if (blockstate1 == p_46606_) { if (blockstate != blockstate1) { this.m_6550_(p_46605_, blockstate, blockstate1); -@@ -234,9 +_,8 @@ +@@ -227,9 +_,8 @@ } this.m_6559_(p_46605_, blockstate, blockstate1); @@ -82,7 +76,7 @@ } } } -@@ -286,6 +_,7 @@ +@@ -279,6 +_,7 @@ } public void m_46672_(BlockPos p_46673_, Block p_46674_) { @@ -90,7 +84,7 @@ } public void m_46590_(BlockPos p_46591_, Block p_46592_, Direction p_46593_) { -@@ -405,10 +_,26 @@ +@@ -398,10 +_,26 @@ (this.f_151504_ ? this.f_151503_ : this.f_151512_).add(p_151526_); } @@ -117,7 +111,7 @@ if (!this.f_151503_.isEmpty()) { this.f_151512_.addAll(this.f_151503_); this.f_151503_.clear(); -@@ -431,12 +_,19 @@ +@@ -424,12 +_,19 @@ public void m_46653_(Consumer p_46654_, T p_46655_) { try { @@ -137,7 +131,7 @@ } } -@@ -478,7 +_,7 @@ +@@ -471,7 +_,7 @@ explosion$blockinteraction1 = this.m_255157_(GameRules.f_254629_); break; case MOB: @@ -146,7 +140,7 @@ break; case TNT: explosion$blockinteraction1 = this.m_255157_(GameRules.f_254705_); -@@ -489,6 +_,7 @@ +@@ -482,6 +_,7 @@ Explosion.BlockInteraction explosion$blockinteraction = explosion$blockinteraction1; Explosion explosion = new Explosion(this, p_256233_, p_255861_, p_255867_, p_256447_, p_255732_, p_255717_, p_256013_, p_256228_, explosion$blockinteraction); @@ -154,7 +148,7 @@ explosion.m_46061_(); explosion.m_46075_(p_256377_); return explosion; -@@ -520,6 +_,7 @@ +@@ -513,6 +_,7 @@ if (!this.m_151570_(p_46748_)) { this.m_46745_(p_46748_).m_8114_(p_46748_); } @@ -162,7 +156,7 @@ } public boolean m_46749_(BlockPos p_46750_) { -@@ -590,6 +_,7 @@ +@@ -583,6 +_,7 @@ list.add(p_151522_); } @@ -170,7 +164,7 @@ if (p_151522_ instanceof EnderDragon) { for(EnderDragonPart enderdragonpart : ((EnderDragon)p_151522_).m_31156_()) { if (p_151522_ != p_46536_ && p_46538_.test(enderdragonpart)) { -@@ -599,6 +_,11 @@ +@@ -592,6 +_,11 @@ } }); @@ -182,7 +176,7 @@ return list; } -@@ -622,6 +_,8 @@ +@@ -615,6 +_,8 @@ } } @@ -191,7 +185,7 @@ if (p_261454_ instanceof EnderDragon enderdragon) { for(EnderDragonPart enderdragonpart : enderdragon.m_31156_()) { T t = p_261885_.m_141992_(enderdragonpart); -@@ -636,6 +_,15 @@ +@@ -629,6 +_,15 @@ return AbortableIterationConsumer.Continuation.CONTINUE; }); @@ -207,16 +201,7 @@ } @Nullable -@@ -690,7 +_,7 @@ - public int m_46681_(BlockPos p_46682_, Direction p_46683_) { - BlockState blockstate = this.m_8055_(p_46682_); - int i = blockstate.m_60746_(this, p_46682_, p_46683_); -- return blockstate.m_60796_(this, p_46682_) ? Math.max(i, this.m_46751_(p_46682_)) : i; -+ return blockstate.shouldCheckWeakPower(this, p_46682_, p_46683_) ? Math.max(i, this.m_46751_(p_46682_)) : i; - } - - public boolean m_46753_(BlockPos p_46754_) { -@@ -841,16 +_,15 @@ +@@ -760,16 +_,15 @@ public abstract Scoreboard m_6188_(); public void m_46717_(BlockPos p_46718_, Block p_46719_) { @@ -237,7 +222,7 @@ this.m_213960_(blockstate, blockpos, p_46719_, p_46718_, false); } } -@@ -935,6 +_,18 @@ +@@ -854,6 +_,18 @@ public BiomeManager m_7062_() { return this.f_46420_; diff --git a/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch b/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch index 4c8cb51440..bd48d34cc8 100644 --- a/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch +++ b/patches/minecraft/net/minecraft/world/level/LevelReader.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/LevelReader.java +++ b/net/minecraft/world/level/LevelReader.java -@@ -187,6 +_,10 @@ +@@ -182,6 +_,10 @@ } /** @deprecated */ diff --git a/patches/minecraft/net/minecraft/world/level/SignalGetter.java.patch b/patches/minecraft/net/minecraft/world/level/SignalGetter.java.patch new file mode 100644 index 0000000000..1ef2223d92 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/SignalGetter.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/level/SignalGetter.java ++++ b/net/minecraft/world/level/SignalGetter.java +@@ -65,7 +_,7 @@ + default int m_277185_(BlockPos p_277961_, Direction p_277351_) { + BlockState blockstate = this.m_8055_(p_277961_); + int i = blockstate.m_60746_(this, p_277961_, p_277351_); +- return blockstate.m_60796_(this, p_277961_) ? Math.max(i, this.m_277173_(p_277961_)) : i; ++ return blockstate.shouldCheckWeakPower(this, p_277961_, p_277351_) ? Math.max(i, this.m_277173_(p_277961_)) : i; + } + + default boolean m_276867_(BlockPos p_277626_) { diff --git a/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch index 8256c7ca05..6a7b0f2abc 100644 --- a/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/BaseRailBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/BaseRailBlock.java +++ b/net/minecraft/world/level/block/BaseRailBlock.java -@@ -20,7 +_,7 @@ +@@ -19,7 +_,7 @@ import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -9,7 +9,7 @@ protected static final VoxelShape f_49355_ = Block.m_49796_(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D); protected static final VoxelShape f_49356_ = Block.m_49796_(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D); public static final BooleanProperty f_152149_ = BlockStateProperties.f_61362_; -@@ -45,6 +_,7 @@ +@@ -44,6 +_,7 @@ public VoxelShape m_5940_(BlockState p_49403_, BlockGetter p_49404_, BlockPos p_49405_, CollisionContext p_49406_) { RailShape railshape = p_49403_.m_60713_(this) ? p_49403_.m_61143_(this.m_7978_()) : null; @@ -17,7 +17,7 @@ return railshape != null && railshape.m_61745_() ? f_49356_ : f_49355_; } -@@ -69,7 +_,7 @@ +@@ -68,7 +_,7 @@ public void m_6861_(BlockState p_49377_, Level p_49378_, BlockPos p_49379_, Block p_49380_, BlockPos p_49381_, boolean p_49382_) { if (!p_49378_.f_46443_ && p_49378_.m_8055_(p_49379_).m_60713_(this)) { @@ -26,7 +26,7 @@ if (m_49398_(p_49379_, p_49378_, railshape)) { m_49950_(p_49377_, p_49378_, p_49379_); p_49378_.m_7471_(p_49379_, p_49382_); -@@ -118,7 +_,7 @@ +@@ -113,7 +_,7 @@ public void m_6810_(BlockState p_49384_, Level p_49385_, BlockPos p_49386_, BlockState p_49387_, boolean p_49388_) { if (!p_49388_) { super.m_6810_(p_49384_, p_49385_, p_49386_, p_49387_, p_49388_); @@ -35,7 +35,7 @@ p_49385_.m_46672_(p_49386_.m_7494_(), this); } -@@ -139,6 +_,11 @@ +@@ -134,6 +_,11 @@ return blockstate.m_61124_(this.m_7978_(), flag1 ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH).m_61124_(f_152149_, Boolean.valueOf(flag)); } @@ -47,7 +47,7 @@ public abstract Property m_7978_(); public BlockState m_7417_(BlockState p_152151_, Direction p_152152_, BlockState p_152153_, LevelAccessor p_152154_, BlockPos p_152155_, BlockPos p_152156_) { -@@ -151,5 +_,15 @@ +@@ -146,5 +_,15 @@ public FluidState m_5888_(BlockState p_152158_) { return p_152158_.m_61143_(f_152149_) ? Fluids.f_76193_.m_76068_(false) : super.m_5888_(p_152158_); diff --git a/patches/minecraft/net/minecraft/world/level/block/Block.java.patch b/patches/minecraft/net/minecraft/world/level/block/Block.java.patch index 30297f210c..5f61da9f34 100644 --- a/patches/minecraft/net/minecraft/world/level/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/Block.java.patch @@ -14,7 +14,7 @@ private static final LoadingCache f_49785_ = CacheBuilder.newBuilder().maximumSize(512L).weakKeys().build(new CacheLoader() { public Boolean load(VoxelShape p_49972_) { return !Shapes.m_83157_(Shapes.m_83144_(), p_49972_, BooleanOp.f_82687_); -@@ -177,7 +_,7 @@ +@@ -176,7 +_,7 @@ f_49790_.error("Block classes should end with Block and {} doesn't.", (Object)s); } } @@ -23,7 +23,7 @@ } public static boolean m_152463_(BlockState p_152464_) { -@@ -192,6 +_,8 @@ +@@ -191,6 +_,8 @@ BlockState blockstate = p_152446_.m_8055_(p_152449_); if (p_152445_.m_60719_(blockstate, p_152448_)) { return false; @@ -32,7 +32,7 @@ } else if (blockstate.m_60815_()) { Block.BlockStatePairKey block$blockstatepairkey = new Block.BlockStatePairKey(p_152445_, blockstate, p_152448_); Object2ByteLinkedOpenHashMap object2bytelinkedopenhashmap = f_49789_.get(); -@@ -323,7 +_,7 @@ +@@ -313,7 +_,7 @@ } private static void m_152440_(Level p_152441_, Supplier p_152442_, ItemStack p_152443_) { @@ -41,7 +41,7 @@ ItemEntity itementity = p_152442_.get(); itementity.m_32060_(); p_152441_.m_7967_(itementity); -@@ -331,12 +_,13 @@ +@@ -321,12 +_,13 @@ } public void m_49805_(ServerLevel p_49806_, BlockPos p_49807_, int p_49808_) { @@ -56,7 +56,7 @@ public float m_7325_() { return this.f_60444_; } -@@ -383,8 +_,10 @@ +@@ -373,8 +_,10 @@ public void m_5548_(BlockGetter p_49821_, Entity p_49822_) { p_49822_.m_20256_(p_49822_.m_20184_().m_82542_(1.0D, 0.0D, 1.0D)); @@ -67,7 +67,7 @@ public ItemStack m_7397_(BlockGetter p_49823_, BlockPos p_49824_, BlockState p_49825_) { return new ItemStack(this); } -@@ -417,6 +_,7 @@ +@@ -407,6 +_,7 @@ public void m_141997_(BlockState p_152450_, Level p_152451_, BlockPos p_152452_, Biome.Precipitation p_152453_) { } @@ -75,7 +75,7 @@ public boolean m_6903_(Explosion p_49826_) { return true; } -@@ -452,6 +_,7 @@ +@@ -442,6 +_,7 @@ return p_152456_.m_61124_(p_152457_, p_152455_.m_61143_(p_152457_)); } @@ -83,7 +83,7 @@ public SoundType m_49962_(BlockState p_49963_) { return this.f_60446_; } -@@ -461,7 +_,7 @@ +@@ -451,7 +_,7 @@ this.f_49788_ = Item.m_41439_(this); } @@ -92,7 +92,7 @@ } public boolean m_49967_() { -@@ -482,6 +_,75 @@ +@@ -472,6 +_,74 @@ protected ImmutableMap m_152458_(Function p_152459_) { return this.f_49792_.m_61056_().stream().collect(ImmutableMap.toImmutableMap(Function.identity(), p_152459_)); } @@ -128,7 +128,7 @@ + net.minecraftforge.common.PlantType type = plantable.getPlantType(world, pos.m_121945_(facing)); + + if (plant.m_60734_() == Blocks.f_50128_) -+ return state.m_60713_(Blocks.f_50128_) || state.m_60713_(Blocks.f_49992_) || state.m_60713_(Blocks.f_49993_); ++ return state.m_60713_(Blocks.f_50128_) || state.m_204336_(BlockTags.f_13029_); + + if (plant.m_60734_() == Blocks.f_50130_ && this == Blocks.f_50130_) + return true; @@ -137,7 +137,7 @@ + return true; + + if (net.minecraftforge.common.PlantType.DESERT.equals(type)) { -+ return this == Blocks.f_49992_ || this == Blocks.f_50352_ || this instanceof GlazedTerracottaBlock; ++ return state.m_204336_(BlockTags.f_13029_) || this == Blocks.f_50352_ || this instanceof GlazedTerracottaBlock; + } else if (net.minecraftforge.common.PlantType.NETHER.equals(type)) { + return this == Blocks.f_50135_; + } else if (net.minecraftforge.common.PlantType.CROP.equals(type)) { @@ -145,17 +145,16 @@ + } else if (net.minecraftforge.common.PlantType.CAVE.equals(type)) { + return state.m_60783_(world, pos, Direction.UP); + } else if (net.minecraftforge.common.PlantType.PLAINS.equals(type)) { -+ return this == Blocks.f_50440_ || this.m_49966_().m_204336_(BlockTags.f_144274_) || this == Blocks.f_50093_; ++ return state.m_204336_(BlockTags.f_144274_) || this == Blocks.f_50093_; + } else if (net.minecraftforge.common.PlantType.WATER.equals(type)) { -+ return state.m_60767_() == net.minecraft.world.level.material.Material.f_76305_; //&& state.getValue(BlockLiquidWrapper) ++ return (state.m_60713_(Blocks.f_49990_) || state.m_60734_() instanceof IceBlock) && world.m_6425_(pos.m_121945_(facing)).m_76178_(); + } else if (net.minecraftforge.common.PlantType.BEACH.equals(type)) { -+ boolean isBeach = state.m_60713_(Blocks.f_50440_) || this.m_49966_().m_204336_(BlockTags.f_144274_) || state.m_60713_(Blocks.f_49992_) || state.m_60713_(Blocks.f_49993_); ++ boolean isBeach = state.m_204336_(BlockTags.f_144274_) || state.m_204336_(BlockTags.f_13029_); + boolean hasWater = false; + for (Direction face : Direction.Plane.HORIZONTAL) { -+ BlockState blockState = world.m_8055_(pos.m_121945_(face)); -+ net.minecraft.world.level.material.FluidState fluidState = world.m_6425_(pos.m_121945_(face)); -+ hasWater |= blockState.m_60713_(Blocks.f_50449_); -+ hasWater |= fluidState.m_205070_(net.minecraft.tags.FluidTags.f_13131_); ++ BlockState adjacentBlockState = world.m_8055_(pos.m_121945_(face)); ++ var adjacentFluidState = world.m_6425_(pos.m_121945_(face)); ++ hasWater = hasWater || adjacentBlockState.m_60713_(Blocks.f_50449_) || adjacentFluidState.m_205070_(net.minecraft.tags.FluidTags.f_13131_); + if (hasWater) + break; //No point continuing. + } diff --git a/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch b/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch index a1e0b2156d..5cb0f09e9d 100644 --- a/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/Blocks.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/level/block/Blocks.java +++ b/net/minecraft/world/level/block/Blocks.java -@@ -161,7 +_,7 @@ +@@ -163,7 +_,7 @@ public static final Block f_50027_ = m_50795_("green_bed", m_50764_(DyeColor.GREEN)); public static final Block f_50028_ = m_50795_("red_bed", m_50764_(DyeColor.RED)); public static final Block f_50029_ = m_50795_("black_bed", m_50764_(DyeColor.BLACK)); -- public static final Block f_50030_ = m_50795_("powered_rail", new PoweredRailBlock(BlockBehaviour.Properties.m_60939_(Material.f_76310_).m_60910_().m_60978_(0.7F).m_60918_(SoundType.f_56743_))); -+ public static final Block f_50030_ = m_50795_("powered_rail", new PoweredRailBlock(BlockBehaviour.Properties.m_60939_(Material.f_76310_).m_60910_().m_60978_(0.7F).m_60918_(SoundType.f_56743_), true)); - public static final Block f_50031_ = m_50795_("detector_rail", new DetectorRailBlock(BlockBehaviour.Properties.m_60939_(Material.f_76310_).m_60910_().m_60978_(0.7F).m_60918_(SoundType.f_56743_))); +- public static final Block f_50030_ = m_50795_("powered_rail", new PoweredRailBlock(BlockBehaviour.Properties.m_284310_().m_60910_().m_60978_(0.7F).m_60918_(SoundType.f_56743_))); ++ public static final Block f_50030_ = m_50795_("powered_rail", new PoweredRailBlock(BlockBehaviour.Properties.m_284310_().m_60910_().m_60978_(0.7F).m_60918_(SoundType.f_56743_), true)); + public static final Block f_50031_ = m_50795_("detector_rail", new DetectorRailBlock(BlockBehaviour.Properties.m_284310_().m_60910_().m_60978_(0.7F).m_60918_(SoundType.f_56743_))); public static final Block f_50032_ = m_50795_("sticky_piston", m_50798_(true)); - public static final Block f_50033_ = m_50795_("cobweb", new WebBlock(BlockBehaviour.Properties.m_60939_(Material.f_76311_).m_60910_().m_60999_().m_60978_(4.0F))); -@@ -1229,17 +_,5 @@ + public static final Block f_50033_ = m_50795_("cobweb", new WebBlock(BlockBehaviour.Properties.m_284310_().m_284180_(MapColor.f_283930_).m_280606_().m_60910_().m_60999_().m_60978_(4.0F).m_278166_(PushReaction.DESTROY))); +@@ -1253,17 +_,5 @@ public static void m_50758_() { Block.f_49791_.forEach(BlockBehaviour.BlockStateBase::m_60611_); diff --git a/patches/minecraft/net/minecraft/world/level/block/CactusBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/CactusBlock.java.patch index 4d9ad8e1ba..b88b97d2ce 100644 --- a/patches/minecraft/net/minecraft/world/level/block/CactusBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/CactusBlock.java.patch @@ -39,16 +39,16 @@ } } } -@@ -87,7 +_,7 @@ +@@ -86,7 +_,7 @@ } BlockState blockstate1 = p_51154_.m_8055_(p_51155_.m_7495_()); -- return (blockstate1.m_60713_(Blocks.f_50128_) || blockstate1.m_60713_(Blocks.f_49992_) || blockstate1.m_60713_(Blocks.f_49993_)) && !p_51154_.m_8055_(p_51155_.m_7494_()).m_60767_().m_76332_(); -+ return blockstate1.canSustainPlant(p_51154_, p_51155_, Direction.UP, this) && !p_51154_.m_8055_(p_51155_.m_7494_()).m_60767_().m_76332_(); +- return (blockstate1.m_60713_(Blocks.f_50128_) || blockstate1.m_204336_(BlockTags.f_13029_)) && !p_51154_.m_8055_(p_51155_.m_7494_()).m_278721_(); ++ return blockstate1.canSustainPlant(p_51154_, p_51155_, Direction.UP, this) && !p_51154_.m_8055_(p_51155_.m_7494_()).m_278721_(); } public void m_7892_(BlockState p_51148_, Level p_51149_, BlockPos p_51150_, Entity p_51151_) { -@@ -100,5 +_,15 @@ +@@ -99,5 +_,15 @@ public boolean m_7357_(BlockState p_51143_, BlockGetter p_51144_, BlockPos p_51145_, PathComputationType p_51146_) { return false; diff --git a/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch index 7ec957ac3f..4ddac891d5 100644 --- a/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/DiodeBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/DiodeBlock.java +++ b/net/minecraft/world/level/block/DiodeBlock.java -@@ -165,6 +_,8 @@ +@@ -154,6 +_,8 @@ protected void m_52580_(Level p_52581_, BlockPos p_52582_, BlockState p_52583_) { Direction direction = p_52583_.m_61143_(f_54117_); BlockPos blockpos = p_52582_.m_121945_(direction.m_122424_()); diff --git a/patches/minecraft/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch index e28131aa83..dcab610ed3 100644 --- a/patches/minecraft/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/EnchantmentTableBlock.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/block/EnchantmentTableBlock.java +++ b/net/minecraft/world/level/block/EnchantmentTableBlock.java -@@ -40,7 +_,7 @@ +@@ -41,7 +_,7 @@ } public static boolean m_207909_(Level p_207910_, BlockPos p_207911_, BlockPos p_207912_) { -- return p_207910_.m_8055_(p_207911_.m_121955_(p_207912_)).m_60713_(Blocks.f_50078_) && p_207910_.m_46859_(p_207911_.m_7918_(p_207912_.m_123341_() / 2, p_207912_.m_123342_(), p_207912_.m_123343_() / 2)); -+ return p_207910_.m_8055_(p_207911_.m_121955_(p_207912_)).getEnchantPowerBonus(p_207910_, p_207911_.m_121955_(p_207912_)) != 0 && p_207910_.m_46859_(p_207911_.m_7918_(p_207912_.m_123341_() / 2, p_207912_.m_123342_(), p_207912_.m_123343_() / 2)); +- return p_207910_.m_8055_(p_207911_.m_121955_(p_207912_)).m_204336_(BlockTags.f_278384_) && p_207910_.m_8055_(p_207911_.m_7918_(p_207912_.m_123341_() / 2, p_207912_.m_123342_(), p_207912_.m_123343_() / 2)).m_204336_(BlockTags.f_278486_); ++ return p_207910_.m_8055_(p_207911_.m_121955_(p_207912_)).getEnchantPowerBonus(p_207910_, p_207911_.m_121955_(p_207912_)) != 0 && p_207910_.m_8055_(p_207911_.m_7918_(p_207912_.m_123341_() / 2, p_207912_.m_123342_(), p_207912_.m_123343_() / 2)).m_204336_(BlockTags.f_278486_); } public boolean m_7923_(BlockState p_52997_) { diff --git a/patches/minecraft/net/minecraft/world/level/block/FarmBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FarmBlock.java.patch index 635af8ab9b..a77de01d79 100644 --- a/patches/minecraft/net/minecraft/world/level/block/FarmBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/FarmBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/FarmBlock.java +++ b/net/minecraft/world/level/block/FarmBlock.java -@@ -83,7 +_,7 @@ +@@ -84,7 +_,7 @@ } public void m_142072_(Level p_153227_, BlockState p_153228_, BlockPos p_153229_, Entity p_153230_, float p_153231_) { @@ -9,15 +9,14 @@ m_269406_(p_153230_, p_153228_, p_153227_, p_153229_); } -@@ -97,18 +_,20 @@ +@@ -98,17 +_,20 @@ } - private static boolean m_53250_(BlockGetter p_53251_, BlockPos p_53252_) { -- Block block = p_53251_.m_8055_(p_53252_.m_7494_()).m_60734_(); -- return block instanceof CropBlock || block instanceof StemBlock || block instanceof AttachedStemBlock; -+ BlockState plant = p_53251_.m_8055_(p_53252_.m_7494_()); -+ BlockState state = p_53251_.m_8055_(p_53252_); -+ return plant.m_60734_() instanceof net.minecraftforge.common.IPlantable && state.canSustainPlant(p_53251_, p_53252_, Direction.UP, (net.minecraftforge.common.IPlantable)plant.m_60734_()); + private static boolean m_53250_(BlockGetter p_279219_, BlockPos p_279209_) { +- return p_279219_.m_8055_(p_279209_.m_7494_()).m_204336_(BlockTags.f_279534_); ++ BlockState plant = p_279219_.m_8055_(p_279209_.m_7494_()); ++ BlockState state = p_279219_.m_8055_(p_279209_); ++ return plant.m_60734_() instanceof net.minecraftforge.common.IPlantable && state.canSustainPlant(p_279219_, p_279209_, Direction.UP, (net.minecraftforge.common.IPlantable)plant.m_60734_()); } private static boolean m_53258_(LevelReader p_53259_, BlockPos p_53260_) { diff --git a/patches/minecraft/net/minecraft/world/level/block/FungusBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/FungusBlock.java.patch index 1cba1aea34..728910d4fa 100644 --- a/patches/minecraft/net/minecraft/world/level/block/FungusBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/FungusBlock.java.patch @@ -5,7 +5,7 @@ public void m_214148_(ServerLevel p_221243_, RandomSource p_221244_, BlockPos p_221245_, BlockState p_221246_) { this.m_255216_(p_221243_).ifPresent((p_256352_) -> { - p_256352_.m_203334_().m_224953_(p_221243_, p_221243_.m_7726_().m_8481_(), p_221244_, p_221245_); -+ net.minecraftforge.event.level.SaplingGrowTreeEvent event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(p_221243_, p_221244_, p_221245_, p_256352_); ++ var event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(p_221243_, p_221244_, p_221245_, p_256352_); + if (event.getResult().equals(net.minecraftforge.eventbus.api.Event.Result.DENY)) return; + event.getFeature().m_203334_().m_224953_(p_221243_, p_221243_.m_7726_().m_8481_(), p_221244_, p_221245_); }); diff --git a/patches/minecraft/net/minecraft/world/level/block/LeavesBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/LeavesBlock.java.patch index ac102c21c4..5051ea00a6 100644 --- a/patches/minecraft/net/minecraft/world/level/block/LeavesBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/LeavesBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/LeavesBlock.java +++ b/net/minecraft/world/level/block/LeavesBlock.java -@@ -22,7 +_,7 @@ +@@ -23,7 +_,7 @@ import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; diff --git a/patches/minecraft/net/minecraft/world/level/block/MagmaBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/MagmaBlock.java.patch deleted file mode 100644 index 20c92adf14..0000000000 --- a/patches/minecraft/net/minecraft/world/level/block/MagmaBlock.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/block/MagmaBlock.java -+++ b/net/minecraft/world/level/block/MagmaBlock.java -@@ -46,7 +_,7 @@ - - public void m_213898_(BlockState p_221420_, ServerLevel p_221421_, BlockPos p_221422_, RandomSource p_221423_) { - BlockPos blockpos = p_221422_.m_7494_(); -- if (p_221421_.m_6425_(p_221422_).m_205070_(FluidTags.f_13131_)) { -+ if (p_221421_.m_6425_(p_221422_).canExtinguish(p_221421_, p_221422_)) { - p_221421_.m_5594_((Player)null, p_221422_, SoundEvents.f_11937_, SoundSource.BLOCKS, 0.5F, 2.6F + (p_221421_.f_46441_.m_188501_() - p_221421_.f_46441_.m_188501_()) * 0.8F); - p_221421_.m_8767_(ParticleTypes.f_123755_, (double)blockpos.m_123341_() + 0.5D, (double)blockpos.m_123342_() + 0.25D, (double)blockpos.m_123343_() + 0.5D, 8, 0.5D, 0.25D, 0.5D, 0.0D); - } diff --git a/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch index 887ce9fbef..5ed91aaf74 100644 --- a/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/MushroomBlock.java.patch @@ -13,7 +13,7 @@ if (optional.isEmpty()) { return false; } else { -+ net.minecraftforge.event.level.SaplingGrowTreeEvent event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(p_221774_, p_221777_, p_221775_, optional.get()); ++ var event = net.minecraftforge.event.ForgeEventFactory.blockGrowFeature(p_221774_, p_221777_, p_221775_, optional.get()); + if (event.getResult().equals(net.minecraftforge.eventbus.api.Event.Result.DENY)) return false; p_221774_.m_7471_(p_221775_, false); - if (optional.get().m_203334_().m_224953_(p_221774_, p_221774_.m_7726_().m_8481_(), p_221777_, p_221775_)) { diff --git a/patches/minecraft/net/minecraft/world/level/block/NoteBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/NoteBlock.java.patch index 97b6d70730..c572d6dce2 100644 --- a/patches/minecraft/net/minecraft/world/level/block/NoteBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/NoteBlock.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/block/NoteBlock.java +++ b/net/minecraft/world/level/block/NoteBlock.java -@@ -98,7 +_,9 @@ - if (p_55035_.f_46443_) { +@@ -89,7 +_,9 @@ + } else if (p_55035_.f_46443_) { return InteractionResult.SUCCESS; } else { - p_55034_ = p_55034_.m_61122_(f_55013_); @@ -11,7 +11,7 @@ p_55035_.m_7731_(p_55036_, p_55034_, 3); this.m_260916_(p_55037_, p_55034_, p_55035_, p_55036_); p_55037_.m_36220_(Stats.f_12960_); -@@ -114,6 +_,9 @@ +@@ -109,6 +_,9 @@ } public boolean m_8133_(BlockState p_55023_, Level p_55024_, BlockPos p_55025_, int p_55026_, int p_55027_) { diff --git a/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch index b87f94c87b..fed32be0dd 100644 --- a/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/PoweredRailBlock.java.patch @@ -42,9 +42,9 @@ if (p_55230_ != RailShape.EAST_WEST || railshape != RailShape.NORTH_SOUTH && railshape != RailShape.ASCENDING_NORTH && railshape != RailShape.ASCENDING_SOUTH) { if (p_55230_ != RailShape.NORTH_SOUTH || railshape != RailShape.EAST_WEST && railshape != RailShape.ASCENDING_EAST && railshape != RailShape.ASCENDING_WEST) { - if (blockstate.m_61143_(f_55215_)) { -- return p_55226_.m_46753_(p_55227_) ? true : this.m_55219_(p_55226_, p_55227_, blockstate, p_55228_, p_55229_ + 1); +- return p_55226_.m_276867_(p_55227_) ? true : this.m_55219_(p_55226_, p_55227_, blockstate, p_55228_, p_55229_ + 1); + if (isActivatorRail() == other.isActivatorRail()) { -+ return p_55226_.m_46753_(p_55227_) ? true : other.m_55219_(p_55226_, p_55227_, blockstate, p_55228_, p_55229_ + 1); ++ return p_55226_.m_276867_(p_55227_) ? true : other.m_55219_(p_55226_, p_55227_, blockstate, p_55228_, p_55229_ + 1); } else { return false; } diff --git a/patches/minecraft/net/minecraft/world/level/block/RedStoneWireBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/RedStoneWireBlock.java.patch index 8f0a163ff9..6bc8825261 100644 --- a/patches/minecraft/net/minecraft/world/level/block/RedStoneWireBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/RedStoneWireBlock.java.patch @@ -3,7 +3,7 @@ @@ -196,7 +_,7 @@ BlockState blockstate = p_55523_.m_8055_(blockpos); if (p_55526_) { - boolean flag = this.m_55612_(p_55523_, blockpos, blockstate); + boolean flag = blockstate.m_60734_() instanceof TrapDoorBlock || this.m_55612_(p_55523_, blockpos, blockstate); - if (flag && m_55640_(p_55523_.m_8055_(blockpos.m_7494_()))) { + if (flag && p_55523_.m_8055_(blockpos.m_7494_()).canRedstoneConnectTo(p_55523_, blockpos.m_7494_(), null)) { if (blockstate.m_60783_(p_55523_, blockpos, p_55525_.m_122424_())) { diff --git a/patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch index abbfd7df7c..e5ee878daa 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SculkCatalystBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/SculkCatalystBlock.java +++ b/net/minecraft/world/level/block/SculkCatalystBlock.java -@@ -72,9 +_,11 @@ +@@ -54,9 +_,11 @@ public void m_213646_(BlockState p_222109_, ServerLevel p_222110_, BlockPos p_222111_, ItemStack p_222112_, boolean p_222113_) { super.m_213646_(p_222109_, p_222110_, p_222111_, p_222112_, p_222113_); diff --git a/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch index 2daf8cd246..6bcb87d479 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/SculkSensorBlock.java +++ b/net/minecraft/world/level/block/SculkSensorBlock.java -@@ -228,9 +_,11 @@ +@@ -252,9 +_,11 @@ public void m_213646_(BlockState p_222142_, ServerLevel p_222143_, BlockPos p_222144_, ItemStack p_222145_, boolean p_222146_) { super.m_213646_(p_222142_, p_222143_, p_222144_, p_222145_, p_222146_); diff --git a/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch b/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch index 74384c8237..ae40e9a8ec 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SoundType.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/SoundType.java +++ b/net/minecraft/world/level/block/SoundType.java -@@ -112,6 +_,7 @@ +@@ -115,6 +_,7 @@ private final SoundEvent f_56737_; private final SoundEvent f_56738_; diff --git a/patches/minecraft/net/minecraft/world/level/block/SpongeBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SpongeBlock.java.patch index 1a4fdf7d5b..f6c138efcd 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SpongeBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SpongeBlock.java.patch @@ -1,19 +1,19 @@ --- a/net/minecraft/world/level/block/SpongeBlock.java +++ b/net/minecraft/world/level/block/SpongeBlock.java -@@ -44,6 +_,7 @@ - Queue> queue = Lists.newLinkedList(); - queue.add(new Tuple<>(p_56809_, 0)); - int i = 0; -+ BlockState state = p_56808_.m_8055_(p_56809_); +@@ -38,6 +_,7 @@ + } - while(!queue.isEmpty()) { - Tuple tuple = queue.poll(); -@@ -55,7 +_,7 @@ - BlockState blockstate = p_56808_.m_8055_(blockpos1); - FluidState fluidstate = p_56808_.m_6425_(blockpos1); - Material material = blockstate.m_60767_(); -- if (fluidstate.m_205070_(FluidTags.f_13131_)) { -+ if (state.canBeHydrated(p_56808_, p_56809_, fluidstate, blockpos1)) { - if (blockstate.m_60734_() instanceof BucketPickup && !((BucketPickup)blockstate.m_60734_()).m_142598_(p_56808_, blockpos1, blockstate).m_41619_()) { - ++i; - if (j < 6) { + private boolean m_56807_(Level p_56808_, BlockPos p_56809_) { ++ BlockState spongeState = p_56808_.m_8055_(p_56809_); + return BlockPos.m_276833_(p_56809_, 6, 65, (p_277519_, p_277492_) -> { + for(Direction direction : f_276425_) { + p_277492_.accept(p_277519_.m_121945_(direction)); +@@ -49,7 +_,7 @@ + } else { + BlockState blockstate = p_56808_.m_8055_(p_279054_); + FluidState fluidstate = p_56808_.m_6425_(p_279054_); +- if (!fluidstate.m_205070_(FluidTags.f_13131_)) { ++ if (!spongeState.canBeHydrated(p_56808_, p_56809_, fluidstate, p_279054_)) { + return false; + } else { + Block block = blockstate.m_60734_(); diff --git a/patches/minecraft/net/minecraft/world/level/block/TntBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/TntBlock.java.patch index f775d2a92b..1df3953885 100644 --- a/patches/minecraft/net/minecraft/world/level/block/TntBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/TntBlock.java.patch @@ -10,7 +10,7 @@ + public void m_6807_(BlockState p_57466_, Level p_57467_, BlockPos p_57468_, BlockState p_57469_, boolean p_57470_) { if (!p_57469_.m_60713_(p_57466_.m_60734_())) { - if (p_57467_.m_46753_(p_57468_)) { + if (p_57467_.m_276867_(p_57468_)) { - m_57433_(p_57467_, p_57468_); + onCaughtFire(p_57466_, p_57467_, p_57468_, null, null); p_57467_.m_7471_(p_57468_, false); @@ -19,7 +19,7 @@ @@ -45,7 +_,7 @@ public void m_6861_(BlockState p_57457_, Level p_57458_, BlockPos p_57459_, Block p_57460_, BlockPos p_57461_, boolean p_57462_) { - if (p_57458_.m_46753_(p_57459_)) { + if (p_57458_.m_276867_(p_57459_)) { - m_57433_(p_57458_, p_57459_); + onCaughtFire(p_57457_, p_57458_, p_57459_, null, null); p_57458_.m_7471_(p_57459_, false); diff --git a/patches/minecraft/net/minecraft/world/level/block/TrapDoorBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/TrapDoorBlock.java.patch index e3c5f2e5c5..71abc9598c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/TrapDoorBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/TrapDoorBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/TrapDoorBlock.java +++ b/net/minecraft/world/level/block/TrapDoorBlock.java -@@ -149,4 +_,17 @@ +@@ -148,4 +_,17 @@ return super.m_7417_(p_57554_, p_57555_, p_57556_, p_57557_, p_57558_, p_57559_); } diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch index 37595a83f5..ae2f00630d 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java.patch @@ -95,7 +95,7 @@ } else { @@ -306,10 +_,10 @@ return true; - } else if (!itemstack1.m_41656_(itemstack)) { + } else if (!ItemStack.m_41656_(itemstack1, itemstack)) { return false; - } else if (itemstack1.m_41613_() < p_155008_ && itemstack1.m_41613_() < itemstack1.m_41741_()) { + } else if (itemstack1.m_41613_() + itemstack.m_41613_() <= p_155008_ && itemstack1.m_41613_() + itemstack.m_41613_() <= itemstack1.m_41741_()) { // Forge fix: make furnace respect stack sizes in furnace recipes @@ -153,7 +153,7 @@ } } -@@ -487,5 +_,34 @@ +@@ -494,5 +_,34 @@ p_58342_.m_36491_(itemstack); } diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch index 11a219562c..bdda845473 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/HopperBlockEntity.java.patch @@ -28,7 +28,7 @@ Container container = m_155596_(p_155553_, p_155554_); if (container != null) { Direction direction = Direction.DOWN; -@@ -417,5 +_,14 @@ +@@ -411,5 +_,14 @@ protected AbstractContainerMenu m_6555_(int p_59312_, Inventory p_59313_) { return new HopperMenu(p_59312_, p_59313_, this); diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/SignBlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/SignBlockEntity.java.patch new file mode 100644 index 0000000000..5db1d7ecf8 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/block/entity/SignBlockEntity.java.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/world/level/block/entity/SignBlockEntity.java ++++ b/net/minecraft/world/level/block/entity/SignBlockEntity.java +@@ -278,4 +_,9 @@ + } + + } ++ ++ @Override ++ public net.minecraft.world.phys.AABB getRenderBoundingBox() { ++ return new net.minecraft.world.phys.AABB(this.m_58899_(), this.m_58899_().m_7918_(1, 1, 1)); ++ } + } diff --git a/patches/minecraft/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch index f70e05b1e2..01e8263198 100644 --- a/patches/minecraft/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/net/minecraft/world/level/block/piston/PistonBaseBlock.java -@@ -168,6 +_,7 @@ +@@ -169,6 +_,7 @@ } if (p_60195_ == 0) { @@ -8,23 +8,23 @@ if (!this.m_60181_(p_60193_, p_60194_, direction, true)) { return false; } -@@ -176,6 +_,7 @@ +@@ -177,6 +_,7 @@ p_60193_.m_5594_((Player)null, p_60194_, SoundEvents.f_12312_, SoundSource.BLOCKS, 0.5F, p_60193_.f_46441_.m_188501_() * 0.25F + 0.6F); - p_60193_.m_142346_((Entity)null, GameEvent.f_157775_, p_60194_); + p_60193_.m_220407_(GameEvent.f_223702_, p_60194_, GameEvent.Context.m_223722_(blockstate)); } else if (p_60195_ == 1 || p_60195_ == 2) { + if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_60193_, p_60194_, direction, false)) return false; BlockEntity blockentity1 = p_60193_.m_7702_(p_60194_.m_121945_(direction)); if (blockentity1 instanceof PistonMovingBlockEntity) { ((PistonMovingBlockEntity)blockentity1).m_60401_(); -@@ -216,6 +_,7 @@ - p_60193_.m_142346_((Entity)null, GameEvent.f_157774_, p_60194_); +@@ -217,6 +_,7 @@ + p_60193_.m_220407_(GameEvent.f_223703_, p_60194_, GameEvent.Context.m_223722_(blockstate1)); } + net.minecraftforge.event.ForgeEventFactory.onPistonMovePost(p_60193_, p_60194_, direction, (p_60195_ == 0)); return true; } -@@ -353,6 +_,10 @@ +@@ -354,6 +_,10 @@ public BlockState m_6843_(BlockState p_60215_, Rotation p_60216_) { return p_60215_.m_61124_(f_52588_, p_60216_.m_55954_(p_60215_.m_61143_(f_52588_))); diff --git a/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch b/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch index a99d0406f9..7adb882537 100644 --- a/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/state/BlockBehaviour.java.patch @@ -27,16 +27,7 @@ p_60516_.m_46747_(p_60517_); } -@@ -231,7 +_,7 @@ - /** @deprecated */ - @Deprecated - public boolean m_6864_(BlockState p_60470_, BlockPlaceContext p_60471_) { -- return this.f_60442_.m_76336_() && (p_60471_.m_43722_().m_41619_() || !p_60471_.m_43722_().m_150930_(this.m_5456_())); -+ return p_60470_.m_60767_().m_76336_() && (p_60471_.m_43722_().m_41619_() || p_60471_.m_43722_().m_41720_() != this.m_5456_()); - } - - /** @deprecated */ -@@ -361,8 +_,8 @@ +@@ -355,8 +_,8 @@ if (f == -1.0F) { return 0.0F; } else { @@ -47,7 +38,7 @@ } } -@@ -395,8 +_,7 @@ +@@ -389,8 +_,7 @@ public final ResourceLocation m_60589_() { if (this.f_60440_ == null) { @@ -57,7 +48,7 @@ } return this.f_60440_; -@@ -419,6 +_,14 @@ +@@ -413,6 +_,14 @@ return this.f_60439_.f_60888_; } @@ -72,11 +63,11 @@ public abstract static class BlockStateBase extends StateHolder { private final int f_60594_; private final boolean f_60595_; -@@ -509,18 +_,22 @@ +@@ -548,12 +_,14 @@ return this.f_60595_; } -+ /** @deprecated use {@link BlockState#getLightEmission(BlockGetter, BlockPos)} */ ++ /** @deprecated Forge: Use {@link BlockState#getLightEmission(BlockGetter, BlockPos)} instead */ + @Deprecated public int m_60791_() { return this.f_60594_; @@ -87,9 +78,13 @@ + return this.m_60734_().isAir((BlockState)this); } - public MaterialColor m_60780_(BlockGetter p_60781_, BlockPos p_60782_) { -- return this.f_60598_; -+ return m_60734_().getMapColor(this.m_7160_(), p_60781_, p_60782_, this.f_60598_); + public boolean m_278200_() { +@@ -567,9 +_,11 @@ + } + + public MapColor m_284242_(BlockGetter p_285002_, BlockPos p_285293_) { +- return this.f_283893_; ++ return m_60734_().getMapColor(this.m_7160_(), p_285002_, p_285293_, this.f_283893_); } + /** @deprecated use {@link BlockState#rotate(LevelAccessor, BlockPos, Rotation)} */ @@ -97,18 +92,18 @@ public BlockState m_60717_(Rotation p_60718_) { return this.m_60734_().m_6843_(this.m_7160_(), p_60718_); } -@@ -908,8 +_,9 @@ - boolean f_60895_ = true; - boolean f_60896_; +@@ -972,8 +_,9 @@ boolean f_243850_ = true; + NoteBlockInstrument f_279538_ = NoteBlockInstrument.HARP; + boolean f_279630_; + private java.util.function.Supplier lootTableSupplier; - BlockBehaviour.StateArgumentPredicate> f_60897_ = (p_60935_, p_60936_, p_60937_, p_60938_) -> { -- return p_60935_.m_60783_(p_60936_, p_60937_, Direction.UP) && p_60935_.m_60791_() < 14; -+ return p_60935_.m_60783_(p_60936_, p_60937_, Direction.UP) && p_60935_.getLightEmission(p_60936_, p_60937_) < 14; + BlockBehaviour.StateArgumentPredicate> f_60897_ = (p_284893_, p_284894_, p_284895_, p_284896_) -> { +- return p_284893_.m_60783_(p_284894_, p_284895_, Direction.UP) && p_284893_.m_60791_() < 14; ++ return p_284893_.m_60783_(p_284894_, p_284895_, Direction.UP) && p_284893_.getLightEmission(p_284894_, p_284895_) < 14; }; - BlockBehaviour.StatePredicate f_60898_ = (p_60985_, p_60986_, p_60987_) -> { - return p_60985_.m_60767_().m_76337_() && p_60985_.m_60838_(p_60986_, p_60987_); -@@ -1041,9 +_,15 @@ + BlockBehaviour.StatePredicate f_60898_ = (p_284888_, p_284889_, p_284890_) -> { + return p_284888_.m_60838_(p_284889_, p_284890_); +@@ -1111,9 +_,15 @@ return this; } @@ -124,4 +119,4 @@ + return this; } - public BlockBehaviour.Properties m_60996_() { + public BlockBehaviour.Properties m_278183_() { diff --git a/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch index 7d421ceb23..a78e6e3f3b 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/ChunkAccess.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -407,4 +_,7 @@ +@@ -463,4 +_,7 @@ public static record TicksToSave(SerializableTickContainer f_187680_, SerializableTickContainer f_187681_) { } diff --git a/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch index fa9826ca84..26fe14d78a 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -48,7 +_,7 @@ +@@ -47,7 +_,7 @@ import net.minecraft.world.ticks.TickContainerAccess; import org.slf4j.Logger; @@ -9,7 +9,7 @@ static final Logger f_62771_ = LogUtils.getLogger(); private static final TickingBlockEntity f_156361_ = new TickingBlockEntity() { public void m_142224_() { -@@ -96,6 +_,7 @@ +@@ -94,6 +_,7 @@ this.f_62791_ = p_196861_; this.f_62784_ = p_196857_; this.f_187943_ = p_196858_; @@ -17,7 +17,7 @@ } public LevelChunk(ServerLevel p_196850_, ProtoChunk p_196851_, @Nullable LevelChunk.PostLoadProcessor p_196852_) { -@@ -237,14 +_,14 @@ +@@ -245,14 +_,14 @@ boolean flag2 = blockstate.m_155947_(); if (!this.f_62776_.f_46443_) { blockstate.m_60753_(this.f_62776_, p_62865_, p_62866_, p_62867_); @@ -34,7 +34,7 @@ p_62866_.m_60696_(this.f_62776_, p_62865_, blockstate, p_62867_); } -@@ -287,6 +_,10 @@ +@@ -295,6 +_,10 @@ @Nullable public BlockEntity m_5685_(BlockPos p_62868_, LevelChunk.EntityCreationType p_62869_) { BlockEntity blockentity = this.f_187610_.get(p_62868_); @@ -45,7 +45,7 @@ if (blockentity == null) { CompoundTag compoundtag = this.f_187609_.remove(p_62868_); if (compoundtag != null) { -@@ -304,9 +_,6 @@ +@@ -312,9 +_,6 @@ this.m_142170_(blockentity); } } @@ -55,7 +55,7 @@ } return blockentity; -@@ -322,6 +_,7 @@ +@@ -330,6 +_,7 @@ } this.m_156406_(p_156391_); @@ -63,7 +63,7 @@ } } -@@ -361,9 +_,14 @@ +@@ -369,9 +_,14 @@ public CompoundTag m_8051_(BlockPos p_62932_) { BlockEntity blockentity = this.m_7702_(p_62932_); if (blockentity != null && !blockentity.m_58901_()) { @@ -78,7 +78,7 @@ } else { CompoundTag compoundtag = this.f_187609_.get(p_62932_); if (compoundtag != null) { -@@ -445,7 +_,7 @@ +@@ -455,7 +_,7 @@ p_187974_.accept((p_187968_, p_187969_, p_187970_) -> { BlockEntity blockentity = this.m_5685_(p_187968_, LevelChunk.EntityCreationType.IMMEDIATE); if (blockentity != null && p_187970_ != null && blockentity.m_58903_() == p_187969_) { @@ -87,16 +87,7 @@ } }); -@@ -472,7 +_,7 @@ - - public Stream m_6267_() { - return StreamSupport.stream(BlockPos.m_121976_(this.f_187604_.m_45604_(), this.m_141937_(), this.f_187604_.m_45605_(), this.f_187604_.m_45608_(), this.m_151558_() - 1, this.f_187604_.m_45609_()).spliterator(), false).filter((p_187990_) -> { -- return this.m_8055_(p_187990_).m_60791_() != 0; -+ return this.m_8055_(p_187990_).getLightEmission(m_62953_(), p_187990_) != 0; - }); - } - -@@ -560,6 +_,7 @@ +@@ -564,6 +_,7 @@ } public void m_187957_() { @@ -104,7 +95,7 @@ this.f_187610_.values().forEach(BlockEntity::m_7651_); this.f_187610_.clear(); this.f_156362_.values().forEach((p_187966_) -> { -@@ -569,6 +_,7 @@ +@@ -573,6 +_,7 @@ } public void m_156369_() { @@ -112,8 +103,8 @@ this.f_187610_.values().forEach((p_187988_) -> { Level level = this.f_62776_; if (level instanceof ServerLevel serverlevel) { -@@ -625,6 +_,41 @@ - this.f_196848_ = p_196865_; +@@ -621,6 +_,41 @@ + return new LevelChunk.BoundTickingBlockEntity<>(p_156376_, p_156377_); } + // FORGE START @@ -154,7 +145,7 @@ class BoundTickingBlockEntity implements TickingBlockEntity { private final T f_156428_; private final BlockEntityTicker f_156429_; -@@ -641,6 +_,7 @@ +@@ -637,6 +_,7 @@ if (LevelChunk.this.m_156410_(blockpos)) { try { ProfilerFiller profilerfiller = LevelChunk.this.f_62776_.m_46473_(); @@ -162,7 +153,7 @@ profilerfiller.m_6521_(this::m_142280_); BlockState blockstate = LevelChunk.this.m_8055_(blockpos); if (this.f_156428_.m_58903_().m_155262_(blockstate)) { -@@ -656,6 +_,12 @@ +@@ -652,6 +_,12 @@ CrashReport crashreport = CrashReport.m_127521_(throwable, "Ticking block entity"); CrashReportCategory crashreportcategory = crashreport.m_127514_("Block entity being ticked"); this.f_156428_.m_58886_(crashreportcategory); @@ -175,7 +166,7 @@ throw new ReportedException(crashreport); } } -@@ -684,6 +_,34 @@ +@@ -680,6 +_,34 @@ IMMEDIATE, QUEUED, CHECK; diff --git a/patches/minecraft/net/minecraft/world/level/chunk/ProtoChunk.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/ProtoChunk.java.patch deleted file mode 100644 index 868b149a22..0000000000 --- a/patches/minecraft/net/minecraft/world/level/chunk/ProtoChunk.java.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/net/minecraft/world/level/chunk/ProtoChunk.java -+++ b/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -123,13 +_,13 @@ - if (this.f_187612_[l].m_188008_() && p_63218_.m_60713_(Blocks.f_50016_)) { - return p_63218_; - } else { -- if (p_63218_.m_60791_() > 0) { -+ if (p_63218_.getLightEmission(this, p_63217_) > 0) { - this.f_63158_.add(new BlockPos((i & 15) + this.m_7697_().m_45604_(), j, (k & 15) + this.m_7697_().m_45605_())); - } - - LevelChunkSection levelchunksection = this.m_183278_(l); - BlockState blockstate = levelchunksection.m_62986_(i & 15, j & 15, k & 15, p_63218_); -- if (this.f_63153_.m_62427_(ChunkStatus.f_62322_) && p_63218_ != blockstate && (p_63218_.m_60739_(this, p_63217_) != blockstate.m_60739_(this, p_63217_) || p_63218_.m_60791_() != blockstate.m_60791_() || p_63218_.m_60787_() || blockstate.m_60787_())) { -+ if (this.f_63153_.m_62427_(ChunkStatus.f_62322_) && p_63218_ != blockstate && (p_63218_.m_60739_(this, p_63217_) != blockstate.m_60739_(this, p_63217_) || p_63218_.getLightEmission(this, p_63217_) != blockstate.getLightEmission(this, p_63217_) || p_63218_.m_60787_() || blockstate.m_60787_())) { - this.f_63151_.m_7174_(p_63217_); - } - diff --git a/patches/minecraft/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch index 1d9d208855..3092222307 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/storage/ChunkSerializer.java.patch @@ -1,23 +1,14 @@ --- a/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -158,6 +_,7 @@ +@@ -159,6 +_,7 @@ return BuiltInRegistries.f_257020_.m_6612_(ResourceLocation.m_135820_(p_258990_)); }, p_188233_); - chunkaccess = new LevelChunk(p_188231_.m_6018_(), p_188233_, upgradedata, levelchunkticks, levelchunkticks1, j1, alevelchunksection, m_196890_(p_188231_, p_188234_), blendingdata); + chunkaccess = new LevelChunk(p_188231_.m_6018_(), p_188233_, upgradedata, levelchunkticks, levelchunkticks1, k1, alevelchunksection, m_196890_(p_188231_, p_188234_), blendingdata); + if (p_188234_.m_128441_("ForgeCaps")) ((LevelChunk)chunkaccess).readCapsFromNBT(p_188234_.m_128469_("ForgeCaps")); } else { ProtoChunkTicks protochunkticks = ProtoChunkTicks.m_193302_(p_188234_.m_128437_("block_ticks", 10), (p_258992_) -> { return BuiltInRegistries.f_256975_.m_6612_(ResourceLocation.m_135820_(p_258992_)); -@@ -182,7 +_,7 @@ - boolean flag3 = chunkstatus.m_62427_(ChunkStatus.f_62323_) || belowzeroretrogen != null && belowzeroretrogen.m_188466_().m_62427_(ChunkStatus.f_62323_); - if (!flag && flag3) { - for(BlockPos blockpos : BlockPos.m_121976_(p_188233_.m_45604_(), p_188231_.m_141937_(), p_188233_.m_45605_(), p_188233_.m_45608_(), p_188231_.m_151558_() - 1, p_188233_.m_45609_())) { -- if (chunkaccess.m_8055_(blockpos).m_60791_() != 0) { -+ if (chunkaccess.m_8055_(blockpos).getLightEmission(chunkaccess, blockpos) != 0) { - protochunk.m_63277_(blockpos); - } - } -@@ -221,6 +_,7 @@ +@@ -212,6 +_,7 @@ } if (chunkstatus$chunktype == ChunkStatus.ChunkType.LEVELCHUNK) { @@ -25,7 +16,7 @@ return new ImposterProtoChunk((LevelChunk)chunkaccess, false); } else { ProtoChunk protochunk1 = (ProtoChunk)chunkaccess; -@@ -257,6 +_,7 @@ +@@ -235,6 +_,7 @@ protochunk1.m_188186_(generationstep$carving, new CarvingMask(compoundtag4.m_128467_(s1), chunkaccess.m_141937_())); } @@ -33,13 +24,12 @@ return protochunk1; } } -@@ -363,6 +_,15 @@ +@@ -340,6 +_,14 @@ } compoundtag.m_128365_("CarvingMasks", compoundtag4); + } -+ else { -+ LevelChunk levelChunk = (LevelChunk) p_63456_; ++ else if (p_63456_ instanceof LevelChunk levelChunk){ + try { + final CompoundTag capTag = levelChunk.writeCapsToNBT(); + if (capTag != null) compoundtag.m_128365_("ForgeCaps", capTag); diff --git a/patches/minecraft/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch b/patches/minecraft/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch index ef712951ce..5b898ca4cf 100644 --- a/patches/minecraft/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch +++ b/patches/minecraft/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch @@ -1,22 +1,6 @@ --- a/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -102,6 +_,7 @@ - - this.f_64068_ = p_64080_.m_128471_("DragonKilled"); - this.f_64069_ = p_64080_.m_128471_("PreviouslyKilled"); -+ this.f_64071_ = !p_64080_.m_128471_("LegacyScanPerformed"); // Forge: fix MC-105080 - if (p_64080_.m_128471_("IsRespawning")) { - this.f_64073_ = DragonRespawnAnimation.START; - } -@@ -137,6 +_,7 @@ - - compoundtag.m_128379_("DragonKilled", this.f_64068_); - compoundtag.m_128379_("PreviouslyKilled", this.f_64069_); -+ compoundtag.m_128379_("LegacyScanPerformed", !this.f_64071_); // Forge: fix MC-105080 - if (this.f_64072_ != null) { - compoundtag.m_128365_("ExitPortalLocation", NbtUtils.m_129224_(this.f_64072_)); - } -@@ -518,6 +_,13 @@ +@@ -513,7 +_,14 @@ endcrystal.m_31052_((BlockPos)null); } } @@ -30,4 +14,5 @@ + public void removePlayer(ServerPlayer player) { + this.f_64060_.m_6539_(player); } - } + + @Nullable diff --git a/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch b/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch index d04074ad90..2a6f2b0e17 100644 --- a/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch +++ b/patches/minecraft/net/minecraft/world/level/entity/PersistentEntitySectionManager.java.patch @@ -9,7 +9,7 @@ + } + private boolean m_157538_(T p_157539_, boolean p_157540_) { -+ if (p_157539_ instanceof Entity entity && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinLevelEvent(entity, entity.f_19853_, p_157540_))) return false; ++ if (p_157539_ instanceof Entity entity && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinLevelEvent(entity, entity.m_9236_(), p_157540_))) return false; + return addEntityWithoutEvent(p_157539_, p_157540_); + } + diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch index 20eb487b0a..54aa49358c 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java +++ b/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java -@@ -130,6 +_,6 @@ +@@ -128,6 +_,6 @@ } private EntityType m_225153_(RandomSource p_225154_) { diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java.patch index 9389bac6a1..cde7ef687d 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java.patch @@ -1,14 +1,17 @@ --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureProcessor.java -@@ -8,9 +_,36 @@ +@@ -7,12 +_,40 @@ + import net.minecraft.world.level.ServerLevelAccessor; public abstract class StructureProcessor { ++ /** ++ * @deprecated Forge: Use {@link #process(LevelReader, BlockPos, BlockPos, StructureTemplate.StructureBlockInfo, StructureTemplate.StructureBlockInfo, StructurePlaceSettings, StructureTemplate)} instead. ++ */ ++ @Deprecated @Nullable -- public abstract StructureTemplate.StructureBlockInfo m_7382_(LevelReader p_74416_, BlockPos p_74417_, BlockPos p_74418_, StructureTemplate.StructureBlockInfo p_74419_, StructureTemplate.StructureBlockInfo p_74420_, StructurePlaceSettings p_74421_); -+ @Deprecated //Forge: Use process below, with the Template context -+ public StructureTemplate.StructureBlockInfo m_7382_(LevelReader p_74416_, BlockPos p_74417_, BlockPos p_74418_, StructureTemplate.StructureBlockInfo p_74419_, StructureTemplate.StructureBlockInfo p_74420_, StructurePlaceSettings p_74421_) { -+ return p_74420_; -+ } + public StructureTemplate.StructureBlockInfo m_7382_(LevelReader p_74416_, BlockPos p_74417_, BlockPos p_74418_, StructureTemplate.StructureBlockInfo p_74419_, StructureTemplate.StructureBlockInfo p_74420_, StructurePlaceSettings p_74421_) { + return p_74420_; + } protected abstract StructureProcessorType m_6953_(); + @@ -36,5 +39,5 @@ + return entityInfo; + } - public void m_271697_(LevelAccessor p_273167_, BlockPos p_273713_, BlockPos p_272620_, StructurePlaceSettings p_272830_, List p_273019_) { - } + public List m_276976_(ServerLevelAccessor p_278247_, BlockPos p_277590_, BlockPos p_277935_, List p_278070_, List p_278053_, StructurePlaceSettings p_277497_) { + return p_278053_; diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch index ccdf0cf22d..60bf55bee7 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -@@ -200,6 +_,10 @@ +@@ -201,6 +_,10 @@ return m_74593_(p_74565_, p_74564_.m_74401_(), p_74564_.m_74404_(), p_74564_.m_74407_()); } @@ -11,7 +11,7 @@ public boolean m_230328_(ServerLevelAccessor p_230329_, BlockPos p_230330_, BlockPos p_230331_, StructurePlaceSettings p_230332_, RandomSource p_230333_, int p_230334_) { if (this.f_74482_.isEmpty()) { return false; -@@ -217,7 +_,7 @@ +@@ -218,7 +_,7 @@ int i1 = Integer.MIN_VALUE; int j1 = Integer.MIN_VALUE; @@ -20,7 +20,7 @@ BlockPos blockpos = structuretemplate$structureblockinfo.f_74675_; if (boundingbox == null || boundingbox.m_71051_(blockpos)) { FluidState fluidstate = p_230332_.m_74413_() ? p_230329_.m_6425_(blockpos) : null; -@@ -329,7 +_,7 @@ +@@ -330,7 +_,7 @@ } if (!p_230332_.m_74408_()) { @@ -29,29 +29,33 @@ } return true; -@@ -358,14 +_,19 @@ +@@ -359,7 +_,15 @@ }); } -+ @Deprecated //Use Forge version - public static List m_74517_(LevelAccessor p_74518_, BlockPos p_74519_, BlockPos p_74520_, StructurePlaceSettings p_74521_, List p_74522_) { -+ return processBlockInfos(p_74518_, p_74519_, p_74520_, p_74521_, p_74522_, null); ++ /** ++ * @deprecated Forge: Use {@link #processBlockInfos(ServerLevelAccessor, BlockPos, BlockPos, StructurePlaceSettings, List, StructureTemplate)} instead. ++ */ ++ @Deprecated + public static List m_74517_(ServerLevelAccessor p_278297_, BlockPos p_74519_, BlockPos p_74520_, StructurePlaceSettings p_74521_, List p_74522_) { ++ return processBlockInfos(p_278297_, p_74519_, p_74520_, p_74521_, p_74522_, null); + } + -+ public static List processBlockInfos(LevelAccessor p_74518_, BlockPos p_74519_, BlockPos p_74520_, StructurePlaceSettings p_74521_, List p_74522_, @Nullable StructureTemplate template) { - List list = Lists.newArrayList(); ++ public static List processBlockInfos(ServerLevelAccessor p_278297_, BlockPos p_74519_, BlockPos p_74520_, StructurePlaceSettings p_74521_, List p_74522_, @Nullable StructureTemplate template) { + List list = new ArrayList<>(); + List list1 = new ArrayList<>(); - for(StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo : p_74522_) { +@@ -367,7 +_,7 @@ BlockPos blockpos = m_74563_(p_74521_, structuretemplate$structureblockinfo.f_74675_).m_121955_(p_74519_); StructureTemplate.StructureBlockInfo structuretemplate$structureblockinfo1 = new StructureTemplate.StructureBlockInfo(blockpos, structuretemplate$structureblockinfo.f_74676_, structuretemplate$structureblockinfo.f_74677_ != null ? structuretemplate$structureblockinfo.f_74677_.m_6426_() : null); -- for(Iterator iterator = p_74521_.m_74411_().iterator(); structuretemplate$structureblockinfo1 != null && iterator.hasNext(); structuretemplate$structureblockinfo1 = iterator.next().m_7382_(p_74518_, p_74519_, p_74520_, structuretemplate$structureblockinfo, structuretemplate$structureblockinfo1, p_74521_)) { -+ for(Iterator iterator = p_74521_.m_74411_().iterator(); structuretemplate$structureblockinfo1 != null && iterator.hasNext(); structuretemplate$structureblockinfo1 = iterator.next().process(p_74518_, p_74519_, p_74520_, structuretemplate$structureblockinfo, structuretemplate$structureblockinfo1, p_74521_, template)) { +- for(Iterator iterator = p_74521_.m_74411_().iterator(); structuretemplate$structureblockinfo1 != null && iterator.hasNext(); structuretemplate$structureblockinfo1 = iterator.next().m_7382_(p_278297_, p_74519_, p_74520_, structuretemplate$structureblockinfo, structuretemplate$structureblockinfo1, p_74521_)) { ++ for(Iterator iterator = p_74521_.m_74411_().iterator(); structuretemplate$structureblockinfo1 != null && iterator.hasNext(); structuretemplate$structureblockinfo1 = iterator.next().process(p_278297_, p_74519_, p_74520_, structuretemplate$structureblockinfo, structuretemplate$structureblockinfo1, p_74521_, template)) { } if (structuretemplate$structureblockinfo1 != null) { -@@ -380,13 +_,29 @@ - return list; +@@ -383,13 +_,29 @@ + return list1; } - private void m_74523_(ServerLevelAccessor p_74524_, BlockPos p_74525_, Mirror p_74526_, Rotation p_74527_, BlockPos p_74528_, @Nullable BoundingBox p_74529_, boolean p_74530_) { @@ -86,7 +90,7 @@ ListTag listtag = new ListTag(); listtag.add(DoubleTag.m_128500_(vec31.f_82479_)); listtag.add(DoubleTag.m_128500_(vec31.f_82480_)); -@@ -394,10 +_,10 @@ +@@ -397,10 +_,10 @@ compoundtag.m_128365_("Pos", listtag); compoundtag.m_128473_("UUID"); m_74543_(p_74524_, compoundtag).ifPresent((p_275190_) -> { diff --git a/patches/minecraft/net/minecraft/world/level/lighting/BlockLightEngine.java.patch b/patches/minecraft/net/minecraft/world/level/lighting/BlockLightEngine.java.patch index 58d64ebea4..66618fd029 100644 --- a/patches/minecraft/net/minecraft/world/level/lighting/BlockLightEngine.java.patch +++ b/patches/minecraft/net/minecraft/world/level/lighting/BlockLightEngine.java.patch @@ -1,12 +1,20 @@ --- a/net/minecraft/world/level/lighting/BlockLightEngine.java +++ b/net/minecraft/world/level/lighting/BlockLightEngine.java -@@ -117,4 +_,9 @@ - this.f_75632_.m_75785_(); - this.m_75576_(Long.MAX_VALUE, p_75502_.m_121878_(), 15 - p_75503_, true); +@@ -105,7 +_,7 @@ } -+ -+ @Override -+ public int queuedUpdateSize() { -+ return f_75632_.queuedUpdateSize(); -+ } - } + + private int m_284436_(long p_285243_, BlockState p_284973_) { +- int i = p_284973_.m_60791_(); ++ int i = p_284973_.getLightEmission(f_283884_.m_7653_(), f_75489_); + return i > 0 && this.f_283849_.m_284382_(SectionPos.m_123235_(p_285243_)) ? i : 0; + } + +@@ -114,7 +_,7 @@ + LightChunk lightchunk = this.f_283884_.m_6196_(p_285274_.f_45578_, p_285274_.f_45579_); + if (lightchunk != null) { + lightchunk.m_284254_((p_285266_, p_285452_) -> { +- int i = p_285452_.m_60791_(); ++ int i = p_285452_.getLightEmission(f_283884_.m_7653_(), p_285266_); + this.m_284218_(p_285266_.m_121878_(), LightEngine.QueueEntry.m_284185_(i, m_284265_(p_285452_))); + }); + } diff --git a/patches/minecraft/net/minecraft/world/level/lighting/DynamicGraphMinFixedPoint.java.patch b/patches/minecraft/net/minecraft/world/level/lighting/DynamicGraphMinFixedPoint.java.patch deleted file mode 100644 index 64cb490429..0000000000 --- a/patches/minecraft/net/minecraft/world/level/lighting/DynamicGraphMinFixedPoint.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/lighting/DynamicGraphMinFixedPoint.java -+++ b/net/minecraft/world/level/lighting/DynamicGraphMinFixedPoint.java -@@ -229,4 +_,8 @@ - protected abstract void m_7351_(long p_75552_, int p_75553_); - - protected abstract int m_6359_(long p_75590_, long p_75591_, int p_75592_); -+ -+ protected int queuedUpdateSize() { -+ return f_75539_.size(); -+ } - } diff --git a/patches/minecraft/net/minecraft/world/level/lighting/LayerLightEngine.java.patch b/patches/minecraft/net/minecraft/world/level/lighting/LayerLightEngine.java.patch deleted file mode 100644 index d08eff250f..0000000000 --- a/patches/minecraft/net/minecraft/world/level/lighting/LayerLightEngine.java.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- a/net/minecraft/world/level/lighting/LayerLightEngine.java -+++ b/net/minecraft/world/level/lighting/LayerLightEngine.java -@@ -214,4 +_,6 @@ - long i = SectionPos.m_123240_(SectionPos.m_123209_(p_75700_.f_45578_, 0, p_75700_.f_45579_)); - this.f_75632_.m_75782_(i, p_75701_); - } -+ -+ public abstract int queuedUpdateSize(); - } diff --git a/patches/minecraft/net/minecraft/world/level/lighting/LightEngine.java.patch b/patches/minecraft/net/minecraft/world/level/lighting/LightEngine.java.patch new file mode 100644 index 0000000000..fa7a1e010e --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/lighting/LightEngine.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/level/lighting/LightEngine.java ++++ b/net/minecraft/world/level/lighting/LightEngine.java +@@ -44,7 +_,7 @@ + if (p_285372_ == p_285110_) { + return false; + } else { +- return p_285372_.m_60739_(p_285159_, p_284985_) != p_285110_.m_60739_(p_285159_, p_284985_) || p_285372_.m_60791_() != p_285110_.m_60791_() || p_285372_.m_60787_() || p_285110_.m_60787_(); ++ return p_285372_.m_60739_(p_285159_, p_284985_) != p_285110_.m_60739_(p_285159_, p_284985_) || p_285372_.getLightEmission(p_285159_, p_284985_) != p_285110_.m_60739_(p_285159_, p_284985_) || p_285372_.m_60787_() || p_285110_.m_60787_(); + } + } + diff --git a/patches/minecraft/net/minecraft/world/level/lighting/SkyLightEngine.java.patch b/patches/minecraft/net/minecraft/world/level/lighting/SkyLightEngine.java.patch deleted file mode 100644 index 953eac68a9..0000000000 --- a/patches/minecraft/net/minecraft/world/level/lighting/SkyLightEngine.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/world/level/lighting/SkyLightEngine.java -+++ b/net/minecraft/world/level/lighting/SkyLightEngine.java -@@ -175,4 +_,9 @@ - public String m_6647_(long p_75853_) { - return super.m_6647_(p_75853_) + (this.f_75632_.m_75890_(p_75853_) ? "*" : ""); - } -+ -+ @Override -+ public int queuedUpdateSize() { -+ return 0; -+ } - } diff --git a/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch b/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch index 6c9e206a2e..bb5cfeaabf 100644 --- a/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch +++ b/patches/minecraft/net/minecraft/world/level/material/FlowingFluid.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/material/FlowingFluid.java +++ b/net/minecraft/world/level/material/FlowingFluid.java -@@ -158,7 +_,7 @@ +@@ -159,7 +_,7 @@ BlockState blockstate = p_256464_.m_8055_(blockpos); FluidState fluidstate = blockstate.m_60819_(); if (fluidstate.m_76152_().m_6212_(this) && this.m_76061_(direction, p_256464_, p_76037_, p_76038_, blockpos, blockstate)) { @@ -9,7 +9,7 @@ ++j; } -@@ -166,7 +_,7 @@ +@@ -167,7 +_,7 @@ } } @@ -17,8 +17,8 @@ + if (j >= 2) { BlockState blockstate1 = p_256464_.m_8055_(p_76037_.m_7495_()); FluidState fluidstate1 = blockstate1.m_60819_(); - if (blockstate1.m_60767_().m_76333_() || this.m_76096_(fluidstate1)) { -@@ -230,6 +_,15 @@ + if (blockstate1.m_280296_() || this.m_76096_(fluidstate1)) { +@@ -231,6 +_,15 @@ return this.m_5613_().m_76145_().m_61124_(f_75947_, Boolean.valueOf(p_76069_)); } diff --git a/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch b/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch index e351282071..65e83fe84f 100644 --- a/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch +++ b/patches/minecraft/net/minecraft/world/level/material/LavaFluid.java.patch @@ -8,7 +8,7 @@ + p_230572_.m_46597_(blockpos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_230572_, blockpos, p_230573_, Blocks.f_50083_.m_49966_())); return; } - } else if (blockstate.m_60767_().m_76334_()) { + } else if (blockstate.m_280555_()) { @@ -86,8 +_,8 @@ return; } @@ -36,7 +36,7 @@ + /** @deprecated Forge: use {@link LavaFluid#isFlammable(LevelReader,BlockPos,Direction)} instead */ + @Deprecated private boolean m_76245_(LevelReader p_76246_, BlockPos p_76247_) { - return p_76247_.m_123342_() >= p_76246_.m_141937_() && p_76247_.m_123342_() < p_76246_.m_151558_() && !p_76246_.m_46805_(p_76247_) ? false : p_76246_.m_8055_(p_76247_).m_60767_().m_76335_(); + return p_76247_.m_123342_() >= p_76246_.m_141937_() && p_76247_.m_123342_() < p_76246_.m_151558_() && !p_76246_.m_46805_(p_76247_) ? false : p_76246_.m_8055_(p_76247_).m_278200_(); } + private boolean isFlammable(LevelReader level, BlockPos pos, Direction face) { diff --git a/patches/minecraft/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch b/patches/minecraft/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch index 020802c621..fe54404d79 100644 --- a/patches/minecraft/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch +++ b/patches/minecraft/net/minecraft/world/level/pathfinder/BlockPathTypes.java.patch @@ -8,7 +8,7 @@ BLOCKED(-1.0F), OPEN(0.0F), WALKABLE(0.0F), -@@ -34,5 +_,17 @@ +@@ -35,5 +_,17 @@ public float m_77124_() { return this.f_77117_; diff --git a/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch b/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch index 90f4ec7826..53ebd04498 100644 --- a/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch +++ b/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -114,7 +_,7 @@ +@@ -112,7 +_,7 @@ BlockPathTypes blockpathtypes = this.m_77567_(this.f_77313_, p_77641_.f_77271_, p_77641_.f_77272_ + 1, p_77641_.f_77273_); BlockPathTypes blockpathtypes1 = this.m_77567_(this.f_77313_, p_77641_.f_77271_, p_77641_.f_77272_, p_77641_.f_77273_); if (this.f_77313_.m_21439_(blockpathtypes) >= 0.0F && blockpathtypes1 != BlockPathTypes.STICKY_HONEY) { @@ -9,7 +9,7 @@ } double d0 = this.m_142213_(new BlockPos(p_77641_.f_77271_, p_77641_.f_77272_, p_77641_.f_77273_)); -@@ -451,6 +_,11 @@ +@@ -453,6 +_,11 @@ if (l != 0 || j1 != 0) { p_77609_.m_122178_(i + l, j + i1, k + j1); BlockState blockstate = p_77608_.m_8055_(p_77609_); @@ -21,30 +21,30 @@ if (blockstate.m_60713_(Blocks.f_50128_) || blockstate.m_60713_(Blocks.f_50685_)) { return BlockPathTypes.DANGER_OTHER; } -@@ -472,6 +_,8 @@ +@@ -478,6 +_,8 @@ protected static BlockPathTypes m_77643_(BlockGetter p_77644_, BlockPos p_77645_) { BlockState blockstate = p_77644_.m_8055_(p_77645_); + BlockPathTypes type = blockstate.getBlockPathType(p_77644_, p_77645_, null); + if (type != null) return type; Block block = blockstate.m_60734_(); - Material material = blockstate.m_60767_(); if (blockstate.m_60795_()) { -@@ -486,6 +_,8 @@ + return BlockPathTypes.OPEN; +@@ -491,6 +_,8 @@ return BlockPathTypes.COCOA; - } else { + } else if (!blockstate.m_60713_(Blocks.f_50070_) && !blockstate.m_60713_(Blocks.f_152588_)) { FluidState fluidstate = p_77644_.m_6425_(p_77645_); -+ BlockPathTypes nonLoggableFluidPathType = fluidstate.getBlockPathType(p_77644_, p_77645_, null, false); -+ if (nonLoggableFluidPathType != null) return nonLoggableFluidPathType; ++ BlockPathTypes nonLoggableFluidPathType = fluidstate.getBlockPathType(p_77644_, p_77645_, null, false); ++ if (nonLoggableFluidPathType != null) return nonLoggableFluidPathType; if (fluidstate.m_205070_(FluidTags.f_13132_)) { return BlockPathTypes.LAVA; } else if (m_77622_(blockstate)) { -@@ -504,6 +_,8 @@ +@@ -510,6 +_,8 @@ if (!blockstate.m_60647_(p_77644_, p_77645_, PathComputationType.LAND)) { return BlockPathTypes.BLOCKED; } else { -+ BlockPathTypes loggableFluidPathType = fluidstate.getBlockPathType(p_77644_, p_77645_, null, true); -+ if (loggableFluidPathType != null) return loggableFluidPathType; ++ BlockPathTypes loggableFluidPathType = fluidstate.getBlockPathType(p_77644_, p_77645_, null, true); ++ if (loggableFluidPathType != null) return loggableFluidPathType; return fluidstate.m_205070_(FluidTags.f_13131_) ? BlockPathTypes.WATER : BlockPathTypes.OPEN; } } else { diff --git a/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch b/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch index cffbc32e7b..ea51b30606 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/LevelStorageSource.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/LevelStorageSource.java +++ b/net/minecraft/world/level/storage/LevelStorageSource.java -@@ -388,6 +_,19 @@ +@@ -439,6 +_,19 @@ return LevelStorageSource.this.m_230817_(this.f_230867_, LevelStorageSource.m_245503_(p_248747_, p_251873_, p_249187_, p_249736_)); } @@ -20,7 +20,7 @@ @Nullable public WorldDataConfiguration m_247706_() { this.m_78313_(); -@@ -404,6 +_,8 @@ +@@ -455,6 +_,8 @@ CompoundTag compoundtag1 = new CompoundTag(); compoundtag1.m_128365_("Data", compoundtag); @@ -29,7 +29,7 @@ try { File file2 = File.createTempFile("level", ".dat", file1); NbtIo.m_128944_(compoundtag1, file2); -@@ -418,6 +_,10 @@ +@@ -469,6 +_,10 @@ public Optional m_182514_() { return !this.f_78270_.m_13639_() ? Optional.empty() : Optional.of(this.f_230867_.m_230860_()); diff --git a/patches/minecraft/net/minecraft/world/level/storage/LevelSummary.java.patch b/patches/minecraft/net/minecraft/world/level/storage/LevelSummary.java.patch index 895950034d..4c355666f9 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/LevelSummary.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/LevelSummary.java.patch @@ -1,11 +1,13 @@ --- a/net/minecraft/world/level/storage/LevelSummary.java +++ b/net/minecraft/world/level/storage/LevelSummary.java -@@ -192,4 +_,8 @@ - return this.f_164922_; +@@ -193,6 +_,10 @@ } } -+ + + public boolean isLifecycleExperimental() { + return this.f_78344_.getLifecycle().equals(com.mojang.serialization.Lifecycle.experimental()); + } - } ++ + public static class SymlinkLevelSummary extends LevelSummary { + public SymlinkLevelSummary(String p_289942_, Path p_289953_) { + super((LevelSettings)null, (LevelVersion)null, p_289942_, false, false, false, p_289953_); diff --git a/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch b/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch index e333a90e95..3a4ecf6a34 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/PrimaryLevelData.java.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/world/level/storage/PrimaryLevelData.java +++ b/net/minecraft/world/level/storage/PrimaryLevelData.java -@@ -79,6 +_,7 @@ - private final Set f_78439_; +@@ -82,6 +_,7 @@ private boolean f_78440_; + private final Set f_276525_; private final TimerQueue f_78441_; + private boolean confirmedExperimentalWarning = false; - private PrimaryLevelData(@Nullable DataFixer p_249266_, int p_249857_, @Nullable CompoundTag p_249309_, boolean p_251525_, int p_249614_, int p_252310_, int p_250544_, float p_250495_, long p_250393_, long p_252085_, int p_250455_, int p_248981_, int p_249051_, boolean p_249672_, int p_249807_, boolean p_252350_, boolean p_250231_, boolean p_249788_, WorldBorder.Settings p_251494_, int p_249519_, int p_250649_, @Nullable UUID p_248892_, Set p_251898_, TimerQueue p_251119_, @Nullable CompoundTag p_248915_, CompoundTag p_252274_, LevelSettings p_248619_, WorldOptions p_251512_, PrimaryLevelData.SpecialWorldProperty p_251396_, Lifecycle p_252247_) { - this.f_78452_ = p_249266_; -@@ -124,7 +_,7 @@ - }).convert(NbtOps.f_128958_).getValue(); - return new PrimaryLevelData(p_78532_, p_78533_, p_78534_, p_78531_.get("WasModded").asBoolean(false), p_78531_.get("SpawnX").asInt(0), p_78531_.get("SpawnY").asInt(0), p_78531_.get("SpawnZ").asInt(0), p_78531_.get("SpawnAngle").asFloat(0.0F), i, p_78531_.get("DayTime").asLong(i), p_78536_.m_78389_(), p_78531_.get("clearWeatherTime").asInt(0), p_78531_.get("rainTime").asInt(0), p_78531_.get("raining").asBoolean(false), p_78531_.get("thunderTime").asInt(0), p_78531_.get("thundering").asBoolean(false), p_78531_.get("initialized").asBoolean(true), p_78531_.get("DifficultyLocked").asBoolean(false), WorldBorder.Settings.m_62037_(p_78531_, WorldBorder.f_61907_), p_78531_.get("WanderingTraderSpawnDelay").asInt(0), p_78531_.get("WanderingTraderSpawnChance").asInt(0), p_78531_.get("WanderingTraderId").read(UUIDUtil.f_235867_).result().orElse((UUID)null), p_78531_.get("ServerBrands").asStream().flatMap((p_78529_) -> { + private PrimaryLevelData(@Nullable DataFixer p_277859_, int p_277672_, @Nullable CompoundTag p_277888_, boolean p_278109_, int p_277714_, int p_278088_, int p_278037_, float p_277542_, long p_277414_, long p_277635_, int p_277595_, int p_277794_, int p_278007_, boolean p_277943_, int p_277674_, boolean p_277644_, boolean p_277749_, boolean p_278004_, WorldBorder.Settings p_277729_, int p_277856_, int p_278051_, @Nullable UUID p_277341_, Set p_277989_, Set p_277399_, TimerQueue p_277860_, @Nullable CompoundTag p_277936_, EndDragonFight.Data p_289764_, LevelSettings p_278064_, WorldOptions p_278072_, PrimaryLevelData.SpecialWorldProperty p_277548_, Lifecycle p_277915_) { + this.f_78452_ = p_277859_; +@@ -127,7 +_,7 @@ return p_78529_.asString().result().stream(); -- }).collect(Collectors.toCollection(Sets::newLinkedHashSet)), new TimerQueue<>(TimerCallbacks.f_82226_, p_78531_.get("ScheduledEvents").asStream()), (CompoundTag)p_78531_.get("CustomBossEvents").orElseEmptyMap().getValue(), compoundtag, p_78535_, p_251864_, p_250651_, p_78538_); -+ }).collect(Collectors.toCollection(Sets::newLinkedHashSet)), new TimerQueue<>(TimerCallbacks.f_82226_, p_78531_.get("ScheduledEvents").asStream()), (CompoundTag)p_78531_.get("CustomBossEvents").orElseEmptyMap().getValue(), compoundtag, p_78535_, p_251864_, p_250651_, p_78538_).withConfirmedWarning(p_78538_ != Lifecycle.stable() && p_78531_.get("confirmedExperimentalSettings").asBoolean(false)); + }).collect(Collectors.toCollection(Sets::newLinkedHashSet)), p_78531_.get("removed_features").asStream().flatMap((p_277335_) -> { + return p_277335_.asString().result().stream(); +- }).collect(Collectors.toSet()), new TimerQueue<>(TimerCallbacks.f_82226_, p_78531_.get("ScheduledEvents").asStream()), (CompoundTag)p_78531_.get("CustomBossEvents").orElseEmptyMap().getValue(), p_78531_.get("DragonFight").read(EndDragonFight.Data.f_289707_).resultOrPartial(f_78442_::error).orElse(EndDragonFight.Data.f_289709_), p_78535_, p_251864_, p_250651_, p_78538_); ++ }).collect(Collectors.toSet()), new TimerQueue<>(TimerCallbacks.f_82226_, p_78531_.get("ScheduledEvents").asStream()), (CompoundTag)p_78531_.get("CustomBossEvents").orElseEmptyMap().getValue(), p_78531_.get("DragonFight").read(EndDragonFight.Data.f_289707_).resultOrPartial(f_78442_::error).orElse(EndDragonFight.Data.f_289709_), p_78535_, p_251864_, p_250651_, p_78538_).withConfirmedWarning(p_78538_ != Lifecycle.stable() && p_78531_.get("confirmedExperimentalSettings").asBoolean(false)); } public CompoundTag m_6626_(RegistryAccess p_78543_, @Nullable CompoundTag p_78544_) { -@@ -198,6 +_,8 @@ +@@ -203,6 +_,8 @@ p_78547_.m_128362_("WanderingTraderId", this.f_78438_); } @@ -25,8 +25,8 @@ + p_78547_.m_128379_("confirmedExperimentalSettings", this.confirmedExperimentalWarning); } - public int m_6789_() { -@@ -468,6 +_,15 @@ + private static ListTag m_277055_(Set p_277880_) { +@@ -483,6 +_,15 @@ public LevelSettings m_5926_() { return this.f_78443_.m_46935_(); diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch index bd2369ae55..ca69dc3bc9 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/LootContext.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/level/storage/loot/LootContext.java +++ b/net/minecraft/world/level/storage/loot/LootContext.java -@@ -108,17 +_,47 @@ - return this.f_78909_; +@@ -88,15 +_,43 @@ + return new LootContext.VisitedEntry<>(LootDataType.f_278496_, p_279163_); } + // ============================== FORGE START ============================== @@ -11,45 +11,41 @@ + + private ResourceLocation queriedLootTableId; + -+ private LootContext(RandomSource rand, float luckIn, ServerLevel worldIn, Function lootTableManagerIn, Function p_i225885_5_, Map, Object> parametersIn, Map conditionsIn, ResourceLocation queriedLootTableId) { -+ this(rand, luckIn, worldIn, lootTableManagerIn, p_i225885_5_, parametersIn, conditionsIn); -+ if (queriedLootTableId != null) this.queriedLootTableId = queriedLootTableId; ++ private LootContext(LootParams p_287722_, RandomSource p_287702_, LootDataResolver p_287619_, ResourceLocation queriedLootTableId) { ++ this(p_287722_, p_287702_, p_287619_); ++ this.queriedLootTableId = queriedLootTableId; + } + + public void setQueriedLootTableId(ResourceLocation queriedLootTableId) { + if (this.queriedLootTableId == null && queriedLootTableId != null) this.queriedLootTableId = queriedLootTableId; + } ++ + public ResourceLocation getQueriedLootTableId() { -+ return this.queriedLootTableId == null? net.minecraftforge.common.loot.LootTableIdCondition.UNKNOWN_LOOT_TABLE : this.queriedLootTableId; ++ return this.queriedLootTableId == null ? net.minecraftforge.common.loot.LootTableIdCondition.UNKNOWN_LOOT_TABLE : this.queriedLootTableId; + } + // =============================== FORGE END =============================== + public static class Builder { - private final ServerLevel f_78955_; - private final Map, Object> f_78956_ = Maps.newIdentityHashMap(); - private final Map f_78957_ = Maps.newHashMap(); + private final LootParams f_78956_; + @Nullable private RandomSource f_78958_; - private float f_78959_; + private ResourceLocation queriedLootTableId; // Forge: correctly pass around loot table ID with copy constructor - public Builder(ServerLevel p_78961_) { - this.f_78955_ = p_78961_; + public Builder(LootParams p_287628_) { + this.f_78956_ = p_287628_; } + public Builder(LootContext context) { -+ this.f_78955_ = context.f_78909_; -+ this.f_78956_.putAll(context.f_78914_); -+ this.f_78957_.putAll(context.f_78915_); ++ this.f_78956_ = context.f_78914_; + this.f_78958_ = context.f_78907_; -+ this.f_78959_ = context.f_78908_; + this.queriedLootTableId = context.queriedLootTableId; + } + - public LootContext.Builder m_230911_(RandomSource p_230912_) { - this.f_78958_ = p_230912_; + public LootContext.Builder m_78965_(long p_78966_) { + if (p_78966_ != 0L) { + this.f_78958_ = RandomSource.m_216335_(p_78966_); +@@ -105,6 +_,11 @@ return this; -@@ -189,9 +_,14 @@ - return (T)this.f_78956_.get(p_78983_); } + public LootContext.Builder withQueriedLootTableId(ResourceLocation queriedLootTableId) { @@ -57,23 +53,19 @@ + return this; + } + - public LootContext m_78975_(LootContextParamSet p_78976_) { - Set> set = Sets.difference(this.f_78956_.keySet(), p_78976_.m_81398_()); -- if (!set.isEmpty()) { -+ if (false && !set.isEmpty()) { // Forge: Allow mods to pass custom loot parameters (not part of the vanilla loot table) to the loot context. - throw new IllegalArgumentException("Parameters not allowed in this parameter set: " + set); - } else { - Set> set1 = Sets.difference(p_78976_.m_81394_(), this.f_78956_.keySet()); -@@ -204,7 +_,7 @@ - } - - MinecraftServer minecraftserver = this.f_78955_.m_7654_(); -- return new LootContext(randomsource, this.f_78959_, this.f_78955_, minecraftserver.m_129898_()::m_79217_, minecraftserver.m_129899_()::m_79252_, this.f_78956_, this.f_78957_); -+ return new LootContext(randomsource, this.f_78959_, this.f_78955_, minecraftserver.m_129898_()::m_79217_, minecraftserver.m_129899_()::m_79252_, this.f_78956_, this.f_78957_, this.queriedLootTableId); - } - } + public ServerLevel m_78962_() { + return this.f_78956_.m_287182_(); } -@@ -231,6 +_,11 @@ +@@ -121,7 +_,7 @@ + randomsource = serverlevel.m_213780_(); + } + +- return new LootContext(this.f_78956_, randomsource, minecraftserver.m_278653_()); ++ return new LootContext(this.f_78956_, randomsource, minecraftserver.m_278653_(), queriedLootTableId); + } + } + +@@ -141,6 +_,11 @@ public LootContextParam m_79003_() { return this.f_78995_; diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/LootDataManager.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/LootDataManager.java.patch new file mode 100644 index 0000000000..b079d0dfda --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/LootDataManager.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/level/storage/loot/LootDataManager.java ++++ b/net/minecraft/world/level/storage/loot/LootDataManager.java +@@ -53,7 +_,7 @@ + Map map1 = new HashMap<>(); + SimpleJsonResourceReloadListener.m_278771_(p_279441_, p_279205_.m_278624_(), p_279205_.m_278857_(), map1); + map1.forEach((p_279416_, p_279151_) -> { +- p_279205_.m_278763_(p_279416_, p_279151_).ifPresent((p_279295_) -> { ++ p_279205_.deserialize(p_279416_, p_279151_, p_279441_).ifPresent((p_279295_) -> { + map.put(p_279416_, p_279295_); + }); + }); diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/LootDataType.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/LootDataType.java.patch new file mode 100644 index 0000000000..7a1e4e6ae9 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/LootDataType.java.patch @@ -0,0 +1,54 @@ +--- a/net/minecraft/world/level/storage/loot/LootDataType.java ++++ b/net/minecraft/world/level/storage/loot/LootDataType.java +@@ -16,13 +_,13 @@ + private static final Logger f_278425_ = LogUtils.getLogger(); + public static final LootDataType f_278407_ = new LootDataType<>(Deserializers.m_78798_().create(), m_278813_(LootItemCondition.class, LootDataManager::m_278755_), "predicates", m_278693_()); + public static final LootDataType f_278496_ = new LootDataType<>(Deserializers.m_78799_().create(), m_278813_(LootItemFunction.class, LootDataManager::m_278704_), "item_modifiers", m_278693_()); +- public static final LootDataType f_278413_ = new LootDataType<>(Deserializers.m_78800_().create(), m_278629_(LootTable.class), "loot_tables", m_278846_()); ++ public static final LootDataType f_278413_ = new LootDataType<>(Deserializers.m_78800_().create(), net.minecraftforge.common.ForgeHooks::getLootTableDeserializer, "loot_tables", m_278846_()); + private final Gson f_278508_; +- private final BiFunction> f_278485_; ++ private final org.apache.commons.lang3.function.TriFunction> f_278485_; + private final String f_278462_; + private final LootDataType.Validator f_278443_; + +- private LootDataType(Gson p_279334_, BiFunction>> p_279478_, String p_279433_, LootDataType.Validator p_279363_) { ++ private LootDataType(Gson p_279334_, BiFunction>> p_279478_, String p_279433_, LootDataType.Validator p_279363_) { + this.f_278508_ = p_279334_; + this.f_278462_ = p_279433_; + this.f_278443_ = p_279363_; +@@ -41,17 +_,17 @@ + this.f_278443_.m_278714_(p_279366_, p_279106_, p_279124_); + } + +- public Optional m_278763_(ResourceLocation p_279253_, JsonElement p_279330_) { +- return this.f_278485_.apply(p_279253_, p_279330_); ++ public Optional deserialize(ResourceLocation p_279253_, JsonElement p_279330_, net.minecraft.server.packs.resources.ResourceManager resourceManager) { ++ return this.f_278485_.apply(p_279253_, p_279330_, resourceManager); + } + + public static Stream> m_278779_() { + return Stream.of(f_278407_, f_278496_, f_278413_); + } + +- private static BiFunction>> m_278629_(Class p_279251_) { ++ private static BiFunction>> m_278629_(Class p_279251_) { + return (p_279398_, p_279358_) -> { +- return (p_279297_, p_279222_) -> { ++ return (p_279297_, p_279222_, resourceManager) -> { + try { + return Optional.of(p_279398_.fromJson(p_279222_, p_279251_)); + } catch (Exception exception) { +@@ -62,10 +_,10 @@ + }; + } + +- private static BiFunction>> m_278813_(Class p_279337_, Function p_279252_) { ++ private static BiFunction>> m_278813_(Class p_279337_, Function p_279252_) { + Class oclass = (Class)p_279337_.arrayType(); + return (p_279462_, p_279351_) -> { +- return (p_279495_, p_279409_) -> { ++ return (p_279495_, p_279409_, resourceManager) -> { + try { + if (p_279409_.isJsonArray()) { + T[] at = (T[])((Object[])p_279462_.fromJson(p_279409_, oclass)); diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/LootParams.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/LootParams.java.patch new file mode 100644 index 0000000000..5441845927 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/LootParams.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/level/storage/loot/LootParams.java ++++ b/net/minecraft/world/level/storage/loot/LootParams.java +@@ -124,7 +_,7 @@ + + public LootParams m_287235_(LootContextParamSet p_287701_) { + Set> set = Sets.difference(this.f_286945_.keySet(), p_287701_.m_81398_()); +- if (!set.isEmpty()) { ++ if (false && !set.isEmpty()) { // Forge: Allow mods to pass custom loot parameters (not part of the vanilla loot table) to the loot context. + throw new IllegalArgumentException("Parameters not allowed in this parameter set: " + set); + } else { + Set> set1 = Sets.difference(p_287701_.m_81394_(), this.f_286945_.keySet()); diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/LootPool.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/LootPool.java.patch index 86525e895c..55da5a1bd8 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/LootPool.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/LootPool.java.patch @@ -1,24 +1,6 @@ --- a/net/minecraft/world/level/storage/loot/LootPool.java +++ b/net/minecraft/world/level/storage/loot/LootPool.java -@@ -31,6 +_,7 @@ - import org.apache.commons.lang3.mutable.MutableInt; - - public class LootPool { -+ private final String name; - final LootPoolEntryContainer[] f_79023_; - final LootItemCondition[] f_79024_; - private final Predicate f_79025_; -@@ -39,7 +_,8 @@ - NumberProvider f_79028_; - NumberProvider f_79029_; - -- LootPool(LootPoolEntryContainer[] p_165128_, LootItemCondition[] p_165129_, LootItemFunction[] p_165130_, NumberProvider p_165131_, NumberProvider p_165132_) { -+ LootPool(LootPoolEntryContainer[] p_165128_, LootItemCondition[] p_165129_, LootItemFunction[] p_165130_, NumberProvider p_165131_, NumberProvider p_165132_, String name) { -+ this.name = name; - this.f_79023_ = p_165128_; - this.f_79024_ = p_165129_; - this.f_79025_ = LootItemConditions.m_81834_(p_165129_); -@@ -112,6 +_,20 @@ +@@ -112,6 +_,19 @@ this.f_79028_.m_6169_(p_79052_.m_79365_(".rolls")); this.f_79029_.m_6169_(p_79052_.m_79365_(".bonusRolls")); } @@ -30,7 +12,6 @@ + if (this.isFrozen()) + throw new RuntimeException("Attempted to modify LootPool after being frozen!"); + } -+ public String getName(){ return this.name; } + public NumberProvider getRolls() { return this.f_79028_; } + public NumberProvider getBonusRolls() { return this.f_79029_; } + public void setRolls (NumberProvider v){ checkFrozen(); this.f_79028_ = v; } @@ -47,36 +28,3 @@ public LootPool.Builder m_165133_(NumberProvider p_165134_) { this.f_79070_ = p_165134_; -@@ -153,11 +_,16 @@ - return this; - } - -+ public LootPool.Builder name(String name) { -+ this.name = name; -+ return this; -+ } -+ - public LootPool m_79082_() { - if (this.f_79070_ == null) { - throw new IllegalArgumentException("Rolls not set"); - } else { -- return new LootPool(this.f_79067_.toArray(new LootPoolEntryContainer[0]), this.f_79068_.toArray(new LootItemCondition[0]), this.f_79069_.toArray(new LootItemFunction[0]), this.f_79070_, this.f_79071_); -+ return new LootPool(this.f_79067_.toArray(new LootPoolEntryContainer[0]), this.f_79068_.toArray(new LootItemCondition[0]), this.f_79069_.toArray(new LootItemFunction[0]), this.f_79070_, this.f_79071_, name); - } - } - } -@@ -170,11 +_,13 @@ - LootItemFunction[] alootitemfunction = GsonHelper.m_13845_(jsonobject, "functions", new LootItemFunction[0], p_79092_, LootItemFunction[].class); - NumberProvider numberprovider = GsonHelper.m_13836_(jsonobject, "rolls", p_79092_, NumberProvider.class); - NumberProvider numberprovider1 = GsonHelper.m_13845_(jsonobject, "bonus_rolls", ConstantValue.m_165692_(0.0F), p_79092_, NumberProvider.class); -- return new LootPool(alootpoolentrycontainer, alootitemcondition, alootitemfunction, numberprovider, numberprovider1); -+ return new LootPool(alootpoolentrycontainer, alootitemcondition, alootitemfunction, numberprovider, numberprovider1, net.minecraftforge.common.ForgeHooks.readPoolName(jsonobject)); - } - - public JsonElement serialize(LootPool p_79094_, Type p_79095_, JsonSerializationContext p_79096_) { - JsonObject jsonobject = new JsonObject(); -+ if (p_79094_.name != null && !p_79094_.name.startsWith("custom#")) -+ jsonobject.add("name", p_79096_.serialize(p_79094_.name)); - jsonobject.add("rolls", p_79096_.serialize(p_79094_.f_79028_)); - jsonobject.add("bonus_rolls", p_79096_.serialize(p_79094_.f_79029_)); - jsonobject.add("entries", p_79096_.serialize(p_79094_.f_79023_)); diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/LootTable.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/LootTable.java.patch index 84b4e2d82b..b5db369099 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/LootTable.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/LootTable.java.patch @@ -1,38 +1,39 @@ --- a/net/minecraft/world/level/storage/loot/LootTable.java +++ b/net/minecraft/world/level/storage/loot/LootTable.java -@@ -35,13 +_,13 @@ - public static final LootTable f_79105_ = new LootTable(LootContextParamSets.f_81410_, new LootPool[0], new LootItemFunction[0]); - public static final LootContextParamSet f_79106_ = LootContextParamSets.f_81420_; +@@ -39,14 +_,14 @@ final LootContextParamSet f_79108_; + @Nullable + final ResourceLocation f_286958_; - final LootPool[] f_79109_; + private final List f_79109_; final LootItemFunction[] f_79110_; private final BiFunction f_79111_; - LootTable(LootContextParamSet p_79114_, LootPool[] p_79115_, LootItemFunction[] p_79116_) { - this.f_79108_ = p_79114_; -- this.f_79109_ = p_79115_; -+ this.f_79109_ = Lists.newArrayList(p_79115_); - this.f_79110_ = p_79116_; - this.f_79111_ = LootItemFunctions.m_80770_(p_79116_); + LootTable(LootContextParamSet p_287716_, @Nullable ResourceLocation p_287737_, LootPool[] p_287700_, LootItemFunction[] p_287663_) { + this.f_79108_ = p_287716_; + this.f_286958_ = p_287737_; +- this.f_79109_ = p_287700_; ++ this.f_79109_ = Lists.newArrayList(p_287700_); + this.f_79110_ = p_287663_; + this.f_79111_ = LootItemFunctions.m_80770_(p_287663_); } -@@ -81,6 +_,7 @@ - +@@ -98,6 +_,7 @@ + this.m_287190_(p_287704_, m_246283_(p_287704_.m_287182_(), p_287617_)); } + @Deprecated //Use other method or manually call ForgeHooks.modifyLoot public void m_79148_(LootContext p_79149_, Consumer p_79150_) { - this.m_79131_(p_79149_, m_246283_(p_79149_, p_79150_)); + this.m_79131_(p_79149_, m_246283_(p_79149_.m_78952_(), p_79150_)); } -@@ -88,6 +_,7 @@ - public ObjectArrayList m_230922_(LootContext p_230923_) { +@@ -113,6 +_,7 @@ + private ObjectArrayList m_230922_(LootContext p_230923_) { ObjectArrayList objectarraylist = new ObjectArrayList<>(); this.m_79148_(p_230923_, objectarraylist::add); + objectarraylist = net.minecraftforge.common.ForgeHooks.modifyLoot(this.getLootTableId(), objectarraylist, p_230923_); return objectarraylist; } -@@ -96,8 +_,8 @@ +@@ -121,8 +_,8 @@ } public void m_79136_(ValidationContext p_79137_) { @@ -43,7 +44,7 @@ } for(int j = 0; j < this.f_79110_.length; ++j) { -@@ -179,6 +_,48 @@ +@@ -205,6 +_,26 @@ return new LootTable.Builder(); } @@ -65,35 +66,13 @@ + this.lootTableId = java.util.Objects.requireNonNull(id); + } + public ResourceLocation getLootTableId() { return this.lootTableId; } -+ -+ public LootPool getPool(String name) { -+ return f_79109_.stream().filter(e -> name.equals(e.getName())).findFirst().orElse(null); -+ } -+ -+ public LootPool removePool(String name) { -+ checkFrozen(); -+ for (LootPool pool : this.f_79109_) { -+ if (name.equals(pool.getName())) { -+ this.f_79109_.remove(pool); -+ return pool; -+ } -+ } -+ return null; -+ } -+ -+ public void addPool(LootPool pool) { -+ checkFrozen(); -+ if (f_79109_.stream().anyMatch(e -> e == pool || e.getName() != null && e.getName().equals(pool.getName()))) -+ throw new RuntimeException("Attempted to add a duplicate pool to loot table: " + pool.getName()); -+ this.f_79109_.add(pool); -+ } + //======================== FORGE END =============================================== + public static class Builder implements FunctionUserBuilder { private final List f_79156_ = Lists.newArrayList(); private final List f_79157_ = Lists.newArrayList(); -@@ -233,7 +_,7 @@ - } +@@ -278,7 +_,7 @@ + jsonobject.addProperty("random_sequence", p_79177_.f_286958_.toString()); } - if (p_79177_.f_79109_.length > 0) { diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/LootTables.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/LootTables.java.patch deleted file mode 100644 index 7b8005e2fe..0000000000 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/LootTables.java.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/net/minecraft/world/level/storage/loot/LootTables.java -+++ b/net/minecraft/world/level/storage/loot/LootTables.java -@@ -37,7 +_,8 @@ - - p_79214_.forEach((p_79198_, p_79199_) -> { - try { -- LootTable loottable = f_79189_.fromJson(p_79199_, LootTable.class); -+ net.minecraft.server.packs.resources.Resource res = p_79215_.m_213713_(getPreparedPath(p_79198_)).orElse(null); -+ LootTable loottable = net.minecraftforge.common.ForgeHooks.loadLootTable(f_79189_, p_79198_, p_79199_, res == null || !res.m_215506_().equals(net.minecraft.server.packs.repository.BuiltInPackSource.f_243761_), this); - builder.put(p_79198_, loottable); - } catch (Exception exception) { - f_79188_.error("Couldn't parse loot table {}", p_79198_, exception); diff --git a/patches/minecraft/net/minecraft/world/level/storage/loot/functions/SmeltItemFunction.java.patch b/patches/minecraft/net/minecraft/world/level/storage/loot/functions/SmeltItemFunction.java.patch index eaf30a375e..9a9dc0b566 100644 --- a/patches/minecraft/net/minecraft/world/level/storage/loot/functions/SmeltItemFunction.java.patch +++ b/patches/minecraft/net/minecraft/world/level/storage/loot/functions/SmeltItemFunction.java.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/world/level/storage/loot/functions/SmeltItemFunction.java +++ b/net/minecraft/world/level/storage/loot/functions/SmeltItemFunction.java -@@ -32,7 +_,7 @@ +@@ -31,7 +_,7 @@ + if (optional.isPresent()) { ItemStack itemstack = optional.get().m_8043_(p_81269_.m_78952_().m_9598_()); if (!itemstack.m_41619_()) { - ItemStack itemstack1 = itemstack.m_41777_(); -- itemstack1.m_41764_(p_81268_.m_41613_()); -+ itemstack1.m_41764_(p_81268_.m_41613_() * itemstack.m_41613_()); //Forge: Support smelting returning multiple - return itemstack1; +- return itemstack.m_255036_(p_81268_.m_41613_()); ++ return itemstack.m_255036_(p_81268_.m_41613_() * itemstack.m_41613_()); // Forge: Support smelting returning multiple } } + diff --git a/settings.gradle b/settings.gradle index 2b71cef5f1..89ce6f59b3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,6 +6,20 @@ pluginManagement { } } +buildscript { + dependencies { + classpath('com.google.code.gson:gson') { + version { + strictly '2.10.1' + } + } + } +} + +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' +} + rootProject.name = 'ForgeRoot' include 'fmlloader' diff --git a/src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json b/src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json index 2f7169dee7..88a130fa50 100644 --- a/src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json +++ b/src/generated/resources/data/forge/tags/blocks/fence_gates/wooden.json @@ -8,6 +8,8 @@ "minecraft:dark_oak_fence_gate", "minecraft:crimson_fence_gate", "minecraft:warped_fence_gate", - "minecraft:mangrove_fence_gate" + "minecraft:mangrove_fence_gate", + "minecraft:bamboo_fence_gate", + "minecraft:cherry_fence_gate" ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/fence_gates/wooden.json b/src/generated/resources/data/forge/tags/items/fence_gates/wooden.json index 2f7169dee7..88a130fa50 100644 --- a/src/generated/resources/data/forge/tags/items/fence_gates/wooden.json +++ b/src/generated/resources/data/forge/tags/items/fence_gates/wooden.json @@ -8,6 +8,8 @@ "minecraft:dark_oak_fence_gate", "minecraft:crimson_fence_gate", "minecraft:warped_fence_gate", - "minecraft:mangrove_fence_gate" + "minecraft:mangrove_fence_gate", + "minecraft:bamboo_fence_gate", + "minecraft:cherry_fence_gate" ] } \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools.json b/src/generated/resources/data/forge/tags/items/tools.json index b023d4204a..acbfe2ae9d 100644 --- a/src/generated/resources/data/forge/tags/items/tools.json +++ b/src/generated/resources/data/forge/tags/items/tools.json @@ -1,10 +1,5 @@ { "values": [ - "#forge:tools/swords", - "#forge:tools/axes", - "#forge:tools/pickaxes", - "#forge:tools/shovels", - "#forge:tools/hoes", "#minecraft:swords", "#minecraft:axes", "#minecraft:pickaxes", diff --git a/src/generated/resources/data/forge/tags/items/tools/axes.json b/src/generated/resources/data/forge/tags/items/tools/axes.json deleted file mode 100644 index e9ed775d2d..0000000000 --- a/src/generated/resources/data/forge/tags/items/tools/axes.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "values": [ - "minecraft:wooden_axe", - "minecraft:stone_axe", - "minecraft:iron_axe", - "minecraft:golden_axe", - "minecraft:diamond_axe", - "minecraft:netherite_axe", - "#minecraft:axes" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/hoes.json b/src/generated/resources/data/forge/tags/items/tools/hoes.json deleted file mode 100644 index 90468b44a9..0000000000 --- a/src/generated/resources/data/forge/tags/items/tools/hoes.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "values": [ - "minecraft:wooden_hoe", - "minecraft:stone_hoe", - "minecraft:iron_hoe", - "minecraft:golden_hoe", - "minecraft:diamond_hoe", - "minecraft:netherite_hoe", - "#minecraft:hoes" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/pickaxes.json b/src/generated/resources/data/forge/tags/items/tools/pickaxes.json deleted file mode 100644 index 64d7352040..0000000000 --- a/src/generated/resources/data/forge/tags/items/tools/pickaxes.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "values": [ - "minecraft:wooden_pickaxe", - "minecraft:stone_pickaxe", - "minecraft:iron_pickaxe", - "minecraft:golden_pickaxe", - "minecraft:diamond_pickaxe", - "minecraft:netherite_pickaxe", - "#minecraft:pickaxes" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/shovels.json b/src/generated/resources/data/forge/tags/items/tools/shovels.json deleted file mode 100644 index 61c063ee06..0000000000 --- a/src/generated/resources/data/forge/tags/items/tools/shovels.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "values": [ - "minecraft:wooden_shovel", - "minecraft:stone_shovel", - "minecraft:iron_shovel", - "minecraft:golden_shovel", - "minecraft:diamond_shovel", - "minecraft:netherite_shovel", - "#minecraft:shovels" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/tools/swords.json b/src/generated/resources/data/forge/tags/items/tools/swords.json deleted file mode 100644 index 7eee2daf6b..0000000000 --- a/src/generated/resources/data/forge/tags/items/tools/swords.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "values": [ - "minecraft:wooden_sword", - "minecraft:stone_sword", - "minecraft:iron_sword", - "minecraft:golden_sword", - "minecraft:diamond_sword", - "minecraft:netherite_sword", - "#minecraft:swords" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/acacia_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/acacia_leaves.json index 50d945a2a8..11ce2ce756 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/acacia_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/acacia_leaves.json @@ -11,7 +11,7 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -65,7 +65,7 @@ { "condition": "minecraft:inverted", "term": { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -123,5 +123,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/acacia_leaves" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/azalea_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/azalea_leaves.json index 99c9e1e6ab..fe79b24d21 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/azalea_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/azalea_leaves.json @@ -11,7 +11,7 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -65,7 +65,7 @@ { "condition": "minecraft:inverted", "term": { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -123,5 +123,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/azalea_leaves" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/birch_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/birch_leaves.json index 3a2e85a9cb..f4196b018e 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/birch_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/birch_leaves.json @@ -11,7 +11,7 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -65,7 +65,7 @@ { "condition": "minecraft:inverted", "term": { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -123,5 +123,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/birch_leaves" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/cherry_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/cherry_leaves.json new file mode 100644 index 0000000000..b873d7821f --- /dev/null +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/cherry_leaves.json @@ -0,0 +1,128 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:alternatives", + "children": [ + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:any_of", + "terms": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + ], + "name": "minecraft:cherry_leaves" + }, + { + "type": "minecraft:item", + "conditions": [ + { + "condition": "minecraft:survives_explosion" + }, + { + "chances": [ + 0.05, + 0.0625, + 0.083333336, + 0.1 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "name": "minecraft:cherry_sapling" + } + ] + } + ], + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:inverted", + "term": { + "condition": "minecraft:any_of", + "terms": [ + { + "action": "shears_dig", + "condition": "forge:can_tool_perform_action" + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "enchantments": [ + { + "enchantment": "minecraft:silk_touch", + "levels": { + "min": 1 + } + } + ] + } + } + ] + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "conditions": [ + { + "chances": [ + 0.02, + 0.022222223, + 0.025, + 0.033333335, + 0.1 + ], + "condition": "minecraft:table_bonus", + "enchantment": "minecraft:fortune" + } + ], + "functions": [ + { + "add": false, + "count": { + "type": "minecraft:uniform", + "max": 2.0, + "min": 1.0 + }, + "function": "minecraft:set_count" + }, + { + "function": "minecraft:explosion_decay" + } + ], + "name": "minecraft:stick" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "minecraft:blocks/cherry_leaves" +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json b/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json index ed4c91a9b9..f0a5746a81 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/cobweb.json @@ -11,7 +11,7 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -49,5 +49,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/cobweb" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/dark_oak_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/dark_oak_leaves.json index cd9c3abc00..0c3515faf1 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/dark_oak_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/dark_oak_leaves.json @@ -11,7 +11,7 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -65,7 +65,7 @@ { "condition": "minecraft:inverted", "term": { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -129,7 +129,7 @@ { "condition": "minecraft:inverted", "term": { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -176,5 +176,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/dark_oak_leaves" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/dead_bush.json b/src/generated/resources/data/minecraft/loot_tables/blocks/dead_bush.json index e4a208c91d..1f9d8b5378 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/dead_bush.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/dead_bush.json @@ -40,5 +40,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/dead_bush" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/fern.json b/src/generated/resources/data/minecraft/loot_tables/blocks/fern.json index 2c5a88b3a5..e89145df53 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/fern.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/fern.json @@ -45,5 +45,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/fern" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/flowering_azalea_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/flowering_azalea_leaves.json index bafa47e567..50ade83fc1 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/flowering_azalea_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/flowering_azalea_leaves.json @@ -11,7 +11,7 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -65,7 +65,7 @@ { "condition": "minecraft:inverted", "term": { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -123,5 +123,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/flowering_azalea_leaves" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/glow_lichen.json b/src/generated/resources/data/minecraft/loot_tables/blocks/glow_lichen.json index 47ed6e39d9..5415d24862 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/glow_lichen.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/glow_lichen.json @@ -111,5 +111,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/glow_lichen" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/grass.json b/src/generated/resources/data/minecraft/loot_tables/blocks/grass.json index 2b65ae0549..2038c1b10c 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/grass.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/grass.json @@ -45,5 +45,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/grass" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/hanging_roots.json b/src/generated/resources/data/minecraft/loot_tables/blocks/hanging_roots.json index f7630ca583..6e84cafd44 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/hanging_roots.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/hanging_roots.json @@ -17,5 +17,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/hanging_roots" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/jungle_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/jungle_leaves.json index e05eab515b..6e55495f1c 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/jungle_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/jungle_leaves.json @@ -11,7 +11,7 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -66,7 +66,7 @@ { "condition": "minecraft:inverted", "term": { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -124,5 +124,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/jungle_leaves" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/large_fern.json b/src/generated/resources/data/minecraft/loot_tables/blocks/large_fern.json index ed07012313..ff6ba4bbc0 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/large_fern.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/large_fern.json @@ -129,5 +129,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/large_fern" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json index 73fa0d88fe..e56c3076a5 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/mangrove_leaves.json @@ -11,7 +11,7 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -71,5 +71,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/mangrove_leaves" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/nether_sprouts.json b/src/generated/resources/data/minecraft/loot_tables/blocks/nether_sprouts.json index eaba9b269d..d0aee8945e 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/nether_sprouts.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/nether_sprouts.json @@ -17,5 +17,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/nether_sprouts" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/oak_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/oak_leaves.json index dcae44c910..717ec11f11 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/oak_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/oak_leaves.json @@ -11,7 +11,7 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -65,7 +65,7 @@ { "condition": "minecraft:inverted", "term": { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -129,7 +129,7 @@ { "condition": "minecraft:inverted", "term": { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -176,5 +176,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/oak_leaves" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/seagrass.json b/src/generated/resources/data/minecraft/loot_tables/blocks/seagrass.json index 43c1bd4978..383923d251 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/seagrass.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/seagrass.json @@ -17,5 +17,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/seagrass" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/small_dripleaf.json b/src/generated/resources/data/minecraft/loot_tables/blocks/small_dripleaf.json index 27e8c5fc0e..e7bb2ff6d1 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/small_dripleaf.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/small_dripleaf.json @@ -17,5 +17,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/small_dripleaf" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/spruce_leaves.json b/src/generated/resources/data/minecraft/loot_tables/blocks/spruce_leaves.json index 2f933e9a11..e785827530 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/spruce_leaves.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/spruce_leaves.json @@ -11,7 +11,7 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -65,7 +65,7 @@ { "condition": "minecraft:inverted", "term": { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -123,5 +123,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/spruce_leaves" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/tall_grass.json b/src/generated/resources/data/minecraft/loot_tables/blocks/tall_grass.json index 0356f1cdb8..44b6453a77 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/tall_grass.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/tall_grass.json @@ -129,5 +129,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/tall_grass" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/tall_seagrass.json b/src/generated/resources/data/minecraft/loot_tables/blocks/tall_seagrass.json index 8ead9c52b1..fa8d199f02 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/tall_seagrass.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/tall_seagrass.json @@ -24,5 +24,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/tall_seagrass" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines.json b/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines.json index 1156d02d24..3506f8ffdf 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/twisting_vines.json @@ -11,7 +11,7 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -56,5 +56,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/twisting_vines" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/vine.json b/src/generated/resources/data/minecraft/loot_tables/blocks/vine.json index 44736b40ac..94c46af2c1 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/vine.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/vine.json @@ -17,5 +17,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/vine" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines.json b/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines.json index 30e272fe63..0911910d8f 100644 --- a/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines.json +++ b/src/generated/resources/data/minecraft/loot_tables/blocks/weeping_vines.json @@ -11,7 +11,7 @@ "type": "minecraft:item", "conditions": [ { - "condition": "minecraft:alternative", + "condition": "minecraft:any_of", "terms": [ { "action": "shears_dig", @@ -56,5 +56,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "minecraft:blocks/weeping_vines" } \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bamboo_chest_raft.json b/src/generated/resources/data/minecraft/recipes/bamboo_chest_raft.json new file mode 100644 index 0000000000..b602612c1b --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/bamboo_chest_raft.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "chest_boat", + "ingredients": [ + { + "tag": "forge:chests/wooden" + }, + { + "item": "minecraft:bamboo_raft" + } + ], + "result": { + "item": "minecraft:bamboo_chest_raft" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bamboo_fence.json b/src/generated/resources/data/minecraft/recipes/bamboo_fence.json new file mode 100644 index 0000000000..a6ee1ca953 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/bamboo_fence.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "group": "wooden_custom_fence", + "key": { + "#": { + "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:bamboo_planks" + } + }, + "pattern": [ + "W#W", + "W#W" + ], + "result": { + "count": 3, + "item": "minecraft:bamboo_fence" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bamboo_fence_gate.json b/src/generated/resources/data/minecraft/recipes/bamboo_fence_gate.json new file mode 100644 index 0000000000..09dc54b13e --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/bamboo_fence_gate.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "redstone", + "group": "wooden_custom_fence_gate", + "key": { + "#": { + "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:bamboo_planks" + } + }, + "pattern": [ + "#W#", + "#W#" + ], + "result": { + "item": "minecraft:bamboo_fence_gate" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/bamboo_sign.json b/src/generated/resources/data/minecraft/recipes/bamboo_sign.json new file mode 100644 index 0000000000..a27437ce82 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/bamboo_sign.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "group": "wooden_sign", + "key": { + "#": { + "item": "minecraft:bamboo_planks" + }, + "X": { + "tag": "forge:rods/wooden" + } + }, + "pattern": [ + "###", + "###", + " X " + ], + "result": { + "count": 3, + "item": "minecraft:bamboo_sign" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/brush.json b/src/generated/resources/data/minecraft/recipes/brush.json new file mode 100644 index 0000000000..6d487be34e --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/brush.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "key": { + "#": { + "tag": "forge:ingots/copper" + }, + "I": { + "tag": "forge:rods/wooden" + }, + "X": { + "item": "minecraft:feather" + } + }, + "pattern": [ + "X", + "#", + "I" + ], + "result": { + "item": "minecraft:brush" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/calibrated_sculk_sensor.json b/src/generated/resources/data/minecraft/recipes/calibrated_sculk_sensor.json new file mode 100644 index 0000000000..8f66fb18de --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/calibrated_sculk_sensor.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "redstone", + "key": { + "#": { + "tag": "forge:gems/amethyst" + }, + "X": { + "item": "minecraft:sculk_sensor" + } + }, + "pattern": [ + " # ", + "#X#" + ], + "result": { + "item": "minecraft:calibrated_sculk_sensor" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cherry_chest_boat.json b/src/generated/resources/data/minecraft/recipes/cherry_chest_boat.json new file mode 100644 index 0000000000..c8e78832c6 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/cherry_chest_boat.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "group": "chest_boat", + "ingredients": [ + { + "tag": "forge:chests/wooden" + }, + { + "item": "minecraft:cherry_boat" + } + ], + "result": { + "item": "minecraft:cherry_chest_boat" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cherry_fence.json b/src/generated/resources/data/minecraft/recipes/cherry_fence.json new file mode 100644 index 0000000000..4b840f57b8 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/cherry_fence.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "group": "wooden_fence", + "key": { + "#": { + "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:cherry_planks" + } + }, + "pattern": [ + "W#W", + "W#W" + ], + "result": { + "count": 3, + "item": "minecraft:cherry_fence" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cherry_fence_gate.json b/src/generated/resources/data/minecraft/recipes/cherry_fence_gate.json new file mode 100644 index 0000000000..9adba86bbe --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/cherry_fence_gate.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "redstone", + "group": "wooden_fence_gate", + "key": { + "#": { + "tag": "forge:rods/wooden" + }, + "W": { + "item": "minecraft:cherry_planks" + } + }, + "pattern": [ + "#W#", + "#W#" + ], + "result": { + "item": "minecraft:cherry_fence_gate" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/cherry_sign.json b/src/generated/resources/data/minecraft/recipes/cherry_sign.json new file mode 100644 index 0000000000..43d50d1b31 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/cherry_sign.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "group": "wooden_sign", + "key": { + "#": { + "item": "minecraft:cherry_planks" + }, + "X": { + "tag": "forge:rods/wooden" + } + }, + "pattern": [ + "###", + "###", + " X " + ], + "result": { + "count": 3, + "item": "minecraft:cherry_sign" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/coast_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/coast_armor_trim_smithing_template.json new file mode 100644 index 0000000000..0d2470475d --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/coast_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "tag": "forge:cobblestone/normal" + }, + "S": { + "item": "minecraft:coast_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:coast_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/dune_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/dune_armor_trim_smithing_template.json new file mode 100644 index 0000000000..9261e16a53 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/dune_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "item": "minecraft:sandstone" + }, + "S": { + "item": "minecraft:dune_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:dune_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/eye_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/eye_armor_trim_smithing_template.json new file mode 100644 index 0000000000..df987b0b54 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/eye_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "item": "minecraft:end_stone" + }, + "S": { + "item": "minecraft:eye_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:eye_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/host_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/host_armor_trim_smithing_template.json new file mode 100644 index 0000000000..474a5e40db --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/host_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "item": "minecraft:terracotta" + }, + "S": { + "item": "minecraft:host_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:host_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/netherite_upgrade_smithing_template.json b/src/generated/resources/data/minecraft/recipes/netherite_upgrade_smithing_template.json new file mode 100644 index 0000000000..66a87f6f57 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/netherite_upgrade_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "item": "minecraft:netherrack" + }, + "S": { + "item": "minecraft:netherite_upgrade_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:netherite_upgrade_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/raiser_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/raiser_armor_trim_smithing_template.json new file mode 100644 index 0000000000..508906d1fa --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/raiser_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "item": "minecraft:terracotta" + }, + "S": { + "item": "minecraft:raiser_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:raiser_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/rib_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/rib_armor_trim_smithing_template.json new file mode 100644 index 0000000000..093880b30a --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/rib_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "item": "minecraft:netherrack" + }, + "S": { + "item": "minecraft:rib_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:rib_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/sentry_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/sentry_armor_trim_smithing_template.json new file mode 100644 index 0000000000..756547a796 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/sentry_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "tag": "forge:cobblestone/normal" + }, + "S": { + "item": "minecraft:sentry_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:sentry_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/shaper_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/shaper_armor_trim_smithing_template.json new file mode 100644 index 0000000000..a848dbc732 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/shaper_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "item": "minecraft:terracotta" + }, + "S": { + "item": "minecraft:shaper_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:shaper_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/silence_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/silence_armor_trim_smithing_template.json new file mode 100644 index 0000000000..250c9b7167 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/silence_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "tag": "forge:cobblestone/deepslate" + }, + "S": { + "item": "minecraft:silence_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:silence_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/snout_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/snout_armor_trim_smithing_template.json new file mode 100644 index 0000000000..9057548796 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/snout_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "item": "minecraft:blackstone" + }, + "S": { + "item": "minecraft:snout_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:snout_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/spire_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/spire_armor_trim_smithing_template.json new file mode 100644 index 0000000000..a2522225b1 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/spire_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "item": "minecraft:purpur_block" + }, + "S": { + "item": "minecraft:spire_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:spire_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/tide_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/tide_armor_trim_smithing_template.json new file mode 100644 index 0000000000..0064053067 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/tide_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "item": "minecraft:prismarine" + }, + "S": { + "item": "minecraft:tide_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:tide_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/vex_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/vex_armor_trim_smithing_template.json new file mode 100644 index 0000000000..cca8ed3eb8 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/vex_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "tag": "forge:cobblestone/normal" + }, + "S": { + "item": "minecraft:vex_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:vex_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/ward_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/ward_armor_trim_smithing_template.json new file mode 100644 index 0000000000..92a25f222d --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/ward_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "tag": "forge:cobblestone/deepslate" + }, + "S": { + "item": "minecraft:ward_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:ward_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wayfinder_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/wayfinder_armor_trim_smithing_template.json new file mode 100644 index 0000000000..a24acf60e4 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/wayfinder_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "item": "minecraft:terracotta" + }, + "S": { + "item": "minecraft:wayfinder_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:wayfinder_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/recipes/wild_armor_trim_smithing_template.json b/src/generated/resources/data/minecraft/recipes/wild_armor_trim_smithing_template.json new file mode 100644 index 0000000000..8aab1eb479 --- /dev/null +++ b/src/generated/resources/data/minecraft/recipes/wild_armor_trim_smithing_template.json @@ -0,0 +1,25 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "#": { + "tag": "forge:gems/diamond" + }, + "C": { + "item": "minecraft:mossy_cobblestone" + }, + "S": { + "item": "minecraft:wild_armor_trim_smithing_template" + } + }, + "pattern": [ + "#S#", + "#C#", + "###" + ], + "result": { + "count": 2, + "item": "minecraft:wild_armor_trim_smithing_template" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/generated/resources/pack.mcmeta b/src/generated/resources/pack.mcmeta index e096da989f..9fbfc8a424 100644 --- a/src/generated/resources/pack.mcmeta +++ b/src/generated/resources/pack.mcmeta @@ -3,7 +3,6 @@ "description": { "translate": "pack.forge.description" }, - "forge:server_data_pack_format": 12, - "pack_format": 13 + "pack_format": 15 } } \ No newline at end of file diff --git a/src/generated_mdk/resources/pack.mcmeta b/src/generated_mdk/resources/pack.mcmeta index 22d1390a9c..eca79ae4ae 100644 --- a/src/generated_mdk/resources/pack.mcmeta +++ b/src/generated_mdk/resources/pack.mcmeta @@ -1,9 +1,8 @@ { "pack": { "description": { - "text": "examplemod resources" + "text": "${mod_id} resources" }, - "forge:server_data_pack_format": 12, - "pack_format": 13 + "pack_format": 15 } } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/conditional.json b/src/generated_test/resources/data/data_gen_test/advancements/conditional.json index 158e0e010a..0e8e928e17 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/conditional.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/conditional.json @@ -41,7 +41,8 @@ "recipes": [ "data_gen_test:conditional" ] - } + }, + "sends_telemetry_event": true }, "conditions": [ { diff --git a/src/generated_test/resources/data/data_gen_test/advancements/obtain_dirt.json b/src/generated_test/resources/data/data_gen_test/advancements/obtain_dirt.json index ada0163bb4..420e57656d 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/obtain_dirt.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/obtain_dirt.json @@ -33,5 +33,6 @@ [ "has_dirt" ] - ] + ], + "sends_telemetry_event": true } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_custom_types.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_custom_types.json index 125ec85e7f..3498c0c9f8 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_custom_types.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_custom_types.json @@ -30,5 +30,6 @@ "recipes": [ "data_gen_test:compound_ingredient_custom_types" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_only_vanilla.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_only_vanilla.json index 5e1c7f59ba..b901c5e759 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_only_vanilla.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/compound_ingredient_only_vanilla.json @@ -30,5 +30,6 @@ "recipes": [ "data_gen_test:compound_ingredient_only_vanilla" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/intersection_ingredient.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/intersection_ingredient.json index 2f14c95d4e..5040275ece 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/intersection_ingredient.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/building_blocks/intersection_ingredient.json @@ -30,5 +30,6 @@ "recipes": [ "data_gen_test:intersection_ingredient" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional2.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional2.json index 90831028ec..cd90f60af6 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional2.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional2.json @@ -33,7 +33,8 @@ "recipes": [ "minecraft:diamond_block" ] - } + }, + "sends_telemetry_event": false }, "conditions": [ { diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional3.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional3.json index 3c0ed67750..f80998c3f0 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional3.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/conditional3.json @@ -33,7 +33,8 @@ "recipes": [ "minecraft:netherite_block" ] - } + }, + "sends_telemetry_event": false }, "conditions": [ { @@ -75,7 +76,8 @@ "recipes": [ "minecraft:netherite_block" ] - } + }, + "sends_telemetry_event": false }, "conditions": [ { diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_item_set.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_item_set.json index 8d5d7cfcc4..fafb062c73 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_item_set.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_item_set.json @@ -30,5 +30,6 @@ "recipes": [ "data_gen_test:contains_nbt_ingredient_item_set" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_single_item.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_single_item.json index 982b2fbfd9..172828139b 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_single_item.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/contains_nbt_ingredient_single_item.json @@ -30,5 +30,6 @@ "recipes": [ "data_gen_test:contains_nbt_ingredient_single_item" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/difference_ingredient.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/difference_ingredient.json index 477d1d6b2f..b51948e515 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/difference_ingredient.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/difference_ingredient.json @@ -30,5 +30,6 @@ "recipes": [ "data_gen_test:difference_ingredient" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/exact_nbt_ingredient.json b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/exact_nbt_ingredient.json index 096da6df7a..f548edbe7e 100644 --- a/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/exact_nbt_ingredient.json +++ b/src/generated_test/resources/data/data_gen_test/advancements/recipes/tools/exact_nbt_ingredient.json @@ -30,5 +30,6 @@ "recipes": [ "data_gen_test:exact_nbt_ingredient" ] - } + }, + "sends_telemetry_event": false } \ No newline at end of file diff --git a/src/generated_test/resources/data/minecraft/advancements/good_parent.json b/src/generated_test/resources/data/minecraft/advancements/good_parent.json index 6f05501fad..e9e9e81263 100644 --- a/src/generated_test/resources/data/minecraft/advancements/good_parent.json +++ b/src/generated_test/resources/data/minecraft/advancements/good_parent.json @@ -34,5 +34,6 @@ [ "get_cobbleStone" ] - ] + ], + "sends_telemetry_event": true } \ No newline at end of file diff --git a/src/generated_test/resources/data/minecraft/advancements/obtain_diamond_block.json b/src/generated_test/resources/data/minecraft/advancements/obtain_diamond_block.json index 6f3e408484..2913ca9868 100644 --- a/src/generated_test/resources/data/minecraft/advancements/obtain_diamond_block.json +++ b/src/generated_test/resources/data/minecraft/advancements/obtain_diamond_block.json @@ -33,5 +33,6 @@ [ "obtained_diamond_block" ] - ] + ], + "sends_telemetry_event": true } \ No newline at end of file diff --git a/src/generated_test/resources/data/minecraft/advancements/story/root.json b/src/generated_test/resources/data/minecraft/advancements/story/root.json index 3a6bc7655c..b459cf2fe6 100644 --- a/src/generated_test/resources/data/minecraft/advancements/story/root.json +++ b/src/generated_test/resources/data/minecraft/advancements/story/root.json @@ -33,5 +33,6 @@ [ "crafting_table" ] - ] + ], + "sends_telemetry_event": true } \ No newline at end of file diff --git a/src/generated_test/resources/data/tag_based_tool_types/loot_tables/blocks/test_stone.json b/src/generated_test/resources/data/tag_based_tool_types/loot_tables/blocks/test_stone.json index 7d1e387c60..8918dd1442 100644 --- a/src/generated_test/resources/data/tag_based_tool_types/loot_tables/blocks/test_stone.json +++ b/src/generated_test/resources/data/tag_based_tool_types/loot_tables/blocks/test_stone.json @@ -16,5 +16,6 @@ ], "rolls": 1.0 } - ] + ], + "random_sequence": "tag_based_tool_types:blocks/test_stone" } \ No newline at end of file diff --git a/src/generated_test/resources/pack.mcmeta b/src/generated_test/resources/pack.mcmeta index 5650f5841c..fc3d590734 100644 --- a/src/generated_test/resources/pack.mcmeta +++ b/src/generated_test/resources/pack.mcmeta @@ -3,7 +3,6 @@ "description": { "text": "Forge tests resource pack" }, - "forge:server_data_pack_format": 12, - "pack_format": 13 + "pack_format": 15 } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java b/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java index 0fca05ba42..4a67cb8565 100644 --- a/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java +++ b/src/main/java/net/minecraftforge/client/ClientCommandSourceStack.java @@ -25,6 +25,7 @@ import net.minecraft.world.scores.Scoreboard; import java.util.Collection; import java.util.Set; +import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -44,9 +45,9 @@ public class ClientCommandSourceStack extends CommandSourceStack * Sends a success message without attempting to get the server side list of admins */ @Override - public void sendSuccess(Component message, boolean sendToAdmins) + public void sendSuccess(Supplier message, boolean sendToAdmins) { - Minecraft.getInstance().player.sendSystemMessage(message); + Minecraft.getInstance().player.sendSystemMessage(message.get()); } /** diff --git a/src/main/java/net/minecraftforge/client/ClientForgeMod.java b/src/main/java/net/minecraftforge/client/ClientForgeMod.java index 64265ffd37..02d8d69bcf 100644 --- a/src/main/java/net/minecraftforge/client/ClientForgeMod.java +++ b/src/main/java/net/minecraftforge/client/ClientForgeMod.java @@ -33,10 +33,6 @@ public class ClientForgeMod event.register("composite", CompositeModel.Loader.INSTANCE); event.register("item_layers", ItemLayerModel.Loader.INSTANCE); event.register("separate_transforms", SeparateTransformsModel.Loader.INSTANCE); - - // TODO: Deprecated. To be removed in 1.20 - event.register("bucket", DynamicFluidContainerModel.Loader.INSTANCE_DEPRECATED); - event.register("separate-perspective", SeparateTransformsModel.Loader.INSTANCE_DEPRECATED); } @SubscribeEvent diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 7235c0f1c9..a1a3b5f670 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -14,7 +14,6 @@ import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.datafixers.util.Either; -import net.minecraft.ChatFormatting; import net.minecraft.FileUtil; import net.minecraft.client.Camera; import net.minecraft.client.KeyMapping; @@ -24,13 +23,14 @@ import net.minecraft.client.Options; import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.color.item.ItemColors; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.LerpingBossEvent; import net.minecraft.client.gui.components.toasts.Toast; import net.minecraft.client.gui.screens.ConfirmScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; +import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner; import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.Model; @@ -78,6 +78,7 @@ import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.PlayerChatMessage; import net.minecraft.network.chat.Style; import net.minecraft.network.protocol.status.ServerStatus; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ReloadableResourceManager; import net.minecraft.server.packs.resources.Resource; @@ -128,7 +129,6 @@ import net.minecraftforge.client.event.RenderArmEvent; import net.minecraftforge.client.event.RenderBlockScreenEffectEvent; import net.minecraftforge.client.event.RenderHandEvent; import net.minecraftforge.client.event.RenderHighlightEvent; -import net.minecraftforge.client.event.RenderLevelLastEvent; import net.minecraftforge.client.event.RenderLevelStageEvent; import net.minecraftforge.client.event.RenderTooltipEvent; import net.minecraftforge.client.event.ScreenEvent; @@ -149,7 +149,7 @@ import net.minecraftforge.common.ForgeI18n; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.MutableHashedLinkedMap; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.IExtensionPoint; @@ -157,6 +157,7 @@ import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoader; import net.minecraftforge.fml.VersionChecker; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.forge.snapshots.ForgeSnapshotsModClient; import net.minecraftforge.gametest.ForgeGameTestHooks; import net.minecraftforge.network.NetworkConstants; import net.minecraftforge.network.NetworkRegistry; @@ -193,9 +194,6 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; -import static net.minecraftforge.fml.VersionChecker.Status.BETA; -import static net.minecraftforge.fml.VersionChecker.Status.BETA_OUTDATED; - @ApiStatus.Internal public class ForgeHooksClient { @@ -252,9 +250,9 @@ public class ForgeHooksClient public static float getGuiFarPlane() { // 1000 units for the overlay background, - // and 2000 units for each layered Screen, + // and 10000 units for each layered Screen, - return 1000.0F + 2000.0F * (1 + guiLayers.size()); + return 1000.0F + 10000.0F * (1 + guiLayers.size()); } public static String getArmorTexture(Entity entity, ItemStack armor, String _default, EquipmentSlot slot, String type) @@ -277,12 +275,6 @@ public class ForgeHooksClient } } - @Deprecated(forRemoval = true, since = "1.19") - public static void dispatchRenderLast(LevelRenderer context, PoseStack poseStack, float partialTick, Matrix4f projectionMatrix, long finishTimeNano) - { - MinecraftForge.EVENT_BUS.post(new RenderLevelLastEvent(context, poseStack, partialTick, projectionMatrix, finishTimeNano)); - } - public static void dispatchRenderStage(RenderLevelStageEvent.Stage stage, LevelRenderer levelRenderer, PoseStack poseStack, Matrix4f projectionMatrix, int renderTick, Camera camera, Frustum frustum) { var mc = Minecraft.getInstance(); @@ -388,30 +380,19 @@ public class ForgeHooksClient //RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance); } - public static void renderMainMenu(TitleScreen gui, PoseStack poseStack, Font font, int width, int height, int alpha) + public static void renderMainMenu(TitleScreen gui, GuiGraphics guiGraphics, Font font, int width, int height, int alpha) { VersionChecker.Status status = ForgeVersion.getStatus(); - if (status == BETA || status == BETA_OUTDATED) - { - // render a warning at the top of the screen, - Component line = Component.translatable("forge.update.beta.1", ChatFormatting.RED, ChatFormatting.RESET).withStyle(ChatFormatting.RED); - GuiComponent.drawCenteredString(poseStack, font, line, width / 2, 4 + (0 * (font.lineHeight + 1)), 0xFFFFFF | alpha); - line = Component.translatable("forge.update.beta.2"); - GuiComponent.drawCenteredString(poseStack, font, line, width / 2, 4 + (1 * (font.lineHeight + 1)), 0xFFFFFF | alpha); - } + ForgeSnapshotsModClient.renderMainMenuWarning(status, gui, guiGraphics, font, width, height, alpha); - String line = null; - switch(status) + forgeStatusLine = switch(status) { - //case FAILED: line = " Version check failed"; break; - //case UP_TO_DATE: line = "Forge up to date"}; break; - //case AHEAD: line = "Using non-recommended Forge build, issues may arise."}; break; - case OUTDATED: - case BETA_OUTDATED: line = I18n.get("forge.update.newversion", ForgeVersion.getTarget()); break; - default: break; - } - - forgeStatusLine = line; + // case FAILED -> " Version check failed"; + // case UP_TO_DATE -> "Forge up to date"; + // case AHEAD -> "Using non-recommended Forge build, issues may arise."; + case OUTDATED, BETA_OUTDATED -> I18n.get("forge.update.newversion", ForgeVersion.getTarget()); + default -> null; + }; } public static String forgeStatusLine; @@ -423,23 +404,23 @@ public class ForgeHooksClient return e.getSound(); } - public static void drawScreen(Screen screen, PoseStack poseStack, int mouseX, int mouseY, float partialTick) + public static void drawScreen(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - poseStack.pushPose(); + guiGraphics.pose().pushPose(); guiLayers.forEach(layer -> { // Prevent the background layers from thinking the mouse is over their controls and showing them as highlighted. - drawScreenInternal(layer, poseStack, Integer.MAX_VALUE, Integer.MAX_VALUE, partialTick); - poseStack.translate(0,0,2000); + drawScreenInternal(layer, guiGraphics, Integer.MAX_VALUE, Integer.MAX_VALUE, partialTick); + guiGraphics.pose().translate(0,0,2000); }); - drawScreenInternal(screen, poseStack, mouseX, mouseY, partialTick); - poseStack.popPose(); + drawScreenInternal(screen, guiGraphics, mouseX, mouseY, partialTick); + guiGraphics.pose().popPose(); } - private static void drawScreenInternal(Screen screen, PoseStack poseStack, int mouseX, int mouseY, float partialTick) + private static void drawScreenInternal(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - if (!MinecraftForge.EVENT_BUS.post(new ScreenEvent.Render.Pre(screen, poseStack, mouseX, mouseY, partialTick))) - screen.renderWithTooltip(poseStack, mouseX, mouseY, partialTick); - MinecraftForge.EVENT_BUS.post(new ScreenEvent.Render.Post(screen, poseStack, mouseX, mouseY, partialTick)); + if (!MinecraftForge.EVENT_BUS.post(new ScreenEvent.Render.Pre(screen, guiGraphics, mouseX, mouseY, partialTick))) + screen.renderWithTooltip(guiGraphics, mouseX, mouseY, partialTick); + MinecraftForge.EVENT_BUS.post(new ScreenEvent.Render.Post(screen, guiGraphics, mouseX, mouseY, partialTick)); } public static Vector3f getFogColor(Camera camera, float partialTick, ClientLevel level, int renderDistance, float darkenWorldAmount, float fogRed, float fogGreen, float fogBlue) @@ -460,8 +441,8 @@ public class ForgeHooksClient public static void onFogRender(FogRenderer.FogMode mode, FogType type, Camera camera, float partialTick, float renderDistance, float nearDistance, float farDistance, FogShape shape) { // Modify fog rendering depending on the fluid - FluidState state = camera.getEntity().level.getFluidState(camera.getBlockPosition()); - if (camera.getPosition().y < (double)((float)camera.getBlockPosition().getY() + state.getHeight(camera.getEntity().level, camera.getBlockPosition()))) + FluidState state = camera.getEntity().level().getFluidState(camera.getBlockPosition()); + if (camera.getPosition().y < (double)((float)camera.getBlockPosition().getY() + state.getHeight(camera.getEntity().level(), camera.getBlockPosition()))) IClientFluidTypeExtensions.of(state).modifyFogRender(camera, mode, renderDistance, partialTick, nearDistance, farDistance, shape); ViewportEvent.RenderFog event = new ViewportEvent.RenderFog(mode, type, camera, partialTick, nearDistance, farDistance, shape); @@ -595,9 +576,9 @@ public class ForgeHooksClient return from.getItem().shouldCauseReequipAnimation(from, to, changed); } - public static CustomizeGuiOverlayEvent.BossEventProgress onCustomizeBossEventProgress(PoseStack poseStack, Window window, LerpingBossEvent bossInfo, int x, int y, int increment) + public static CustomizeGuiOverlayEvent.BossEventProgress onCustomizeBossEventProgress(GuiGraphics guiGraphics, Window window, LerpingBossEvent bossInfo, int x, int y, int increment) { - CustomizeGuiOverlayEvent.BossEventProgress evt = new CustomizeGuiOverlayEvent.BossEventProgress(window, poseStack, + CustomizeGuiOverlayEvent.BossEventProgress evt = new CustomizeGuiOverlayEvent.BossEventProgress(window, guiGraphics, Minecraft.getInstance().getPartialTick(), bossInfo, x, y, increment); MinecraftForge.EVENT_BUS.post(evt); return evt; @@ -879,7 +860,7 @@ public class ForgeHooksClient } private static final ResourceLocation ICON_SHEET = new ResourceLocation(ForgeVersion.MOD_ID, "textures/gui/icons.png"); - public static void drawForgePingInfo(JoinMultiplayerScreen gui, ServerData target, PoseStack poseStack, int x, int y, int width, int relativeMouseX, int relativeMouseY) { + public static void drawForgePingInfo(JoinMultiplayerScreen gui, ServerData target, GuiGraphics guiGraphics, int x, int y, int width, int relativeMouseX, int relativeMouseY) { int idx; String tooltip; if (target.forgeData == null) @@ -917,8 +898,7 @@ public class ForgeHooksClient tooltip = ForgeI18n.parseMessage("fml.menu.multiplayer.unknown", target.forgeData.type()); } - RenderSystem.setShaderTexture(0, ICON_SHEET); - GuiComponent.blit(poseStack, x + width - 18, y + 10, 16, 16, 0, idx, 16, 16, 256, 256); + guiGraphics.blit(ICON_SHEET, x + width - 18, y + 10, 16, 16, 0, idx, 16, 16, 256, 256); if(relativeMouseX > width - 15 && relativeMouseX < width && relativeMouseY > 10 && relativeMouseY < 26) { //this is not the most proper way to do it, @@ -1028,38 +1008,34 @@ public class ForgeHooksClient } } - public static Font getTooltipFont(@Nullable Font forcedFont, @NotNull ItemStack stack, Font fallbackFont) + public static Font getTooltipFont(@NotNull ItemStack stack, Font fallbackFont) { - if (forcedFont != null) - { - return forcedFont; - } Font stackFont = IClientItemExtensions.of(stack).getFont(stack, IClientItemExtensions.FontContext.TOOLTIP); return stackFont == null ? fallbackFont : stackFont; } - public static RenderTooltipEvent.Pre onRenderTooltipPre(@NotNull ItemStack stack, PoseStack poseStack, int x, int y, int screenWidth, int screenHeight, @NotNull List components, @Nullable Font forcedFont, @NotNull Font fallbackFont) + public static RenderTooltipEvent.Pre onRenderTooltipPre(@NotNull ItemStack stack, GuiGraphics graphics, int x, int y, int screenWidth, int screenHeight, @NotNull List components, @NotNull Font fallbackFont, @NotNull ClientTooltipPositioner positioner) { - var preEvent = new RenderTooltipEvent.Pre(stack, poseStack, x, y, screenWidth, screenHeight, getTooltipFont(forcedFont, stack, fallbackFont), components); + var preEvent = new RenderTooltipEvent.Pre(stack, graphics, x, y, screenWidth, screenHeight, getTooltipFont(stack, fallbackFont), components, positioner); MinecraftForge.EVENT_BUS.post(preEvent); return preEvent; } - public static RenderTooltipEvent.Color onRenderTooltipColor(@NotNull ItemStack stack, PoseStack poseStack, int x, int y, @NotNull Font font, @NotNull List components) + public static RenderTooltipEvent.Color onRenderTooltipColor(@NotNull ItemStack stack, GuiGraphics graphics, int x, int y, @NotNull Font font, @NotNull List components) { - var colorEvent = new RenderTooltipEvent.Color(stack, poseStack, x, y, font, 0xf0100010, 0x505000FF, 0x5028007f, components); + var colorEvent = new RenderTooltipEvent.Color(stack, graphics, x, y, font, 0xf0100010, 0x505000FF, 0x5028007f, components); MinecraftForge.EVENT_BUS.post(colorEvent); return colorEvent; } - public static List gatherTooltipComponents(ItemStack stack, List textElements, int mouseX, int screenWidth, int screenHeight, @Nullable Font forcedFont, Font fallbackFont) + public static List gatherTooltipComponents(ItemStack stack, List textElements, int mouseX, int screenWidth, int screenHeight, Font fallbackFont) { - return gatherTooltipComponents(stack, textElements, Optional.empty(), mouseX, screenWidth, screenHeight, forcedFont, fallbackFont); + return gatherTooltipComponents(stack, textElements, Optional.empty(), mouseX, screenWidth, screenHeight, fallbackFont); } - public static List gatherTooltipComponents(ItemStack stack, List textElements, Optional itemComponent, int mouseX, int screenWidth, int screenHeight, @Nullable Font forcedFont, Font fallbackFont) + public static List gatherTooltipComponents(ItemStack stack, List textElements, Optional itemComponent, int mouseX, int screenWidth, int screenHeight, Font fallbackFont) { - Font font = getTooltipFont(forcedFont, stack, fallbackFont); + Font font = getTooltipFont(stack, fallbackFont); List> elements = textElements.stream() .map((Function>) Either::left) .collect(Collectors.toCollection(ArrayList::new)); @@ -1206,7 +1182,7 @@ public class ForgeHooksClient return new ResourceLocation(loc.getNamespace(), normalised); } - public static void onCreativeModeTabBuildContents(CreativeModeTab tab, CreativeModeTab.DisplayItemsGenerator originalGenerator, CreativeModeTab.ItemDisplayParameters params, CreativeModeTab.Output output) + public static void onCreativeModeTabBuildContents(CreativeModeTab tab, ResourceKey tabKey, CreativeModeTab.DisplayItemsGenerator originalGenerator, CreativeModeTab.ItemDisplayParameters params, CreativeModeTab.Output output) { final var entries = new MutableHashedLinkedMap(ItemStackLinkedSet.TYPE_AND_TAG, (key, left, right) -> { @@ -1223,7 +1199,7 @@ public class ForgeHooksClient entries.put(stack, vis); }); - ModLoader.get().postEvent(new CreativeModeTabEvent.BuildContents(tab, params, entries)); + ModLoader.get().postEvent(new BuildCreativeModeTabContentsEvent(tab, tabKey, params, entries)); for (var entry : entries) output.accept(entry.getKey(), entry.getValue()); diff --git a/src/main/java/net/minecraftforge/client/IItemDecorator.java b/src/main/java/net/minecraftforge/client/IItemDecorator.java index 7150af2065..7f2ff3e507 100644 --- a/src/main/java/net/minecraftforge/client/IItemDecorator.java +++ b/src/main/java/net/minecraftforge/client/IItemDecorator.java @@ -5,10 +5,8 @@ package net.minecraftforge.client; -import com.mojang.blaze3d.vertex.PoseStack; - import net.minecraft.client.gui.Font; -import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; import net.minecraftforge.client.event.RegisterItemDecorationsEvent; @@ -20,21 +18,13 @@ import net.minecraftforge.client.event.RegisterItemDecorationsEvent; public interface IItemDecorator { /** - * Use {@linkplain IItemDecorator#render(PoseStack, Font, ItemStack, int, int)} instead. - */ - @Deprecated(forRemoval = true, since = "1.19.4") - default boolean render(Font font, ItemStack stack, int xOffset, int yOffset, float blitOffset) { - return false; - } - - /** - * Is called after {@linkplain ItemRenderer#renderGuiItemDecorations(PoseStack, Font, ItemStack, int, int, String)} is done rendering. + * Is called after {@linkplain GuiGraphics#renderItemDecorations(Font, ItemStack, int, int, String)} is done rendering. * The StackCount is rendered at blitOffset+200 so use the blitOffset with caution. *

* The RenderState during this call will be: enableTexture, enableDepthTest, enableBlend and defaultBlendFunc * @return true if you have modified the RenderState and it has to be reset for other ItemDecorators */ - default boolean render(PoseStack poseStack, Font font, ItemStack stack, int xOffset, int yOffset) { - return IItemDecorator.this.render(font, stack, xOffset, yOffset, 0); + default boolean render(GuiGraphics guiGraphics, Font font, ItemStack stack, int xOffset, int yOffset) { + return false; } } diff --git a/src/main/java/net/minecraftforge/client/ItemDecoratorHandler.java b/src/main/java/net/minecraftforge/client/ItemDecoratorHandler.java index 28e2d0ba46..d282c0e1f7 100644 --- a/src/main/java/net/minecraftforge/client/ItemDecoratorHandler.java +++ b/src/main/java/net/minecraftforge/client/ItemDecoratorHandler.java @@ -9,12 +9,12 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import net.minecraft.client.gui.GuiGraphics; import org.jetbrains.annotations.ApiStatus; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.Font; import net.minecraft.world.item.Item; @@ -54,12 +54,12 @@ public final class ItemDecoratorHandler return DECORATOR_LOOKUP.getOrDefault(stack.getItem(), EMPTY); } - public void render(PoseStack poseStack, Font font, ItemStack stack, int xOffset, int yOffset) + public void render(GuiGraphics guiGraphics, Font font, ItemStack stack, int xOffset, int yOffset) { resetRenderState(); for (IItemDecorator itemDecorator : itemDecorators) { - if (itemDecorator.render(poseStack, font, stack, xOffset, yOffset)) + if (itemDecorator.render(guiGraphics, font, stack, xOffset, yOffset)) resetRenderState(); } } diff --git a/src/main/java/net/minecraftforge/client/event/ContainerScreenEvent.java b/src/main/java/net/minecraftforge/client/event/ContainerScreenEvent.java index e0f3d09205..3c0f4fc910 100644 --- a/src/main/java/net/minecraftforge/client/event/ContainerScreenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ContainerScreenEvent.java @@ -5,7 +5,7 @@ package net.minecraftforge.client.event; -import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; @@ -53,25 +53,25 @@ public abstract class ContainerScreenEvent extends Event */ public static abstract class Render extends ContainerScreenEvent { - private final PoseStack poseStack; + private final GuiGraphics guiGraphics; private final int mouseX; private final int mouseY; @ApiStatus.Internal - protected Render(AbstractContainerScreen guiContainer, PoseStack poseStack, int mouseX, int mouseY) + protected Render(AbstractContainerScreen guiContainer, GuiGraphics guiGraphics, int mouseX, int mouseY) { super(guiContainer); - this.poseStack = poseStack; + this.guiGraphics = guiGraphics; this.mouseX = mouseX; this.mouseY = mouseY; } /** - * {@return the pose stack used for rendering} + * {@return the gui graphics used for rendering} */ - public PoseStack getPoseStack() + public GuiGraphics getGuiGraphics() { - return poseStack; + return guiGraphics; } /** @@ -105,9 +105,9 @@ public abstract class ContainerScreenEvent extends Event public static class Foreground extends Render { @ApiStatus.Internal - public Foreground(AbstractContainerScreen guiContainer, PoseStack poseStack, int mouseX, int mouseY) + public Foreground(AbstractContainerScreen guiContainer, GuiGraphics guiGraphics, int mouseX, int mouseY) { - super(guiContainer, poseStack, mouseX, mouseY); + super(guiContainer, guiGraphics, mouseX, mouseY); } } @@ -123,9 +123,9 @@ public abstract class ContainerScreenEvent extends Event public static class Background extends Render { @ApiStatus.Internal - public Background(AbstractContainerScreen guiContainer, PoseStack poseStack, int mouseX, int mouseY) + public Background(AbstractContainerScreen guiContainer, GuiGraphics guiGraphics, int mouseX, int mouseY) { - super(guiContainer, poseStack, mouseX, mouseY); + super(guiContainer, guiGraphics, mouseX, mouseY); } } } diff --git a/src/main/java/net/minecraftforge/client/event/CustomizeGuiOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/CustomizeGuiOverlayEvent.java index 9fa7c5e945..2a33da2d2c 100644 --- a/src/main/java/net/minecraftforge/client/event/CustomizeGuiOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/CustomizeGuiOverlayEvent.java @@ -6,7 +6,7 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.platform.Window; -import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.LerpingBossEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; @@ -26,14 +26,14 @@ import java.util.ArrayList; public abstract class CustomizeGuiOverlayEvent extends Event { private final Window window; - private final PoseStack poseStack; + private final GuiGraphics guiGraphics; private final float partialTick; @ApiStatus.Internal - protected CustomizeGuiOverlayEvent(Window window, PoseStack poseStack, float partialTick) + protected CustomizeGuiOverlayEvent(Window window, GuiGraphics guiGraphics, float partialTick) { this.window = window; - this.poseStack = poseStack; + this.guiGraphics = guiGraphics; this.partialTick = partialTick; } @@ -42,9 +42,9 @@ public abstract class CustomizeGuiOverlayEvent extends Event return window; } - public PoseStack getPoseStack() + public GuiGraphics getGuiGraphics() { - return poseStack; + return guiGraphics; } public float getPartialTick() @@ -70,9 +70,9 @@ public abstract class CustomizeGuiOverlayEvent extends Event private int increment; @ApiStatus.Internal - public BossEventProgress(Window window, PoseStack poseStack, float partialTick, LerpingBossEvent bossEvent, int x, int y, int increment) + public BossEventProgress(Window window, GuiGraphics guiGraphics, float partialTick, LerpingBossEvent bossEvent, int x, int y, int increment) { - super(window, poseStack, partialTick); + super(window, guiGraphics, partialTick); this.bossEvent = bossEvent; this.x = x; this.y = y; @@ -137,9 +137,9 @@ public abstract class CustomizeGuiOverlayEvent extends Event private final ArrayList right; @ApiStatus.Internal - public DebugText(Window window, PoseStack poseStack, float partialTick, ArrayList left, ArrayList right) + public DebugText(Window window, GuiGraphics guiGraphics, float partialTick, ArrayList left, ArrayList right) { - super(window, poseStack, partialTick); + super(window, guiGraphics, partialTick); this.left = left; this.right = right; } @@ -175,9 +175,9 @@ public abstract class CustomizeGuiOverlayEvent extends Event private int posY; @ApiStatus.Internal - public Chat(Window window, PoseStack poseStack, float partialTick, int posX, int posY) + public Chat(Window window, GuiGraphics guiGraphics, float partialTick, int posX, int posY) { - super(window, poseStack, partialTick); + super(window, guiGraphics, partialTick); this.setPosX(posX); this.setPosY(posY); } diff --git a/src/main/java/net/minecraftforge/client/event/RegisterParticleProvidersEvent.java b/src/main/java/net/minecraftforge/client/event/RegisterParticleProvidersEvent.java index 4fc92d9bed..c9dcdb73e1 100644 --- a/src/main/java/net/minecraftforge/client/event/RegisterParticleProvidersEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RegisterParticleProvidersEvent.java @@ -55,25 +55,6 @@ public class RegisterParticleProvidersEvent extends Event implements IModBusEven particleEngine.register(type, provider); } - /** - *

Registers a ParticleProvider for a non-json-based ParticleType. - * These particles do not receive a list of texture sprites to use for rendering themselves.

- * - * There must be no particle json with an ID matching the ParticleType, - * or a redundant texture list error will occur when particle jsons load.

- * - * @param ParticleOptions used by the ParticleType and ParticleProvider. - * @param type ParticleType to register a ParticleProvider for. - * @param provider ParticleProvider function responsible for providing that ParticleType's particles. - * @see #registerSpecial - * @deprecated Renamed to {@link #registerSpecial} - */ - @Deprecated(forRemoval = true, since = "1.19.4") - public void register(ParticleType type, ParticleProvider provider) - { - registerSpecial(type, provider); - } - /** *

Registers a ParticleProvider for a json-based ParticleType with a single texture; * the resulting {@link TextureSheetParticle}s will use that texture when created.

@@ -91,25 +72,6 @@ public class RegisterParticleProvidersEvent extends Event implements IModBusEven particleEngine.register(type, sprite); } - /** - *

Registers a ParticleProvider for a json-based ParticleType with a single texture; - * the resulting {@link TextureSheetParticle}s will use that texture when created.

- * - *

A particle json with an ID matching the ParticleType must exist in the particles asset folder, - * or a missing texture list error will occur when particle jsons load.

- * - * @param ParticleOptions used by the ParticleType and Sprite function. - * @param type ParticleType to register a ParticleProvider for. - * @param sprite Sprite function responsible for providing that ParticleType's particles. - * @see #registerSprite - * @deprecated Renamed to {@link #registerSprite} - */ - @Deprecated(forRemoval = true, since = "1.19.4") - public void register(ParticleType type, ParticleProvider.Sprite sprite) - { - registerSprite(type, sprite); - } - /** *

Registers a ParticleProvider for a json-based ParticleType. * Particle jsons define a list of texture sprites which the particle can use to render itself.

@@ -127,22 +89,4 @@ public class RegisterParticleProvidersEvent extends Event implements IModBusEven particleEngine.register(type, registration); } - /** - *

Registers a ParticleProvider for a json-based ParticleType. - * Particle jsons define a list of texture sprites which the particle can use to render itself.

- * - *

A particle json with an ID matching the ParticleType must exist in the particles asset folder, - * or a missing texture list error will occur when particle jsons load.

- * - * @param ParticleOptions used by the ParticleType and SpriteParticleRegistration function. - * @param type ParticleType to register a particle provider for. - * @param registration SpriteParticleRegistration function responsible for providing that ParticleType's particles. - * @see #registerSpriteSet - * @deprecated Renamed to {@link #registerSpriteSet} - */ - @Deprecated(forRemoval = true, since = "1.19.4") - public void register(ParticleType type, ParticleEngine.SpriteParticleRegistration registration) - { - registerSpriteSet(type, registration); - } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderGuiEvent.java b/src/main/java/net/minecraftforge/client/event/RenderGuiEvent.java index c83ace6969..3c853e082c 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderGuiEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderGuiEvent.java @@ -6,7 +6,7 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.platform.Window; -import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; @@ -23,14 +23,14 @@ import org.jetbrains.annotations.ApiStatus; public abstract class RenderGuiEvent extends Event { private final Window window; - private final PoseStack poseStack; + private final GuiGraphics guiGraphics; private final float partialTick; @ApiStatus.Internal - protected RenderGuiEvent(Window window, PoseStack poseStack, float partialTick) + protected RenderGuiEvent(Window window, GuiGraphics guiGraphics, float partialTick) { this.window = window; - this.poseStack = poseStack; + this.guiGraphics = guiGraphics; this.partialTick = partialTick; } @@ -39,9 +39,9 @@ public abstract class RenderGuiEvent extends Event return window; } - public PoseStack getPoseStack() + public GuiGraphics getGuiGraphics() { - return poseStack; + return guiGraphics; } public float getPartialTick() @@ -65,9 +65,9 @@ public abstract class RenderGuiEvent extends Event public static class Pre extends RenderGuiEvent { @ApiStatus.Internal - public Pre(Window window, PoseStack poseStack, float partialTick) + public Pre(Window window, GuiGraphics guiGraphics, float partialTick) { - super(window, poseStack, partialTick); + super(window, guiGraphics, partialTick); } } @@ -82,9 +82,9 @@ public abstract class RenderGuiEvent extends Event public static class Post extends RenderGuiEvent { @ApiStatus.Internal - public Post(Window window, PoseStack poseStack, float partialTick) + public Post(Window window, GuiGraphics guiGraphics, float partialTick) { - super(window, poseStack, partialTick); + super(window, guiGraphics, partialTick); } } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderGuiOverlayEvent.java b/src/main/java/net/minecraftforge/client/event/RenderGuiOverlayEvent.java index 78bd0a05be..c8bd73ad60 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderGuiOverlayEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderGuiOverlayEvent.java @@ -6,7 +6,7 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.platform.Window; -import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraftforge.client.gui.overlay.NamedGuiOverlay; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; @@ -26,17 +26,17 @@ import org.jetbrains.annotations.ApiStatus; public abstract class RenderGuiOverlayEvent extends Event { private final Window window; - private final PoseStack poseStack; + private final GuiGraphics guiGraphics; private final float partialTick; private final NamedGuiOverlay overlay; @ApiStatus.Internal - protected RenderGuiOverlayEvent(Window window, PoseStack poseStack, float partialTick, NamedGuiOverlay overlay) + protected RenderGuiOverlayEvent(Window window, GuiGraphics guiGraphics, float partialTick, NamedGuiOverlay overlay) { - this.overlay = overlay; this.window = window; - this.poseStack = poseStack; + this.guiGraphics = guiGraphics; this.partialTick = partialTick; + this.overlay = overlay; } public Window getWindow() @@ -44,9 +44,9 @@ public abstract class RenderGuiOverlayEvent extends Event return window; } - public PoseStack getPoseStack() + public GuiGraphics getGuiGraphics() { - return poseStack; + return guiGraphics; } public float getPartialTick() @@ -75,9 +75,9 @@ public abstract class RenderGuiOverlayEvent extends Event public static class Pre extends RenderGuiOverlayEvent { @ApiStatus.Internal - public Pre(Window window, PoseStack poseStack, float partialTick, NamedGuiOverlay overlay) + public Pre(Window window, GuiGraphics guiGraphics, float partialTick, NamedGuiOverlay overlay) { - super(window, poseStack, partialTick, overlay); + super(window, guiGraphics, partialTick, overlay); } } @@ -92,9 +92,9 @@ public abstract class RenderGuiOverlayEvent extends Event public static class Post extends RenderGuiOverlayEvent { @ApiStatus.Internal - public Post(Window window, PoseStack poseStack, float partialTick, NamedGuiOverlay overlay) + public Post(Window window, GuiGraphics guiGraphics, float partialTick, NamedGuiOverlay overlay) { - super(window, poseStack, partialTick, overlay); + super(window, guiGraphics, partialTick, overlay); } } } diff --git a/src/main/java/net/minecraftforge/client/event/RenderLevelLastEvent.java b/src/main/java/net/minecraftforge/client/event/RenderLevelLastEvent.java deleted file mode 100644 index 0368dc8f57..0000000000 --- a/src/main/java/net/minecraftforge/client/event/RenderLevelLastEvent.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.client.event; - -import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.client.renderer.LevelRenderer; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.Cancelable; -import net.minecraftforge.fml.LogicalSide; -import org.jetbrains.annotations.ApiStatus; -import org.joml.Matrix4f; - -/** - * Fired after all level rendering. - * This can be used for custom rendering outside of e.g. a block entity or entity renderer. - * - *

This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.

- * - *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, - * only on the {@linkplain LogicalSide#CLIENT logical client}.

- * - * @deprecated Use {@link RenderLevelStageEvent} instead for more flexibility and improved compatibility with translucent objects. - * There is no {@link RenderLevelStageEvent.Stage} that directly replaces this event, instead you must decide which Stage best fits your use case. - * @see GameRenderer - * @see LevelRenderer - */ -@Deprecated(forRemoval = true, since = "1.19") -public class RenderLevelLastEvent extends net.minecraftforge.eventbus.api.Event -{ - private final LevelRenderer levelRenderer; - private final PoseStack poseStack; - private final float partialTick; - private final Matrix4f projectionMatrix; - private final long startNanos; - - @ApiStatus.Internal - public RenderLevelLastEvent(LevelRenderer levelRenderer, PoseStack poseStack, float partialTick, Matrix4f projectionMatrix, long startNanos) - { - this.levelRenderer = levelRenderer; - this.poseStack = poseStack; - this.partialTick = partialTick; - this.projectionMatrix = projectionMatrix; - this.startNanos = startNanos; - } - - /** - * {@return the level renderer} - */ - public LevelRenderer getLevelRenderer() - { - return levelRenderer; - } - - /** - * {@return the pose stack used for rendering} - */ - public PoseStack getPoseStack() - { - return poseStack; - } - - /** - * {@return the partial tick} - */ - public float getPartialTick() - { - return partialTick; - } - - /** - * {@return the projection matrix} - */ - public Matrix4f getProjectionMatrix() - { - return projectionMatrix; - } - - /** - * {@return the time when rendering started, in nanoseconds} - */ - public long getStartNanos() - { - return startNanos; - } -} diff --git a/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java b/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java index 8c3eb2f350..c9eea0e0c8 100644 --- a/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java +++ b/src/main/java/net/minecraftforge/client/event/RenderTooltipEvent.java @@ -5,10 +5,11 @@ package net.minecraftforge.client.event; -import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.util.Either; import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; +import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipPositioner; import net.minecraft.network.chat.FormattedText; import net.minecraft.world.inventory.tooltip.TooltipComponent; import net.minecraft.world.item.ItemStack; @@ -31,21 +32,21 @@ import java.util.List; * @see RenderTooltipEvent.Pre * @see RenderTooltipEvent.Color */ -public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api.Event +public abstract class RenderTooltipEvent extends Event { @NotNull protected final ItemStack itemStack; - protected final PoseStack poseStack; + protected final GuiGraphics graphics; protected int x; protected int y; protected Font font; protected final List components; @ApiStatus.Internal - protected RenderTooltipEvent(@NotNull ItemStack itemStack, PoseStack poseStack, int x, int y, @NotNull Font font, @NotNull List components) + protected RenderTooltipEvent(@NotNull ItemStack itemStack, GuiGraphics graphics, int x, int y, @NotNull Font font, @NotNull List components) { this.itemStack = itemStack; - this.poseStack = poseStack; + this.graphics = graphics; this.components = Collections.unmodifiableList(components); this.x = x; this.y = y; @@ -63,11 +64,11 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api } /** - * {@return the pose stack used for rendering} + * {@return the graphics helper for the gui} */ - public PoseStack getPoseStack() + public GuiGraphics getGraphics() { - return poseStack; + return this.graphics; } /** @@ -211,13 +212,15 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api { private final int screenWidth; private final int screenHeight; + private final ClientTooltipPositioner positioner; @ApiStatus.Internal - public Pre(@NotNull ItemStack stack, PoseStack poseStack, int x, int y, int screenWidth, int screenHeight, @NotNull Font font, @NotNull List components) + public Pre(@NotNull ItemStack stack, GuiGraphics graphics, int x, int y, int screenWidth, int screenHeight, @NotNull Font font, @NotNull List components, @NotNull ClientTooltipPositioner positioner) { - super(stack, poseStack, x, y, font, components); + super(stack, graphics, x, y, font, components); this.screenWidth = screenWidth; this.screenHeight = screenHeight; + this.positioner = positioner; } /** @@ -239,6 +242,11 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api return screenHeight; } + public ClientTooltipPositioner getTooltipPositioner() + { + return positioner; + } + /** * Sets the font to be used to render text. * @@ -290,9 +298,9 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api private int borderEnd; @ApiStatus.Internal - public Color(@NotNull ItemStack stack, PoseStack poseStack, int x, int y, @NotNull Font fr, int background, int borderStart, int borderEnd, @NotNull List components) + public Color(@NotNull ItemStack stack, GuiGraphics graphics, int x, int y, @NotNull Font fr, int background, int borderStart, int borderEnd, @NotNull List components) { - super(stack, poseStack, x, y, fr, components); + super(stack, graphics, x, y, fr, components); this.originalBackground = background; this.originalBorderStart = borderStart; this.originalBorderEnd = borderEnd; diff --git a/src/main/java/net/minecraftforge/client/event/ScreenEvent.java b/src/main/java/net/minecraftforge/client/event/ScreenEvent.java index fd9336f3a8..c70892662f 100644 --- a/src/main/java/net/minecraftforge/client/event/ScreenEvent.java +++ b/src/main/java/net/minecraftforge/client/event/ScreenEvent.java @@ -6,7 +6,7 @@ package net.minecraftforge.client.event; import com.mojang.blaze3d.platform.InputConstants; -import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen; @@ -62,7 +62,7 @@ public abstract class ScreenEvent extends Event * See the two subclasses for listening before and after the initialization. * *

Listeners added through this event may also be marked as renderable or narratable, if they inherit from - * {@link net.minecraft.client.gui.components.Widget} and {@link net.minecraft.client.gui.narration.NarratableEntry} + * {@link net.minecraft.client.gui.components.Renderable} and {@link net.minecraft.client.gui.narration.NarratableEntry} * respectively.

* * @see Init.Pre @@ -159,27 +159,27 @@ public abstract class ScreenEvent extends Event */ public static abstract class Render extends ScreenEvent { - private final PoseStack poseStack; + private final GuiGraphics guiGraphics; private final int mouseX; private final int mouseY; private final float partialTick; @ApiStatus.Internal - protected Render(Screen screen, PoseStack poseStack, int mouseX, int mouseY, float partialTick) + protected Render(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { super(screen); - this.poseStack = poseStack; + this.guiGraphics = guiGraphics; this.mouseX = mouseX; this.mouseY = mouseY; this.partialTick = partialTick; } /** - * {@return the pose stack used for rendering} + * {@return the gui graphics used for rendering} */ - public PoseStack getPoseStack() + public GuiGraphics getGuiGraphics() { - return poseStack; + return guiGraphics; } /** @@ -219,9 +219,9 @@ public abstract class ScreenEvent extends Event public static class Pre extends Render { @ApiStatus.Internal - public Pre(Screen screen, PoseStack poseStack, int mouseX, int mouseY, float partialTick) + public Pre(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - super(screen, poseStack, mouseX, mouseY, partialTick); + super(screen, guiGraphics, mouseX, mouseY, partialTick); } } @@ -236,9 +236,9 @@ public abstract class ScreenEvent extends Event public static class Post extends Render { @ApiStatus.Internal - public Post(Screen screen, PoseStack poseStack, int mouseX, int mouseY, float partialTick) + public Post(Screen screen, GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - super(screen, poseStack, mouseX, mouseY, partialTick); + super(screen, guiGraphics, mouseX, mouseY, partialTick); } } } @@ -254,21 +254,21 @@ public abstract class ScreenEvent extends Event */ public static class BackgroundRendered extends ScreenEvent { - private final PoseStack poseStack; + private final GuiGraphics guiGraphics; @ApiStatus.Internal - public BackgroundRendered(Screen screen, PoseStack poseStack) + public BackgroundRendered(Screen screen, GuiGraphics guiGraphics) { super(screen); - this.poseStack = poseStack; + this.guiGraphics = guiGraphics; } /** - * {@return the pose stack used for rendering} + * {@return the gui graphics used for rendering} */ - public PoseStack getPoseStack() + public GuiGraphics getGuiGraphics() { - return poseStack; + return guiGraphics; } } diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeGuiGraphics.java b/src/main/java/net/minecraftforge/client/extensions/IForgeGuiGraphics.java new file mode 100644 index 0000000000..8831e62027 --- /dev/null +++ b/src/main/java/net/minecraftforge/client/extensions/IForgeGuiGraphics.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.client.extensions; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.resources.ResourceLocation; + +/** + * Extension interface for {@link GuiGraphics}. + */ +public interface IForgeGuiGraphics +{ + private GuiGraphics self() + { + return (GuiGraphics) this; + } + + int DEFAULT_BACKGROUND_COLOR = 0xF0100010; + int DEFAULT_BORDER_COLOR_START = 0x505000FF; + int DEFAULT_BORDER_COLOR_END = (DEFAULT_BORDER_COLOR_START & 0xFEFEFE) >> 1 | DEFAULT_BORDER_COLOR_START & 0xFF000000; + String UNDO_CHAR = "\u21B6"; + String RESET_CHAR = "\u2604"; + String VALID = "\u2714"; + String INVALID = "\u2715"; + int[] TEXT_COLOR_CODES = new int[] { 0, 170, 43520, 43690, 11141120, 11141290, 16755200, 11184810, 5592405, 5592575, 5635925, 5636095, 16733525, 16733695, 16777045, 16777215, + 0, 42, 10752, 10794, 2752512, 2752554, 2763264, 2763306, 1381653, 1381695, 1392405, 1392447, 4134165, 4134207, 4144917, 4144959 }; + + default int getColorFromFormattingCharacter(char c, boolean isLighter) + { + return TEXT_COLOR_CODES[isLighter ? "0123456789abcdef".indexOf(c) : "0123456789abcdef".indexOf(c) + 16]; + } + + /** + * Draws a textured box of any size (smallest size is borderSize * 2 square) + * based on a fixed size textured box with continuous borders and filler. + * + * @param texture the ResourceLocation object that contains the desired image + * @param x x-axis offset + * @param y y-axis offset + * @param u bound resource location image x offset + * @param v bound resource location image y offset + * @param width the desired box width + * @param height the desired box height + * @param textureWidth the width of the box texture in the resource location image + * @param textureHeight the height of the box texture in the resource location image + * @param borderSize the size of the box's borders + */ + default void blitWithBorder(ResourceLocation texture, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, int borderSize) + { + this.blitWithBorder(texture, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize); + } + + /** + * Draws a textured box of any size (smallest size is borderSize * 2 square) + * based on a fixed size textured box with continuous borders and filler. + * + * @param texture the ResourceLocation object that contains the desired image + * @param x x-axis offset + * @param y y-axis offset + * @param u bound resource location image x offset + * @param v bound resource location image y offset + * @param width the desired box width + * @param height the desired box height + * @param textureWidth the width of the box texture in the resource location image + * @param textureHeight the height of the box texture in the resource location image + * @param topBorder the size of the box's top border + * @param bottomBorder the size of the box's bottom border + * @param leftBorder the size of the box's left border + * @param rightBorder the size of the box's right border + */ + default void blitWithBorder(ResourceLocation texture, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, int topBorder, int bottomBorder, int leftBorder, int rightBorder) + { + int fillerWidth = textureWidth - leftBorder - rightBorder; + int fillerHeight = textureHeight - topBorder - bottomBorder; + int canvasWidth = width - leftBorder - rightBorder; + int canvasHeight = height - topBorder - bottomBorder; + int xPasses = canvasWidth / fillerWidth; + int remainderWidth = canvasWidth % fillerWidth; + int yPasses = canvasHeight / fillerHeight; + int remainderHeight = canvasHeight % fillerHeight; + + // Draw Border + // Top Left + self().blit(texture, x, y, u, v, leftBorder, topBorder); + // Top Right + self().blit(texture, x + leftBorder + canvasWidth, y, u + leftBorder + fillerWidth, v, rightBorder, topBorder); + // Bottom Left + self().blit(texture, x, y + topBorder + canvasHeight, u, v + topBorder + fillerHeight, leftBorder, bottomBorder); + // Bottom Right + self().blit(texture, x + leftBorder + canvasWidth, y + topBorder + canvasHeight, u + leftBorder + fillerWidth, v + topBorder + fillerHeight, rightBorder, bottomBorder); + + for (int i = 0; i < xPasses + (remainderWidth > 0 ? 1 : 0); i++) + { + // Top Border + self().blit(texture, x + leftBorder + (i * fillerWidth), y, u + leftBorder, v, (i == xPasses ? remainderWidth : fillerWidth), topBorder); + // Bottom Border + self().blit(texture, x + leftBorder + (i * fillerWidth), y + topBorder + canvasHeight, u + leftBorder, v + topBorder + fillerHeight, (i == xPasses ? remainderWidth : fillerWidth), bottomBorder); + + // Throw in some filler for good measure + for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++) + self().blit(texture, x + leftBorder + (i * fillerWidth), y + topBorder + (j * fillerHeight), u + leftBorder, v + topBorder, (i == xPasses ? remainderWidth : fillerWidth), (j == yPasses ? remainderHeight : fillerHeight)); + } + + // Side Borders + for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++) + { + // Left Border + self().blit(texture, x, y + topBorder + (j * fillerHeight), u, v + topBorder, leftBorder, (j == yPasses ? remainderHeight : fillerHeight)); + // Right Border + self().blit(texture, x + leftBorder + canvasWidth, y + topBorder + (j * fillerHeight), u + leftBorder + fillerWidth, v + topBorder, rightBorder, (j == yPasses ? remainderHeight : fillerHeight)); + } + } + + default void blitInscribed(ResourceLocation texture, int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight) + { + this.blitInscribed(texture, x, y, boundsWidth, boundsHeight, rectWidth, rectHeight, true, true); + } + + default void blitInscribed(ResourceLocation texture, int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight, boolean centerX, boolean centerY) + { + if (rectWidth * boundsHeight > rectHeight * boundsWidth) + { + int h = boundsHeight; + boundsHeight = (int) (boundsWidth * ((double) rectHeight / rectWidth)); + if (centerY) y += (h - boundsHeight) / 2; + } + else + { + int w = boundsWidth; + boundsWidth = (int) (boundsHeight * ((double) rectWidth / rectHeight)); + if (centerX) x += (w - boundsWidth) / 2; + } + + self().blit(texture, x, y, boundsWidth, boundsHeight, 0.0f,0.0f, rectWidth, rectHeight, rectWidth, rectHeight); + } +} diff --git a/src/main/java/net/minecraftforge/client/extensions/common/IClientBlockExtensions.java b/src/main/java/net/minecraftforge/client/extensions/common/IClientBlockExtensions.java index ea72ce34e7..7c4f42df9a 100644 --- a/src/main/java/net/minecraftforge/client/extensions/common/IClientBlockExtensions.java +++ b/src/main/java/net/minecraftforge/client/extensions/common/IClientBlockExtensions.java @@ -7,6 +7,7 @@ package net.minecraftforge.client.extensions.common; import net.minecraft.client.particle.ParticleEngine; import net.minecraft.core.BlockPos; +import net.minecraft.tags.FluidTags; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; @@ -15,7 +16,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.FluidState; import net.minecraft.world.phys.HitResult; import net.minecraftforge.fml.LogicalSide; import org.joml.Vector3d; @@ -89,7 +90,8 @@ public interface IClientBlockExtensions */ default Vector3d getFogColor(BlockState state, LevelReader level, BlockPos pos, Entity entity, Vector3d originalColor, float partialTick) { - if (state.getMaterial() == Material.WATER) + FluidState fluidState = level.getFluidState(pos); + if (fluidState.is(FluidTags.WATER)) { float f12 = 0.0F; @@ -105,7 +107,7 @@ public interface IClientBlockExtensions } return new Vector3d(0.02F + f12, 0.02F + f12, 0.2F + f12); } - else if (state.getMaterial() == Material.LAVA) + else if (fluidState.is(FluidTags.LAVA)) { return new Vector3d(0.6F, 0.1F, 0.0F); } diff --git a/src/main/java/net/minecraftforge/client/extensions/common/IClientMobEffectExtensions.java b/src/main/java/net/minecraftforge/client/extensions/common/IClientMobEffectExtensions.java index 899f58630f..3a7d858d4d 100644 --- a/src/main/java/net/minecraftforge/client/extensions/common/IClientMobEffectExtensions.java +++ b/src/main/java/net/minecraftforge/client/extensions/common/IClientMobEffectExtensions.java @@ -5,8 +5,8 @@ package net.minecraftforge.client.extensions.common; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; @@ -57,15 +57,15 @@ public interface IClientMobEffectExtensions * Renders the icon of the specified effect in the player's inventory. * This can be used to render icons from your own texture sheet. * - * @param instance The effect instance - * @param screen The effect-rendering screen - * @param poseStack The pose stack - * @param x The x coordinate - * @param y The y coordinate - * @param blitOffset The blit offset + * @param instance The effect instance + * @param screen The effect-rendering screen + * @param guiGraphics The gui graphics + * @param x The x coordinate + * @param y The y coordinate + * @param blitOffset The blit offset * @return true to prevent default rendering, false otherwise */ - default boolean renderInventoryIcon(MobEffectInstance instance, EffectRenderingInventoryScreen screen, PoseStack poseStack, int x, int y, int blitOffset) + default boolean renderInventoryIcon(MobEffectInstance instance, EffectRenderingInventoryScreen screen, GuiGraphics guiGraphics, int x, int y, int blitOffset) { return false; } @@ -73,15 +73,15 @@ public interface IClientMobEffectExtensions /** * Renders the text of the specified effect in the player's inventory. * - * @param instance The effect instance - * @param screen The effect-rendering screen - * @param poseStack The pose stack - * @param x The x coordinate - * @param y The y coordinate - * @param blitOffset The blit offset + * @param instance The effect instance + * @param screen The effect-rendering screen + * @param guiGraphics The gui graphics + * @param x The x coordinate + * @param y The y coordinate + * @param blitOffset The blit offset * @return true to prevent default rendering, false otherwise */ - default boolean renderInventoryText(MobEffectInstance instance, EffectRenderingInventoryScreen screen, PoseStack poseStack, int x, int y, int blitOffset) + default boolean renderInventoryText(MobEffectInstance instance, EffectRenderingInventoryScreen screen, GuiGraphics guiGraphics, int x, int y, int blitOffset) { return false; } @@ -90,16 +90,16 @@ public interface IClientMobEffectExtensions * Renders the icon of the specified effect on the player's HUD. * This can be used to render icons from your own texture sheet. * - * @param instance The effect instance - * @param gui The gui - * @param poseStack The pose stack - * @param x The x coordinate - * @param y The y coordinate - * @param z The z depth - * @param alpha The alpha value. Blinks when the effect is about to run out + * @param instance The effect instance + * @param gui The gui + * @param guiGraphics The gui graphics + * @param x The x coordinate + * @param y The y coordinate + * @param z The z depth + * @param alpha The alpha value. Blinks when the effect is about to run out * @return true to prevent default rendering, false otherwise */ - default boolean renderGuiIcon(MobEffectInstance instance, Gui gui, PoseStack poseStack, int x, int y, float z, float alpha) + default boolean renderGuiIcon(MobEffectInstance instance, Gui gui, GuiGraphics guiGraphics, int x, int y, float z, float alpha) { return false; } diff --git a/src/main/java/net/minecraftforge/client/gui/CreativeTabsScreenPage.java b/src/main/java/net/minecraftforge/client/gui/CreativeTabsScreenPage.java index d3e47fdd02..bcdb6d6678 100644 --- a/src/main/java/net/minecraftforge/client/gui/CreativeTabsScreenPage.java +++ b/src/main/java/net/minecraftforge/client/gui/CreativeTabsScreenPage.java @@ -6,7 +6,7 @@ package net.minecraftforge.client.gui; import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.CreativeModeTabs; +import net.minecraftforge.common.CreativeModeTabRegistry; import net.minecraftforge.common.util.ConcatenatedListView; import java.util.ArrayList; @@ -17,18 +17,18 @@ public final class CreativeTabsScreenPage private final List tabs; private final List topTabs; private final List bottomTabs; - private final ConcatenatedListView visibleTabs; + private final List visibleTabs; public CreativeTabsScreenPage(List tabs) { this.tabs = tabs; this.topTabs = new ArrayList<>(); this.bottomTabs = new ArrayList<>(); - this.visibleTabs = ConcatenatedListView.of(tabs, CreativeModeTabs.defaultTabs()); + this.visibleTabs = ConcatenatedListView.of(tabs, CreativeModeTabRegistry.getDefaultTabs()); int maxLength = 10; int topLength = maxLength / 2; - int length = Math.min(10, tabs.size()); + int length = tabs.size(); for (int i = 0; i < length; i++) { @@ -45,15 +45,19 @@ public final class CreativeTabsScreenPage public boolean isTop(CreativeModeTab tab) { if (!this.tabs.contains(tab)) - return CreativeModeTabs.defaultTabs().indexOf(tab) < (CreativeModeTabs.defaultTabs().size() / 2); + return CreativeModeTabRegistry.getDefaultTabs().indexOf(tab) < (CreativeModeTabRegistry.getDefaultTabs().size() / 2); return this.topTabs.contains(tab); } public int getColumn(CreativeModeTab tab) { +// if (!this.tabs.contains(tab)) { +// return CreativeModeTabs.tabs().indexOf(tab) % 6; +// } +// return this.topTabs.contains(tab) ? this.topTabs.indexOf(tab) : this.bottomTabs.indexOf(tab); if (!this.tabs.contains(tab)) - return (CreativeModeTabs.defaultTabs().indexOf(tab) % (CreativeModeTabs.defaultTabs().size() / 2)) + 5; + return (CreativeModeTabRegistry.getDefaultTabs().indexOf(tab) % (CreativeModeTabRegistry.getDefaultTabs().size() / 2)) + 5; return this.topTabs.contains(tab) ? this.topTabs.indexOf(tab) : this.bottomTabs.indexOf(tab); } diff --git a/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java b/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java index 543dce0466..6865391375 100644 --- a/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/LoadingErrorScreen.java @@ -6,9 +6,9 @@ package net.minecraftforge.client.gui; import com.google.common.base.Strings; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.ErrorScreen; import net.minecraft.client.gui.components.ObjectSelectionList; import net.minecraft.util.FormattedCharSequence; @@ -78,17 +78,17 @@ public class LoadingErrorScreen extends ErrorScreen { } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick) + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - this.renderBackground(poseStack); - this.entryList.render(poseStack, mouseX, mouseY, partialTick); - drawMultiLineCenteredString(poseStack, font, this.modLoadErrors.isEmpty() ? warningHeader : errorHeader, this.width / 2, 10); - this.renderables.forEach(button -> button.render(poseStack, mouseX, mouseY, partialTick)); + this.renderBackground(guiGraphics); + this.entryList.render(guiGraphics, mouseX, mouseY, partialTick); + drawMultiLineCenteredString(guiGraphics, font, this.modLoadErrors.isEmpty() ? warningHeader : errorHeader, this.width / 2, 10); + this.renderables.forEach(button -> button.render(guiGraphics, mouseX, mouseY, partialTick)); } - private void drawMultiLineCenteredString(PoseStack poseStack, Font fr, Component str, int x, int y) { + private void drawMultiLineCenteredString(GuiGraphics guiGraphics, Font fr, Component str, int x, int y) { for (FormattedCharSequence s : fr.split(str, this.width)) { - fr.drawShadow(poseStack, s, (float) (x - fr.width(s) / 2.0), y, 0xFFFFFF); + guiGraphics.drawString(fr, s, (float) (x - fr.width(s) / 2.0), (float) y, 0xFFFFFF, true); y+=fr.lineHeight; } } @@ -142,16 +142,16 @@ public class LoadingErrorScreen extends ErrorScreen { } @Override - public void render(PoseStack poseStack, int entryIdx, int top, int left, final int entryWidth, final int entryHeight, final int mouseX, final int mouseY, final boolean p_194999_5_, final float partialTick) { + public void render(GuiGraphics guiGraphics, int entryIdx, int top, int left, final int entryWidth, final int entryHeight, final int mouseX, final int mouseY, final boolean p_194999_5_, final float partialTick) { Font font = Minecraft.getInstance().font; final List strings = font.split(message, LoadingEntryList.this.width - 20); int y = top + 2; for (FormattedCharSequence string : strings) { if (center) - font.draw(poseStack, string, left + (width) - font.width(string) / 2F, y, 0xFFFFFF); + guiGraphics.drawString(font, string, left + (width) - font.width(string) / 2F, (float) y, 0xFFFFFF, false); else - font.draw(poseStack, string, left + 5, y, 0xFFFFFF); + guiGraphics.drawString(font, string, left + 5, y, 0xFFFFFF, false); y += font.lineHeight; } } diff --git a/src/main/java/net/minecraftforge/client/gui/ModListScreen.java b/src/main/java/net/minecraftforge/client/gui/ModListScreen.java index 75f2e1522d..9886f6bd94 100644 --- a/src/main/java/net/minecraftforge/client/gui/ModListScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/ModListScreen.java @@ -16,9 +16,7 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.narration.NarrationElementOutput; -import net.minecraft.client.renderer.GameRenderer; import net.minecraft.server.packs.resources.IoSupplier; import net.minecraftforge.client.ConfigScreenHandler; import net.minecraftforge.client.gui.widget.ModListWidget; @@ -34,6 +32,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.components.Button; @@ -176,16 +175,14 @@ public class ModListScreen extends Screen } @Override - protected void drawPanel(PoseStack poseStack, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY) + protected void drawPanel(GuiGraphics guiGraphics, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY) { if (logoPath != null) { - RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.enableBlend(); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - RenderSystem.setShaderTexture(0, logoPath); // Draw the logo image inscribed in a rectangle with width entryWidth (minus some padding) and height 50 int headerHeight = 50; - ScreenUtils.blitInscribed(poseStack, left + PADDING, relativeY, width - (PADDING * 2), headerHeight, logoDims.width, logoDims.height, false, true); + guiGraphics.blitInscribed(logoPath, left + PADDING, relativeY, width - (PADDING * 2), headerHeight, logoDims.width, logoDims.height, false, true); relativeY += headerHeight + PADDING; } @@ -194,7 +191,7 @@ public class ModListScreen extends Screen if (line != null) { RenderSystem.enableBlend(); - ModListScreen.this.font.drawShadow(poseStack, line, left + PADDING, relativeY, 0xFFFFFF); + guiGraphics.drawString(ModListScreen.this.font, line, left + PADDING, relativeY, 0xFFFFFF); RenderSystem.disableBlend(); } relativeY += font.lineHeight; @@ -202,7 +199,7 @@ public class ModListScreen extends Screen final Style component = findTextLine(mouseX, mouseY); if (component!=null) { - ModListScreen.this.renderComponentHoverEffect(poseStack, component, mouseX, mouseY); + guiGraphics.renderComponentHoverEffect(ModListScreen.this.font, component, mouseX, mouseY); } } @@ -362,17 +359,17 @@ public class ModListScreen extends Screen } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick) + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - this.modList.render(poseStack, mouseX, mouseY, partialTick); + this.modList.render(guiGraphics, mouseX, mouseY, partialTick); if (this.modInfo != null) - this.modInfo.render(poseStack, mouseX, mouseY, partialTick); + this.modInfo.render(guiGraphics, mouseX, mouseY, partialTick); Component text = Component.translatable("fml.menu.mods.search"); int x = modList.getLeft() + ((modList.getRight() - modList.getLeft()) / 2) - (getFontRenderer().width(text) / 2); - this.search.render(poseStack, mouseX , mouseY, partialTick); - super.render(poseStack, mouseX, mouseY, partialTick); - getFontRenderer().draw(poseStack, text.getVisualOrderText(), x, search.getY() - getFontRenderer().lineHeight, 0xFFFFFF); + this.search.render(guiGraphics, mouseX , mouseY, partialTick); + super.render(guiGraphics, mouseX, mouseY, partialTick); + guiGraphics.drawString(getFontRenderer(), text.getVisualOrderText(), x, search.getY() - getFontRenderer().lineHeight, 0xFFFFFF, false); } public Minecraft getMinecraftInstance() diff --git a/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java b/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java index efcd8fec69..deb4bfac47 100644 --- a/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java +++ b/src/main/java/net/minecraftforge/client/gui/ModMismatchDisconnectedScreen.java @@ -17,12 +17,12 @@ import java.util.stream.Collectors; import net.minecraftforge.client.gui.widget.ScrollPanel; import org.apache.commons.lang3.tuple.Pair; -import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.MultiLineLabel; import net.minecraft.client.gui.narration.NarrationElementOutput; @@ -102,13 +102,13 @@ public class ModMismatchDisconnectedScreen extends Screen } @Override - public void render(PoseStack stack, int mouseX, int mouseY, float partialTicks) + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { - this.renderBackground(stack); + this.renderBackground(guiGraphics); int textYOffset = modMismatchData.containsMismatches() ? 18 : 0; - drawCenteredString(stack, this.font, this.title, this.width / 2, (this.height - this.listHeight - this.textHeight) / 2 - textYOffset - 9 * 2, 0xAAAAAA); - this.message.renderCentered(stack, this.width / 2, (this.height - this.listHeight - this.textHeight) / 2 - textYOffset); - super.render(stack, mouseX, mouseY, partialTicks); + guiGraphics.drawCenteredString(this.font, this.title, this.width / 2, (this.height - this.listHeight - this.textHeight) / 2 - textYOffset - 9 * 2, 0xAAAAAA); + this.message.renderCentered(guiGraphics, this.width / 2, (this.height - this.listHeight - this.textHeight) / 2 - textYOffset); + super.render(guiGraphics, mouseX, mouseY, partialTicks); } class MismatchInfoPanel extends ScrollPanel @@ -217,7 +217,7 @@ public class ModMismatchDisconnectedScreen extends Screen } @Override - protected void drawPanel(PoseStack stack, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY) + protected void drawPanel(GuiGraphics guiGraphics, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY) { int i = 0; @@ -228,11 +228,11 @@ public class ModMismatchDisconnectedScreen extends Screen int color = Optional.ofNullable(font.getSplitter().componentStyleAtWidth(name, 0)).map(Style::getColor).map(TextColor::getValue).orElse(0xFFFFFF); //Only indent the given name if a version string is present. This makes it easier to distinguish table section headers and mod entries int nameLeft = left + border + (versions == null ? 0 : nameIndent); - font.draw(stack, name, nameLeft, relativeY + i * 12, color); + guiGraphics.drawString(font, name, nameLeft, relativeY + i * 12, color, false); if (versions != null) { - font.draw(stack, versions.getLeft(), left + border + nameIndent + nameWidth, relativeY + i * 12, color); - font.draw(stack, versions.getRight(), left + border + nameIndent + nameWidth + versionWidth, relativeY + i * 12, color); + guiGraphics.drawString(font, versions.getLeft(), left + border + nameIndent + nameWidth, relativeY + i * 12, color, false); + guiGraphics.drawString(font, versions.getRight(), left + border + nameIndent + nameWidth + versionWidth, relativeY + i * 12, color, false); } i++; @@ -240,13 +240,13 @@ public class ModMismatchDisconnectedScreen extends Screen } @Override - public void render(PoseStack stack, int mouseX, int mouseY, float partialTicks) + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { - super.render(stack, mouseX, mouseY, partialTicks); + super.render(guiGraphics, mouseX, mouseY, partialTicks); Style style = getComponentStyleAt(mouseX, mouseY); if (style != null && style.getHoverEvent() != null) { - ModMismatchDisconnectedScreen.this.renderComponentHoverEffect(stack, style, mouseX, mouseY); + guiGraphics.renderComponentHoverEffect(font, style, mouseX, mouseY); } } diff --git a/src/main/java/net/minecraftforge/client/gui/ScreenUtils.java b/src/main/java/net/minecraftforge/client/gui/ScreenUtils.java index 2bedad5433..85c8e395cc 100644 --- a/src/main/java/net/minecraftforge/client/gui/ScreenUtils.java +++ b/src/main/java/net/minecraftforge/client/gui/ScreenUtils.java @@ -6,14 +6,13 @@ package net.minecraftforge.client.gui; import com.mojang.blaze3d.vertex.VertexFormat; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.GameRenderer; import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import net.minecraft.resources.ResourceLocation; -import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.systems.RenderSystem; import org.joml.Matrix4f; @@ -21,7 +20,9 @@ import org.joml.Matrix4f; * This class provides several methods and constants used by the Config GUI classes. * * @author bspkrs + * @deprecated Use extension methods in {@link net.minecraftforge.client.extensions.IForgeGuiGraphics} instead */ +@Deprecated(forRemoval = true) public class ScreenUtils { public static final int DEFAULT_BACKGROUND_COLOR = 0xF0100010; @@ -33,7 +34,7 @@ public class ScreenUtils public static final String INVALID = "\u2715"; public static int[] TEXT_COLOR_CODES = new int[] { 0, 170, 43520, 43690, 11141120, 11141290, 16755200, 11184810, 5592405, 5592575, 5635925, 5636095, 16733525, 16733695, 16777045, 16777215, - 0, 42, 10752, 10794, 2752512, 2752554, 2763264, 2763306, 1381653, 1381695, 1392405, 1392447, 4134165, 4134207, 4144917, 4144959 }; + 0, 42, 10752, 10794, 2752512, 2752554, 2763264, 2763306, 1381653, 1381695, 1392405, 1392447, 4134165, 4134207, 4144917, 4144959 }; public static int getColorFromFormattingCharacter(char c, boolean isLighter) { @@ -45,7 +46,7 @@ public class ScreenUtils * and filler. It is assumed that the desired texture ResourceLocation object has been bound using * Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation). * - * @param poseStack the gui pose stack + * @param guiGraphics the gui graphics * @param x x axis offset * @param y y axis offset * @param u bound resource location image x offset @@ -57,10 +58,10 @@ public class ScreenUtils * @param borderSize the size of the box's borders * @param zLevel the zLevel to draw at */ - public static void blitWithBorder(PoseStack poseStack, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, + public static void blitWithBorder(GuiGraphics guiGraphics, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, int borderSize, float zLevel) { - blitWithBorder(poseStack, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel); + blitWithBorder(guiGraphics, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel); } /** @@ -68,7 +69,7 @@ public class ScreenUtils * and filler. The provided ResourceLocation object will be bound using * Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation). * - * @param poseStack the gui pose stack + * @param guiGraphics the gui graphics * @param res the ResourceLocation object that contains the desired image * @param x x axis offset * @param y y axis offset @@ -81,10 +82,10 @@ public class ScreenUtils * @param borderSize the size of the box's borders * @param zLevel the zLevel to draw at */ - public static void blitWithBorder(PoseStack poseStack, ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, + public static void blitWithBorder(GuiGraphics guiGraphics, ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, int borderSize, float zLevel) { - blitWithBorder(poseStack, res, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel); + blitWithBorder(guiGraphics, res, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel); } /** @@ -92,7 +93,7 @@ public class ScreenUtils * and filler. The provided ResourceLocation object will be bound using * Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation). * - * @param poseStack the gui pose stack + * @param guiGraphics the gui graphics * @param res the ResourceLocation object that contains the desired image * @param x x axis offset * @param y y axis offset @@ -108,12 +109,12 @@ public class ScreenUtils * @param rightBorder the size of the box's right border * @param zLevel the zLevel to draw at */ - public static void blitWithBorder(PoseStack poseStack, ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, + public static void blitWithBorder(GuiGraphics guiGraphics, ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel) { RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderTexture(0, res); - blitWithBorder(poseStack, x, y, u, v, width, height, textureWidth, textureHeight, topBorder, bottomBorder, leftBorder, rightBorder, zLevel); + blitWithBorder(guiGraphics, x, y, u, v, width, height, textureWidth, textureHeight, topBorder, bottomBorder, leftBorder, rightBorder, zLevel); } /** @@ -121,7 +122,7 @@ public class ScreenUtils * and filler. It is assumed that the desired texture ResourceLocation object has been bound using * Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation). * - * @param poseStack the gui pose stack + * @param guiGraphics the gui graphics * @param x x axis offset * @param y y axis offset * @param u bound resource location image x offset @@ -136,7 +137,7 @@ public class ScreenUtils * @param rightBorder the size of the box's right border * @param zLevel the zLevel to draw at */ - public static void blitWithBorder(PoseStack poseStack, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, + public static void blitWithBorder(GuiGraphics guiGraphics, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight, int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel) { RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); @@ -154,37 +155,41 @@ public class ScreenUtils // Draw Border // Top Left - drawTexturedModalRect(poseStack, x, y, u, v, leftBorder, topBorder, zLevel); + drawTexturedModalRect(guiGraphics, x, y, u, v, leftBorder, topBorder, zLevel); // Top Right - drawTexturedModalRect(poseStack, x + leftBorder + canvasWidth, y, u + leftBorder + fillerWidth, v, rightBorder, topBorder, zLevel); + drawTexturedModalRect(guiGraphics, x + leftBorder + canvasWidth, y, u + leftBorder + fillerWidth, v, rightBorder, topBorder, zLevel); // Bottom Left - drawTexturedModalRect(poseStack, x, y + topBorder + canvasHeight, u, v + topBorder + fillerHeight, leftBorder, bottomBorder, zLevel); + drawTexturedModalRect(guiGraphics, x, y + topBorder + canvasHeight, u, v + topBorder + fillerHeight, leftBorder, bottomBorder, zLevel); // Bottom Right - drawTexturedModalRect(poseStack, x + leftBorder + canvasWidth, y + topBorder + canvasHeight, u + leftBorder + fillerWidth, v + topBorder + fillerHeight, rightBorder, bottomBorder, zLevel); + drawTexturedModalRect(guiGraphics, x + leftBorder + canvasWidth, y + topBorder + canvasHeight, u + leftBorder + fillerWidth, v + topBorder + fillerHeight, rightBorder, bottomBorder, zLevel); for (int i = 0; i < xPasses + (remainderWidth > 0 ? 1 : 0); i++) { // Top Border - drawTexturedModalRect(poseStack, x + leftBorder + (i * fillerWidth), y, u + leftBorder, v, (i == xPasses ? remainderWidth : fillerWidth), topBorder, zLevel); + drawTexturedModalRect(guiGraphics, x + leftBorder + (i * fillerWidth), y, u + leftBorder, v, (i == xPasses ? remainderWidth : fillerWidth), topBorder, zLevel); // Bottom Border - drawTexturedModalRect(poseStack, x + leftBorder + (i * fillerWidth), y + topBorder + canvasHeight, u + leftBorder, v + topBorder + fillerHeight, (i == xPasses ? remainderWidth : fillerWidth), bottomBorder, zLevel); + drawTexturedModalRect(guiGraphics, x + leftBorder + (i * fillerWidth), y + topBorder + canvasHeight, u + leftBorder, v + topBorder + fillerHeight, (i == xPasses ? remainderWidth : fillerWidth), bottomBorder, zLevel); // Throw in some filler for good measure for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++) - drawTexturedModalRect(poseStack, x + leftBorder + (i * fillerWidth), y + topBorder + (j * fillerHeight), u + leftBorder, v + topBorder, (i == xPasses ? remainderWidth : fillerWidth), (j == yPasses ? remainderHeight : fillerHeight), zLevel); + drawTexturedModalRect(guiGraphics, x + leftBorder + (i * fillerWidth), y + topBorder + (j * fillerHeight), u + leftBorder, v + topBorder, (i == xPasses ? remainderWidth : fillerWidth), (j == yPasses ? remainderHeight : fillerHeight), zLevel); } // Side Borders for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++) { // Left Border - drawTexturedModalRect(poseStack, x, y + topBorder + (j * fillerHeight), u, v + topBorder, leftBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel); + drawTexturedModalRect(guiGraphics, x, y + topBorder + (j * fillerHeight), u, v + topBorder, leftBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel); // Right Border - drawTexturedModalRect(poseStack, x + leftBorder + canvasWidth, y + topBorder + (j * fillerHeight), u + leftBorder + fillerWidth, v + topBorder, rightBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel); + drawTexturedModalRect(guiGraphics, x + leftBorder + canvasWidth, y + topBorder + (j * fillerHeight), u + leftBorder + fillerWidth, v + topBorder, rightBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel); } } - public static void drawTexturedModalRect(PoseStack poseStack, int x, int y, int u, int v, int width, int height, float zLevel) + /** + * @deprecated Use {@link GuiGraphics#blit(ResourceLocation, int, int, int, int, int, int)} instead + */ + @Deprecated(forRemoval = true) + public static void drawTexturedModalRect(GuiGraphics guiGraphics, int x, int y, int u, int v, int width, int height, float zLevel) { final float uScale = 1f / 0x100; final float vScale = 1f / 0x100; @@ -192,7 +197,7 @@ public class ScreenUtils Tesselator tessellator = Tesselator.getInstance(); BufferBuilder wr = tessellator.getBuilder(); wr.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - Matrix4f matrix = poseStack.last().pose(); + Matrix4f matrix = guiGraphics.pose().last().pose(); wr.vertex(matrix, x , y + height, zLevel).uv( u * uScale, ((v + height) * vScale)).endVertex(); wr.vertex(matrix, x + width, y + height, zLevel).uv((u + width) * uScale, ((v + height) * vScale)).endVertex(); wr.vertex(matrix, x + width, y , zLevel).uv((u + width) * uScale, ( v * vScale)).endVertex(); @@ -200,6 +205,10 @@ public class ScreenUtils tessellator.end(); } + /** + * @deprecated Use {@link GuiGraphics#fillGradient(int, int, int, int, int, int, int)} instead + */ + @Deprecated(forRemoval = true) public static void drawGradientRect(Matrix4f mat, int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) { float startAlpha = (float)(startColor >> 24 & 255) / 255.0F; @@ -228,12 +237,12 @@ public class ScreenUtils RenderSystem.disableBlend(); } - public static void blitInscribed(PoseStack poseStack, int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight) + public static void blitInscribed(GuiGraphics guiGraphics, ResourceLocation texture, int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight) { - blitInscribed(poseStack, x, y, boundsWidth, boundsHeight, rectWidth, rectHeight, true, true); + blitInscribed(guiGraphics, texture, x, y, boundsWidth, boundsHeight, rectWidth, rectHeight, true, true); } - public static void blitInscribed(PoseStack poseStack, int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight, boolean centerX, boolean centerY) + public static void blitInscribed(GuiGraphics guiGraphics, ResourceLocation texture, int x, int y, int boundsWidth, int boundsHeight, int rectWidth, int rectHeight, boolean centerX, boolean centerY) { if (rectWidth * boundsHeight > rectHeight * boundsWidth) { int h = boundsHeight; @@ -245,6 +254,6 @@ public class ScreenUtils if (centerX) x += (w - boundsWidth) / 2; } - GuiComponent.blit(poseStack, x, y, boundsWidth, boundsHeight, 0.0f,0.0f, rectWidth, rectHeight, rectWidth, rectHeight); + guiGraphics.blit(texture, x, y, boundsWidth, boundsHeight, 0.0f,0.0f, rectWidth, rectHeight, rectWidth, rectHeight); } } diff --git a/src/main/java/net/minecraftforge/client/gui/TitleScreenModUpdateIndicator.java b/src/main/java/net/minecraftforge/client/gui/TitleScreenModUpdateIndicator.java index 9304b831a3..d9678e24b9 100644 --- a/src/main/java/net/minecraftforge/client/gui/TitleScreenModUpdateIndicator.java +++ b/src/main/java/net/minecraftforge/client/gui/TitleScreenModUpdateIndicator.java @@ -5,9 +5,7 @@ package net.minecraftforge.client.gui; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.systems.RenderSystem; - +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.TitleScreen; import net.minecraft.client.gui.screens.Screen; @@ -50,21 +48,19 @@ public class TitleScreenModUpdateIndicator extends Screen } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick) + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { if (showNotification == null || !showNotification.shouldDraw() || !FMLConfig.runVersionCheck()) { return; } - RenderSystem.setShaderTexture(0, VERSION_CHECK_ICONS); - int x = modButton.getX(); int y = modButton.getY(); int w = modButton.getWidth(); int h = modButton.getHeight(); - blit(poseStack, x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16); + guiGraphics.blit(VERSION_CHECK_ICONS, x + w - (h / 2 + 4), y + (h / 2 - 4), showNotification.getSheetOffset() * 8, (showNotification.isAnimated() && ((System.currentTimeMillis() / 800 & 1) == 1)) ? 8 : 0, 8, 8, 64, 16); } public static TitleScreenModUpdateIndicator init(TitleScreen guiMainMenu, Button modButton) diff --git a/src/main/java/net/minecraftforge/client/gui/overlay/ForgeGui.java b/src/main/java/net/minecraftforge/client/gui/overlay/ForgeGui.java index 6199c0039a..c76513884f 100644 --- a/src/main/java/net/minecraftforge/client/gui/overlay/ForgeGui.java +++ b/src/main/java/net/minecraftforge/client/gui/overlay/ForgeGui.java @@ -7,17 +7,15 @@ package net.minecraftforge.client.gui.overlay; import com.mojang.blaze3d.platform.Window; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.Util; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.DebugScreenOverlay; import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.resources.language.I18n; -import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.util.StringUtil; import net.minecraft.world.effect.MobEffects; @@ -40,7 +38,6 @@ import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.MinecraftForge; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; @@ -77,12 +74,7 @@ public class ForgeGui extends Gui return minecraft; } - public void setupOverlayRenderState(boolean blend, boolean depthText) - { - setupOverlayRenderState(blend, depthText, Gui.GUI_ICONS_LOCATION); - } - - public void setupOverlayRenderState(boolean blend, boolean depthTest, @Nullable ResourceLocation texture) + public void setupOverlayRenderState(boolean blend, boolean depthTest) { if (blend) { @@ -103,17 +95,12 @@ public class ForgeGui extends Gui RenderSystem.disableDepthTest(); } - if (texture != null) - { - bind(texture); - } - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShader(GameRenderer::getPositionTexShader); } @Override - public void render(PoseStack poseStack, float partialTick) + public void render(GuiGraphics guiGraphics, float partialTick) { this.screenWidth = this.minecraft.getWindow().getGuiScaledWidth(); this.screenHeight = this.minecraft.getWindow().getGuiScaledHeight(); @@ -121,7 +108,7 @@ public class ForgeGui extends Gui rightHeight = 39; leftHeight = 39; - if (MinecraftForge.EVENT_BUS.post(new RenderGuiEvent.Pre(minecraft.getWindow(), poseStack, partialTick))) + if (MinecraftForge.EVENT_BUS.post(new RenderGuiEvent.Pre(minecraft.getWindow(), guiGraphics, partialTick))) { return; } @@ -134,9 +121,9 @@ public class ForgeGui extends Gui try { IGuiOverlay overlay = entry.overlay(); - if (pre(entry, poseStack)) return; - overlay.render(this, poseStack, partialTick, screenWidth, screenHeight); - post(entry, poseStack); + if (pre(entry, guiGraphics)) return; + overlay.render(this, guiGraphics, partialTick, screenWidth, screenHeight); + post(entry, guiGraphics); } catch (Exception e) { LOGGER.error("Error rendering overlay '{}'", entry.id(), e); @@ -145,7 +132,7 @@ public class ForgeGui extends Gui RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - MinecraftForge.EVENT_BUS.post(new RenderGuiEvent.Post(minecraft.getWindow(), poseStack, partialTick)); + MinecraftForge.EVENT_BUS.post(new RenderGuiEvent.Post(minecraft.getWindow(), guiGraphics, partialTick)); } public boolean shouldDrawSurvivalElements() @@ -153,21 +140,20 @@ public class ForgeGui extends Gui return minecraft.gameMode.canHurtPlayer() && minecraft.getCameraEntity() instanceof Player; } - protected void renderSubtitles(PoseStack poseStack) + protected void renderSubtitles(GuiGraphics guiGraphics) { - this.subtitleOverlay.render(poseStack); + this.subtitleOverlay.render(guiGraphics); } - protected void renderBossHealth(PoseStack poseStack) + protected void renderBossHealth(GuiGraphics guiGraphics) { - bind(GuiComponent.GUI_ICONS_LOCATION); RenderSystem.defaultBlendFunc(); minecraft.getProfiler().push("bossHealth"); - this.bossOverlay.render(poseStack); + this.bossOverlay.render(guiGraphics); minecraft.getProfiler().pop(); } - void renderSpyglassOverlay(PoseStack stack) + void renderSpyglassOverlay(GuiGraphics guiGraphics) { float deltaFrame = this.minecraft.getDeltaFrameTime(); this.scopeScale = Mth.lerp(0.5F * deltaFrame, this.scopeScale, 1.125F); @@ -175,7 +161,7 @@ public class ForgeGui extends Gui { if (this.minecraft.player.isScoping()) { - this.renderSpyglassOverlay(stack, this.scopeScale); + this.renderSpyglassOverlay(guiGraphics, this.scopeScale); } else { @@ -184,7 +170,7 @@ public class ForgeGui extends Gui } } - void renderHelmet(float partialTick, PoseStack poseStack) + void renderHelmet(float partialTick, GuiGraphics guiGraphics) { ItemStack itemstack = this.minecraft.player.getInventory().getArmor(3); @@ -193,7 +179,7 @@ public class ForgeGui extends Gui Item item = itemstack.getItem(); if (item == Blocks.CARVED_PUMPKIN.asItem()) { - renderTextureOverlay(poseStack, PUMPKIN_BLUR_LOCATION, 1.0F); + renderTextureOverlay(guiGraphics, PUMPKIN_BLUR_LOCATION, 1.0F); } else { @@ -202,15 +188,15 @@ public class ForgeGui extends Gui } } - void renderFrostbite(PoseStack pStack) + void renderFrostbite(GuiGraphics guiGraphics) { if (this.minecraft.player.getTicksFrozen() > 0) { - this.renderTextureOverlay(pStack, POWDER_SNOW_OUTLINE_LOCATION, this.minecraft.player.getPercentFrozen()); + this.renderTextureOverlay(guiGraphics, POWDER_SNOW_OUTLINE_LOCATION, this.minecraft.player.getPercentFrozen()); } } - protected void renderArmor(PoseStack poseStack, int width, int height) + protected void renderArmor(GuiGraphics guiGraphics, int width, int height) { minecraft.getProfiler().push("armor"); @@ -223,15 +209,15 @@ public class ForgeGui extends Gui { if (i < level) { - blit(poseStack, left, top, 34, 9, 9, 9); + guiGraphics.blit(GUI_ICONS_LOCATION, left, top, 34, 9, 9, 9); } else if (i == level) { - blit(poseStack, left, top, 25, 9, 9, 9); + guiGraphics.blit(GUI_ICONS_LOCATION, left, top, 25, 9, 9, 9); } else if (i > level) { - blit(poseStack, left, top, 16, 9, 9, 9); + guiGraphics.blit(GUI_ICONS_LOCATION, left, top, 16, 9, 9, 9); } left += 8; } @@ -242,17 +228,15 @@ public class ForgeGui extends Gui } @Override - protected void renderPortalOverlay(PoseStack stack, float partialTick) + protected void renderPortalOverlay(GuiGraphics guiGraphics, float alpha) { - float f1 = Mth.lerp(partialTick, this.minecraft.player.oPortalTime, this.minecraft.player.portalTime); - - if (f1 > 0.0F) + if (alpha > 0.0F) { - super.renderPortalOverlay(stack, f1); + super.renderPortalOverlay(guiGraphics, alpha); } } - protected void renderAir(int width, int height, PoseStack poseStack) + protected void renderAir(int width, int height, GuiGraphics guiGraphics) { minecraft.getProfiler().push("air"); Player player = (Player) this.minecraft.getCameraEntity(); @@ -268,7 +252,7 @@ public class ForgeGui extends Gui for (int i = 0; i < full + partial; ++i) { - blit(poseStack, left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9); + guiGraphics.blit(GUI_ICONS_LOCATION, left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9); } rightHeight += 10; } @@ -277,9 +261,8 @@ public class ForgeGui extends Gui minecraft.getProfiler().pop(); } - public void renderHealth(int width, int height, PoseStack pStack) + public void renderHealth(int width, int height, GuiGraphics guiGraphics) { - bind(GUI_ICONS_LOCATION); minecraft.getProfiler().push("health"); RenderSystem.enableBlend(); @@ -328,13 +311,13 @@ public class ForgeGui extends Gui regen = this.tickCount % Mth.ceil(healthMax + 5.0F); } - this.renderHearts(pStack, player, left, top, rowHeight, regen, healthMax, health, healthLast, absorb, highlight); + this.renderHearts(guiGraphics, player, left, top, rowHeight, regen, healthMax, health, healthLast, absorb, highlight); RenderSystem.disableBlend(); minecraft.getProfiler().pop(); } - public void renderFood(int width, int height, PoseStack poseStack) + public void renderFood(int width, int height, GuiGraphics guiGraphics) { minecraft.getProfiler().push("food"); @@ -368,24 +351,22 @@ public class ForgeGui extends Gui y = top + (random.nextInt(3) - 1); } - blit(poseStack, x, y, 16 + background * 9, 27, 9, 9); + guiGraphics.blit(GUI_ICONS_LOCATION, x, y, 16 + background * 9, 27, 9, 9); if (idx < level) - blit(poseStack, x, y, icon + 36, 27, 9, 9); + guiGraphics.blit(GUI_ICONS_LOCATION, x, y, icon + 36, 27, 9, 9); else if (idx == level) - blit(poseStack, x, y, icon + 45, 27, 9, 9); + guiGraphics.blit(GUI_ICONS_LOCATION, x, y, icon + 45, 27, 9, 9); } RenderSystem.disableBlend(); minecraft.getProfiler().pop(); } - protected void renderSleepFade(int width, int height, PoseStack poseStack) + protected void renderSleepFade(int width, int height, GuiGraphics guiGraphics) { if (minecraft.player.getSleepTimer() > 0) { minecraft.getProfiler().push("sleep"); - RenderSystem.disableDepthTest(); - // RenderSystem.disableAlphaTest(); int sleepTime = minecraft.player.getSleepTimer(); float opacity = (float) sleepTime / 100.0F; @@ -395,42 +376,38 @@ public class ForgeGui extends Gui } int color = (int) (220.0F * opacity) << 24 | 1052704; - fill(poseStack, 0, 0, width, height, color); - // RenderSystem.enableAlphaTest(); - RenderSystem.enableDepthTest(); + guiGraphics.fill(0, 0, width, height, color); minecraft.getProfiler().pop(); } } - protected void renderExperience(int x, PoseStack poseStack) + protected void renderExperience(int x, GuiGraphics guiGraphics) { - bind(GUI_ICONS_LOCATION); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableBlend(); if (minecraft.gameMode.hasExperience()) { - super.renderExperienceBar(poseStack, x); + super.renderExperienceBar(guiGraphics, x); } RenderSystem.enableBlend(); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); } @Override - public void renderJumpMeter(PlayerRideableJumping playerRideableJumping, PoseStack poseStack, int x) + public void renderJumpMeter(PlayerRideableJumping playerRideableJumping, GuiGraphics guiGraphics, int x) { - bind(GUI_ICONS_LOCATION); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableBlend(); - super.renderJumpMeter(playerRideableJumping, poseStack, x); + super.renderJumpMeter(playerRideableJumping, guiGraphics, x); RenderSystem.enableBlend(); minecraft.getProfiler().pop(); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); } - protected void renderHUDText(int width, int height, PoseStack poseStack) + protected void renderHUDText(int width, int height, GuiGraphics guiGraphics) { minecraft.getProfiler().push("forgeHudText"); RenderSystem.defaultBlendFunc(); @@ -458,7 +435,7 @@ public class ForgeGui extends Gui listR.addAll(debugOverlay.getRight()); } - var event = new CustomizeGuiOverlayEvent.DebugText(minecraft.getWindow(), poseStack, minecraft.getFrameTime(), listL, listR); + var event = new CustomizeGuiOverlayEvent.DebugText(minecraft.getWindow(), guiGraphics, minecraft.getFrameTime(), listL, listR); MinecraftForge.EVENT_BUS.post(event); int top = 2; @@ -466,8 +443,8 @@ public class ForgeGui extends Gui { if (msg != null && !msg.isEmpty()) { - fill(poseStack, 1, top - 1, 2 + font.width(msg) + 1, top + font.lineHeight - 1, -1873784752); - font.draw(poseStack, msg, 2, top, 14737632); + guiGraphics.fill(1, top - 1, 2 + font.width(msg) + 1, top + font.lineHeight - 1, -1873784752); + guiGraphics.drawString(font, msg, 2, top, 14737632, false); } top += font.lineHeight; } @@ -479,8 +456,8 @@ public class ForgeGui extends Gui { int w = font.width(msg); int left = width - 2 - w; - fill(poseStack, left - 1, top - 1, left + w + 1, top + font.lineHeight - 1, -1873784752); - font.draw(poseStack, msg, left, top, 14737632); + guiGraphics.fill(left - 1, top - 1, left + w + 1, top + font.lineHeight - 1, -1873784752); + guiGraphics.drawString(font, msg, left, top, 14737632, false); } top += font.lineHeight; } @@ -488,15 +465,15 @@ public class ForgeGui extends Gui minecraft.getProfiler().pop(); } - protected void renderFPSGraph(PoseStack poseStack) + protected void renderFPSGraph(GuiGraphics guiGraphics) { if (this.minecraft.options.renderDebug && this.minecraft.options.renderFpsChart) { - this.debugOverlay.render(poseStack); + this.debugOverlay.render(guiGraphics); } } - protected void renderRecordOverlay(int width, int height, float partialTick, PoseStack pStack) + protected void renderRecordOverlay(int width, int height, float partialTick, GuiGraphics guiGraphics) { if (overlayMessageTime > 0) { @@ -507,22 +484,23 @@ public class ForgeGui extends Gui if (opacity > 8) { - pStack.pushPose(); - pStack.translate(width / 2D, height - 68, 0.0D); + guiGraphics.pose().pushPose(); + guiGraphics.pose().translate(width / 2D, height - 68, 0.0D); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); int color = (animateOverlayMessageColor ? Mth.hsvToRgb(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE); - drawBackdrop(pStack, font, -4, font.width(overlayMessageString), 16777215 | (opacity << 24)); - font.drawShadow(pStack, overlayMessageString.getVisualOrderText(), -font.width(overlayMessageString) / 2, -4, color | (opacity << 24)); + int messageWidth = font.width(overlayMessageString); + drawBackdrop(guiGraphics, font, -4, messageWidth, 16777215 | (opacity << 24)); + guiGraphics.drawString(font, overlayMessageString.getVisualOrderText(), -messageWidth / 2, -4, color | (opacity << 24)); RenderSystem.disableBlend(); - pStack.popPose(); + guiGraphics.pose().popPose(); } minecraft.getProfiler().pop(); } } - protected void renderTitle(int width, int height, float partialTick, PoseStack pStack) + protected void renderTitle(int width, int height, float partialTick, GuiGraphics guiGraphics) { if (title != null && titleTime > 0) { @@ -541,50 +519,50 @@ public class ForgeGui extends Gui if (opacity > 8) { - pStack.pushPose(); - pStack.translate(width / 2D, height / 2D, 0.0D); + guiGraphics.pose().pushPose(); + guiGraphics.pose().translate(width / 2D, height / 2D, 0.0D); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); - pStack.pushPose(); - pStack.scale(4.0F, 4.0F, 4.0F); + guiGraphics.pose().pushPose(); + guiGraphics.pose().scale(4.0F, 4.0F, 4.0F); int l = opacity << 24 & -16777216; - this.getFont().drawShadow(pStack, this.title.getVisualOrderText(), (float) (-this.getFont().width(this.title) / 2), -10.0F, 16777215 | l); - pStack.popPose(); + guiGraphics.drawString(this.font, this.title.getVisualOrderText(), -this.getFont().width(this.title) / 2, -10, 16777215 | l, true); + guiGraphics.pose().popPose(); if (this.subtitle != null) { - pStack.pushPose(); - pStack.scale(2.0F, 2.0F, 2.0F); - this.getFont().drawShadow(pStack, this.subtitle.getVisualOrderText(), (float) (-this.getFont().width(this.subtitle) / 2), 5.0F, 16777215 | l); - pStack.popPose(); + guiGraphics.pose().pushPose(); + guiGraphics.pose().scale(2.0F, 2.0F, 2.0F); + guiGraphics.drawString(this.font, this.subtitle.getVisualOrderText(), -this.getFont().width(this.subtitle) / 2, 5, 16777215 | l, true); + guiGraphics.pose().popPose(); } RenderSystem.disableBlend(); - pStack.popPose(); + guiGraphics.pose().popPose(); } this.minecraft.getProfiler().pop(); } } - protected void renderChat(int width, int height, PoseStack pStack) + protected void renderChat(int width, int height, GuiGraphics guiGraphics) { minecraft.getProfiler().push("chat"); Window window = minecraft.getWindow(); - var event = new CustomizeGuiOverlayEvent.Chat(window, pStack, minecraft.getFrameTime(), 0, height - 40); + var event = new CustomizeGuiOverlayEvent.Chat(window, guiGraphics, minecraft.getFrameTime(), 0, height - 40); MinecraftForge.EVENT_BUS.post(event); - pStack.pushPose(); + guiGraphics.pose().pushPose(); // We give the absolute Y position of the chat component in the event and account for the chat component's own offsetting here. - pStack.translate(event.getPosX(), (event.getPosY() - height + 40) / chat.getScale(), 0.0D); + guiGraphics.pose().translate(event.getPosX(), (event.getPosY() - height + 40) / chat.getScale(), 0.0D); int mouseX = Mth.floor(minecraft.mouseHandler.xpos() * window.getGuiScaledWidth() / window.getScreenWidth()); int mouseY = Mth.floor(minecraft.mouseHandler.ypos() * window.getGuiScaledHeight() / window.getScreenHeight()); - chat.render(pStack, tickCount, mouseX, mouseY); - pStack.popPose(); + chat.render(guiGraphics, tickCount, mouseX, mouseY); + guiGraphics.pose().popPose(); minecraft.getProfiler().pop(); } - protected void renderPlayerList(int width, int height, PoseStack poseStack) + protected void renderPlayerList(int width, int height, GuiGraphics guiGraphics) { Objective scoreobjective = this.minecraft.level.getScoreboard().getDisplayObjective(0); ClientPacketListener handler = minecraft.player.connection; @@ -592,7 +570,7 @@ public class ForgeGui extends Gui if (minecraft.options.keyPlayerList.isDown() && (!minecraft.isLocalServer() || handler.getOnlinePlayers().size() > 1 || scoreobjective != null)) { this.tabList.setVisible(true); - this.tabList.render(poseStack, width, this.minecraft.level.getScoreboard(), scoreobjective); + this.tabList.render(guiGraphics, width, this.minecraft.level.getScoreboard(), scoreobjective); } else @@ -601,14 +579,12 @@ public class ForgeGui extends Gui } } - protected void renderHealthMount(int width, int height, PoseStack poseStack) + protected void renderHealthMount(int width, int height, GuiGraphics guiGraphics) { Player player = (Player) minecraft.getCameraEntity(); Entity tmp = player.getVehicle(); if (!(tmp instanceof LivingEntity)) return; - bind(GUI_ICONS_LOCATION); - boolean unused = false; int left_align = width / 2 + 91; @@ -636,12 +612,12 @@ public class ForgeGui extends Gui for (int i = 0; i < rowCount; ++i) { int x = left_align - i * 8 - 9; - blit(poseStack, x, top, BACKGROUND, 9, 9, 9); + guiGraphics.blit(GUI_ICONS_LOCATION, x, top, BACKGROUND, 9, 9, 9); if (i * 2 + 1 + heart < health) - blit(poseStack, x, top, FULL, 9, 9, 9); + guiGraphics.blit(GUI_ICONS_LOCATION, x, top, FULL, 9, 9, 9); else if (i * 2 + 1 + heart == health) - blit(poseStack, x, top, HALF, 9, 9, 9); + guiGraphics.blit(GUI_ICONS_LOCATION, x, top, HALF, 9, 9, 9); } rightHeight += 10; @@ -650,19 +626,14 @@ public class ForgeGui extends Gui } //Helper macros - private boolean pre(NamedGuiOverlay overlay, PoseStack poseStack) + private boolean pre(NamedGuiOverlay overlay, GuiGraphics guiGraphics) { - return MinecraftForge.EVENT_BUS.post(new RenderGuiOverlayEvent.Pre(minecraft.getWindow(), poseStack, minecraft.getFrameTime(), overlay)); + return MinecraftForge.EVENT_BUS.post(new RenderGuiOverlayEvent.Pre(minecraft.getWindow(), guiGraphics, minecraft.getFrameTime(), overlay)); } - private void post(NamedGuiOverlay overlay, PoseStack poseStack) + private void post(NamedGuiOverlay overlay, GuiGraphics guiGraphics) { - MinecraftForge.EVENT_BUS.post(new RenderGuiOverlayEvent.Post(minecraft.getWindow(), poseStack, minecraft.getFrameTime(), overlay)); - } - - private void bind(ResourceLocation res) - { - RenderSystem.setShaderTexture(0, res); + MinecraftForge.EVENT_BUS.post(new RenderGuiOverlayEvent.Post(minecraft.getWindow(), guiGraphics, minecraft.getFrameTime(), overlay)); } private static class ForgeDebugScreenOverlay extends DebugScreenOverlay @@ -683,10 +654,10 @@ public class ForgeGui extends Gui } @Override - protected void drawGameInformation(PoseStack poseStack) {} + protected void drawGameInformation(GuiGraphics guiGraphics) {} @Override - protected void drawSystemInformation(PoseStack poseStack) {} + protected void drawSystemInformation(GuiGraphics guiGraphics) {} private List getLeft() { diff --git a/src/main/java/net/minecraftforge/client/gui/overlay/IGuiOverlay.java b/src/main/java/net/minecraftforge/client/gui/overlay/IGuiOverlay.java index 40ff6c9e85..f8f1a594f7 100644 --- a/src/main/java/net/minecraftforge/client/gui/overlay/IGuiOverlay.java +++ b/src/main/java/net/minecraftforge/client/gui/overlay/IGuiOverlay.java @@ -5,7 +5,7 @@ package net.minecraftforge.client.gui.overlay; -import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraftforge.client.event.RegisterGuiOverlaysEvent; /** @@ -16,5 +16,5 @@ import net.minecraftforge.client.event.RegisterGuiOverlaysEvent; @FunctionalInterface public interface IGuiOverlay { - void render(ForgeGui gui, PoseStack poseStack, float partialTick, int screenWidth, int screenHeight); + void render(ForgeGui gui, GuiGraphics guiGraphics, float partialTick, int screenWidth, int screenHeight); } diff --git a/src/main/java/net/minecraftforge/client/gui/overlay/VanillaGuiOverlay.java b/src/main/java/net/minecraftforge/client/gui/overlay/VanillaGuiOverlay.java index 29436540dc..9a2dd42a30 100644 --- a/src/main/java/net/minecraftforge/client/gui/overlay/VanillaGuiOverlay.java +++ b/src/main/java/net/minecraftforge/client/gui/overlay/VanillaGuiOverlay.java @@ -8,8 +8,9 @@ package net.minecraftforge.client.gui.overlay; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.Minecraft; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.PlayerRideableJumping; import net.minecraft.world.level.GameType; import net.minecraft.world.scores.Objective; @@ -23,166 +24,165 @@ import org.lwjgl.opengl.GL11; */ public enum VanillaGuiOverlay { - VIGNETTE("vignette", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + VIGNETTE("vignette", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { if (Minecraft.useFancyGraphics()) { gui.setupOverlayRenderState(true, false); - gui.renderVignette(poseStack, gui.getMinecraft().getCameraEntity()); + gui.renderVignette(guiGraphics, gui.getMinecraft().getCameraEntity()); } }), - SPYGLASS("spyglass", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + SPYGLASS("spyglass", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { gui.setupOverlayRenderState(true, false); - gui.renderSpyglassOverlay(poseStack); + gui.renderSpyglassOverlay(guiGraphics); }), - HELMET("helmet", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + HELMET("helmet", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { gui.setupOverlayRenderState(true, false); - gui.renderHelmet(partialTick, poseStack); + gui.renderHelmet(partialTick, guiGraphics); }), - FROSTBITE("frostbite", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + FROSTBITE("frostbite", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { gui.setupOverlayRenderState(true, false); - gui.renderFrostbite(poseStack); + gui.renderFrostbite(guiGraphics); }), - PORTAL("portal", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { - - if (!gui.getMinecraft().player.hasEffect(MobEffects.CONFUSION)) - { + PORTAL("portal", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { + float f1 = Mth.lerp(partialTick, gui.getMinecraft().player.oSpinningEffectIntensity, gui.getMinecraft().player.spinningEffectIntensity); + if (f1 > 0.0F && !gui.getMinecraft().player.hasEffect(MobEffects.CONFUSION)) { gui.setupOverlayRenderState(true, false); - gui.renderPortalOverlay(poseStack, partialTick); + gui.renderPortalOverlay(guiGraphics, partialTick); } - }), - HOTBAR("hotbar", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + HOTBAR("hotbar", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { if (!gui.getMinecraft().options.hideGui) { gui.setupOverlayRenderState(true, false); if (gui.getMinecraft().gameMode.getPlayerMode() == GameType.SPECTATOR) { - gui.getSpectatorGui().renderHotbar(poseStack); + gui.getSpectatorGui().renderHotbar(guiGraphics); } else { - gui.renderHotbar(partialTick, poseStack); + gui.renderHotbar(partialTick, guiGraphics); } } }), - CROSSHAIR("crosshair", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + CROSSHAIR("crosshair", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { if (!gui.getMinecraft().options.hideGui) { gui.setupOverlayRenderState(true, false); - poseStack.pushPose(); - poseStack.translate(0, 0, -90); - gui.renderCrosshair(poseStack); - poseStack.popPose(); + guiGraphics.pose().pushPose(); + guiGraphics.pose().translate(0, 0, -90); + gui.renderCrosshair(guiGraphics); + guiGraphics.pose().popPose(); } }), - BOSS_EVENT_PROGRESS("boss_event_progress", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + BOSS_EVENT_PROGRESS("boss_event_progress", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { if (!gui.getMinecraft().options.hideGui) { gui.setupOverlayRenderState(true, false); - poseStack.pushPose(); - poseStack.translate(0, 0, -90); - gui.renderBossHealth(poseStack); - poseStack.popPose(); + guiGraphics.pose().pushPose(); + guiGraphics.pose().translate(0, 0, -90); + gui.renderBossHealth(guiGraphics); + guiGraphics.pose().popPose(); } }), - PLAYER_HEALTH("player_health", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + PLAYER_HEALTH("player_health", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { if (!gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements()) { gui.setupOverlayRenderState(true, false); - gui.renderHealth(screenWidth, screenHeight, poseStack); + gui.renderHealth(screenWidth, screenHeight, guiGraphics); } }), - ARMOR_LEVEL("armor_level", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + ARMOR_LEVEL("armor_level", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { if (!gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements()) { gui.setupOverlayRenderState(true, false); - gui.renderArmor(poseStack, screenWidth, screenHeight); + gui.renderArmor(guiGraphics, screenWidth, screenHeight); } }), - FOOD_LEVEL("food_level", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { - boolean isMounted = gui.getMinecraft().player.getVehicle() instanceof LivingEntity; + FOOD_LEVEL("food_level", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { + Entity vehicle = gui.getMinecraft().player.getVehicle(); + boolean isMounted = vehicle != null && vehicle.showVehicleHealth(); if (!isMounted && !gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements()) { gui.setupOverlayRenderState(true, false); - gui.renderFood(screenWidth, screenHeight, poseStack); + gui.renderFood(screenWidth, screenHeight, guiGraphics); } }), - MOUNT_HEALTH("mount_health", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + MOUNT_HEALTH("mount_health", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { if (!gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements()) { gui.setupOverlayRenderState(true, false); - gui.renderHealthMount(screenWidth, screenHeight, poseStack); + gui.renderHealthMount(screenWidth, screenHeight, guiGraphics); } }), - AIR_LEVEL("air_level", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + AIR_LEVEL("air_level", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { if (!gui.getMinecraft().options.hideGui && gui.shouldDrawSurvivalElements()) { gui.setupOverlayRenderState(true, false); - gui.renderAir(screenWidth, screenHeight, poseStack); + gui.renderAir(screenWidth, screenHeight, guiGraphics); } }), - JUMP_BAR("jump_bar", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + JUMP_BAR("jump_bar", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { PlayerRideableJumping playerRideableJumping = gui.getMinecraft().player.jumpableVehicle(); if (playerRideableJumping != null && !gui.getMinecraft().options.hideGui) { gui.setupOverlayRenderState(true, false); - gui.renderJumpMeter(playerRideableJumping, poseStack, screenWidth / 2 - 91); + gui.renderJumpMeter(playerRideableJumping, guiGraphics, screenWidth / 2 - 91); } }), - EXPERIENCE_BAR("experience_bar", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + EXPERIENCE_BAR("experience_bar", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { if (gui.getMinecraft().player.jumpableVehicle() == null && !gui.getMinecraft().options.hideGui) { gui.setupOverlayRenderState(true, false); - gui.renderExperience(screenWidth / 2 - 91, poseStack); + gui.renderExperience(screenWidth / 2 - 91, guiGraphics); } }), - ITEM_NAME("item_name", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + ITEM_NAME("item_name", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { if (!gui.getMinecraft().options.hideGui) { gui.setupOverlayRenderState(true, false); if (gui.getMinecraft().gameMode.getPlayerMode() != GameType.SPECTATOR) { - gui.renderSelectedItemName(poseStack); + gui.renderSelectedItemName(guiGraphics); } else if (gui.getMinecraft().player.isSpectator()) { - gui.getSpectatorGui().renderTooltip(poseStack); + gui.getSpectatorGui().renderTooltip(guiGraphics); } } }), - SLEEP_FADE("sleep_fade", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { - gui.renderSleepFade(screenWidth, screenHeight, poseStack); + SLEEP_FADE("sleep_fade", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { + gui.renderSleepFade(screenWidth, screenHeight, guiGraphics); }), - DEBUG_TEXT("debug_text", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { - gui.renderHUDText(screenWidth, screenHeight, poseStack); + DEBUG_TEXT("debug_text", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { + gui.renderHUDText(screenWidth, screenHeight, guiGraphics); }), - FPS_GRAPH("fps_graph", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { - gui.renderFPSGraph(poseStack); + FPS_GRAPH("fps_graph", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { + gui.renderFPSGraph(guiGraphics); }), - POTION_ICONS("potion_icons", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { - gui.renderEffects(poseStack); + POTION_ICONS("potion_icons", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { + gui.renderEffects(guiGraphics); }), - RECORD_OVERLAY("record_overlay", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + RECORD_OVERLAY("record_overlay", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { if (!gui.getMinecraft().options.hideGui) { - gui.renderRecordOverlay(screenWidth, screenHeight, partialTick, poseStack); + gui.renderRecordOverlay(screenWidth, screenHeight, partialTick, guiGraphics); } }), - SUBTITLES("subtitles", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + SUBTITLES("subtitles", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { if (!gui.getMinecraft().options.hideGui) { - gui.renderSubtitles(poseStack); + gui.renderSubtitles(guiGraphics); } }), - TITLE_TEXT("title_text", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + TITLE_TEXT("title_text", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { if (!gui.getMinecraft().options.hideGui) { - gui.renderTitle(screenWidth, screenHeight, partialTick, poseStack); + gui.renderTitle(screenWidth, screenHeight, partialTick, guiGraphics); } }), - SCOREBOARD("scoreboard", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + SCOREBOARD("scoreboard", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { Scoreboard scoreboard = gui.getMinecraft().level.getScoreboard(); Objective objective = null; @@ -195,22 +195,22 @@ public enum VanillaGuiOverlay Objective scoreobjective1 = objective != null ? objective : scoreboard.getDisplayObjective(1); if (scoreobjective1 != null) { - gui.displayScoreboardSidebar(poseStack, scoreobjective1); + gui.displayScoreboardSidebar(guiGraphics, scoreobjective1); } }), - CHAT_PANEL("chat_panel", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + CHAT_PANEL("chat_panel", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - gui.renderChat(screenWidth, screenHeight, poseStack); + gui.renderChat(screenWidth, screenHeight, guiGraphics); }), - PLAYER_LIST("player_list", (gui, poseStack, partialTick, screenWidth, screenHeight) -> { + PLAYER_LIST("player_list", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); - gui.renderPlayerList(screenWidth, screenHeight, poseStack); + gui.renderPlayerList(screenWidth, screenHeight, guiGraphics); }); private final ResourceLocation id; diff --git a/src/main/java/net/minecraftforge/client/gui/widget/ExtendedButton.java b/src/main/java/net/minecraftforge/client/gui/widget/ExtendedButton.java index fcb445e670..8d0b7f3960 100644 --- a/src/main/java/net/minecraftforge/client/gui/widget/ExtendedButton.java +++ b/src/main/java/net/minecraftforge/client/gui/widget/ExtendedButton.java @@ -5,13 +5,12 @@ package net.minecraftforge.client.gui.widget; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.locale.Language; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; -import net.minecraftforge.client.gui.ScreenUtils; /** * This class provides a button that fixes several bugs present in the vanilla GuiButton drawing code. @@ -44,13 +43,13 @@ public class ExtendedButton extends Button * Draws this button to the screen. */ @Override - public void renderWidget(PoseStack poseStack, int mouseX, int mouseY, float partialTick) + public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { Minecraft mc = Minecraft.getInstance(); int k = !this.active ? 0 : (this.isHoveredOrFocused() ? 2 : 1); - ScreenUtils.blitWithBorder(poseStack, WIDGETS_LOCATION, this.getX(), this.getY(), 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, 0); + guiGraphics.blitWithBorder(WIDGETS_LOCATION, this.getX(), this.getY(), 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2); final FormattedText buttonText = mc.font.ellipsize(this.getMessage(), this.width - 6); // Remove 6 pixels so that the text is always contained within the button's borders - drawCenteredString(poseStack, mc.font, Language.getInstance().getVisualOrder(buttonText), this.getX() + this.width / 2, this.getY() + (this.height - 8) / 2, getFGColor()); + guiGraphics.drawCenteredString(mc.font, Language.getInstance().getVisualOrder(buttonText), this.getX() + this.width / 2, this.getY() + (this.height - 8) / 2, getFGColor()); } } diff --git a/src/main/java/net/minecraftforge/client/gui/widget/ForgeSlider.java b/src/main/java/net/minecraftforge/client/gui/widget/ForgeSlider.java index 7b2ba63fa5..7f359b4485 100644 --- a/src/main/java/net/minecraftforge/client/gui/widget/ForgeSlider.java +++ b/src/main/java/net/minecraftforge/client/gui/widget/ForgeSlider.java @@ -5,17 +5,11 @@ package net.minecraftforge.client.gui.widget; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractSliderButton; -import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.locale.Language; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.FormattedText; import net.minecraft.util.Mth; -import net.minecraftforge.client.gui.ScreenUtils; -import org.jetbrains.annotations.NotNull; import org.lwjgl.glfw.GLFW; import java.text.DecimalFormat; @@ -226,16 +220,13 @@ public class ForgeSlider extends AbstractSliderButton protected void applyValue() {} @Override - public void renderWidget(@NotNull PoseStack poseStack, int mouseX, int mouseY, float partialTick) + public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { - RenderSystem.setShader(GameRenderer::getPositionTexShader); - RenderSystem.setShaderTexture(0, SLIDER_LOCATION); - final Minecraft mc = Minecraft.getInstance(); - ScreenUtils.blitWithBorder(poseStack, this.getX(), this.getY(), 0, getTextureY(), this.width, this.height, 200, 20, 2, 3, 2, 2, 0); + guiGraphics.blitWithBorder(SLIDER_LOCATION, this.getX(), this.getY(), 0, getTextureY(), this.width, this.height, 200, 20, 2, 3, 2, 2); - ScreenUtils.blitWithBorder(poseStack, this.getX() + (int)(this.value * (double)(this.width - 8)), this.getY(), 0, getHandleTextureY(), 8, this.height, 200, 20 , 2, 3, 2, 2, 0); + guiGraphics.blitWithBorder(SLIDER_LOCATION, this.getX() + (int)(this.value * (double)(this.width - 8)), this.getY(), 0, getHandleTextureY(), 8, this.height, 200, 20 , 2, 3, 2, 2); - renderScrollingString(poseStack, mc.font, 2, getFGColor() | Mth.ceil(this.alpha * 255.0F) << 24); + renderScrollingString(guiGraphics, mc.font, 2, getFGColor() | Mth.ceil(this.alpha * 255.0F) << 24); } } diff --git a/src/main/java/net/minecraftforge/client/gui/widget/ModListWidget.java b/src/main/java/net/minecraftforge/client/gui/widget/ModListWidget.java index ea0d952de5..806f4b6ab9 100644 --- a/src/main/java/net/minecraftforge/client/gui/widget/ModListWidget.java +++ b/src/main/java/net/minecraftforge/client/gui/widget/ModListWidget.java @@ -5,9 +5,8 @@ package net.minecraftforge.client.gui.widget; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.ObjectSelectionList; import net.minecraft.resources.ResourceLocation; import net.minecraft.network.chat.Component; @@ -55,9 +54,9 @@ public class ModListWidget extends ObjectSelectionList } @Override - protected void renderBackground(PoseStack poseStack) + protected void renderBackground(GuiGraphics guiGraphics) { - this.parent.renderBackground(poseStack); + this.parent.renderBackground(guiGraphics); } public class ModEntry extends ObjectSelectionList.Entry { @@ -75,22 +74,21 @@ public class ModListWidget extends ObjectSelectionList } @Override - public void render(PoseStack poseStack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTick) + public void render(GuiGraphics guiGraphics, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isMouseOver, float partialTick) { Component name = Component.literal(stripControlCodes(modInfo.getDisplayName())); Component version = Component.literal(stripControlCodes(MavenVersionStringHelper.artifactVersionToString(modInfo.getVersion()))); VersionChecker.CheckResult vercheck = VersionChecker.getResult(modInfo); Font font = this.parent.getFontRenderer(); - font.draw(poseStack, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(name, listWidth))), left + 3, top + 2, 0xFFFFFF); - font.draw(poseStack, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(version, listWidth))), left + 3, top + 2 + font.lineHeight, 0xCCCCCC); + guiGraphics.drawString(font, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(name, listWidth))), left + 3, top + 2, 0xFFFFFF, false); + guiGraphics.drawString(font, Language.getInstance().getVisualOrder(FormattedText.composite(font.substrByWidth(version, listWidth))), left + 3, top + 2 + font.lineHeight, 0xCCCCCC, false); if (vercheck.status().shouldDraw()) { //TODO: Consider adding more icons for visualization RenderSystem.setShaderColor(1, 1, 1, 1); - RenderSystem.setShaderTexture(0, VERSION_CHECK_ICONS); - poseStack.pushPose(); - GuiComponent.blit(poseStack, getLeft() + width - 12, top + entryHeight / 4, vercheck.status().getSheetOffset() * 8, (vercheck.status().isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16); - poseStack.popPose(); + guiGraphics.pose().pushPose(); + guiGraphics.blit(VERSION_CHECK_ICONS, getLeft() + width - 12, top + entryHeight / 4, vercheck.status().getSheetOffset() * 8, (vercheck.status().isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16); + guiGraphics.pose().popPose(); } } diff --git a/src/main/java/net/minecraftforge/client/gui/widget/ScrollPanel.java b/src/main/java/net/minecraftforge/client/gui/widget/ScrollPanel.java index c8929debea..5e4afe43dd 100644 --- a/src/main/java/net/minecraftforge/client/gui/widget/ScrollPanel.java +++ b/src/main/java/net/minecraftforge/client/gui/widget/ScrollPanel.java @@ -5,25 +5,22 @@ package net.minecraftforge.client.gui.widget; -import java.util.Collections; -import java.util.List; - +import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat; -import net.minecraft.client.gui.components.Renderable; -import net.minecraft.client.gui.narration.NarratableEntry; -import net.minecraft.client.renderer.GameRenderer; - -import com.mojang.blaze3d.systems.RenderSystem; - import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Renderable; import net.minecraft.client.gui.components.events.AbstractContainerEventHandler; import net.minecraft.client.gui.components.events.GuiEventListener; -import net.minecraftforge.client.gui.ScreenUtils; +import net.minecraft.client.gui.narration.NarratableEntry; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.renderer.GameRenderer; + +import java.util.Collections; +import java.util.List; /** * Abstract scroll panel class. @@ -160,18 +157,18 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen /** * Draws the background of the scroll panel. This runs AFTER Scissors are enabled. */ - protected void drawBackground(PoseStack matrix, Tesselator tess, float partialTick) + protected void drawBackground(GuiGraphics guiGraphics, Tesselator tess, float partialTick) { BufferBuilder worldr = tess.getBuilder(); if (this.client.level != null) { - this.drawGradientRect(matrix, this.left, this.top, this.right, this.bottom, bgColorFrom, bgColorTo); + this.drawGradientRect(guiGraphics, this.left, this.top, this.right, this.bottom, bgColorFrom, bgColorTo); } else // Draw dark dirt background { RenderSystem.setShader(GameRenderer::getPositionTexColorShader); - RenderSystem.setShaderTexture(0, GuiComponent.BACKGROUND_LOCATION); + RenderSystem.setShaderTexture(0, Screen.BACKGROUND_LOCATION); final float texScale = 32.0F; worldr.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); worldr.vertex(this.left, this.bottom, 0.0D).uv(this.left / texScale, (this.bottom + (int)this.scrollDistance) / texScale).color(0x20, 0x20, 0x20, 0xFF).endVertex(); @@ -186,7 +183,7 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen * Draw anything special on the screen. Scissor (RenderSystem.enableScissor) is enabled * for anything that is rendered outside the view box. Do not mess with Scissor unless you support this. */ - protected abstract void drawPanel(PoseStack poseStack, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY); + protected abstract void drawPanel(GuiGraphics guiGraphics, int entryRight, int relativeY, Tesselator tess, int mouseX, int mouseY); protected boolean clickPanel(double mouseX, double mouseY, int button) { return false; } @@ -295,7 +292,7 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen } @Override - public void render(PoseStack matrix, int mouseX, int mouseY, float partialTick) + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { Tesselator tess = Tesselator.getInstance(); BufferBuilder worldr = tess.getBuilder(); @@ -304,10 +301,10 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen RenderSystem.enableScissor((int)(left * scale), (int)(client.getWindow().getHeight() - (bottom * scale)), (int)(width * scale), (int)(height * scale)); - this.drawBackground(matrix, tess, partialTick); + this.drawBackground(guiGraphics, tess, partialTick); int baseY = this.top + border - (int)this.scrollDistance; - this.drawPanel(matrix, right, baseY, tess, mouseX, mouseY); + this.drawPanel(guiGraphics, right, baseY, tess, mouseX, mouseY); RenderSystem.disableDepthTest(); @@ -364,9 +361,9 @@ public abstract class ScrollPanel extends AbstractContainerEventHandler implemen RenderSystem.disableScissor(); } - protected void drawGradientRect(PoseStack poseStack, int left, int top, int right, int bottom, int color1, int color2) + protected void drawGradientRect(GuiGraphics guiGraphics, int left, int top, int right, int bottom, int color1, int color2) { - ScreenUtils.drawGradientRect(poseStack.last().pose(), 0, left, top, right, bottom, color1, color2); + guiGraphics.fillGradient(left, top, right, bottom, color1, color2); } @Override diff --git a/src/main/java/net/minecraftforge/client/gui/widget/UnicodeGlyphButton.java b/src/main/java/net/minecraftforge/client/gui/widget/UnicodeGlyphButton.java index 988d204f44..079af7dbf7 100644 --- a/src/main/java/net/minecraftforge/client/gui/widget/UnicodeGlyphButton.java +++ b/src/main/java/net/minecraftforge/client/gui/widget/UnicodeGlyphButton.java @@ -5,11 +5,9 @@ package net.minecraftforge.client.gui.widget; -import com.mojang.blaze3d.vertex.PoseStack; - import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; -import net.minecraftforge.client.gui.ScreenUtils; /** * This class provides a button that shows a string glyph at the beginning. The glyph can be scaled using the glyphScale parameter. @@ -29,14 +27,14 @@ public class UnicodeGlyphButton extends ExtendedButton } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick) + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { if (this.visible) { Minecraft mc = Minecraft.getInstance(); this.isHovered = mouseX >= this.getX() && mouseY >= this.getY() && mouseX < this.getX() + this.width && mouseY < this.getY() + this.height; int k = !this.active ? 0 : (this.isHoveredOrFocused() ? 2 : 1); - ScreenUtils.blitWithBorder(poseStack, WIDGETS_LOCATION, this.getX(), this.getY(), 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, 0); + guiGraphics.blitWithBorder(WIDGETS_LOCATION, this.getX(), this.getY(), 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2); Component buttonText = this.createNarrationMessage(); int glyphWidth = (int) (mc.font.width(glyph) * glyphScale); @@ -50,14 +48,14 @@ public class UnicodeGlyphButton extends ExtendedButton strWidth = mc.font.width(buttonText); totalWidth = glyphWidth + strWidth; - poseStack.pushPose(); - poseStack.scale(glyphScale, glyphScale, 1.0F); - this.drawCenteredString(poseStack, mc.font, Component.literal(glyph), + guiGraphics.pose().pushPose(); + guiGraphics.pose().scale(glyphScale, glyphScale, 1.0F); + guiGraphics.drawCenteredString(mc.font, Component.literal(glyph), (int) (((this.getX() + (this.width / 2) - (strWidth / 2)) / glyphScale) - (glyphWidth / (2 * glyphScale)) + 2), (int) (((this.getY() + ((this.height - 8) / glyphScale) / 2) - 1) / glyphScale), getFGColor()); - poseStack.popPose(); + guiGraphics.pose().popPose(); - this.drawCenteredString(poseStack, mc.font, buttonText, (int) (this.getX() + (this.width / 2) + (glyphWidth / glyphScale)), + guiGraphics.drawCenteredString(mc.font, buttonText, (int) (this.getX() + (this.width / 2) + (glyphWidth / glyphScale)), this.getY() + (this.height - 8) / 2, getFGColor()); } diff --git a/src/main/java/net/minecraftforge/client/model/CompositeModel.java b/src/main/java/net/minecraftforge/client/model/CompositeModel.java index 7438f51fc5..baefc99f11 100644 --- a/src/main/java/net/minecraftforge/client/model/CompositeModel.java +++ b/src/main/java/net/minecraftforge/client/model/CompositeModel.java @@ -47,8 +47,6 @@ import net.minecraftforge.client.model.geometry.IGeometryLoader; import net.minecraftforge.client.model.geometry.IUnbakedGeometry; import net.minecraftforge.client.model.geometry.UnbakedGeometryHelper; import net.minecraftforge.common.util.ConcatenatedListView; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -60,30 +58,18 @@ import org.jetbrains.annotations.Nullable; */ public class CompositeModel implements IUnbakedGeometry { - private static final Logger LOGGER = LogManager.getLogger(); - private final ImmutableMap children; private final ImmutableList itemPasses; - private final boolean logWarning; public CompositeModel(ImmutableMap children, ImmutableList itemPasses) - { - this(children, itemPasses, false); - } - - private CompositeModel(ImmutableMap children, ImmutableList itemPasses, boolean logWarning) { this.children = children; this.itemPasses = itemPasses; - this.logWarning = logWarning; } @Override public BakedModel bake(IGeometryBakingContext context, ModelBaker baker, Function spriteGetter, ModelState modelState, ItemOverrides overrides, ResourceLocation modelLocation) { - if (logWarning) - LOGGER.warn("Model \"" + modelLocation + "\" is using the deprecated \"parts\" field in its composite model instead of \"children\". This field will be removed in 1.20."); - Material particleLocation = context.getMaterial("particle"); TextureAtlasSprite particle = spriteGetter.apply(particleLocation); @@ -405,8 +391,7 @@ public class CompositeModel implements IUnbakedGeometry { List itemPasses = new ArrayList<>(); ImmutableMap.Builder childrenBuilder = ImmutableMap.builder(); - readChildren(jsonObject, "children", deserializationContext, childrenBuilder, itemPasses, false); - boolean logWarning = readChildren(jsonObject, "parts", deserializationContext, childrenBuilder, itemPasses, true); + readChildren(jsonObject, "children", deserializationContext, childrenBuilder, itemPasses); var children = childrenBuilder.build(); if (children.isEmpty()) @@ -424,20 +409,19 @@ public class CompositeModel implements IUnbakedGeometry } } - return new CompositeModel(children, ImmutableList.copyOf(itemPasses), logWarning); + return new CompositeModel(children, ImmutableList.copyOf(itemPasses)); } - private boolean readChildren(JsonObject jsonObject, String name, JsonDeserializationContext deserializationContext, ImmutableMap.Builder children, List itemPasses, boolean logWarning) + private void readChildren(JsonObject jsonObject, String name, JsonDeserializationContext deserializationContext, ImmutableMap.Builder children, List itemPasses) { if (!jsonObject.has(name)) - return false; + return; var childrenJsonObject = jsonObject.getAsJsonObject(name); for (Map.Entry entry : childrenJsonObject.entrySet()) { children.put(entry.getKey(), deserializationContext.deserialize(entry.getValue(), BlockModel.class)); itemPasses.add(entry.getKey()); // We can do this because GSON preserves ordering during deserialization } - return logWarning; } } } diff --git a/src/main/java/net/minecraftforge/client/model/DynamicFluidContainerModel.java b/src/main/java/net/minecraftforge/client/model/DynamicFluidContainerModel.java index 59c5efb97f..0078602d67 100644 --- a/src/main/java/net/minecraftforge/client/model/DynamicFluidContainerModel.java +++ b/src/main/java/net/minecraftforge/client/model/DynamicFluidContainerModel.java @@ -5,12 +5,9 @@ package net.minecraftforge.client.model; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; -import com.google.common.collect.Sets; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonObject; -import com.mojang.datafixers.util.Pair; import com.mojang.math.Transformation; import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.multiplayer.ClientLevel; @@ -22,7 +19,6 @@ import net.minecraft.client.resources.model.BlockModelRotation; import net.minecraft.client.resources.model.Material; import net.minecraft.client.resources.model.ModelBaker; import net.minecraft.client.resources.model.ModelState; -import net.minecraft.client.resources.model.UnbakedModel; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.GsonHelper; import net.minecraft.world.entity.LivingEntity; @@ -40,16 +36,12 @@ import net.minecraftforge.client.model.geometry.StandaloneGeometryBakingContext; import net.minecraftforge.client.model.geometry.UnbakedGeometryHelper; import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.registries.ForgeRegistries; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.joml.Quaternionf; import org.joml.Vector3f; -import java.util.Collection; import java.util.Map; -import java.util.Set; import java.util.function.Function; /** @@ -64,8 +56,6 @@ import java.util.function.Function; */ public class DynamicFluidContainerModel implements IUnbakedGeometry { - private static final Logger LOGGER = LogManager.getLogger(); - // Depth offsets to prevent Z-fighting private static final Transformation FLUID_TRANSFORM = new Transformation(new Vector3f(), new Quaternionf(), new Vector3f(1, 1, 1.002f), new Quaternionf()); private static final Transformation COVER_TRANSFORM = new Transformation(new Vector3f(), new Quaternionf(), new Vector3f(1, 1, 1.004f), new Quaternionf()); @@ -74,22 +64,13 @@ public class DynamicFluidContainerModel implements IUnbakedGeometry deprecationWarnings; - public DynamicFluidContainerModel(Fluid fluid, boolean flipGas, boolean coverIsMask, boolean applyFluidLuminosity) - { - this(fluid, flipGas, coverIsMask, applyFluidLuminosity, false, Map.of()); - } - - private DynamicFluidContainerModel(Fluid fluid, boolean flipGas, boolean coverIsMask, boolean applyFluidLuminosity, boolean deprecatedLoader, Map deprecationWarnings) + private DynamicFluidContainerModel(Fluid fluid, boolean flipGas, boolean coverIsMask, boolean applyFluidLuminosity) { this.fluid = fluid; this.flipGas = flipGas; this.coverIsMask = coverIsMask; this.applyFluidLuminosity = applyFluidLuminosity; - this.deprecatedLoader = deprecatedLoader; - this.deprecationWarnings = deprecationWarnings; } public static RenderTypeGroup getLayerRenderTypes(boolean unlit) @@ -103,17 +84,12 @@ public class DynamicFluidContainerModel implements IUnbakedGeometry spriteGetter, ModelState modelState, ItemOverrides overrides, ResourceLocation modelLocation) { - if (deprecatedLoader) - LOGGER.warn("Model \"" + modelLocation + "\" is using the deprecated loader \"forge:bucket\" instead of \"forge:fluid_container\". This loader will be removed in 1.20."); - for (var entry : deprecationWarnings.entrySet()) - LOGGER.warn("Model \"" + modelLocation + "\" is using the deprecated \"" + entry.getKey() + "\" field in its fluid container model instead of \"" + entry.getValue() + "\". This field will be removed in 1.20."); - Material particleLocation = context.hasMaterial("particle") ? context.getMaterial("particle") : null; Material baseLocation = context.hasMaterial("base") ? context.getMaterial("base") : null; Material fluidMaskLocation = context.hasMaterial("fluid") ? context.getMaterial("fluid") : null; @@ -189,15 +165,10 @@ public class DynamicFluidContainerModel implements IUnbakedGeometry { - public static final Loader INSTANCE = new Loader(false); - @Deprecated(forRemoval = true, since = "1.19") - public static final Loader INSTANCE_DEPRECATED = new Loader(true); + public static final Loader INSTANCE = new Loader(); - private final boolean deprecated; - - private Loader(boolean deprecated) + private Loader() { - this.deprecated = deprecated; } @Override @@ -214,26 +185,8 @@ public class DynamicFluidContainerModel implements IUnbakedGeometrybuilder(); - if (jsonObject.has("flipGas")) - { - flip = GsonHelper.getAsBoolean(jsonObject, "flipGas"); - deprecationWarningsBuilder.put("flipGas", "flip_gas"); - } - if (jsonObject.has("coverIsMask")) - { - coverIsMask = GsonHelper.getAsBoolean(jsonObject, "coverIsMask"); - deprecationWarningsBuilder.put("coverIsMask", "cover_is_mask"); - } - if (jsonObject.has("applyFluidLuminosity")) - { - applyFluidLuminosity = GsonHelper.getAsBoolean(jsonObject, "applyFluidLuminosity"); - deprecationWarningsBuilder.put("applyFluidLuminosity", "apply_fluid_luminosity"); - } - // create new model with correct liquid - return new DynamicFluidContainerModel(fluid, flip, coverIsMask, applyFluidLuminosity, deprecated, deprecationWarningsBuilder.build()); + return new DynamicFluidContainerModel(fluid, flip, coverIsMask, applyFluidLuminosity); } } diff --git a/src/main/java/net/minecraftforge/client/model/ElementsModel.java b/src/main/java/net/minecraftforge/client/model/ElementsModel.java index 3401feec26..bdc7e58eaa 100644 --- a/src/main/java/net/minecraftforge/client/model/ElementsModel.java +++ b/src/main/java/net/minecraftforge/client/model/ElementsModel.java @@ -25,36 +25,22 @@ import net.minecraftforge.client.model.geometry.IGeometryBakingContext; import net.minecraftforge.client.model.geometry.IGeometryLoader; import net.minecraftforge.client.model.geometry.SimpleUnbakedGeometry; import net.minecraftforge.client.model.geometry.UnbakedGeometryHelper; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; /** * A model composed of vanilla {@linkplain BlockElement block elements}. */ public class ElementsModel extends SimpleUnbakedGeometry { - private static final Logger LOGGER = LogManager.getLogger(); - private final List elements; - private final boolean deprecatedLoader; public ElementsModel(List elements) - { - this(elements, false); - } - - private ElementsModel(List elements, boolean deprecatedLoader) { this.elements = elements; - this.deprecatedLoader = deprecatedLoader; } @Override protected void addQuads(IGeometryBakingContext context, IModelBuilder modelBuilder, ModelBaker baker, Function spriteGetter, ModelState modelState, ResourceLocation modelLocation) { - if (deprecatedLoader) - LOGGER.warn("Model \"" + modelLocation + "\" is using the deprecated loader \"minecraft:elements\" instead of \"forge:elements\". This loader will be removed in 1.20."); - // If there is a root transform, undo the ModelState transform, apply it, then re-apply the ModelState transform. // This is necessary because of things like UV locking, which should only respond to the ModelState, and as such // that is the only transform that should be applied during face bake. @@ -82,15 +68,10 @@ public class ElementsModel extends SimpleUnbakedGeometry public static final class Loader implements IGeometryLoader { - public static final Loader INSTANCE = new Loader(false); - @Deprecated(forRemoval = true, since = "1.19") - public static final Loader INSTANCE_DEPRECATED = new Loader(true); + public static final Loader INSTANCE = new Loader(); - private final boolean deprecated; - - private Loader(boolean deprecated) + private Loader() { - this.deprecated = deprecated; } @Override @@ -105,7 +86,7 @@ public class ElementsModel extends SimpleUnbakedGeometry elements.add(deserializationContext.deserialize(element, BlockElement.class)); } - return new ElementsModel(elements, deprecated); + return new ElementsModel(elements); } } } diff --git a/src/main/java/net/minecraftforge/client/model/IQuadTransformer.java b/src/main/java/net/minecraftforge/client/model/IQuadTransformer.java index 8b2b0ca487..f82cf0aac3 100644 --- a/src/main/java/net/minecraftforge/client/model/IQuadTransformer.java +++ b/src/main/java/net/minecraftforge/client/model/IQuadTransformer.java @@ -56,39 +56,6 @@ public interface IQuadTransformer }; } - /** - * Creates a {@link BakedQuad} transformer that does nothing. - * - * @deprecated Use {@link QuadTransformers#empty()} - */ - @Deprecated(forRemoval = true, since = "1.19") - static IQuadTransformer empty() - { - return QuadTransformers.empty(); - } - - /** - * Creates a {@link BakedQuad} transformer that applies the specified {@link Transformation}. - * - * @deprecated Use {@link QuadTransformers#applying(Transformation)} - */ - @Deprecated(forRemoval = true, since = "1.19") - static IQuadTransformer applying(Transformation transform) - { - return QuadTransformers.applying(transform); - } - - /** - * Creates a {@link BakedQuad} transformer that applies the specified lightmap. - * - * @deprecated Use {@link QuadTransformers#applyingLightmap(int)} - */ - @Deprecated(forRemoval = true, since = "1.19") - static IQuadTransformer applyingLightmap(int lightmap) - { - return QuadTransformers.applyingLightmap(lightmap); - } - private static BakedQuad copy(BakedQuad quad) { var vertices = quad.getVertices(); diff --git a/src/main/java/net/minecraftforge/client/model/SeparateTransformsModel.java b/src/main/java/net/minecraftforge/client/model/SeparateTransformsModel.java index abe1dca770..28993a67d4 100644 --- a/src/main/java/net/minecraftforge/client/model/SeparateTransformsModel.java +++ b/src/main/java/net/minecraftforge/client/model/SeparateTransformsModel.java @@ -36,8 +36,6 @@ import net.minecraftforge.client.model.data.ModelData; import net.minecraftforge.client.model.geometry.IGeometryBakingContext; import net.minecraftforge.client.model.geometry.IGeometryLoader; import net.minecraftforge.client.model.geometry.IUnbakedGeometry; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -46,30 +44,18 @@ import org.jetbrains.annotations.Nullable; */ public class SeparateTransformsModel implements IUnbakedGeometry { - private static final Logger LOGGER = LogManager.getLogger(); - private final BlockModel baseModel; private final ImmutableMap perspectives; - private final boolean deprecatedLoader; public SeparateTransformsModel(BlockModel baseModel, ImmutableMap perspectives) - { - this(baseModel, perspectives, false); - } - - private SeparateTransformsModel(BlockModel baseModel, ImmutableMap perspectives, boolean deprecatedLoader) { this.baseModel = baseModel; this.perspectives = perspectives; - this.deprecatedLoader = deprecatedLoader; } @Override public BakedModel bake(IGeometryBakingContext context, ModelBaker baker, Function spriteGetter, ModelState modelState, ItemOverrides overrides, ResourceLocation modelLocation) { - if (deprecatedLoader) - LOGGER.warn("Model \"" + modelLocation + "\" is using the deprecated loader \"forge:separate-perspective\" instead of \"forge:separate_transforms\". This loader will be removed in 1.20."); - return new Baked( context.useAmbientOcclusion(), context.isGui3d(), context.useBlockLight(), spriteGetter.apply(context.getMaterial("particle")), overrides, @@ -177,15 +163,10 @@ public class SeparateTransformsModel implements IUnbakedGeometry { - public static final Loader INSTANCE = new Loader(false); - @Deprecated(forRemoval = true, since = "1.19") - public static final Loader INSTANCE_DEPRECATED = new Loader(true); + public static final Loader INSTANCE = new Loader(); - private final boolean deprecated; - - private Loader(boolean deprecated) + private Loader() { - this.deprecated = deprecated; } @Override @@ -205,7 +186,7 @@ public class SeparateTransformsModel implements IUnbakedGeometry { - private final RootTransformBuilder rootTransform; - public BlockModelBuilder(ResourceLocation outputLocation, ExistingFileHelper existingFileHelper) { super(outputLocation, existingFileHelper); - this.rootTransform = new RootTransformBuilder(super.rootTransforms()); - } - - /** - * @deprecated Use {@link ModelBuilder#rootTransforms()} instead - */ - @Deprecated(forRemoval = true, since = "1.19.4") - public RootTransformBuilder rootTransform() - { - return rootTransform; } @Override @@ -48,293 +29,4 @@ public class BlockModelBuilder extends ModelBuilder { return super.toJson(); } - - /** - * @deprecated Use {@link ModelBuilder.RootTransformsBuilder} instead via {@link ModelBuilder#rootTransforms()} - */ - @Deprecated(forRemoval = true, since = "1.19.4") - public class RootTransformBuilder - { - private final ModelBuilder.RootTransformsBuilder rootTransforms; - - private RootTransformBuilder(ModelBuilder.RootTransformsBuilder rootTransforms) - { - this.rootTransforms = rootTransforms; - } - - /** - * Sets the translation of the root transform. - * - * @param translation the translation - * @return this builder - * @throws NullPointerException if {@code translation} is {@code null} - */ - public RootTransformBuilder translation(Vector3f translation) - { - rootTransforms.translation(translation); - return this; - } - - /** - * Sets the translation of the root transform. - * - * @param x x translation - * @param y y translation - * @param z z translation - * @return this builder - */ - public RootTransformBuilder translation(float x, float y, float z) - { - return translation(new Vector3f(x, y, z)); - } - - /** - * Sets the left rotation of the root transform. - * - * @param rotation the left rotation - * @return this builder - * @throws NullPointerException if {@code rotation} is {@code null} - */ - public RootTransformBuilder rotation(Quaternionf rotation) - { - rootTransforms.rotation(rotation); - return this; - } - - /** - * Sets the left rotation of the root transform. - * - * @param x x rotation - * @param y y rotation - * @param z z rotation - * @param isDegrees whether the rotation is in degrees or radians - * @return this builder - */ - public RootTransformBuilder rotation(float x, float y, float z, boolean isDegrees) - { - return rotation(TransformationHelper.quatFromXYZ(x, y, z, isDegrees)); - } - - /** - * Sets the left rotation of the root transform. - * - * @param leftRotation the left rotation - * @return this builder - * @throws NullPointerException if {@code leftRotation} is {@code null} - */ - public RootTransformBuilder leftRotation(Quaternionf leftRotation) - { - return rotation(leftRotation); - } - - /** - * Sets the left rotation of the root transform. - * - * @param x x rotation - * @param y y rotation - * @param z z rotation - * @param isDegrees whether the rotation is in degrees or radians - * @return this builder - */ - public RootTransformBuilder leftRotation(float x, float y, float z, boolean isDegrees) - { - return leftRotation(TransformationHelper.quatFromXYZ(x, y, z, isDegrees)); - } - - /** - * Sets the right rotation of the root transform. - * - * @param rightRotation the right rotation - * @return this builder - * @throws NullPointerException if {@code rightRotation} is {@code null} - */ - public RootTransformBuilder rightRotation(Quaternionf rightRotation) - { - rootTransforms.rightRotation(rightRotation); - return this; - } - - /** - * Sets the right rotation of the root transform. - * - * @param x x rotation - * @param y y rotation - * @param z z rotation - * @param isDegrees whether the rotation is in degrees or radians - * @return this builder - */ - public RootTransformBuilder rightRotation(float x, float y, float z, boolean isDegrees) - { - return rightRotation(TransformationHelper.quatFromXYZ(x, y, z, isDegrees)); - } - - /** - * Sets the right rotation of the root transform. - * - * @param postRotation the right rotation - * @return this builder - * @throws NullPointerException if {@code rightRotation} is {@code null} - */ - public RootTransformBuilder postRotation(Quaternionf postRotation) - { - return rightRotation(postRotation); - } - - /** - * Sets the right rotation of the root transform. - * - * @param x x rotation - * @param y y rotation - * @param z z rotation - * @param isDegrees whether the rotation is in degrees or radians - * @return this builder - */ - public RootTransformBuilder postRotation(float x, float y, float z, boolean isDegrees) - { - return postRotation(TransformationHelper.quatFromXYZ(x, y, z, isDegrees)); - } - - /** - * Sets the scale of the root transform. - * - * @param scale the scale - * @return this builder - */ - public RootTransformBuilder scale(float scale) - { - return scale(new Vector3f(scale, scale, scale)); - } - - /** - * Sets the scale of the root transform. - * - * @param xScale x scale - * @param yScale y scale - * @param zScale z scale - * @return this builder - */ - public RootTransformBuilder scale(float xScale, float yScale, float zScale) - { - return scale(new Vector3f(xScale, yScale, zScale)); - } - - /** - * Sets the scale of the root transform. - * - * @param scale the scale vector - * @return this builder - * @throws NullPointerException if {@code scale} is {@code null} - */ - public RootTransformBuilder scale(Vector3f scale) - { - rootTransforms.scale(scale); - return this; - } - - /** - * Sets the root transform. - * - * @param transformation the transformation to use - * @return this builder - * @throws NullPointerException if {@code transformation} is {@code null} - */ - public RootTransformBuilder transform(Transformation transformation) - { - rootTransforms.transform(transformation); - return this; - } - - /** - * Sets the origin of the root transform. - * - * @param origin the origin vector - * @return this builder - * @throws NullPointerException if {@code origin} is {@code null} - */ - public RootTransformBuilder origin(Vector3f origin) - { - rootTransforms.origin(origin); - return this; - } - - /** - * Sets the origin of the root transform. - * - * @param origin the origin name - * @return this builder - * @throws NullPointerException if {@code origin} is {@code null} - * @throws IllegalArgumentException if {@code origin} is not {@code center}, {@code corner} or {@code opposing-corner} - */ - public RootTransformBuilder origin(TransformOrigin origin) - { - rootTransforms.origin(origin.toNewOrigin()); - return this; - } - - /** - * Finish configuring the parent builder - * @return the parent block model builder - */ - public BlockModelBuilder end() - { - return BlockModelBuilder.this; - } - - public JsonObject toJson() - { - return rootTransforms.toJson(); - } - - /** - * @deprecated Use {@link TransformationHelper.TransformOrigin} instead - */ - @Deprecated(forRemoval = true, since = "1.19.4") - public enum TransformOrigin implements StringRepresentable - { - CENTER(TransformationHelper.TransformOrigin.CENTER), - CORNER(TransformationHelper.TransformOrigin.CORNER), - OPPOSING_CORNER(TransformationHelper.TransformOrigin.OPPOSING_CORNER); - - private final TransformationHelper.TransformOrigin newOrigin; - - TransformOrigin(TransformationHelper.TransformOrigin newOrigin) - { - this.newOrigin = newOrigin; - } - - public Vector3f getVector() - { - return newOrigin.getVector(); - } - - @Override - @NotNull - public String getSerializedName() - { - return newOrigin.getSerializedName(); - } - - private TransformationHelper.TransformOrigin toNewOrigin() - { - return newOrigin; - } - - public static @Nullable TransformOrigin fromString(String originName) - { - if (CENTER.getSerializedName().equals(originName)) - { - return CENTER; - } - if (CORNER.getSerializedName().equals(originName)) - { - return CORNER; - } - if (OPPOSING_CORNER.getSerializedName().equals(originName)) - { - return OPPOSING_CORNER; - } - return null; - } - } - } } diff --git a/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java b/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java index fcffaa5902..09e74f931e 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java +++ b/src/main/java/net/minecraftforge/client/model/generators/BlockStateProvider.java @@ -5,7 +5,6 @@ package net.minecraftforge.client.model.generators; -import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -59,6 +58,7 @@ import net.minecraftforge.registries.ForgeRegistries; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.VisibleForTesting; /** * Data provider for blockstate files. Extends {@link BlockModelProvider} so that diff --git a/src/main/java/net/minecraftforge/client/model/generators/IGeneratedBlockState.java b/src/main/java/net/minecraftforge/client/model/generators/IGeneratedBlockState.java index a7f5212a87..a5d0b1992b 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/IGeneratedBlockState.java +++ b/src/main/java/net/minecraftforge/client/model/generators/IGeneratedBlockState.java @@ -5,8 +5,8 @@ package net.minecraftforge.client.model.generators; -import com.google.common.annotations.VisibleForTesting; import com.google.gson.JsonObject; +import org.jetbrains.annotations.VisibleForTesting; @VisibleForTesting public interface IGeneratedBlockState diff --git a/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java b/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java index dc4595aec7..ef8bedb3c8 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ModelBuilder.java @@ -15,7 +15,6 @@ import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.stream.Collectors; -import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.gson.Gson; import com.google.gson.JsonArray; @@ -38,6 +37,7 @@ import net.minecraftforge.client.model.ForgeFaceData; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.common.util.TransformationHelper; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.VisibleForTesting; import org.joml.Quaternionf; import org.joml.Vector3f; @@ -519,7 +519,7 @@ public class ModelBuilder> extends ModelFile { public ElementBuilder cube(String texture) { return allFaces(addTexture(texture).andThen((dir, f) -> f.cullface(dir))); } - + /** * Set the block and sky light of the element (0-15). * Traditional "emissivity" values were set both of these to the same value. diff --git a/src/main/java/net/minecraftforge/client/model/generators/ModelProvider.java b/src/main/java/net/minecraftforge/client/model/generators/ModelProvider.java index d08c9bd6a3..4afdf1c0b7 100644 --- a/src/main/java/net/minecraftforge/client/model/generators/ModelProvider.java +++ b/src/main/java/net/minecraftforge/client/model/generators/ModelProvider.java @@ -5,7 +5,6 @@ package net.minecraftforge.client.model.generators; -import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -22,6 +21,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.PackType; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.common.data.ExistingFileHelper.ResourceType; +import org.jetbrains.annotations.VisibleForTesting; public abstract class ModelProvider> implements DataProvider { diff --git a/src/main/java/net/minecraftforge/client/model/geometry/GeometryLoaderManager.java b/src/main/java/net/minecraftforge/client/model/geometry/GeometryLoaderManager.java index 2be549bb93..264e047b54 100644 --- a/src/main/java/net/minecraftforge/client/model/geometry/GeometryLoaderManager.java +++ b/src/main/java/net/minecraftforge/client/model/geometry/GeometryLoaderManager.java @@ -47,7 +47,6 @@ public final class GeometryLoaderManager public static void init() { var loaders = new HashMap>(); - loaders.put(new ResourceLocation("minecraft:elements"), ElementsModel.Loader.INSTANCE_DEPRECATED); // TODO: Deprecated. To be removed in 1.20 var event = new ModelEvent.RegisterGeometryLoaders(loaders); ModLoader.get().postEventWrapContainerInModOrder(event); LOADERS = ImmutableMap.copyOf(loaders); diff --git a/src/main/java/net/minecraftforge/client/model/geometry/UnbakedGeometryHelper.java b/src/main/java/net/minecraftforge/client/model/geometry/UnbakedGeometryHelper.java index 862cb9d060..521a238b7d 100644 --- a/src/main/java/net/minecraftforge/client/model/geometry/UnbakedGeometryHelper.java +++ b/src/main/java/net/minecraftforge/client/model/geometry/UnbakedGeometryHelper.java @@ -108,18 +108,6 @@ public class UnbakedGeometryHelper if (blockModel.getRootModel() == ModelBakery.GENERATION_MARKER) return ITEM_MODEL_GENERATOR.generateBlockModel(spriteGetter, blockModel).bake(modelBaker, blockModel, spriteGetter, modelState, modelLocation, guiLight3d); - return bakeVanilla(blockModel, modelBaker, owner, spriteGetter, modelState, modelLocation); - } - - /** - * Helper for baking vanilla {@link BlockModel} instances. - * - * @deprecated Merge into the method above in 1.20 once the call from {@link BlockModel} is gone. - */ - @ApiStatus.Internal - @Deprecated(forRemoval = true, since = "1.19.2") - public static BakedModel bakeVanilla(BlockModel blockModel, ModelBaker modelBaker, BlockModel owner, Function spriteGetter, ModelState modelState, ResourceLocation modelLocation) - { if (blockModel.getRootModel() == ModelBakery.BLOCK_ENTITY_MARKER) { var particleSprite = spriteGetter.apply(blockModel.getMaterial("particle")); diff --git a/src/main/java/net/minecraftforge/client/model/obj/ObjLoader.java b/src/main/java/net/minecraftforge/client/model/obj/ObjLoader.java index b06c4569ef..d4d7f34761 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/ObjLoader.java +++ b/src/main/java/net/minecraftforge/client/model/obj/ObjLoader.java @@ -58,49 +58,16 @@ public class ObjLoader implements IGeometryLoader, ResourceManagerRelo boolean emissiveAmbient = GsonHelper.getAsBoolean(jsonObject, "emissive_ambient", true); String mtlOverride = GsonHelper.getAsString(jsonObject, "mtl_override", null); - // TODO: Deprecated names. To be removed in 1.20 - var deprecationWarningsBuilder = ImmutableMap.builder(); - if (jsonObject.has("detectCullableFaces")) - { - automaticCulling = GsonHelper.getAsBoolean(jsonObject, "detectCullableFaces"); - deprecationWarningsBuilder.put("detectCullableFaces", "automatic_culling"); - } - if (jsonObject.has("diffuseLighting")) - { - shadeQuads = GsonHelper.getAsBoolean(jsonObject, "diffuseLighting"); - deprecationWarningsBuilder.put("diffuseLighting", "shade_quads"); - } - if (jsonObject.has("flip-v")) - { - flipV = GsonHelper.getAsBoolean(jsonObject, "flip-v"); - deprecationWarningsBuilder.put("flip-v", "flip_v"); - } - if (jsonObject.has("ambientToFullbright")) - { - emissiveAmbient = GsonHelper.getAsBoolean(jsonObject, "ambientToFullbright"); - deprecationWarningsBuilder.put("ambientToFullbright", "emissive_ambient"); - } - if (jsonObject.has("materialLibraryOverride")) - { - mtlOverride = GsonHelper.getAsString(jsonObject, "materialLibraryOverride"); - deprecationWarningsBuilder.put("materialLibraryOverride", "mtl_override"); - } - - return loadModel(new ObjModel.ModelSettings(new ResourceLocation(modelLocation), automaticCulling, shadeQuads, flipV, emissiveAmbient, mtlOverride), deprecationWarningsBuilder.build()); + return loadModel(new ObjModel.ModelSettings(new ResourceLocation(modelLocation), automaticCulling, shadeQuads, flipV, emissiveAmbient, mtlOverride)); } public ObjModel loadModel(ObjModel.ModelSettings settings) - { - return loadModel(settings, Map.of()); - } - - private ObjModel loadModel(ObjModel.ModelSettings settings, Map deprecationWarnings) { return modelCache.computeIfAbsent(settings, (data) -> { Resource resource = manager.getResource(settings.modelLocation()).orElseThrow(); try (ObjTokenizer tokenizer = new ObjTokenizer(resource.open())) { - return ObjModel.parse(tokenizer, settings, deprecationWarnings); + return ObjModel.parse(tokenizer, settings); } catch (FileNotFoundException e) { throw new RuntimeException("Could not find OBJ model", e); diff --git a/src/main/java/net/minecraftforge/client/model/obj/ObjModel.java b/src/main/java/net/minecraftforge/client/model/obj/ObjModel.java index 607c8769d3..3891d609a2 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/ObjModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/ObjModel.java @@ -29,8 +29,6 @@ import net.minecraftforge.client.model.pipeline.QuadBakingVertexConsumer; import net.minecraftforge.client.model.renderable.CompositeRenderable; import net.minecraftforge.client.textures.UnitTextureAtlasSprite; import org.apache.commons.lang3.tuple.Pair; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.joml.Vector3f; @@ -58,8 +56,6 @@ import java.util.stream.Stream; */ public class ObjModel extends SimpleUnbakedGeometry { - private static final Logger LOGGER = LogManager.getLogger(); - private static final Vector4f COLOR_WHITE = new Vector4f(1, 1, 1, 1); private static final Vec2[] DEFAULT_COORDS = { new Vec2(0, 0), @@ -86,9 +82,7 @@ public class ObjModel extends SimpleUnbakedGeometry public final ResourceLocation modelLocation; - private final Map deprecationWarnings; - - private ObjModel(ModelSettings settings, Map deprecationWarnings) + private ObjModel(ModelSettings settings) { this.modelLocation = settings.modelLocation; this.automaticCulling = settings.automaticCulling; @@ -96,19 +90,13 @@ public class ObjModel extends SimpleUnbakedGeometry this.flipV = settings.flipV; this.emissiveAmbient = settings.emissiveAmbient; this.mtlOverride = settings.mtlOverride; - this.deprecationWarnings = deprecationWarnings; } public static ObjModel parse(ObjTokenizer tokenizer, ModelSettings settings) throws IOException - { - return parse(tokenizer, settings, Map.of()); - } - - static ObjModel parse(ObjTokenizer tokenizer, ModelSettings settings, Map deprecationWarnings) throws IOException { var modelLocation = settings.modelLocation; var materialLibraryOverrideLocation = settings.mtlOverride; - var model = new ObjModel(settings, deprecationWarnings); + var model = new ObjModel(settings); // for relative references to material libraries String modelDomain = modelLocation.getNamespace(); @@ -348,9 +336,6 @@ public class ObjModel extends SimpleUnbakedGeometry @Override protected void addQuads(IGeometryBakingContext owner, IModelBuilder modelBuilder, ModelBaker baker, Function spriteGetter, ModelState modelTransform, ResourceLocation modelLocation) { - for (var entry : deprecationWarnings.entrySet()) - LOGGER.warn("Model \"" + modelLocation + "\" is using the deprecated \"" + entry.getKey() + "\" field in its OBJ model instead of \"" + entry.getValue() + "\". This field will be removed in 1.20."); - parts.values().stream().filter(part -> owner.isComponentVisible(part.name(), true)) .forEach(part -> part.addQuads(owner, modelBuilder, baker, spriteGetter, modelTransform, modelLocation)); } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/RemappingVertexPipeline.java b/src/main/java/net/minecraftforge/client/model/pipeline/RemappingVertexPipeline.java index be6820eee0..f9ec60aa88 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/RemappingVertexPipeline.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/RemappingVertexPipeline.java @@ -137,6 +137,7 @@ public class RemappingVertexPipeline implements VertexConsumer else parent.misc(element, misc[miscElementIds.get(element)]); } + parent.endVertex(); } @Override diff --git a/src/main/java/net/minecraftforge/common/CreativeModeTabRegistry.java b/src/main/java/net/minecraftforge/common/CreativeModeTabRegistry.java index e4141a343b..d7f2000f6c 100644 --- a/src/main/java/net/minecraftforge/common/CreativeModeTabRegistry.java +++ b/src/main/java/net/minecraftforge/common/CreativeModeTabRegistry.java @@ -5,8 +5,6 @@ package net.minecraftforge.common; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import com.google.common.graph.ElementOrder; @@ -19,15 +17,8 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.mojang.logging.LogUtils; import it.unimi.dsi.fastutil.booleans.BooleanConsumer; -import java.io.IOException; -import java.io.Reader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.function.Consumer; -import java.util.stream.Collectors; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; import net.minecraft.server.packs.resources.PreparableReloadListener; @@ -40,8 +31,6 @@ import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTabs; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.CreativeModeTabSearchRegistry; -import net.minecraftforge.event.CreativeModeTabEvent; -import net.minecraftforge.fml.ModLoader; import net.minecraftforge.fml.loading.FMLEnvironment; import net.minecraftforge.fml.loading.FMLLoader; import net.minecraftforge.fml.loading.toposort.TopologicalSort; @@ -51,12 +40,22 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; +import java.io.IOException; +import java.io.Reader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + public final class CreativeModeTabRegistry { private static final Logger LOGGER = LogUtils.getLogger(); private static final ResourceLocation CREATIVE_MODE_TAB_ORDERING_JSON = new ResourceLocation("forge", "creative_mode_tab_ordering.json"); private static final List SORTED_TABS = new ArrayList<>(); private static final List SORTED_TABS_VIEW = Collections.unmodifiableList(SORTED_TABS); + private static final List DEFAULT_TABS = new ArrayList<>(); /** * {@return an unmodifiable view of the sorted list of creative mode tabs in ascending order} @@ -66,6 +65,10 @@ public final class CreativeModeTabRegistry return SORTED_TABS_VIEW; } + public static List getDefaultTabs() { + return Collections.unmodifiableList(DEFAULT_TABS); + } + /** * {@return the {@linkplain CreativeModeTab} with the given name, or null} * @@ -74,7 +77,7 @@ public final class CreativeModeTabRegistry @Nullable public static CreativeModeTab getTab(ResourceLocation name) { - return creativeModeTabs.get(name); + return BuiltInRegistries.CREATIVE_MODE_TAB.get(name); } /** @@ -85,67 +88,10 @@ public final class CreativeModeTabRegistry @Nullable public static ResourceLocation getName(CreativeModeTab tab) { - return creativeModeTabs.inverse().get(tab); + return BuiltInRegistries.CREATIVE_MODE_TAB.getKey(tab); } - private static void processCreativeModeTab(CreativeModeTab creativeModeTab, ResourceLocation name, List afterEntries, List beforeEntries) - { - creativeModeTabs.put(name, creativeModeTab); - for (Object after : afterEntries) - { - ResourceLocation other = getCreativeModeTabName(after); - edges.put(other, name); - } - for (Object before : beforeEntries) - { - ResourceLocation other = getCreativeModeTabName(before); - edges.put(name, other); - } - } - - private static ResourceLocation getCreativeModeTabName(Object entry) - { - if (entry instanceof String s) - return new ResourceLocation(s); - if (entry instanceof ResourceLocation rl) - return rl; - if (entry instanceof CreativeModeTab t) - return Objects.requireNonNull(getName(t), "Can't have sorting dependencies for creative mode tabs not registered in the CreativeModeTabSortingRegistry"); - throw new IllegalStateException("Invalid object type passed into the CreativeModeTab dependencies " + entry.getClass()); - } - - private static final BiMap creativeModeTabs = HashBiMap.create(); - private static final BiMap vanillaCreativeModeTabs = HashBiMap.create(); private static final Multimap edges = HashMultimap.create(); - private static final Multimap vanillaEdges = HashMultimap.create(); - - static - { - final ResourceLocation buildingBlocks = new ResourceLocation("building_blocks"); - final ResourceLocation coloredBlocks = new ResourceLocation("colored_blocks"); - final ResourceLocation naturalBlocks = new ResourceLocation("natural_blocks"); - final ResourceLocation functionalBlocks = new ResourceLocation("functional_blocks"); - final ResourceLocation redstoneBlocks = new ResourceLocation("redstone_blocks"); - final ResourceLocation toolsAndUtilities = new ResourceLocation("tools_and_utilities"); - final ResourceLocation combat = new ResourceLocation("combat"); - final ResourceLocation foodAndDrinks = new ResourceLocation("food_and_drinks"); - final ResourceLocation ingredients = new ResourceLocation("ingredients"); - final ResourceLocation spawnEggs = new ResourceLocation("spawn_eggs"); - - processCreativeModeTab(CreativeModeTabs.BUILDING_BLOCKS, buildingBlocks, List.of(), List.of()); - processCreativeModeTab(CreativeModeTabs.COLORED_BLOCKS, coloredBlocks, List.of(buildingBlocks), List.of(naturalBlocks)); - processCreativeModeTab(CreativeModeTabs.NATURAL_BLOCKS, naturalBlocks, List.of(coloredBlocks), List.of(functionalBlocks)); - processCreativeModeTab(CreativeModeTabs.FUNCTIONAL_BLOCKS, functionalBlocks, List.of(naturalBlocks), List.of(redstoneBlocks)); - processCreativeModeTab(CreativeModeTabs.REDSTONE_BLOCKS, redstoneBlocks, List.of(functionalBlocks), List.of(toolsAndUtilities)); - processCreativeModeTab(CreativeModeTabs.TOOLS_AND_UTILITIES, toolsAndUtilities, List.of(redstoneBlocks), List.of(combat)); - processCreativeModeTab(CreativeModeTabs.COMBAT, combat, List.of(toolsAndUtilities), List.of(foodAndDrinks)); - processCreativeModeTab(CreativeModeTabs.FOOD_AND_DRINKS, foodAndDrinks, List.of(combat), List.of(ingredients)); - processCreativeModeTab(CreativeModeTabs.INGREDIENTS, ingredients, List.of(foodAndDrinks), List.of(spawnEggs)); - processCreativeModeTab(CreativeModeTabs.SPAWN_EGGS, spawnEggs, List.of(ingredients), List.of()); - - vanillaEdges.putAll(edges); - vanillaCreativeModeTabs.putAll(creativeModeTabs); - } static PreparableReloadListener getReloadListener() { @@ -190,7 +136,7 @@ public final class CreativeModeTabRegistry customOrder.add(CreativeModeTab); } - List missingCreativeModeTabs = creativeModeTabs.values().stream().filter(CreativeModeTab -> !customOrder.contains(CreativeModeTab)).toList(); + List missingCreativeModeTabs = BuiltInRegistries.CREATIVE_MODE_TAB.stream().filter(CreativeModeTab -> !customOrder.contains(CreativeModeTab)).toList(); if (!missingCreativeModeTabs.isEmpty()) throw new IllegalStateException("CreativeModeTabs missing from the ordered list: " + missingCreativeModeTabs.stream() .map(CreativeModeTab -> Objects.toString(CreativeModeTabRegistry.getName(CreativeModeTab))).collect(Collectors.joining(", "))); @@ -214,13 +160,17 @@ public final class CreativeModeTabRegistry { final MutableGraph graph = GraphBuilder.directed().nodeOrder(ElementOrder.insertion()).build(); - for (CreativeModeTab CreativeModeTab : creativeModeTabs.values()) + for (CreativeModeTab tab : BuiltInRegistries.CREATIVE_MODE_TAB) { - graph.addNode(CreativeModeTab); + if (!DEFAULT_TABS.contains(tab)) + graph.addNode(tab); } - edges.forEach((key, value) -> { - if (creativeModeTabs.containsKey(key) && creativeModeTabs.containsKey(value)) - graph.putEdge(creativeModeTabs.get(key), creativeModeTabs.get(value)); + edges.forEach((key, value) -> + { + final CreativeModeTab keyC = getTab(key); + final CreativeModeTab valueC = getTab(value); + if (keyC != null && valueC != null) + graph.putEdge(keyC, valueC); }); List tierList = TopologicalSort.topologicalSort(graph, null); @@ -229,7 +179,8 @@ public final class CreativeModeTabRegistry private static void setCreativeModeTabOrder(List tierList) { - runInServerThreadIfPossible(hasServer -> { + runInServerThreadIfPossible(hasServer -> + { SORTED_TABS.clear(); SORTED_TABS.addAll(tierList); }); @@ -245,15 +196,53 @@ public final class CreativeModeTabRegistry } @ApiStatus.Internal - public static void fireCollectionEvent() + public static void sortTabs() { edges.clear(); - edges.putAll(vanillaEdges); - creativeModeTabs.clear(); - creativeModeTabs.putAll(vanillaCreativeModeTabs); + DEFAULT_TABS.add(BuiltInRegistries.CREATIVE_MODE_TAB.get(CreativeModeTabs.HOTBAR)); + DEFAULT_TABS.add(BuiltInRegistries.CREATIVE_MODE_TAB.get(CreativeModeTabs.SEARCH)); + DEFAULT_TABS.add(BuiltInRegistries.CREATIVE_MODE_TAB.get(CreativeModeTabs.OP_BLOCKS)); + DEFAULT_TABS.add(BuiltInRegistries.CREATIVE_MODE_TAB.get(CreativeModeTabs.INVENTORY)); - ModLoader.get().postEvent(new CreativeModeTabEvent.Register(CreativeModeTabRegistry::registerCreativeModeTab)); + final List> indexed = new ArrayList<>(); + BuiltInRegistries.CREATIVE_MODE_TAB.holders().filter(c -> !DEFAULT_TABS.contains(c.get())).forEach(indexed::add); + for (int i = 0; i < 10; i++) // Vanilla ordering + { + final Holder value = indexed.get(i); + final CreativeModeTab tab = value.get(); + final ResourceLocation name = value.unwrapKey().orElseThrow().location(); + + final boolean specifiesOrder = !tab.tabsBefore.isEmpty() || !tab.tabsAfter.isEmpty(); + for (final ResourceLocation after : tab.tabsAfter.isEmpty() ? (i + 1 == indexed.size() || specifiesOrder ? + List.of() : List.of(indexed.get(i + 1).unwrapKey().orElseThrow().location())) : tab.tabsAfter) + { + edges.put(name, after); + } + + for (final ResourceLocation before : tab.tabsBefore.isEmpty() ? (i == 0 || specifiesOrder ? + List.of() : List.of(indexed.get(i - 1).unwrapKey().orElseThrow().location())) : tab.tabsBefore) + { + edges.put(before, name); + } + } + + for (int i = 10; i < indexed.size(); i++) + { + final Holder value = indexed.get(i); + final CreativeModeTab tab = value.get(); + final ResourceLocation name = value.unwrapKey().orElseThrow().location(); + + for (final ResourceLocation after : tab.tabsAfter) + { + edges.put(name, after); + } + + for (final ResourceLocation before : tab.tabsBefore) + { + edges.put(before, name); + } + } recalculateItemCreativeModeTabs(); @@ -261,22 +250,4 @@ public final class CreativeModeTabRegistry CreativeModeTabSearchRegistry.createSearchTrees(); } - @ApiStatus.Internal - private static CreativeModeTab registerCreativeModeTab(Consumer configurator, ResourceLocation name, List afterEntries, List beforeEntries) - { - if (creativeModeTabs.containsKey(name)) - throw new IllegalStateException("Duplicate creative mode tab with name: " + name); - - // The initial values for the builder do not matter - CreativeModeTab.Builder builder = new CreativeModeTab.Builder(CreativeModeTab.Row.TOP, 0); - configurator.accept(builder); - CreativeModeTab creativeModeTab = builder.build(); - - if (creativeModeTab.isAlignedRight()) - throw new IllegalStateException("CreativeModeTab " + name + " is aligned right, this is not supported!"); - - processCreativeModeTab(creativeModeTab, name, afterEntries, beforeEntries); - - return creativeModeTab; - } } diff --git a/src/main/java/net/minecraftforge/common/ForgeConfig.java b/src/main/java/net/minecraftforge/common/ForgeConfig.java index a02b69260c..32fc104c90 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfig.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfig.java @@ -77,36 +77,11 @@ public class ForgeConfig { * General configuration that doesn't need to be synchronized but needs to be available before server startup */ public static class Common { - @Deprecated(since = "1.19.2", forRemoval = true) - public final BooleanValue cachePackAccess; - @Deprecated(since = "1.19.2", forRemoval = true) - public final BooleanValue indexVanillaPackCachesOnThread; - @Deprecated(since = "1.19.2", forRemoval = true) - public final BooleanValue indexModPackCachesOnThread; Common(ForgeConfigSpec.Builder builder) { builder.comment("[DEPRECATED / NO EFFECT]: General configuration settings") .push("general"); - cachePackAccess = builder - .comment("[DEPRECATED / NO EFFECT] [NOW IN RESOURCE-CACHING CONFIG]: Set this to true to cache resource listings in resource and data packs") - .translation("forge.configgui.cachePackAccess") - .worldRestart() - .define("cachePackAccess", true); - - indexVanillaPackCachesOnThread = builder - .comment("[DEPRECATED / NO EFFECT] [NOW IN RESOURCE-CACHING CONFIG]: Set this to true to index vanilla resource and data packs on thread") - .translation("forge.configgui.indexVanillaPackCachesOnThread") - .worldRestart() - .define("indexVanillaPackCachesOnThread", false); - - indexModPackCachesOnThread = builder - .comment("[DEPRECATED / NO EFFECT] [NOW IN RESOURCE-CACHING CONFIG]: Set this to true to index mod resource and data packs on thread") - .translation("forge.configgui.indexModPackCachesOnThread") - .worldRestart() - .define("indexModPackCachesOnThread", false); - - builder.pop(); } } diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 527dece70e..88c1ceacfb 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -11,9 +11,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.Deque; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Locale; import java.util.Map; @@ -30,7 +28,6 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; -import com.google.common.collect.Queues; import com.google.common.collect.Sets; import com.google.gson.Gson; import com.google.gson.JsonElement; @@ -40,7 +37,6 @@ import com.mojang.serialization.Lifecycle; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import net.minecraft.ResourceLocationException; -import net.minecraft.advancements.Advancement; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.SharedSuggestionProvider; @@ -59,6 +55,8 @@ import net.minecraft.network.chat.contents.LiteralContents; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.metadata.pack.PackMetadataSection; +import net.minecraft.server.packs.resources.Resource; +import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagEntry; import net.minecraft.tags.TagKey; @@ -74,8 +72,6 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.ExperienceOrb; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeModifier; @@ -96,7 +92,6 @@ import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.WorldData; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.LootTables; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.entity.item.ItemEntity; @@ -114,7 +109,6 @@ import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.PotionUtils; import net.minecraft.stats.Stats; import net.minecraft.world.phys.Vec3; -import net.minecraft.world.level.BaseSpawner; import net.minecraft.world.level.block.entity.FurnaceBlockEntity; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.phys.AABB; @@ -158,11 +152,9 @@ import net.minecraftforge.event.entity.living.LivingChangeTargetEvent.ILivingTar import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.living.LivingKnockBackEvent; -import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; import net.minecraftforge.event.entity.living.LivingUseTotemEvent; import net.minecraftforge.event.entity.living.LootingLevelEvent; import net.minecraftforge.event.entity.living.ShieldBlockEvent; -import net.minecraftforge.event.entity.player.AdvancementEvent; import net.minecraftforge.event.entity.player.AnvilRepairEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.event.entity.player.CriticalHitEvent; @@ -171,7 +163,6 @@ import net.minecraftforge.event.entity.living.LivingGetProjectileEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.level.BlockEvent; import net.minecraftforge.event.level.NoteBlockEvent; -import net.minecraftforge.eventbus.api.Event.Result; import net.minecraftforge.fluids.FluidType; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoader; @@ -182,6 +173,7 @@ import net.minecraftforge.registries.GameData; import net.minecraftforge.registries.RegistryManager; import net.minecraftforge.server.permission.PermissionAPI; +import org.apache.commons.lang3.function.TriFunction; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Marker; @@ -193,7 +185,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.level.GameType; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.material.Fluid; import org.apache.maven.artifact.versioning.ArtifactVersion; @@ -236,23 +227,6 @@ public class ForgeHooks MinecraftForge.EVENT_BUS.post(new DifficultyChangeEvent(difficulty, oldDifficulty)); } - //Optifine Helper Functions u.u, these are here specifically for Optifine - //Note: When using Optifine, these methods are invoked using reflection, which - //incurs a major performance penalty. - // TODO: Remove in 1.20 - @Deprecated(since = "1.19.2", forRemoval = true) - public static void onLivingSetAttackTarget(LivingEntity entity, LivingEntity target) - { - MinecraftForge.EVENT_BUS.post(new LivingSetAttackTargetEvent(entity, target)); - } - - // TODO: Remove in 1.20 - @Deprecated(since = "1.19.2", forRemoval = true) - public static void onLivingSetAttackTarget(LivingEntity entity, LivingEntity target, ILivingTargetType targetType) - { - MinecraftForge.EVENT_BUS.post(new LivingSetAttackTargetEvent(entity, target, targetType)); - } - public static LivingChangeTargetEvent onLivingChangeTarget(LivingEntity entity, LivingEntity originalTarget, ILivingTargetType targetType) { LivingChangeTargetEvent event = new LivingChangeTargetEvent(entity, originalTarget, targetType); @@ -392,7 +366,7 @@ public class ForgeHooks if (MinecraftForge.EVENT_BUS.post(event)) return null; - if (!player.level.isClientSide) + if (!player.level().isClientSide) player.getCommandSenderWorld().addFreshEntity(event.getEntity()); return event.getEntity(); } @@ -666,7 +640,7 @@ public class ForgeHooks public static int onGrindstoneChange(@NotNull ItemStack top, @NotNull ItemStack bottom, Container outputSlot, int xp) { - GrindstoneEvent.OnplaceItem e = new GrindstoneEvent.OnplaceItem(top, bottom, xp); + GrindstoneEvent.OnPlaceItem e = new GrindstoneEvent.OnPlaceItem(top, bottom, xp); if (MinecraftForge.EVENT_BUS.post(e)) { outputSlot.setItem(0, ItemStack.EMPTY); @@ -804,43 +778,38 @@ public class ForgeHooks return newGameType; } - private static ThreadLocal> lootContext = new ThreadLocal>(); - private static LootTableContext getLootTableContext() + public static TriFunction> getLootTableDeserializer(Gson gson, String directory) { - LootTableContext ctx = lootContext.get().peek(); - - if (ctx == null) - throw new JsonParseException("Invalid call stack, could not grab json context!"); // Should I throw this? Do we care about custom deserializers outside the manager? - - return ctx; + return (location, data, resourceManager) -> { + try + { + Resource resource = resourceManager.getResource(location.withPath(directory + "/" + location.getPath() + ".json")).orElse(null); + boolean custom = resource == null || !resource.isBuiltin(); + return Optional.ofNullable(loadLootTable(gson, location, data, custom)); + } + catch (Exception exception) + { + LOGGER.error("Couldn't parse element {}:{}", directory, location, exception); + return Optional.empty(); + } + }; } - @Nullable - public static LootTable loadLootTable(Gson gson, ResourceLocation name, JsonElement data, boolean custom, LootTables lootTableManager) + public static LootTable loadLootTable(Gson gson, ResourceLocation name, JsonElement data, boolean custom) { - Deque que = lootContext.get(); - if (que == null) - { - que = Queues.newArrayDeque(); - lootContext.set(que); - } - - LootTable ret = null; + LootTable ret; try { - que.push(new LootTableContext(name, custom)); ret = gson.fromJson(data, LootTable.class); ret.setLootTableId(name); - que.pop(); } catch (JsonParseException e) { - que.pop(); throw e; } if (!custom) - ret = ForgeEventFactory.loadLootTable(name, ret, lootTableManager); + ret = ForgeEventFactory.loadLootTable(name, ret); if (ret != null) ret.freeze(); @@ -892,91 +861,6 @@ public class ForgeHooks Biome apply(final Biome.ClimateSettings climate, final BiomeSpecialEffects effects, final BiomeGenerationSettings gen, final MobSpawnSettings spawns); } - private static class LootTableContext - { - public final ResourceLocation name; - private final boolean vanilla; - public final boolean custom; - public int poolCount = 0; - public int entryCount = 0; - private HashSet entryNames = Sets.newHashSet(); - - private LootTableContext(ResourceLocation name, boolean custom) - { - this.name = name; - this.custom = custom; - this.vanilla = "minecraft".equals(this.name.getNamespace()); - } - - private void resetPoolCtx() - { - this.entryCount = 0; - this.entryNames.clear(); - } - - public String validateEntryName(@Nullable String name) - { - if (name != null && !this.entryNames.contains(name)) - { - this.entryNames.add(name); - return name; - } - - if (!this.vanilla) - throw new JsonParseException("Loot Table \"" + this.name.toString() + "\" Duplicate entry name \"" + name + "\" for pool #" + (this.poolCount - 1) + " entry #" + (this.entryCount-1)); - - int x = 0; - while (this.entryNames.contains(name + "#" + x)) - x++; - - name = name + "#" + x; - this.entryNames.add(name); - - return name; - } - } - - public static String readPoolName(JsonObject json) - { - LootTableContext ctx = ForgeHooks.getLootTableContext(); - ctx.resetPoolCtx(); - - if (json.has("name")) - return GsonHelper.getAsString(json, "name"); - - if (ctx.custom) - return "custom#" + json.hashCode(); //We don't care about custom ones modders shouldn't be editing them! - - ctx.poolCount++; - - if (!ctx.vanilla) - throw new JsonParseException("Loot Table \"" + ctx.name.toString() + "\" Missing `name` entry for pool #" + (ctx.poolCount - 1)); - - return ctx.poolCount == 1 ? "main" : "pool" + (ctx.poolCount - 1); - } - - public static String readLootEntryName(JsonObject json, String type) - { - LootTableContext ctx = ForgeHooks.getLootTableContext(); - ctx.entryCount++; - - if (json.has("entryName")) - return ctx.validateEntryName(GsonHelper.getAsString(json, "entryName")); - - if (ctx.custom) - return "custom#" + json.hashCode(); //We don't care about custom ones modders shouldn't be editing them! - - String name = null; - if ("item".equals(type)) - name = GsonHelper.getAsString(json, "name"); - else if ("loot_table".equals(type)) - name = GsonHelper.getAsString(json, "name"); - else if ("empty".equals(type)) - name = "empty"; - - return ctx.validateEntryName(name); - } - public static boolean onCropsGrowPre(Level level, BlockPos pos, BlockState state, boolean def) { BlockEvent ev = new BlockEvent.CropGrowEvent.Pre(level,pos,state); @@ -1001,15 +885,6 @@ public class ForgeHooks return null; } - /** - * @deprecated See {@link ForgeEventFactory#onAdvancementEarnedEvent} and {@link ForgeEventFactory#onAdvancementProgressedEvent} - */ - @Deprecated(forRemoval = true, since = "1.19.2") - public static void onAdvancement(ServerPlayer player, Advancement advancement) - { - MinecraftForge.EVENT_BUS.post(new AdvancementEvent(player, advancement)); - } - /** * Hook to fire {@link ItemAttributeModifierEvent}. Modders should use {@link ItemStack#getAttributeModifiers(EquipmentSlot)} instead. */ @@ -1306,21 +1181,12 @@ public class ForgeHooks levelTag.put("fml", fmlData); } - /** - * @deprecated To be removed in 1.20. - * Use {@link #readAdditionalLevelSaveData(CompoundTag, LevelStorageSource.LevelDirectory)} instead. - */ - @Deprecated(forRemoval = true, since = "1.19.2") - public static void readAdditionalLevelSaveData(CompoundTag rootTag) { - readAdditionalLevelSaveData(rootTag, null); - } - /** * @param rootTag Level data file contents. - * @param levelDirectory Level currently being loaded. TODO 1.20 - Remove nullable annotation + * @param levelDirectory Level currently being loaded. */ @ApiStatus.Internal - public static void readAdditionalLevelSaveData(CompoundTag rootTag, @Nullable LevelStorageSource.LevelDirectory levelDirectory) + public static void readAdditionalLevelSaveData(CompoundTag rootTag, LevelStorageSource.LevelDirectory levelDirectory) { CompoundTag tag = rootTag.getCompound("fml"); if (tag.contains("LoadingModList")) diff --git a/src/main/java/net/minecraftforge/common/ForgeMod.java b/src/main/java/net/minecraftforge/common/ForgeMod.java index cbb1f268b0..a0ce44dcfc 100644 --- a/src/main/java/net/minecraftforge/common/ForgeMod.java +++ b/src/main/java/net/minecraftforge/common/ForgeMod.java @@ -26,6 +26,7 @@ import net.minecraft.commands.Commands; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.RangedAttribute; import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.BlockGetter; @@ -68,6 +69,7 @@ import net.minecraftforge.fluids.ForgeFlowingFluid; import net.minecraftforge.fml.*; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.*; +import net.minecraftforge.forge.snapshots.ForgeSnapshotsMod; import net.minecraftforge.registries.*; import net.minecraftforge.registries.holdersets.AndHolderSet; import net.minecraftforge.registries.holdersets.AnyHolderSet; @@ -123,6 +125,7 @@ import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.Predicate; import java.util.stream.Collectors; @Mod("forge") @@ -156,13 +159,6 @@ public class ForgeMod */ public static final RegistryObject BLOCK_REACH = ATTRIBUTES.register("block_reach", () -> new RangedAttribute("forge.block_reach", 4.5D, 0.0D, 1024.0D).setSyncable(true)); - /** - * TODO: Remove - * @deprecated - use {@link #BLOCK_REACH} - */ - @Deprecated(forRemoval = true, since = "1.19.4") - public static final RegistryObject REACH_DISTANCE = BLOCK_REACH; - /** * Attack Range represents the distance at which a player may attack an entity. The default is 3 blocks. Players in creative mode have an additional 3 blocks of entity reach. * The default of 3.0 is technically considered a bug by Mojang - see MC-172289 and MC-92484. However, updating this value would allow for longer-range attacks on vanilla servers, which makes some people mad. @@ -172,13 +168,6 @@ public class ForgeMod */ public static final RegistryObject ENTITY_REACH = ATTRIBUTES.register("entity_reach", () -> new RangedAttribute("forge.entity_reach", 3.0D, 0.0D, 1024.0D).setSyncable(true)); - /** - * TODO: Remove - * @deprecated - use {@link #ENTITY_REACH} - */ - @Deprecated(forRemoval = true, since = "1.19.4") - public static final RegistryObject ATTACK_RANGE = ENTITY_REACH; - /** * Step Height Addition modifies the amount of blocks an entity may walk up without jumping. * @see IForgeEntity#getStepHeight() @@ -371,7 +360,7 @@ public class ForgeMod @Override public double motionScale(Entity entity) { - return entity.level.dimensionType().ultraWarm() ? 0.007D : 0.0023333333333333335D; + return entity.level().dimensionType().ultraWarm() ? 0.007D : 0.0023333333333333335D; } @Override @@ -428,6 +417,7 @@ public class ForgeMod public ForgeMod() { LOGGER.info(FORGEMOD,"Forge mod loading, version {}, for MC {} with MCP {}", ForgeVersion.getVersion(), MCPVersion.getMCVersion(), MCPVersion.getMCPVersion()); + ForgeSnapshotsMod.logStartupWarning(); INSTANCE = this; MinecraftForge.initialize(); CrashReportCallables.registerCrashCallable("Crash Report UUID", ()-> { @@ -450,6 +440,7 @@ public class ForgeMod modEventBus.addListener(this::gatherData); modEventBus.addListener(this::loadComplete); modEventBus.addListener(this::registerFluids); + modEventBus.addListener(this::registerVanillaDisplayContexts); modEventBus.addListener(this::registerRecipeSerializers); modEventBus.addListener(this::registerLootData); modEventBus.register(this); @@ -603,6 +594,20 @@ public class ForgeMod } } + public void registerVanillaDisplayContexts(RegisterEvent event) + { + if (event.getRegistryKey().equals(ForgeRegistries.Keys.DISPLAY_CONTEXTS)) + { + IForgeRegistryInternal forgeRegistry = (IForgeRegistryInternal) event.getForgeRegistry(); + if (forgeRegistry == null) + throw new IllegalStateException("Item display context was not a forge registry, wtf???"); + + Arrays.stream(ItemDisplayContext.values()) + .filter(Predicate.not(ItemDisplayContext::isModded)) + .forEach(ctx -> forgeRegistry.register(ctx.getId(), new ResourceLocation("minecraft", ctx.getSerializedName()), ctx)); + } + } + public void registerRecipeSerializers(RegisterEvent event) { if (event.getRegistryKey().equals(ForgeRegistries.Keys.RECIPE_SERIALIZERS)) @@ -647,7 +652,7 @@ public class ForgeMod /** * TODO: Remove when {@link ForgeRegistry#addAlias(ResourceLocation, ResourceLocation)} is elevated to {@link IForgeRegistry}. */ - @Deprecated(forRemoval = true, since = "1.19.3") + @Deprecated(forRemoval = true, since = "1.20") private static void addAlias(IForgeRegistry registry, ResourceLocation from, ResourceLocation to) { ForgeRegistry fReg = (ForgeRegistry) registry; diff --git a/src/main/java/net/minecraftforge/common/IPlantable.java b/src/main/java/net/minecraftforge/common/IPlantable.java index 62c5c1a965..453bf4fa4e 100644 --- a/src/main/java/net/minecraftforge/common/IPlantable.java +++ b/src/main/java/net/minecraftforge/common/IPlantable.java @@ -16,7 +16,7 @@ import net.minecraft.world.level.BlockGetter; public interface IPlantable { default PlantType getPlantType(BlockGetter level, BlockPos pos) { - if (this instanceof CropBlock) return PlantType.CROP; + if (this instanceof CropBlock || this == Blocks.PITCHER_CROP) return PlantType.CROP; if (this instanceof SaplingBlock) return PlantType.PLAINS; if (this instanceof FlowerBlock) return PlantType.PLAINS; if (this == Blocks.DEAD_BUSH) return PlantType.DESERT; @@ -24,7 +24,7 @@ public interface IPlantable if (this == Blocks.RED_MUSHROOM) return PlantType.CAVE; if (this == Blocks.BROWN_MUSHROOM) return PlantType.CAVE; if (this == Blocks.NETHER_WART) return PlantType.NETHER; - if (this == Blocks.TALL_GRASS) return PlantType.PLAINS; + if (this == Blocks.TALL_GRASS) return PlantType.PLAINS; return net.minecraftforge.common.PlantType.PLAINS; } diff --git a/src/main/java/net/minecraftforge/common/Tags.java b/src/main/java/net/minecraftforge/common/Tags.java index b54e1f087f..cfec0f2137 100644 --- a/src/main/java/net/minecraftforge/common/Tags.java +++ b/src/main/java/net/minecraftforge/common/Tags.java @@ -419,61 +419,6 @@ public class Tags * @see net.minecraftforge.common.ToolActions */ public static final TagKey TOOLS = tag("tools"); - /** - * A tag containing all existing swords. - * - * Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}. - * - * @see net.minecraftforge.common.ToolAction - * @see net.minecraftforge.common.ToolActions - * @deprecated Replaced by net.minecraft.tags.ItemTags#SWORDS - */ - @Deprecated(since = "1.19.4", forRemoval = true) - public static final TagKey TOOLS_SWORDS = tag("tools/swords"); - /** - * A tag containing all existing axes. - * - * Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}. - * - * @see net.minecraftforge.common.ToolAction - * @see net.minecraftforge.common.ToolActions - * @deprecated Replaced by net.minecraft.tags.ItemTags#AXES - */ - @Deprecated(since = "1.19.4", forRemoval = true) - public static final TagKey TOOLS_AXES = tag("tools/axes"); - /** - * A tag containing all existing pickaxes. - * - * Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}. - * - * @see net.minecraftforge.common.ToolAction - * @see net.minecraftforge.common.ToolActions - * @deprecated Replaced by net.minecraft.tags.ItemTags#PICKAXES - */ - @Deprecated(since = "1.19.4", forRemoval = true) - public static final TagKey TOOLS_PICKAXES = tag("tools/pickaxes"); - /** - * A tag containing all existing shovels. - * - * Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}. - * - * @see net.minecraftforge.common.ToolAction - * @see net.minecraftforge.common.ToolActions - * @deprecated Replaced by net.minecraft.tags.ItemTags#SHOVELS - */ - @Deprecated(since = "1.19.4", forRemoval = true) - public static final TagKey TOOLS_SHOVELS = tag("tools/shovels"); - /** - * A tag containing all existing hoes. - * - * Note: This tag is not an alternative or a substitute to {@link net.minecraftforge.common.ToolActions}. - * - * @see net.minecraftforge.common.ToolAction - * @see net.minecraftforge.common.ToolActions - * @deprecated Replaced by net.minecraft.tags.ItemTags#HOES - */ - @Deprecated(since = "1.19.4", forRemoval = true) - public static final TagKey TOOLS_HOES = tag("tools/hoes"); /** * A tag containing all existing shields. * diff --git a/src/main/java/net/minecraftforge/common/capabilities/CapabilityProvider.java b/src/main/java/net/minecraftforge/common/capabilities/CapabilityProvider.java index 3b94292ec9..1319e2d349 100644 --- a/src/main/java/net/minecraftforge/common/capabilities/CapabilityProvider.java +++ b/src/main/java/net/minecraftforge/common/capabilities/CapabilityProvider.java @@ -7,7 +7,6 @@ package net.minecraftforge.common.capabilities; import javax.annotation.ParametersAreNonnullByDefault; -import com.google.common.annotations.VisibleForTesting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.nbt.CompoundTag; import net.minecraft.core.Direction; @@ -16,6 +15,7 @@ import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.event.ForgeEventFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.VisibleForTesting; import java.util.function.Supplier; diff --git a/src/main/java/net/minecraftforge/common/crafting/CraftingHelper.java b/src/main/java/net/minecraftforge/common/crafting/CraftingHelper.java index f380bece11..bcfb2bf97b 100644 --- a/src/main/java/net/minecraftforge/common/crafting/CraftingHelper.java +++ b/src/main/java/net/minecraftforge/common/crafting/CraftingHelper.java @@ -95,7 +95,7 @@ public class CraftingHelper return serializer.parse(buffer); } - public static Ingredient getIngredient(JsonElement json) + public static Ingredient getIngredient(JsonElement json, boolean allowEmpty) { if (json == null || json.isJsonNull()) throw new JsonSyntaxException("Json cannot be null"); @@ -106,7 +106,7 @@ public class CraftingHelper List vanilla = Lists.newArrayList(); json.getAsJsonArray().forEach((ele) -> { - Ingredient ing = CraftingHelper.getIngredient(ele); + Ingredient ing = CraftingHelper.getIngredient(ele, allowEmpty); if (ing.getClass() == Ingredient.class) //Vanilla, Due to how we read it splits each itemstack, so we pull out to re-merge later vanilla.add(ing); diff --git a/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java b/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java index def0270162..faddf5e8c1 100644 --- a/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java +++ b/src/main/java/net/minecraftforge/common/data/ExistingFileHelper.java @@ -6,14 +6,13 @@ package net.minecraftforge.common.data; import java.io.File; -import java.io.IOException; +import java.io.FileNotFoundException; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; -import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; @@ -36,6 +35,7 @@ import net.minecraftforge.fml.ModList; import net.minecraftforge.forgespi.language.IModFileInfo; import net.minecraftforge.resource.ResourcePackLoader; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.VisibleForTesting; /** * Enables data providers to check if other data files currently exist. The @@ -226,13 +226,18 @@ public class ExistingFileHelper { } @VisibleForTesting - public Resource getResource(ResourceLocation loc, PackType packType, String pathSuffix, String pathPrefix) throws IOException { + public Resource getResource(ResourceLocation loc, PackType packType, String pathSuffix, String pathPrefix) throws FileNotFoundException { return getResource(getLocation(loc, pathSuffix, pathPrefix), packType); } @VisibleForTesting - public Resource getResource(ResourceLocation loc, PackType packType) throws IOException { - return getManager(packType).getResource(loc).orElseThrow(); + public Resource getResource(ResourceLocation loc, PackType packType) throws FileNotFoundException { + return getManager(packType).getResourceOrThrow(loc); + } + + @VisibleForTesting + public List getResourceStack(ResourceLocation loc, PackType packType) { + return getManager(packType).getResourceStack(loc); } /** diff --git a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java index e0e01464d8..08f3447119 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeBlockTagsProvider.java @@ -51,7 +51,7 @@ public final class ForgeBlockTagsProvider extends BlockTagsProvider tag(END_STONES).add(Blocks.END_STONE); tag(ENDERMAN_PLACE_ON_BLACKLIST); tag(FENCE_GATES).addTags(FENCE_GATES_WOODEN); - tag(FENCE_GATES_WOODEN).add(Blocks.OAK_FENCE_GATE, Blocks.SPRUCE_FENCE_GATE, Blocks.BIRCH_FENCE_GATE, Blocks.JUNGLE_FENCE_GATE, Blocks.ACACIA_FENCE_GATE, Blocks.DARK_OAK_FENCE_GATE, Blocks.CRIMSON_FENCE_GATE, Blocks.WARPED_FENCE_GATE, Blocks.MANGROVE_FENCE_GATE); + tag(FENCE_GATES_WOODEN).add(Blocks.OAK_FENCE_GATE, Blocks.SPRUCE_FENCE_GATE, Blocks.BIRCH_FENCE_GATE, Blocks.JUNGLE_FENCE_GATE, Blocks.ACACIA_FENCE_GATE, Blocks.DARK_OAK_FENCE_GATE, Blocks.CRIMSON_FENCE_GATE, Blocks.WARPED_FENCE_GATE, Blocks.MANGROVE_FENCE_GATE, Blocks.BAMBOO_FENCE_GATE, Blocks.CHERRY_FENCE_GATE); tag(FENCES).addTags(FENCES_NETHER_BRICK, FENCES_WOODEN); tag(FENCES_NETHER_BRICK).add(Blocks.NETHER_BRICK_FENCE); tag(FENCES_WOODEN).addTag(BlockTags.WOODEN_FENCES); diff --git a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java index c2f1b99b85..115aa476d3 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeItemTagsProvider.java @@ -156,18 +156,12 @@ public final class ForgeItemTagsProvider extends ItemTagsProvider copy(Tags.Blocks.STORAGE_BLOCKS_RAW_IRON, Tags.Items.STORAGE_BLOCKS_RAW_IRON); copy(Tags.Blocks.STORAGE_BLOCKS_NETHERITE, Tags.Items.STORAGE_BLOCKS_NETHERITE); tag(Tags.Items.STRING).add(Items.STRING); - tag(Tags.Items.TOOLS_SWORDS).add(Items.WOODEN_SWORD, Items.STONE_SWORD, Items.IRON_SWORD, Items.GOLDEN_SWORD, Items.DIAMOND_SWORD, Items.NETHERITE_SWORD).addTags(ItemTags.SWORDS); - tag(Tags.Items.TOOLS_AXES).add(Items.WOODEN_AXE, Items.STONE_AXE, Items.IRON_AXE, Items.GOLDEN_AXE, Items.DIAMOND_AXE, Items.NETHERITE_AXE).addTags(ItemTags.AXES); - tag(Tags.Items.TOOLS_PICKAXES).add(Items.WOODEN_PICKAXE, Items.STONE_PICKAXE, Items.IRON_PICKAXE, Items.GOLDEN_PICKAXE, Items.DIAMOND_PICKAXE, Items.NETHERITE_PICKAXE).addTags(ItemTags.PICKAXES); - tag(Tags.Items.TOOLS_SHOVELS).add(Items.WOODEN_SHOVEL, Items.STONE_SHOVEL, Items.IRON_SHOVEL, Items.GOLDEN_SHOVEL, Items.DIAMOND_SHOVEL, Items.NETHERITE_SHOVEL).addTags(ItemTags.SHOVELS); - tag(Tags.Items.TOOLS_HOES).add(Items.WOODEN_HOE, Items.STONE_HOE, Items.IRON_HOE, Items.GOLDEN_HOE, Items.DIAMOND_HOE, Items.NETHERITE_HOE).addTags(ItemTags.HOES); tag(Tags.Items.TOOLS_SHIELDS).add(Items.SHIELD); tag(Tags.Items.TOOLS_BOWS).add(Items.BOW); tag(Tags.Items.TOOLS_CROSSBOWS).add(Items.CROSSBOW); tag(Tags.Items.TOOLS_FISHING_RODS).add(Items.FISHING_ROD); tag(Tags.Items.TOOLS_TRIDENTS).add(Items.TRIDENT); tag(Tags.Items.TOOLS) - .addTags(Tags.Items.TOOLS_SWORDS, Tags.Items.TOOLS_AXES, Tags.Items.TOOLS_PICKAXES, Tags.Items.TOOLS_SHOVELS, Tags.Items.TOOLS_HOES) // TODO: Since: 1.20, remove this line vanilla added these tags in 1.19.4 .addTags(ItemTags.SWORDS, ItemTags.AXES, ItemTags.PICKAXES, ItemTags.SHOVELS, ItemTags.HOES) .addTags(Tags.Items.TOOLS_SHIELDS, Tags.Items.TOOLS_BOWS, Tags.Items.TOOLS_CROSSBOWS, Tags.Items.TOOLS_FISHING_RODS, Tags.Items.TOOLS_TRIDENTS); tag(Tags.Items.ARMORS_HELMETS).add(Items.LEATHER_HELMET, Items.TURTLE_HELMET, Items.CHAINMAIL_HELMET, Items.IRON_HELMET, Items.GOLDEN_HELMET, Items.DIAMOND_HELMET, Items.NETHERITE_HELMET); diff --git a/src/main/java/net/minecraftforge/common/data/ForgeLootTableProvider.java b/src/main/java/net/minecraftforge/common/data/ForgeLootTableProvider.java index 414807373b..b4e5a4de2c 100644 --- a/src/main/java/net/minecraftforge/common/data/ForgeLootTableProvider.java +++ b/src/main/java/net/minecraftforge/common/data/ForgeLootTableProvider.java @@ -13,7 +13,7 @@ import net.minecraft.data.loot.packs.VanillaLootTableProvider; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.storage.loot.predicates.AlternativeLootItemCondition; +import net.minecraft.world.level.storage.loot.predicates.CompositeLootItemCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.predicates.InvertedLootItemCondition; import net.minecraft.world.level.storage.loot.predicates.MatchTool; @@ -114,7 +114,7 @@ public final class ForgeLootTableProvider extends LootTableProvider { if (invLootCondition instanceof MatchTool && checkMatchTool((MatchTool) invLootCondition, from)) { lootConditions[i] = InvertedLootItemCondition.invert(CanToolPerformAction.canToolPerformAction(toolAction)).build(); found = true; - } else if (invLootCondition instanceof AlternativeLootItemCondition && findAndReplaceInAlternative((AlternativeLootItemCondition) invLootCondition, from, toolAction)) { + } else if (invLootCondition instanceof CompositeLootItemCondition compositeLootItemCondition && findAndReplaceInComposite(compositeLootItemCondition, from, toolAction)) { found = true; } } @@ -149,7 +149,7 @@ public final class ForgeLootTableProvider extends LootTableProvider { } for (int i = 0; i < lootConditions.length; i++) { - if (lootConditions[i] instanceof AlternativeLootItemCondition && findAndReplaceInAlternative((AlternativeLootItemCondition) lootConditions[i], from, toolAction)) { + if (lootConditions[i] instanceof CompositeLootItemCondition composite && findAndReplaceInComposite(composite, from, toolAction)) { found = true; } else if (lootConditions[i] instanceof MatchTool && checkMatchTool((MatchTool) lootConditions[i], from)) { lootConditions[i] = CanToolPerformAction.canToolPerformAction(toolAction).build(); @@ -160,12 +160,12 @@ public final class ForgeLootTableProvider extends LootTableProvider { return found; } - private boolean findAndReplaceInAlternative(AlternativeLootItemCondition alternative, Item from, ToolAction toolAction) { - LootItemCondition[] lootConditions = ObfuscationReflectionHelper.getPrivateValue(AlternativeLootItemCondition.class, alternative, "f_8146" + "8_"); + private boolean findAndReplaceInComposite(CompositeLootItemCondition alternative, Item from, ToolAction toolAction) { + LootItemCondition[] lootConditions = ObfuscationReflectionHelper.getPrivateValue(CompositeLootItemCondition.class, alternative, "f_28560" + "9_"); boolean found = false; if (lootConditions == null) { - throw new IllegalStateException(AlternativeLootItemCondition.class.getName() + " is missing field f_8146" + "8_"); + throw new IllegalStateException(CompositeLootItemCondition.class.getName() + " is missing field f_28560" + "9_"); } for (int i = 0; i < lootConditions.length; i++) { diff --git a/src/main/java/net/minecraftforge/common/data/VanillaSoundDefinitionsProvider.java b/src/main/java/net/minecraftforge/common/data/VanillaSoundDefinitionsProvider.java index 9894f89e27..9a7c7f0e30 100644 --- a/src/main/java/net/minecraftforge/common/data/VanillaSoundDefinitionsProvider.java +++ b/src/main/java/net/minecraftforge/common/data/VanillaSoundDefinitionsProvider.java @@ -5,12 +5,10 @@ package net.minecraftforge.common.data; - import net.minecraft.data.PackOutput; import net.minecraftforge.common.ForgeMod; public class VanillaSoundDefinitionsProvider extends SoundDefinitionsProvider { - public VanillaSoundDefinitionsProvider(PackOutput output, ExistingFileHelper helper) { super(output, "minecraft", helper); } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java b/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java index 248fc21d39..426f9d6836 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeAbstractMinecart.java @@ -29,7 +29,7 @@ public interface IForgeAbstractMinecart int y = Mth.floor(self().getY()); int z = Mth.floor(self().getZ()); BlockPos pos = new BlockPos(x, y, z); - if (self().level.getBlockState(pos.below()).is(BlockTags.RAILS)) pos = pos.below(); + if (self().level().getBlockState(pos.below()).is(BlockTags.RAILS)) pos = pos.below(); return pos; } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeAdvancementBuilder.java b/src/main/java/net/minecraftforge/common/extensions/IForgeAdvancementBuilder.java index 69521f39cc..c823020068 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeAdvancementBuilder.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeAdvancementBuilder.java @@ -37,7 +37,7 @@ public interface IForgeAdvancementBuilder { if (fileHelper.exists(advancementId, PackType.SERVER_DATA, ".json", "advancements")) { - return new Advancement(advancementId, null, null, AdvancementRewards.EMPTY, Maps.newHashMap(), null); + return new Advancement(advancementId, null, null, AdvancementRewards.EMPTY, Maps.newHashMap(), new String[0][0], false); } return null; }); diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java index b9b8a77797..30a5b0e642 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java @@ -23,12 +23,13 @@ import net.minecraft.world.entity.projectile.FishingHook; import net.minecraft.world.entity.projectile.WitherSkull; import net.minecraft.world.item.*; import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.SignalGetter; import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.level.material.MaterialColor; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.pathfinder.BlockPathTypes; import net.minecraft.tags.BlockTags; import net.minecraft.core.Direction; @@ -430,7 +431,7 @@ public interface IForgeBlock */ default float getEnchantPowerBonus(BlockState state, LevelReader level, BlockPos pos) { - return state.is(Blocks.BOOKSHELF) ? 1: 0; + return state.is(BlockTags.ENCHANTMENT_POWER_PROVIDER) ? 1: 0; } /** @@ -442,13 +443,13 @@ public interface IForgeBlock default void onNeighborChange(BlockState state, LevelReader level, BlockPos pos, BlockPos neighbor){} /** - * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. + * Called to determine whether to allow the block to handle its own indirect power rather than using the default rules. * @param level The level * @param pos Block position in level * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side * @return Whether Block#isProvidingWeakPower should be called when determining indirect power */ - default boolean shouldCheckWeakPower(BlockState state, LevelReader level, BlockPos pos, Direction side) + default boolean shouldCheckWeakPower(BlockState state, SignalGetter level, BlockPos pos, Direction side) { return state.isRedstoneConductor(level, pos); } @@ -606,7 +607,7 @@ public interface IForgeBlock */ default boolean isFlammable(BlockState state, BlockGetter level, BlockPos pos, Direction direction) { - return state.getFlammability(level, pos, direction) > 0; + return state.ignitedByLava() || state.getFlammability(level, pos, direction) > 0; } /** @@ -911,14 +912,14 @@ public interface IForgeBlock } /** - * Returns the {@link MaterialColor} shown on the map. + * Returns the {@link MapColor} shown on the map. * * @param state The state of this block * @param level The level this block is in * @param pos The blocks position in the level - * @param defaultColor The {@code MaterialColor} configured for the given {@code BlockState} in the {@link BlockBehaviour.Properties} + * @param defaultColor The {@code MapColor} configured for the given {@code BlockState} in the {@link BlockBehaviour.Properties} */ - default MaterialColor getMapColor(BlockState state, BlockGetter level, BlockPos pos, MaterialColor defaultColor) + default MapColor getMapColor(BlockState state, BlockGetter level, BlockPos pos, MapColor defaultColor) { return defaultColor; } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java index 01b218b2df..03ee04cc6f 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java @@ -19,6 +19,7 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.FishingHook; import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.SignalGetter; import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.item.ItemStack; @@ -382,13 +383,13 @@ public interface IForgeBlockState } /** - * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. + * Called to determine whether to allow the block to handle its own indirect power rather than using the default rules. * @param level The level * @param pos Block position in level * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side * @return Whether Block#isProvidingWeakPower should be called when determining indirect power */ - default boolean shouldCheckWeakPower(LevelReader level, BlockPos pos, Direction side) + default boolean shouldCheckWeakPower(SignalGetter level, BlockPos pos, Direction side) { return self().getBlock().shouldCheckWeakPower(self(), level, pos, side); } @@ -669,7 +670,7 @@ public interface IForgeBlockState */ default boolean isScaffolding(LivingEntity entity) { - return self().getBlock().isScaffolding(self(), entity.level, entity.blockPosition(), entity); + return self().getBlock().isScaffolding(self(), entity.level(), entity.blockPosition(), entity); } /** diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java index a5b7aff7f1..d1cbdf2a51 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItem.java @@ -189,20 +189,6 @@ public interface IForgeItem return false; } - /** - * Called each tick while using an item. - * - * @param stack The Item being used - * @param player The Player using the item - * @param count The amount of time in tick the item has been used for - * continuously - * @deprecated {@link net.minecraft.world.item.Item#onUseTick(Level, LivingEntity, ItemStack, int) Implement Vanilla's Version} - */ - @Deprecated(since = "1.19.4", forRemoval = true) - default void onUsingTick(ItemStack stack, LivingEntity player, int count) - { - } - /** * Called when an entity stops using an item for any reason, notably when selecting another item without releasing or finishing. * This method is called in addition to any other hooks called when an item is finished using; when another hook is also called it will be called before this method. @@ -595,7 +581,7 @@ public interface IForgeItem return true; if (!newStack.isDamageableItem() || !oldStack.isDamageableItem()) - return !ItemStack.tagMatches(newStack, oldStack); + return !ItemStack.isSameItemSameTags(newStack, oldStack); CompoundTag newTag = newStack.getTag(); CompoundTag oldTag = oldStack.getTag(); @@ -628,7 +614,11 @@ public interface IForgeItem */ default boolean canContinueUsing(ItemStack oldStack, ItemStack newStack) { - return ItemStack.isSame(oldStack, newStack); + if (oldStack == newStack) { + return true; + } else { + return !oldStack.isEmpty() && !newStack.isEmpty() && ItemStack.isSameItem(newStack, oldStack); + } } /** @@ -862,7 +852,6 @@ public interface IForgeItem */ default boolean canGrindstoneRepair(ItemStack stack) { - // TODO 1.20: Change to return false; this changes the default behavior for all items from opt-out to opt-in. - return true; + return false; } } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java index 2b97421ff6..9bbc9b837f 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeItemStack.java @@ -38,6 +38,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Map; +import java.util.Objects; /* * Extension added to ItemStack that bounces to ItemSack sensitive Item methods. Typically this is just for convince. @@ -86,7 +87,7 @@ public interface IForgeItemStack extends ICapabilitySerializable Player entityplayer = context.getPlayer(); BlockPos blockpos = context.getClickedPos(); BlockInWorld blockworldstate = new BlockInWorld(context.getLevel(), blockpos, false); - Registry registry = entityplayer.level.registryAccess().registryOrThrow(Registries.BLOCK); + Registry registry = entityplayer.level().registryAccess().registryOrThrow(Registries.BLOCK); if (entityplayer != null && !entityplayer.getAbilities().mayBuild && !self().hasAdventureModePlaceTagForBlock(registry, blockworldstate)) { return InteractionResult.PASS; } else { @@ -243,21 +244,6 @@ public interface IForgeItemStack extends ICapabilitySerializable return self().getItem().onEntitySwing(self(), entity); } - /** - * Called each tick while using an item. - * - * @param player The Player using the item - * @param count The amount of time in tick the item has been used for - * continuously - * - * @deprecated {@link net.minecraft.world.item.ItemStack#onUseTick(Level, LivingEntity, int) Use Vanilla's Version} - */ - @Deprecated(since = "1.19.4", forRemoval = true) - default void onUsingTick(LivingEntity player, int count) - { - self().getItem().onUsingTick(self(), player, count); - } - /** * Called when an entity stops using an item item for any reason. * @@ -444,7 +430,7 @@ public interface IForgeItemStack extends ICapabilitySerializable return other.isEmpty(); else return !other.isEmpty() && self().getCount() == other.getCount() && self().getItem() == other.getItem() && - (limitTags ? self().areShareTagsEqual(other) : ItemStack.tagMatches(self(), other)); + (limitTags ? self().areShareTagsEqual(other) : Objects.equals(self().getTag(), other.getTag())); } /** diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeMobEffectInstance.java b/src/main/java/net/minecraftforge/common/extensions/IForgeMobEffectInstance.java index 66f937148b..7f587e5200 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeMobEffectInstance.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeMobEffectInstance.java @@ -30,7 +30,7 @@ public interface IForgeMobEffectInstance * @return true if the given ItemStack is in the list of curative items for this PotionEffect, false otherwise */ default boolean isCurativeItem(ItemStack stack) { - return this.getCurativeItems().stream().anyMatch(e -> e.sameItem(stack)); + return this.getCurativeItems().stream().anyMatch(e -> ItemStack.isSameItem(e, stack)); } /*** diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgePlayer.java b/src/main/java/net/minecraftforge/common/extensions/IForgePlayer.java index f0fb15874c..9990988d59 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgePlayer.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgePlayer.java @@ -32,15 +32,6 @@ public interface IForgePlayer return range == 0 ? 0 : range + (self().isCreative() ? 3 : 0); } - /** - * @deprecated Use {@link #getEntityReach()} - */ - @Deprecated(forRemoval = true, since = "1.19.4") - default double getAttackRange() - { - return this.getEntityReach(); - } - /** * The reach distance is increased by 0.5 for creative players, unless it is currently zero, which disables interactions. * @return The reach distance of this player. @@ -51,19 +42,10 @@ public interface IForgePlayer return reach == 0 ? 0 : reach + (self().isCreative() ? 0.5 : 0); } - /** - * @deprecated use {@link #getBlockReach()} - */ - @Deprecated(forRemoval = true, since = "1.19.4") - default double getReachDistance() - { - return this.getBlockReach(); - } - /** * Checks if the player can reach an entity by targeting the passed vector.
* On the server, additional padding is added to account for movement/lag. - * @param vec The vector being range-checked. + * @param entityHitVec The vector being range-checked. * @param padding Extra validation distance. * @return If the player can attack the entity. * @apiNote Do not use for block checks, as this method uses {@link #getEntityReach()} @@ -86,24 +68,6 @@ public interface IForgePlayer return isCloseEnough(entity, getEntityReach() + padding); } - /** - * @deprecated use {@link #canReach(Entity, double)}h - */ - @Deprecated(forRemoval = true, since = "1.19.4") - default boolean canHit(Entity entity, double padding) - { - return canReach(entity, padding); - } - - /** - * @deprecated use {@link #canReach(Entity, double)}h - */ - @Deprecated(forRemoval = true, since = "1.19.4") - default boolean canInteractWith(Entity entity, double padding) - { - return canReach(entity, padding); - } - /** * Checks if the player can reach a block.
* On the server, additional padding is added to account for movement/lag. @@ -117,15 +81,6 @@ public interface IForgePlayer return self().getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) < reach * reach; } - /** - * @deprecated use {@link #canReach(BlockPos, double)} - */ - @Deprecated(forRemoval = true, since = "1.19.4") - default boolean canInteractWith(BlockPos pos, double padding) - { - return canReach(pos, padding); - } - /** * Utility check to see if the player is close enough to a target entity. Uses "eye-to-closest-corner" checks. * @param entity The entity being checked against diff --git a/src/main/java/net/minecraftforge/client/extensions/IForgeTransformation.java b/src/main/java/net/minecraftforge/common/extensions/IForgeTransformation.java similarity index 78% rename from src/main/java/net/minecraftforge/client/extensions/IForgeTransformation.java rename to src/main/java/net/minecraftforge/common/extensions/IForgeTransformation.java index ebf4d7616f..8a23dc5107 100644 --- a/src/main/java/net/minecraftforge/client/extensions/IForgeTransformation.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeTransformation.java @@ -3,14 +3,11 @@ * SPDX-License-Identifier: LGPL-2.1-only */ -package net.minecraftforge.client.extensions; +package net.minecraftforge.common.extensions; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.core.Direction; import com.mojang.math.Transformation; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import org.joml.Matrix4f; import org.joml.Vector3f; import org.joml.Vector4f; @@ -18,7 +15,6 @@ import org.joml.Vector4f; /** * Extension interface for {@link Transformation}. */ -// TODO - 1.20: Transformation is not client-only, move this extension outside the client package public interface IForgeTransformation { private Transformation self() @@ -36,21 +32,6 @@ public interface IForgeTransformation return self().equals(Transformation.identity()); } - /** - * Pushes and applies this transformation to the pose stack. The effects of this method can be reversed by a - * corresponding {@link PoseStack#popPose()}. - * - * @deprecated Use {@linkplain PoseStack#pushTransformation(Transformation)}, as {@linkplain Transformation} can be present in common code. - * - * @param stack the pose stack to modify - */ - @OnlyIn(Dist.CLIENT) // TODO - 1.20: Remove in favour of client-only PoseStack extension - @Deprecated(forRemoval = true, since = "1.19.2") - default void push(PoseStack stack) - { - stack.pushTransformation(self()); - } - /** * Transforms the position according to this transformation. * diff --git a/src/main/java/net/minecraftforge/common/util/FakePlayerFactory.java b/src/main/java/net/minecraftforge/common/util/FakePlayerFactory.java index 30a8f1e44d..d9adf843f4 100644 --- a/src/main/java/net/minecraftforge/common/util/FakePlayerFactory.java +++ b/src/main/java/net/minecraftforge/common/util/FakePlayerFactory.java @@ -40,6 +40,6 @@ public class FakePlayerFactory public static void unloadLevel(ServerLevel level) { - fakePlayers.entrySet().removeIf(entry -> entry.getValue().level == level); + fakePlayers.entrySet().removeIf(entry -> entry.getValue().level() == level); } } diff --git a/src/main/java/net/minecraftforge/common/util/SortedProperties.java b/src/main/java/net/minecraftforge/common/util/SortedProperties.java index cdb64f8d88..c87ab5400b 100644 --- a/src/main/java/net/minecraftforge/common/util/SortedProperties.java +++ b/src/main/java/net/minecraftforge/common/util/SortedProperties.java @@ -7,6 +7,7 @@ package net.minecraftforge.common.util; import java.io.IOException; import java.io.OutputStream; +import java.io.Writer; import java.util.Collections; import java.util.Enumeration; import java.util.Map; @@ -44,7 +45,7 @@ public class SortedProperties extends Properties return Collections.enumeration(new TreeSet<>(super.keySet())); } - public static void store(Properties props, OutputStream stream, String comment) throws IOException + public static void store(Properties props, Writer stream, String comment) throws IOException { SortedProperties sorted = new SortedProperties(); sorted.putAll(props); diff --git a/src/main/java/net/minecraftforge/common/world/ModifiableBiomeInfo.java b/src/main/java/net/minecraftforge/common/world/ModifiableBiomeInfo.java index 701598400e..897386bec6 100644 --- a/src/main/java/net/minecraftforge/common/world/ModifiableBiomeInfo.java +++ b/src/main/java/net/minecraftforge/common/world/ModifiableBiomeInfo.java @@ -111,7 +111,7 @@ public class ModifiableBiomeInfo private MobSpawnSettingsBuilder mobSpawnSettings; /** - * @param biome A biome that has not had its modified biome data generated yet + * @param original the biome to copy * @return A ModifiedBiomeInfo.Builder with a copy of the biome's data */ public static Builder copyOf(final BiomeInfo original) @@ -126,7 +126,7 @@ public class ModifiableBiomeInfo effectsBuilder, generationBuilder, mobSpawnBuilder - ); + ); } private Builder(final ClimateSettingsBuilder climateSettings, final BiomeSpecialEffectsBuilder effects, final BiomeGenerationSettingsBuilder generationSettings, final MobSpawnSettingsBuilder mobSpawnSettings) @@ -147,17 +147,6 @@ public class ModifiableBiomeInfo return climateSettings; } - /** - * {@return Builder for client special effects} - * - * @deprecated Use {@link #getSpecialEffects()} as it provides read access. TODO remove this by 1.20 - */ - @Deprecated(forRemoval=true, since="1.19") - public BiomeSpecialEffects.Builder getEffects() - { - return effects; - } - public BiomeSpecialEffectsBuilder getSpecialEffects() { return effects; diff --git a/src/main/java/net/minecraftforge/energy/CapabilityEnergy.java b/src/main/java/net/minecraftforge/energy/CapabilityEnergy.java deleted file mode 100644 index 5d4a49ff14..0000000000 --- a/src/main/java/net/minecraftforge/energy/CapabilityEnergy.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.energy; - -import net.minecraftforge.common.capabilities.*; - -@Deprecated(forRemoval = true, since = "1.19.2") -public class CapabilityEnergy -{ - /** - * @deprecated Create your own reference using {@link CapabilityManager#get(CapabilityToken)}, or use {@link ForgeCapabilities#ENERGY}. - */ - @Deprecated(forRemoval = true, since = "1.19.2") - public static final Capability ENERGY = ForgeCapabilities.ENERGY; - public static void register(RegisterCapabilitiesEvent event){} -} diff --git a/src/main/java/net/minecraftforge/entity/PartEntity.java b/src/main/java/net/minecraftforge/entity/PartEntity.java index 4c606f5155..05a2d1a6db 100644 --- a/src/main/java/net/minecraftforge/entity/PartEntity.java +++ b/src/main/java/net/minecraftforge/entity/PartEntity.java @@ -13,7 +13,7 @@ public abstract class PartEntity extends Entity { private final T parent; public PartEntity(T parent) { - super(parent.getType(), parent.level); + super(parent.getType(), parent.level()); this.parent = parent; } diff --git a/src/main/java/net/minecraftforge/event/BuildCreativeModeTabContentsEvent.java b/src/main/java/net/minecraftforge/event/BuildCreativeModeTabContentsEvent.java new file mode 100644 index 0000000000..eafae5759f --- /dev/null +++ b/src/main/java/net/minecraftforge/event/BuildCreativeModeTabContentsEvent.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.event; + +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.flag.FeatureFlagSet; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.ItemLike; +import net.minecraftforge.common.util.MutableHashedLinkedMap; +import net.minecraftforge.eventbus.api.Cancelable; +import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; +import net.minecraftforge.fml.event.IModBusEvent; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import org.jetbrains.annotations.ApiStatus; + +import java.util.function.Supplier; + +/** + * Fired when the contents of a specific creative mode tab are being populated. + * This event may be fired multiple times if the operator status of the local player or enabled feature flags changes. + *

+ * This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + *

+ * This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, + * only on the {@linkplain LogicalSide#CLIENT logical client}. + */ +public final class BuildCreativeModeTabContentsEvent extends Event implements IModBusEvent, CreativeModeTab.Output { + private final CreativeModeTab tab; + private final CreativeModeTab.ItemDisplayParameters parameters; + private final MutableHashedLinkedMap entries; + private final ResourceKey tabKey; + + @ApiStatus.Internal + public BuildCreativeModeTabContentsEvent(CreativeModeTab tab, ResourceKey tabKey, CreativeModeTab.ItemDisplayParameters parameters, MutableHashedLinkedMap entries) { + this.tab = tab; + this.tabKey = tabKey; + this.parameters = parameters; + this.entries = entries; + } + + /** + * {@return the creative mode tab currently populating its contents} + */ + public CreativeModeTab getTab() { + return this.tab; + } + + /** + * {@return the key of the creative mode tab currently populating its contents} + */ + public ResourceKey getTabKey() { + return this.tabKey; + } + + public FeatureFlagSet getFlags() { + return this.parameters.enabledFeatures(); + } + + public CreativeModeTab.ItemDisplayParameters getParameters() { + return parameters; + } + + public boolean hasPermissions() { + return this.parameters.hasPermissions(); + } + + public MutableHashedLinkedMap getEntries() { + return this.entries; + } + + @Override + public void accept(ItemStack stack, CreativeModeTab.TabVisibility visibility) { + getEntries().put(stack, visibility); + } + + public void accept(Supplier item, CreativeModeTab.TabVisibility visibility) { + this.accept(item.get(), visibility); + } + + public void accept(Supplier item) { + this.accept(item.get()); + } +} diff --git a/src/main/java/net/minecraftforge/event/CreativeModeTabEvent.java b/src/main/java/net/minecraftforge/event/CreativeModeTabEvent.java deleted file mode 100644 index 2d1f23d97b..0000000000 --- a/src/main/java/net/minecraftforge/event/CreativeModeTabEvent.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.event; - -import java.util.Collection; -import java.util.List; -import java.util.function.Consumer; -import java.util.function.Supplier; - -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.flag.FeatureFlagSet; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.CreativeModeTab.Output; -import net.minecraft.world.item.CreativeModeTab.TabVisibility; -import net.minecraft.world.item.CreativeModeTabs; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.ItemLike; -import net.minecraftforge.common.util.MutableHashedLinkedMap; -import net.minecraftforge.eventbus.api.Cancelable; -import net.minecraftforge.eventbus.api.Event; -import net.minecraftforge.fml.LogicalSide; -import net.minecraftforge.fml.event.IModBusEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; - -public class CreativeModeTabEvent extends Event implements IModBusEvent -{ - private static final List DEFAULT_AFTER_ENTRIES = List.of(CreativeModeTabs.SPAWN_EGGS); - - @ApiStatus.Internal - public CreativeModeTabEvent() {} - - /** - * A registrar which is capable of registering new tabs. - */ - @FunctionalInterface - public interface Registrar { - - /** - * Register a new tab. - * - * @param configurator The tab configurator to register - * @param name The name of the tab. - * @param afters A list of tab names (String, ResourceLocations) or tabs that need to appear before this tab in the creative mode menu. - * @param befores A list of tab names (String, ResourceLocations) or tabs that need to appear after this tab in the creative mode menu. - * @return The configured tab. - */ - @NotNull - CreativeModeTab registerCreativeModeTab(@NotNull final Consumer configurator, @NotNull final ResourceLocation name, @NotNull final List afters, @NotNull final List befores); - } - - /** - * Fired when creative mode tabs can be registered. - *

- * This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. - *

- * This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, - * on both {@linkplain LogicalSide logical sides}. - */ - public static final class Register extends CreativeModeTabEvent - { - private final Registrar registrar; - - @ApiStatus.Internal - public Register(Registrar registrar) { - this.registrar = registrar; - } - - /** - * Registers and configures a creative mode tab with the given name and returns the built instance. - * - * @param name the name of the tab. Must be unique. - * @param beforeEntries the list of {@linkplain ResourceLocation tab names} or {@linkplain CreativeModeTab tabs} that should appear before this tab in the creative mode inventory screen - * @param afterEntries the list of {@linkplain ResourceLocation tab names} or {@linkplain CreativeModeTab tabs} that should appear after this tab in the creative mode inventory screen - * @param configurator the configurator which configures the builder - * @return the configured creative mode tab - * @see #registerCreativeModeTab(ResourceLocation, Consumer) - */ - public CreativeModeTab registerCreativeModeTab(ResourceLocation name, List beforeEntries, List afterEntries, Consumer configurator) - { - return registrar.registerCreativeModeTab(configurator, name, afterEntries, beforeEntries); - } - - /** - * Registers and configures a creative mode tab with the given name and returns the built instance. - * The tab is sorted by default to be after {@link CreativeModeTabs#SPAWN_EGGS}. - * - * @param name the name of the tab. Must be unique. - * @param configurator the configurator which configures the builder - * @return the configured creative mode tab - * @see #registerCreativeModeTab(ResourceLocation, List, List, Consumer) - */ - public CreativeModeTab registerCreativeModeTab(ResourceLocation name, Consumer configurator) - { - return registrar.registerCreativeModeTab(configurator, name, DEFAULT_AFTER_ENTRIES, List.of()); - } - } - - /** - * Fired when the contents of a specific creative mode tab are being populated. - * This event may be fired multiple times if the operator status of the local player or enabled feature flags changes. - *

- * This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. - *

- * This event is fired on the {@linkplain FMLJavaModLoadingContext#getModEventBus() mod-specific event bus}, - * only on the {@linkplain LogicalSide#CLIENT logical client}. - */ - public static final class BuildContents extends CreativeModeTabEvent implements Output - { - private final CreativeModeTab tab; - private final CreativeModeTab.ItemDisplayParameters parameters; - private final MutableHashedLinkedMap entries; - - @ApiStatus.Internal - public BuildContents(CreativeModeTab tab, CreativeModeTab.ItemDisplayParameters parameters, MutableHashedLinkedMap entries) - { - this.tab = tab; - this.parameters = parameters; - this.entries = entries; - } - - /** - * {@return the creative mode tab currently populating its contents} - */ - public CreativeModeTab getTab() - { - return this.tab; - } - - public FeatureFlagSet getFlags() - { - return this.parameters.enabledFeatures(); - } - - public CreativeModeTab.ItemDisplayParameters getParameters() - { - return parameters; - } - - public boolean hasPermissions() - { - return this.parameters.hasPermissions(); - } - - public MutableHashedLinkedMap getEntries() - { - return this.entries; - } - - @Override - public void accept(ItemStack stack, TabVisibility visibility) - { - getEntries().put(stack, visibility); - } - - public void accept(Supplier item, CreativeModeTab.TabVisibility visibility) - { - this.accept(item.get(), visibility); - } - - public void accept(Supplier item) - { - this.accept(item.get()); - } - } -} diff --git a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java index 60a7735635..fce09c2b0f 100644 --- a/src/main/java/net/minecraftforge/event/ForgeEventFactory.java +++ b/src/main/java/net/minecraftforge/event/ForgeEventFactory.java @@ -55,7 +55,6 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.LootTables; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.world.level.BaseSpawner; import net.minecraft.world.InteractionResultHolder; @@ -75,7 +74,6 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.Level; import net.minecraft.server.level.ServerLevel; @@ -429,7 +427,7 @@ public class ForgeEventFactory public static int onItemExpire(ItemEntity entity, @NotNull ItemStack item) { if (item.isEmpty()) return -1; - ItemExpireEvent event = new ItemExpireEvent(entity, (item.isEmpty() ? 6000 : item.getItem().getEntityLifespan(item, entity.level))); + ItemExpireEvent event = new ItemExpireEvent(entity, (item.isEmpty() ? 6000 : item.getItem().getEntityLifespan(item, entity.level()))); if (!MinecraftForge.EVENT_BUS.post(event)) return -1; return event.getExtraLife(); } @@ -443,7 +441,7 @@ public class ForgeEventFactory public static boolean canMountEntity(Entity entityMounting, Entity entityBeingMounted, boolean isMounting) { - boolean isCanceled = MinecraftForge.EVENT_BUS.post(new EntityMountEvent(entityMounting, entityBeingMounted, entityMounting.level, isMounting)); + boolean isCanceled = MinecraftForge.EVENT_BUS.post(new EntityMountEvent(entityMounting, entityBeingMounted, entityMounting.level(), isMounting)); if(isCanceled) { @@ -579,8 +577,8 @@ public class ForgeEventFactory if (canContinueSleep == Result.DEFAULT) { return player.getSleepingPos().map(pos-> { - BlockState state = player.level.getBlockState(pos); - return state.getBlock().isBed(state, player.level, pos, player); + BlockState state = player.level().getBlockState(pos); + return state.getBlock().isBed(state, player.level(), pos, player); }).orElse(false); } else @@ -594,7 +592,7 @@ public class ForgeEventFactory Result canContinueSleep = evt.getResult(); if (canContinueSleep == Result.DEFAULT) - return !player.level.isDay(); + return !player.level().isDay(); else return canContinueSleep == Result.ALLOW; } @@ -620,9 +618,9 @@ public class ForgeEventFactory return MinecraftForge.EVENT_BUS.post(new ProjectileImpactEvent(projectile, ray)); } - public static LootTable loadLootTable(ResourceLocation name, LootTable table, LootTables lootTableManager) + public static LootTable loadLootTable(ResourceLocation name, LootTable table) { - LootTableLoadEvent event = new LootTableLoadEvent(name, table, lootTableManager); + LootTableLoadEvent event = new LootTableLoadEvent(name, table); if (MinecraftForge.EVENT_BUS.post(event)) return LootTable.EMPTY; return event.getTable(); @@ -667,12 +665,6 @@ public class ForgeEventFactory return result == Result.DEFAULT ? level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) : result == Result.ALLOW; } - @Deprecated(forRemoval = true, since = "1.19.2") - public static boolean saplingGrowTree(LevelAccessor level, RandomSource randomSource, BlockPos pos) - { - return !blockGrowFeature(level, randomSource, pos, null).getResult().equals(Result.DENY); - } - public static SaplingGrowTreeEvent blockGrowFeature(LevelAccessor level, RandomSource randomSource, BlockPos pos, @Nullable Holder> holder) { SaplingGrowTreeEvent event = new SaplingGrowTreeEvent(level, randomSource, pos, holder); @@ -771,18 +763,8 @@ public class ForgeEventFactory return event; } - /** - * @deprecated Use {@linkplain #onEnderPearlLand(ServerPlayer, double, double, double, ThrownEnderpearl, float, HitResult) the hit result-sensitive version}. - */ @ApiStatus.Internal - @Deprecated(forRemoval = true, since = "1.19.2") - public static EntityTeleportEvent.EnderPearl onEnderPearlLand(ServerPlayer entity, double targetX, double targetY, double targetZ, ThrownEnderpearl pearlEntity, float attackDamage) - { - return onEnderPearlLand(entity, targetX, targetY, targetZ, pearlEntity, attackDamage, null); - } - - @ApiStatus.Internal // TODO - 1.20: remove the nullable - public static EntityTeleportEvent.EnderPearl onEnderPearlLand(ServerPlayer entity, double targetX, double targetY, double targetZ, ThrownEnderpearl pearlEntity, float attackDamage, @Nullable HitResult hitResult) + public static EntityTeleportEvent.EnderPearl onEnderPearlLand(ServerPlayer entity, double targetX, double targetY, double targetZ, ThrownEnderpearl pearlEntity, float attackDamage, HitResult hitResult) { EntityTeleportEvent.EnderPearl event = new EntityTeleportEvent.EnderPearl(entity, targetX, targetY, targetZ, pearlEntity, attackDamage, hitResult); MinecraftForge.EVENT_BUS.post(event); diff --git a/src/main/java/net/minecraftforge/event/GrindstoneEvent.java b/src/main/java/net/minecraftforge/event/GrindstoneEvent.java index 734a5478e0..b73acec05a 100644 --- a/src/main/java/net/minecraftforge/event/GrindstoneEvent.java +++ b/src/main/java/net/minecraftforge/event/GrindstoneEvent.java @@ -60,7 +60,7 @@ public abstract class GrindstoneEvent extends Event /** * This event is {@link Cancelable}
- * {@link OnplaceItem} is fired when the inputs to a grindstone are changed.
+ * {@link OnPlaceItem} is fired when the inputs to a grindstone are changed.
* * The following rules apply: *

    @@ -79,11 +79,11 @@ public abstract class GrindstoneEvent extends Event *
*/ @Cancelable - public static class OnplaceItem extends GrindstoneEvent + public static class OnPlaceItem extends GrindstoneEvent { private ItemStack output; - public OnplaceItem(ItemStack top, ItemStack bottom, int xp) + public OnPlaceItem(ItemStack top, ItemStack bottom, int xp) { super(top, bottom, xp); this.output = ItemStack.EMPTY; diff --git a/src/main/java/net/minecraftforge/event/LootTableLoadEvent.java b/src/main/java/net/minecraftforge/event/LootTableLoadEvent.java index d3d2e6d340..6da674f6f5 100644 --- a/src/main/java/net/minecraftforge/event/LootTableLoadEvent.java +++ b/src/main/java/net/minecraftforge/event/LootTableLoadEvent.java @@ -7,31 +7,32 @@ package net.minecraftforge.event; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.storage.loot.LootTable; -import net.minecraft.world.level.storage.loot.LootTables; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.fml.LogicalSide; /** - * Event fired when a LootTable json is loaded from json. - * This event is fired whenever resources are loaded, or when the server starts. - * This event will NOT be fired for LootTables loaded from the world folder, these are - * considered configurations files and should not be modified by mods. + * Fired when a {@link LootTable} is loaded from JSON. + * Loot tables loaded from world save datapacks will not fire this event as they are considered user configuration files. + * This event is fired whenever server resources are loaded or reloaded. * - * Canceling the event will make it load a empty loot table. + *

This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}. + * If the event is cancelled, the loot table will be made empty.

* + *

This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus}, + * only on the {@linkplain LogicalSide#SERVER logical server}.

*/ @Cancelable public class LootTableLoadEvent extends Event { private final ResourceLocation name; private LootTable table; - private LootTables lootTableManager; - public LootTableLoadEvent(ResourceLocation name, LootTable table, LootTables lootTableManager) + public LootTableLoadEvent(ResourceLocation name, LootTable table) { this.name = name; this.table = table; - this.lootTableManager = lootTableManager; } public ResourceLocation getName() @@ -44,11 +45,6 @@ public class LootTableLoadEvent extends Event return this.table; } - public LootTables getLootTableManager() - { - return this.lootTableManager; - } - public void setTable(LootTable table) { this.table = table; diff --git a/src/main/java/net/minecraftforge/event/ModMismatchEvent.java b/src/main/java/net/minecraftforge/event/ModMismatchEvent.java index 16bc1eaa45..8d3bdd146e 100644 --- a/src/main/java/net/minecraftforge/event/ModMismatchEvent.java +++ b/src/main/java/net/minecraftforge/event/ModMismatchEvent.java @@ -45,7 +45,6 @@ public class ModMismatchEvent extends Event implements IModBusEvent * The level being loaded. Useful for things like {@link net.minecraft.world.level.storage.DimensionDataStorage} * to manage multiple files changing between mod versions. */ - @Nullable private final LevelStorageSource.LevelDirectory levelDirectory; /** @@ -59,7 +58,7 @@ public class ModMismatchEvent extends Event implements IModBusEvent private final HashMap resolved; @ApiStatus.Internal - public ModMismatchEvent(@Nullable LevelStorageSource.LevelDirectory levelDirectory, Map previousVersions, Map missingVersions) + public ModMismatchEvent(LevelStorageSource.LevelDirectory levelDirectory, Map previousVersions, Map missingVersions) { this.levelDirectory = levelDirectory; this.resolved = new HashMap<>(previousVersions.size()); @@ -77,7 +76,6 @@ public class ModMismatchEvent extends Event implements IModBusEvent * Gets the current level directory for the world being loaded. * Can be used for file operations and manual modification of mod files before world load. */ - @Nullable public LevelStorageSource.LevelDirectory getLevelDirectory() { return this.levelDirectory; diff --git a/src/main/java/net/minecraftforge/event/PlayLevelSoundEvent.java b/src/main/java/net/minecraftforge/event/PlayLevelSoundEvent.java index 508dcd23f5..eaaeca2e3e 100644 --- a/src/main/java/net/minecraftforge/event/PlayLevelSoundEvent.java +++ b/src/main/java/net/minecraftforge/event/PlayLevelSoundEvent.java @@ -168,7 +168,7 @@ public class PlayLevelSoundEvent extends Event public AtEntity(Entity entity, Holder sound, SoundSource source, float volume, float pitch) { - super(entity.level, sound, source, volume, pitch); + super(entity.level(), sound, source, volume, pitch); this.entity = entity; } diff --git a/src/main/java/net/minecraftforge/event/entity/EntityTeleportEvent.java b/src/main/java/net/minecraftforge/event/entity/EntityTeleportEvent.java index 772635c18a..4c90fac526 100644 --- a/src/main/java/net/minecraftforge/event/entity/EntityTeleportEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/EntityTeleportEvent.java @@ -153,11 +153,10 @@ public class EntityTeleportEvent extends EntityEvent private final ServerPlayer player; private final ThrownEnderpearl pearlEntity; private float attackDamage; - @Nullable - private final HitResult hitResult; // TODO - 1.20: make the hit result nonnull, remove the other constructor + private final HitResult hitResult; @ApiStatus.Internal - public EnderPearl(ServerPlayer entity, double targetX, double targetY, double targetZ, ThrownEnderpearl pearlEntity, float attackDamage, @Nullable HitResult hitResult) + public EnderPearl(ServerPlayer entity, double targetX, double targetY, double targetZ, ThrownEnderpearl pearlEntity, float attackDamage, HitResult hitResult) { super(entity, targetX, targetY, targetZ); this.pearlEntity = pearlEntity; @@ -166,16 +165,6 @@ public class EntityTeleportEvent extends EntityEvent this.hitResult = hitResult; } - /** - * @deprecated Use {@linkplain #EnderPearl(ServerPlayer, double, double, double, ThrownEnderpearl, float, HitResult)} the hit result-sensitive version}. - */ - @ApiStatus.Internal - @Deprecated(forRemoval = true, since = "1.19.2") - public EnderPearl(ServerPlayer entity, double targetX, double targetY, double targetZ, ThrownEnderpearl pearlEntity, float attackDamage) - { - this(entity, targetX, targetY, targetZ, pearlEntity, attackDamage, null); - } - public ThrownEnderpearl getPearlEntity() { return pearlEntity; diff --git a/src/main/java/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java b/src/main/java/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java deleted file mode 100644 index 8b9a41bee8..0000000000 --- a/src/main/java/net/minecraftforge/event/entity/living/LivingSetAttackTargetEvent.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.event.entity.living; - -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.ai.behavior.StartAttacking; -import net.minecraftforge.common.ForgeHooks; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.living.LivingChangeTargetEvent.ILivingTargetType; -import net.minecraftforge.event.entity.living.LivingChangeTargetEvent.LivingTargetType; - -/** - * This event is deprecated. Use {@link LivingChangeTargetEvent} instead.
- *
- * LivingSetAttackTargetEvent is fired when an Entity sets a target to attack.
- * This event is fired whenever an Entity sets a target to attack in - * {@link Mob#setTarget(LivingEntity)} or {@link StartAttacking#setAttackTarget(Mob, LivingEntity)}
- *
- * This event is fired via the {@link ForgeHooks#onLivingSetAttackTarget(LivingEntity, LivingEntity)}.
- *
- * {@link #getTarget} returns the newly targeted Entity.
- * {@link #getTargetType()} returns the target type that caused the change of targets.
- *
- * This event is not {@link net.minecraftforge.eventbus.api.Cancelable}.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#EVENT_BUS}. - **/ -// TODO: Remove in 1.20 -@Deprecated(since = "1.19.2", forRemoval = true) -public class LivingSetAttackTargetEvent extends LivingEvent -{ - private final ILivingTargetType targetType; - private final LivingEntity originalTarget; - - public LivingSetAttackTargetEvent(LivingEntity entity, LivingEntity target) - { - super(entity); - this.targetType = LivingTargetType.MOB_TARGET; - this.originalTarget = target; - } - - public LivingSetAttackTargetEvent(LivingEntity entity, LivingEntity target, ILivingTargetType targetType) - { - super(entity); - this.targetType = targetType; - this.originalTarget = target; - } - - /** - * {@return the target this living entity had after changing its target to a new - * target, but before posting this event.} - */ - public LivingEntity getTarget() - { - return originalTarget; - } - - /** - * {@return the target type of this event.} - */ - public ILivingTargetType getTargetType() - { - return targetType; - } -} diff --git a/src/main/java/net/minecraftforge/event/entity/player/AdvancementEvent.java b/src/main/java/net/minecraftforge/event/entity/player/AdvancementEvent.java index eba0f29266..091bcd16c9 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/AdvancementEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/AdvancementEvent.java @@ -11,16 +11,10 @@ import net.minecraft.world.entity.player.Player; import net.minecraftforge.common.MinecraftForge; /** - * This event is fired when a player gets an advancement. - *
- * This event is not {@link net.minecraftforge.eventbus.api.Cancelable}.
- *
- * This event does not have a result. {@link HasResult}
- *
- * This event is fired on the {@link MinecraftForge#EVENT_BUS}. - * @deprecated Use {@link net.minecraftforge.event.entity.player.AdvancementEvent.AdvancementEarnEvent} and {@link net.minecraftforge.event.entity.player.AdvancementEvent.AdvancementProgressEvent} instead + * Base class used for advancement-related events. Should not be used directly. + * @see AdvancementEarnEvent + * @see AdvancementProgressEvent */ -@Deprecated(since = "1.19.2") public class AdvancementEvent extends PlayerEvent { private final Advancement advancement; @@ -49,24 +43,22 @@ public class AdvancementEvent extends PlayerEvent * * @see AdvancementProgress#isDone() */ - //todo: should extend AdvancementEvent in 1.20 - public static class AdvancementEarnEvent extends PlayerEvent + public static class AdvancementEarnEvent extends AdvancementEvent { - private final Advancement advancement; public AdvancementEarnEvent(Player player, Advancement earned) { - super(player); - this.advancement = earned; + super(player, earned); } /** * * {@return the advancement that was earned} */ + @Override public Advancement getAdvancement() { - return advancement; + return super.getAdvancement(); } } @@ -82,18 +74,15 @@ public class AdvancementEvent extends PlayerEvent * @see net.minecraft.server.PlayerAdvancements#award(Advancement, String) * @see net.minecraft.server.PlayerAdvancements#revoke(Advancement, String) */ - //todo: should extend AdvancementEvent in 1.20 - public static class AdvancementProgressEvent extends PlayerEvent + public static class AdvancementProgressEvent extends AdvancementEvent { - private final Advancement advancement; private final AdvancementProgress advancementProgress; private final String criterionName; private final AdvancementEvent.AdvancementProgressEvent.ProgressType progressType; public AdvancementProgressEvent(Player player, Advancement progressed, AdvancementProgress advancementProgress, String criterionName, AdvancementEvent.AdvancementProgressEvent.ProgressType progressType) { - super(player); - this.advancement = progressed; + super(player, progressed); this.advancementProgress = advancementProgress; this.criterionName = criterionName; this.progressType = progressType; @@ -103,9 +92,10 @@ public class AdvancementEvent extends PlayerEvent * * {@return The advancement that was progressed} */ + @Override public Advancement getAdvancement() { - return advancement; + return super.getAdvancement(); } /** diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java index c4e6fc2e2b..542896e252 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerEvent.java @@ -125,7 +125,6 @@ public class PlayerEvent extends LivingEvent public float getNewSpeed() { return newSpeed; } public void setNewSpeed(float newSpeed) { this.newSpeed = newSpeed; } public Optional getPosition() { return this.pos; } - @Deprecated(forRemoval = true, since ="1.19") public BlockPos getPos() { return pos.orElse(LEGACY_UNKNOWN); } } /** diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java index 08d08fecdc..6acc81f824 100644 --- a/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerInteractEvent.java @@ -352,7 +352,7 @@ public class PlayerInteractEvent extends PlayerEvent */ public Level getLevel() { - return getEntity().level; + return getEntity().level(); } /** diff --git a/src/main/java/net/minecraftforge/event/level/ChunkEvent.java b/src/main/java/net/minecraftforge/event/level/ChunkEvent.java index b1c39b3d96..94e757bfbf 100644 --- a/src/main/java/net/minecraftforge/event/level/ChunkEvent.java +++ b/src/main/java/net/minecraftforge/event/level/ChunkEvent.java @@ -61,13 +61,6 @@ public class ChunkEvent extends LevelEvent { private final boolean newChunk; - @ApiStatus.Internal - @Deprecated(forRemoval = true, since = "1.19.3") - public Load(ChunkAccess chunk) - { - this(chunk, false); - } - @ApiStatus.Internal public Load(ChunkAccess chunk, boolean newChunk) { diff --git a/src/main/java/net/minecraftforge/event/level/SaplingGrowTreeEvent.java b/src/main/java/net/minecraftforge/event/level/SaplingGrowTreeEvent.java index 8c4dfea3bf..8bda026cfa 100644 --- a/src/main/java/net/minecraftforge/event/level/SaplingGrowTreeEvent.java +++ b/src/main/java/net/minecraftforge/event/level/SaplingGrowTreeEvent.java @@ -9,11 +9,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; -import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.block.SaplingBlock; -import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.Cancelable; @@ -22,8 +19,6 @@ import org.jetbrains.annotations.Nullable; /** * This event is fired whenever a sapling, fungus, mushroom or azalea grows into a tree. - * This event is fired during sapling growth in - * {@link SaplingBlock#advanceTree(ServerLevel, BlockPos, BlockState, RandomSource)}. *

* This event is not {@linkplain Cancelable cancellable} but does {@linkplain HasResult have a result}. * {@linkplain Result#ALLOW ALLOW} and {@linkplain Result#DEFAULT DEFAULT} will allow the sapling to grow @@ -32,8 +27,8 @@ import org.jetbrains.annotations.Nullable; *

* This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus} * only on the {@linkplain net.minecraftforge.fml.LogicalSide#SERVER logical server}. - * TODO 1.20 rename event */ +// TODO: Rename to BlockFeatureGrowEvent in 1.20 @HasResult public class SaplingGrowTreeEvent extends LevelEvent { @@ -42,12 +37,6 @@ public class SaplingGrowTreeEvent extends LevelEvent @Nullable private Holder> feature; - @Deprecated(forRemoval = true, since = "1.19.2") - public SaplingGrowTreeEvent(LevelAccessor level, RandomSource randomSource, BlockPos pos) - { - this(level, randomSource, pos, null); - } - public SaplingGrowTreeEvent(LevelAccessor level, RandomSource randomSource, BlockPos pos, @Nullable Holder> feature) { super(level); diff --git a/src/main/java/net/minecraftforge/fluids/FluidType.java b/src/main/java/net/minecraftforge/fluids/FluidType.java index a2a308a5ef..b0529bcfee 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidType.java +++ b/src/main/java/net/minecraftforge/fluids/FluidType.java @@ -14,6 +14,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.FluidTags; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; @@ -30,7 +31,6 @@ import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.level.material.Material; import net.minecraft.world.level.pathfinder.BlockPathTypes; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; @@ -825,8 +825,7 @@ public class FluidType { if (level.dimensionType().ultraWarm()) { - BlockState state = this.getBlockForFluidState(level, pos, this.getStateForPlacement(level, pos, stack)); - return state != null && state.getMaterial() == Material.WATER; + return this == ForgeMod.WATER_TYPE.get() || this.getStateForPlacement(level, pos, stack).is(FluidTags.WATER); } return false; } diff --git a/src/main/java/net/minecraftforge/fluids/FluidUtil.java b/src/main/java/net/minecraftforge/fluids/FluidUtil.java index 5956ab9c79..bb683e43a4 100644 --- a/src/main/java/net/minecraftforge/fluids/FluidUtil.java +++ b/src/main/java/net/minecraftforge/fluids/FluidUtil.java @@ -10,7 +10,6 @@ import net.minecraft.world.item.BucketItem; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.BucketPickup; import net.minecraft.world.level.block.LiquidBlockContainer; -import net.minecraft.world.level.material.Material; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.material.Fluid; @@ -141,7 +140,7 @@ public class FluidUtil if (soundevent != null) { - player.level.playSound(null, player.getX(), player.getY() + 0.5, player.getZ(), soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); + player.level().playSound(null, player.getX(), player.getY() + 0.5, player.getZ(), soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); } } } @@ -193,7 +192,7 @@ public class FluidUtil if (soundevent != null) { - player.level.playSound(null, player.getX(), player.getY() + 0.5, player.getZ(), soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); + player.level().playSound(null, player.getX(), player.getY() + 0.5, player.getZ(), soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); } } @@ -570,8 +569,7 @@ public class FluidUtil // check that we can place the fluid at the destination BlockState destBlockState = level.getBlockState(pos); - Material destMaterial = destBlockState.getMaterial(); - boolean isDestNonSolid = !destMaterial.isSolid(); + boolean isDestNonSolid = !destBlockState.isSolid(); boolean isDestReplaceable = destBlockState.canBeReplaced(context); boolean canDestContainFluid = destBlockState.getBlock() instanceof LiquidBlockContainer && ((LiquidBlockContainer) destBlockState.getBlock()).canPlaceLiquid(level, pos, destBlockState, fluid); if (!level.isEmptyBlock(pos) && !isDestNonSolid && !isDestReplaceable && !canDestContainFluid) @@ -642,10 +640,9 @@ public class FluidUtil if (!level.isClientSide) { BlockState destBlockState = level.getBlockState(pos); - Material destMaterial = destBlockState.getMaterial(); - boolean isDestNonSolid = !destMaterial.isSolid(); + boolean isDestNonSolid = !destBlockState.isSolid(); boolean isDestReplaceable = false; //TODO: Needs BlockItemUseContext destBlockState.getBlock().isReplaceable(level, pos); - if ((isDestNonSolid || isDestReplaceable) && !destMaterial.isLiquid()) + if ((isDestNonSolid || isDestReplaceable) && !destBlockState.liquid()) { level.destroyBlock(pos, true); } diff --git a/src/main/java/net/minecraftforge/fluids/capability/CapabilityFluidHandler.java b/src/main/java/net/minecraftforge/fluids/capability/CapabilityFluidHandler.java deleted file mode 100644 index c458ed93ca..0000000000 --- a/src/main/java/net/minecraftforge/fluids/capability/CapabilityFluidHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.fluids.capability; - -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.CapabilityManager; -import net.minecraftforge.common.capabilities.CapabilityToken; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; - -@Deprecated(forRemoval = true, since = "1.19.2") -public class CapabilityFluidHandler -{ - /** - * @deprecated Create your own reference using {@link CapabilityManager#get(CapabilityToken)}, or use - * {@link ForgeCapabilities#FLUID_HANDLER}. - */ - @Deprecated(forRemoval = true, since = "1.19.2") - public static Capability FLUID_HANDLER_CAPABILITY = ForgeCapabilities.FLUID_HANDLER; - /** - * @deprecated Create your own reference using {@link CapabilityManager#get(CapabilityToken)}, or use - * {@link ForgeCapabilities#FLUID_HANDLER_ITEM}. - */ - @Deprecated(forRemoval = true, since = "1.19.2") - public static Capability FLUID_HANDLER_ITEM_CAPABILITY = ForgeCapabilities.FLUID_HANDLER_ITEM; - - public static void register(RegisterCapabilitiesEvent event){} -} diff --git a/src/main/java/net/minecraftforge/internal/BrandingControl.java b/src/main/java/net/minecraftforge/internal/BrandingControl.java index 4881c8c1ca..684abe5dc7 100644 --- a/src/main/java/net/minecraftforge/internal/BrandingControl.java +++ b/src/main/java/net/minecraftforge/internal/BrandingControl.java @@ -16,6 +16,7 @@ import net.minecraft.server.packs.resources.ResourceManagerReloadListener; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.common.ForgeI18n; import net.minecraftforge.fml.ModList; +import net.minecraftforge.forge.snapshots.ForgeSnapshotsMod; import net.minecraftforge.versions.forge.ForgeVersion; import net.minecraftforge.versions.mcp.MCPVersion; @@ -31,7 +32,7 @@ public class BrandingControl if (brandings == null) { ImmutableList.Builder brd = ImmutableList.builder(); - brd.add("Forge " + ForgeVersion.getVersion()); + brd.add(ForgeSnapshotsMod.BRANDING_NAME + ' ' + ForgeVersion.getVersion()); brd.add("Minecraft " + MCPVersion.getMCVersion()); brd.add("MCP " + MCPVersion.getMCPVersion()); int tModCount = ModList.get().size(); @@ -70,11 +71,11 @@ public class BrandingControl } public static String getClientBranding() { - return "forge"; + return ForgeSnapshotsMod.BRANDING_ID; } public static String getServerBranding() { - return "forge"; + return ForgeSnapshotsMod.BRANDING_ID; } public static ResourceManagerReloadListener resourceManagerReloadListener() { diff --git a/src/main/java/net/minecraftforge/items/CapabilityItemHandler.java b/src/main/java/net/minecraftforge/items/CapabilityItemHandler.java deleted file mode 100644 index dbc9e915fd..0000000000 --- a/src/main/java/net/minecraftforge/items/CapabilityItemHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.items; - -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.CapabilityManager; -import net.minecraftforge.common.capabilities.CapabilityToken; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; - -@Deprecated(forRemoval = true, since = "1.19.2") -public class CapabilityItemHandler -{ - /** - * @deprecated Create your own reference using {@link CapabilityManager#get(CapabilityToken)}, or use {@link ForgeCapabilities#ITEM_HANDLER}. - */ - @Deprecated(forRemoval = true, since = "1.19.2") - public static final Capability ITEM_HANDLER_CAPABILITY = ForgeCapabilities.ITEM_HANDLER; - - public static void register(RegisterCapabilitiesEvent event){} - -} diff --git a/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java b/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java index b5d2c284f0..3ae1961783 100644 --- a/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java +++ b/src/main/java/net/minecraftforge/items/ItemHandlerHelper.java @@ -38,7 +38,7 @@ public class ItemHandlerHelper public static boolean canItemStacksStack(@NotNull ItemStack a, @NotNull ItemStack b) { - if (a.isEmpty() || !a.sameItem(b) || a.hasTag() != b.hasTag()) + if (a.isEmpty() || !ItemStack.isSameItem(a, b) || a.hasTag() != b.hasTag()) return false; return (!a.hasTag() || a.getTag().equals(b.getTag())) && a.areCapsCompatible(b); @@ -150,7 +150,7 @@ public class ItemHandlerHelper if (stack.isEmpty()) return; IItemHandler inventory = new PlayerMainInvWrapper(player.getInventory()); - Level level = player.level; + Level level = player.level(); // try adding it into the inventory ItemStack remainder = stack; diff --git a/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java index bc69cf4626..a972cdd8b6 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/PlayerMainInvWrapper.java @@ -35,7 +35,7 @@ public class PlayerMainInvWrapper extends RangedWrapper ItemStack inSlot = getStackInSlot(slot); if(!inSlot.isEmpty()) { - if (getInventoryPlayer().player.level.isClientSide) + if (getInventoryPlayer().player.level().isClientSide) { inSlot.setPopTime(5); } diff --git a/src/main/java/net/minecraftforge/items/wrapper/ShulkerItemStackInvWrapper.java b/src/main/java/net/minecraftforge/items/wrapper/ShulkerItemStackInvWrapper.java index 63e938276a..deec48690e 100644 --- a/src/main/java/net/minecraftforge/items/wrapper/ShulkerItemStackInvWrapper.java +++ b/src/main/java/net/minecraftforge/items/wrapper/ShulkerItemStackInvWrapper.java @@ -16,13 +16,12 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; -import net.minecraftforge.registries.ForgeRegistries; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -233,6 +232,6 @@ public class ShulkerItemStackInvWrapper implements IItemHandlerModifiable, ICapa @NotNull public LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) { - return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.orEmpty(cap, this.holder); + return ForgeCapabilities.ITEM_HANDLER.orEmpty(cap, this.holder); } } diff --git a/src/main/java/net/minecraftforge/logging/CrashReportExtender.java b/src/main/java/net/minecraftforge/logging/CrashReportExtender.java index 8b1be79157..66b8c1353f 100644 --- a/src/main/java/net/minecraftforge/logging/CrashReportExtender.java +++ b/src/main/java/net/minecraftforge/logging/CrashReportExtender.java @@ -37,7 +37,9 @@ public class CrashReportExtender public static void addCrashReportHeader(StringBuilder stringbuilder, CrashReport crashReport) { + net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.addCrashReportHeader(stringbuilder, crashReport); } + public static String generateEnhancedStackTrace(final Throwable throwable) { return generateEnhancedStackTrace(throwable, true); } diff --git a/src/main/java/net/minecraftforge/network/NetworkHooks.java b/src/main/java/net/minecraftforge/network/NetworkHooks.java index 85b1ff8ebb..851b0fb4ad 100644 --- a/src/main/java/net/minecraftforge/network/NetworkHooks.java +++ b/src/main/java/net/minecraftforge/network/NetworkHooks.java @@ -186,7 +186,7 @@ public class NetworkHooks */ public static void openScreen(ServerPlayer player, MenuProvider containerSupplier, Consumer extraDataWriter) { - if (player.level.isClientSide) return; + if (player.level().isClientSide) return; player.doCloseContainer(); player.nextContainerCounter(); int openContainerId = player.containerCounter; diff --git a/src/main/java/net/minecraftforge/network/simple/SimpleChannel.java b/src/main/java/net/minecraftforge/network/simple/SimpleChannel.java index 621e8c6ed9..7ebac94637 100644 --- a/src/main/java/net/minecraftforge/network/simple/SimpleChannel.java +++ b/src/main/java/net/minecraftforge/network/simple/SimpleChannel.java @@ -237,18 +237,6 @@ public class SimpleChannel return this; } - /** - * Set the message consumer, which is called once a message has been decoded. - * @param consumer The message consumer. - * @return The message builder, for chaining. - * @deprecated Use {@link #consumerMainThread(BiConsumer)} or {@link #consumerNetworkThread(BiConsumer)}. - */ - @Deprecated(forRemoval = true, since = "1.19") - public MessageBuilder consumer(BiConsumer> consumer) { - consumerMainThread(consumer); - return this; - } - /** * Set the message consumer, which is called once a message has been decoded. This accepts the decoded message * object and the message's context. @@ -305,18 +293,6 @@ public class SimpleChannel return this; } - /** - * Set the message consumer, which is called once a message has been decoded. - * @param handler The message consumer. - * @return The message builder, for chaining. - * @deprecated Use {@link #consumerMainThread(BiConsumer)} or {@link #consumerNetworkThread(BiConsumer)}. - */ - @Deprecated(forRemoval = true, since = "1.19") - public MessageBuilder consumer(ToBooleanBiFunction> handler) { - consumerMainThread(handler::applyAsBool); - return this; - } - public void add() { final IndexedMessageCodec.MessageHandler message = this.channel.registerMessage(this.id, this.type, this.encoder, this.decoder, this.consumer, this.networkDirection); if (this.loginIndexSetter != null) { diff --git a/src/main/java/net/minecraftforge/registries/ForgeDeferredRegistriesSetup.java b/src/main/java/net/minecraftforge/registries/ForgeDeferredRegistriesSetup.java index 72f53f65f5..d006ea684d 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeDeferredRegistriesSetup.java +++ b/src/main/java/net/minecraftforge/registries/ForgeDeferredRegistriesSetup.java @@ -5,8 +5,6 @@ package net.minecraftforge.registries; -import net.minecraftforge.common.world.BiomeModifier; -import net.minecraftforge.common.world.StructureModifier; import net.minecraftforge.eventbus.api.IEventBus; public class ForgeDeferredRegistriesSetup @@ -18,8 +16,13 @@ public class ForgeDeferredRegistriesSetup */ public static void setup(IEventBus modEventBus) { - if (setup) - throw new IllegalStateException("Setup has already been called!"); + synchronized (ForgeDeferredRegistriesSetup.class) + { + if (setup) + throw new IllegalStateException("Setup has already been called!"); + + setup = true; + } ForgeRegistries.DEFERRED_ENTITY_DATA_SERIALIZERS.register(modEventBus); ForgeRegistries.DEFERRED_GLOBAL_LOOT_MODIFIER_SERIALIZERS.register(modEventBus); @@ -28,7 +31,5 @@ public class ForgeDeferredRegistriesSetup ForgeRegistries.DEFERRED_STRUCTURE_MODIFIER_SERIALIZERS.register(modEventBus); ForgeRegistries.DEFERRED_HOLDER_SET_TYPES.register(modEventBus); ForgeRegistries.DEFERRED_DISPLAY_CONTEXTS.register(modEventBus); - - setup = true; } } diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java index b8a8be6c49..a1a0d7caf3 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java +++ b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java @@ -48,6 +48,7 @@ import org.apache.logging.log4j.MarkerManager; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.VisibleForTesting; @ApiStatus.Internal public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegistryModifiable @@ -70,16 +71,12 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist private final BakeCallback bake; private final MissingFactory missing; private final BitSet availabilityMap; - @Deprecated(forRemoval = true, since = "1.19.4") - private final Set dummies = Sets.newHashSet(); private final Set blocked = Sets.newHashSet(); private final Multimap overrides = ArrayListMultimap.create(); private final Map> delegatesByName = Maps.newHashMap(); private final Map> delegatesByValue = Maps.newHashMap(); private final BiMap, V> owners = HashBiMap.create(); private final ForgeRegistryTagManager tagManager; - @Deprecated(forRemoval = true, since = "1.19.4") - private final DummyFactory dummyFactory; private final int min; private final int max; private final boolean allowOverrides; @@ -113,7 +110,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist this.validate = builder.getValidate(); this.bake = builder.getBake(); this.missing = builder.getMissingFactory(); - this.dummyFactory = builder.getDummyFactory(); this.allowOverrides = builder.getAllowOverrides(); this.isModifiable = builder.getAllowModifications(); this.hasWrapper = builder.getHasWrapper(); @@ -464,9 +460,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist if (this.add != null) this.add.onAdd(this, this.stage, idToUse, rkey, value, oldEntry); - if (this.dummies.remove(key)) - LOGGER.debug(REGISTRIES,"Registry {} Dummy Remove: {}", this.name, key); - LOGGER.trace(REGISTRIES,"Registry {} add: {} {} {} (req. id {})", this.name, key, idToUse, value, id); return idToUse; @@ -489,7 +482,7 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist * Any registry lookups that target the first name will resolve as the second name, if the first name is not present. * @param src The source registry name to alias from. * @param dst The target registry name to alias to. - * + * * TODO: Add as public API in IForgeRegistry and DeferredRegister. */ public void addAlias(ResourceLocation src, ResourceLocation dst) @@ -507,15 +500,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist LOGGER.trace(REGISTRIES,"Registry {} alias: {} -> {}", this.name, src, dst); } - @Deprecated(forRemoval = true, since = "1.19.4") - void addDummy(ResourceLocation key) - { - if (this.isLocked()) - throw new IllegalStateException(String.format(Locale.ENGLISH, "Attempted to register the dummy %s too late", key)); - this.dummies.add(key); - LOGGER.trace(REGISTRIES,"Registry {} dummy: {}", this.name, key); - } - @NotNull @Override public Optional> getDelegate(ResourceKey rkey) @@ -584,12 +568,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist return this.defaultValue; } - @Deprecated(forRemoval = true, since = "1.19.4") - boolean isDummied(ResourceLocation key) - { - return this.dummies.contains(key); - } - void validateContent(ResourceLocation registryName) { @@ -715,10 +693,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist } } - //Needs to be below add so that dummies are persisted - this.dummies.clear(); - from.dummies.forEach(this::addDummy); - if (errored) throw new RuntimeException("One of more entry values did not copy to the correct id. Check log for details!"); } @@ -737,7 +711,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist this.aliases.clear(); - this.dummies.clear(); this.ids.clear(); this.names.clear(); @@ -804,7 +777,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist { TablePrinter tab = new TablePrinter() .header("ID", r -> r.id) - .header("Dummy", r -> r.dummied) .header("Key", r -> r.key) .header("Value", r -> r.value); @@ -815,14 +787,14 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist getKeys().stream().map(this::getID).sorted().map(id -> { V val = getValue(id); ResourceLocation key = getKey(val); - return new DumpRow(Integer.toString(id), getKey(val).toString(), val.toString(), Boolean.toString(this.dummies.contains(key))); + return new DumpRow(Integer.toString(id), getKey(val).toString(), val.toString()); }).forEach(tab::add); tab.build(sb); })); } } - private record DumpRow(String id, String key, String value, @Deprecated(forRemoval = true, since = "1.19.4") String dummied) {} + private record DumpRow(String id, String key, String value) {} public void loadIds(Map ids, Map overrides, Map missing, Map remapped, ForgeRegistry old, ResourceLocation name) { @@ -830,20 +802,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist for (Map.Entry entry : ids.entrySet()) { ResourceLocation itemName = entry.getKey(); - /* - * Due to the way that Mojang wrote the world loading and validation code. - * Single player gets loaded twice and the 'active' registry is one we have loaded from - * from the world and potentially injected dummies into. - * The real fix would be to figure out how to revert the registries to the frozen state - * after validating data packs, but before injecting world data. - * But this should work for now, as we never want to inject dummies, this would be done - * further down the load stack. - */ - if (old.isDummied(itemName)) - { - LOGGER.info(REGISTRIES, "Registry {}: Skipping injection of dummied object {}", this.name, itemName); - continue; - } int newId = entry.getValue(); int currId = old.getIDRaw(itemName); @@ -924,68 +882,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist } } - @Deprecated(forRemoval = true, since = "1.19.4") - boolean markDummy(ResourceLocation key, int id) - { - if (this.dummyFactory == null) - return false; - - ForgeRegistry active = RegistryManager.ACTIVE.getRegistry(getRegistryKey()); - NamespacedWrapper wrapper = active.getWrapper(); - if (wrapper != null && wrapper.isIntrusive() && wrapper.isFrozen()) - { - try - { - // We have to unfreeze the ACTIVE registry because a lot of vanilla objects use intrusive handlers in object init. - wrapper.unfreeze(); - createAndAddDummy(key, id); - } - finally - { - wrapper.freeze(); - } - } - else - createAndAddDummy(key, id); - - return true; - } - - @Deprecated(forRemoval = true, since = "1.19.4") - private void createAndAddDummy(ResourceLocation key, int id) - { - V dummy = this.dummyFactory.createDummy(key); - LOGGER.debug(REGISTRIES,"Registry {} Dummy Add: {} {} -> {}", this.name, key, id, dummy); - - //It was blocked before so we need to unset the blocking map - this.availabilityMap.clear(id); - if (this.containsKey(key)) - { - //If the entry already exists, we need to delete it so we can add a dummy... - V value = this.names.remove(key); - if (value == null) - throw new IllegalStateException("ContainsKey for " + key + " was true, but removing by name returned no value.. This should never happen unless hackery!"); - - ResourceKey rkey = this.keys.inverse().remove(value); // Remove from the RegistryKey -> Value map - if (rkey == null) - throw new IllegalStateException("Removed a entry that did not have an associated RegistryKey: " + key + " " + value.toString() + " This should never happen unless hackery!"); - - Integer oldid = this.ids.inverse().remove(value); - if (oldid == null) - throw new IllegalStateException("Removed a entry that did not have an associated id: " + key + " " + value.toString() + " This should never happen unless hackery!"); - - if (oldid != id) - LOGGER.debug(REGISTRIES,"Registry {}: Dummy ID mismatch {} {} -> {}", this.name, key, oldid, id); - - LOGGER.debug(REGISTRIES,"Registry {} remove: {} {}", this.name, key, oldid); - } - - int realId = this.add(id, key, dummy); - if (realId != id) - LOGGER.warn(REGISTRIES,"Registry {}: Object did not get ID it asked for. Name: {} Expected: {} Got: {}", this.name, key, id, realId); - this.dummies.add(key); - } - //Public for tests public Snapshot makeSnapshot() { @@ -993,7 +889,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist this.ids.forEach((id, value) -> ret.ids.put(getKey(value), id)); ret.aliases.putAll(this.aliases); ret.blocked.addAll(this.blocked); - ret.dummied.addAll(this.dummies); ret.overrides.putAll(getOverrideOwners()); return ret; } @@ -1057,8 +952,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist public final Map ids = Maps.newTreeMap(sorter); public final Map aliases = Maps.newTreeMap(sorter); public final Set blocked = Sets.newTreeSet(); - @Deprecated(forRemoval = true, since = "1.19.4") - public final Set dummied = Sets.newTreeSet(sorter); public final Map overrides = Maps.newTreeMap(sorter); private FriendlyByteBuf binary = null; @@ -1099,10 +992,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist int[] blocked = this.blocked.stream().mapToInt(x->x).sorted().toArray(); data.putIntArray("blocked", blocked); - ListTag dummied = new ListTag(); - this.dummied.stream().sorted().forEach(e -> dummied.add(StringTag.valueOf(e.toString()))); - data.put("dummied", dummied); - return data; } @@ -1141,9 +1030,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist ret.blocked.add(i); } - list = nbt.getList("dummied", 8); - list.forEach(e -> ret.dummied.add(new ResourceLocation(((StringTag)e).getAsString()))); - return ret; } @@ -1173,9 +1059,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist pkt.writeVarInt(this.blocked.size()); this.blocked.forEach(pkt::writeVarInt); - pkt.writeVarInt(this.dummied.size()); - this.dummied.forEach(pkt::writeResourceLocation); - this.binary = pkt; } @@ -1205,10 +1088,6 @@ public class ForgeRegistry implements IForgeRegistryInternal, IForgeRegist for (int x = 0; x < len; x++) ret.blocked.add(buff.readVarInt()); - len = buff.readVarInt(); - for (int x = 0; x < len; x++) - ret.dummied.add(buff.readResourceLocation()); - return ret; } } diff --git a/src/main/java/net/minecraftforge/registries/GameData.java b/src/main/java/net/minecraftforge/registries/GameData.java index b58319ce37..6a737ea7cd 100644 --- a/src/main/java/net/minecraftforge/registries/GameData.java +++ b/src/main/java/net/minecraftforge/registries/GameData.java @@ -40,13 +40,11 @@ import net.minecraft.world.entity.ai.village.poi.PoiType; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemDisplayContext; -import net.minecraft.world.level.block.AirBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.levelgen.DebugLevelSource; import net.minecraft.world.level.material.Fluid; -import net.minecraft.world.level.material.Material; import net.minecraftforge.common.CreativeModeTabRegistry; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.MinecraftForge; @@ -209,9 +207,6 @@ public class GameData return new RegistryBuilder() .setMaxID(128 * 2) /* 0 -> 127 gets positive ID, 128 -> 256 gets negative ID */.disableOverrides().disableSaving() .setDefaultKey(new ResourceLocation("minecraft:none")) - .onCreate((owner, stage) -> Arrays.stream(ItemDisplayContext.values()) - .filter(Predicate.not(ItemDisplayContext::isModded)) - .forEach(ctx -> owner.register(ctx.getId(), new ResourceLocation("minecraft", ctx.getSerializedName()), ctx))) .onAdd(ItemDisplayContext.ADD_CALLBACK); } @@ -403,7 +398,7 @@ public class GameData { ForgeHooks.modifyAttributes(); SpawnPlacements.fireSpawnPlacementEvent(); - CreativeModeTabRegistry.fireCollectionEvent(); + CreativeModeTabRegistry.sortTabs(); } } @@ -427,7 +422,7 @@ public class GameData } } - private static class BlockCallbacks implements IForgeRegistry.AddCallback, IForgeRegistry.ClearCallback, IForgeRegistry.BakeCallback, IForgeRegistry.CreateCallback, IForgeRegistry.DummyFactory + private static class BlockCallbacks implements IForgeRegistry.AddCallback, IForgeRegistry.ClearCallback, IForgeRegistry.BakeCallback, IForgeRegistry.CreateCallback { static final BlockCallbacks INSTANCE = new BlockCallbacks(); @@ -488,14 +483,6 @@ public class GameData owner.setSlaveMap(BLOCK_TO_ITEM, Maps.newHashMap()); } - @Override - @Deprecated(forRemoval = true, since = "1.19.4") - public Block createDummy(ResourceLocation key) - { - Block ret = new DummyAirBlock(Block.Properties.of(Material.AIR).noCollission().noLootTable().air()); - return ret; - } - @Override public void onBake(IForgeRegistryInternal owner, RegistryManager stage) { @@ -514,21 +501,6 @@ public class GameData } DebugLevelSource.initValidStates(); } - - @Deprecated(forRemoval = true, since = "1.19.4") - private static class DummyAirBlock extends AirBlock - { - private DummyAirBlock(Block.Properties properties) - { - super(properties); - } - - @Override - public String getDescriptionId() - { - return "block.minecraft.air"; - } - } } private static class ItemCallbacks implements IForgeRegistry.AddCallback, IForgeRegistry.ClearCallback, IForgeRegistry.CreateCallback @@ -699,34 +671,6 @@ public class GameData loadPersistentDataToStagingRegistry(RegistryManager.ACTIVE, STAGING, remaps.get(key), missing.get(key), key, value); }); - snapshot.forEach((key, value) -> - { - value.dummied.forEach(dummy -> - { - Map m = missing.get(key); - ForgeRegistry reg = STAGING.getRegistry(key); - - // Currently missing locally, we just inject and carry on - if (m.containsKey(dummy)) - { - if (reg.markDummy(dummy, m.get(dummy))) - m.remove(dummy); - } - else if (isLocalWorld) - { - LOGGER.debug(REGISTRIES,"Registry {}: Resuscitating dummy entry {}", key, dummy); - } - else - { - // The server believes this is a dummy block identity, but we seem to have one locally. This is likely a conflict - // in mod setup - Mark this entry as a dummy - int id = reg.getID(dummy); - LOGGER.warn(REGISTRIES, "Registry {}: The ID {} @ {} is currently locally mapped - it will be replaced with a dummy for this session", dummy, key, id); - reg.markDummy(dummy, id); - } - }); - }); - int count = missing.values().stream().mapToInt(Map::size).sum(); if (count > 0) { @@ -791,17 +735,6 @@ public class GameData if (injectFrozenData) { - // If we're loading from disk, we can actually substitute air in the block map for anything that is otherwise "missing". This keeps the reference in the map, in case - // the block comes back later - missing.forEach((name, m) -> - { - if (m.isEmpty()) - return; - ForgeRegistry reg = STAGING.getRegistry(name); - m.forEach((rl, id) -> reg.markDummy(rl, id)); - }); - - // If we're loading up the world from disk, we want to add in the new data that might have been provisioned by mods // So we load it from the frozen persistent registry RegistryManager.ACTIVE.registries.forEach((name, reg) -> @@ -852,8 +785,6 @@ public class GameData ForgeRegistry _new = to.getRegistry(name, RegistryManager.ACTIVE); snap.aliases.forEach(_new::addAlias); snap.blocked.forEach(_new::block); - // Load current dummies BEFORE the snapshot is loaded so that add() will remove from the list. - snap.dummied.forEach(_new::addDummy); _new.loadIds(snap.ids, snap.overrides, missing, remaps, active, name); } diff --git a/src/main/java/net/minecraftforge/registries/IForgeRegistry.java b/src/main/java/net/minecraftforge/registries/IForgeRegistry.java index f9c96f0473..341932ed74 100644 --- a/src/main/java/net/minecraftforge/registries/IForgeRegistry.java +++ b/src/main/java/net/minecraftforge/registries/IForgeRegistry.java @@ -141,20 +141,6 @@ public interface IForgeRegistry extends Iterable void onBake(IForgeRegistryInternal owner, RegistryManager stage); } - /** - * Factory for creating dummy entries, allowing worlds to be loaded and keep the missing block references. - * @deprecated Dummies are being removed due to lack of use and high maintenance cost. There will not be an equivalent replacement feature added. - */ - @FunctionalInterface - @Deprecated(forRemoval = true, since = "1.19.4") - interface DummyFactory - { - V createDummy(ResourceLocation key); - } - - /** - * - */ @FunctionalInterface interface MissingFactory { diff --git a/src/main/java/net/minecraftforge/registries/ObjectHolderRef.java b/src/main/java/net/minecraftforge/registries/ObjectHolderRef.java index 47843e4ba1..605bebe95c 100644 --- a/src/main/java/net/minecraftforge/registries/ObjectHolderRef.java +++ b/src/main/java/net/minecraftforge/registries/ObjectHolderRef.java @@ -89,7 +89,7 @@ class ObjectHolderRef implements Consumer> return; Object thing; - if (registry.containsKey(injectedObject) && !registry.isDummied(injectedObject)) + if (registry.containsKey(injectedObject)) { thing = registry.getValue(injectedObject); } diff --git a/src/main/java/net/minecraftforge/registries/RegistryBuilder.java b/src/main/java/net/minecraftforge/registries/RegistryBuilder.java index 8ca54c614c..f4e0b153a4 100644 --- a/src/main/java/net/minecraftforge/registries/RegistryBuilder.java +++ b/src/main/java/net/minecraftforge/registries/RegistryBuilder.java @@ -12,7 +12,6 @@ import net.minecraftforge.registries.IForgeRegistry.AddCallback; import net.minecraftforge.registries.IForgeRegistry.BakeCallback; import net.minecraftforge.registries.IForgeRegistry.ClearCallback; import net.minecraftforge.registries.IForgeRegistry.CreateCallback; -import net.minecraftforge.registries.IForgeRegistry.DummyFactory; import net.minecraftforge.registries.IForgeRegistry.MissingFactory; import net.minecraftforge.registries.IForgeRegistry.ValidateCallback; import org.jetbrains.annotations.Nullable; @@ -39,8 +38,6 @@ public class RegistryBuilder private boolean allowOverrides = true; private boolean allowModifications = false; private boolean hasWrapper = false; - @Deprecated(forRemoval = true, since = "1.19.4") - private DummyFactory dummyFactory; private MissingFactory missingFactory; private Set legacyNames = new HashSet<>(); @Nullable @@ -83,8 +80,6 @@ public class RegistryBuilder this.add((ValidateCallback)inst); if (inst instanceof BakeCallback) this.add((BakeCallback)inst); - if (inst instanceof DummyFactory) - this.set((DummyFactory)inst); if (inst instanceof MissingFactory) this.set((MissingFactory)inst); return this; @@ -145,19 +140,6 @@ public class RegistryBuilder return this.add(bake); } - @Deprecated(forRemoval = true, since = "1.19.4") - public RegistryBuilder set(DummyFactory factory) - { - this.dummyFactory = factory; - return this; - } - - @Deprecated(forRemoval = true, since = "1.19.4") - public RegistryBuilder dummy(DummyFactory factory) - { - return this.set(factory); - } - public RegistryBuilder set(MissingFactory missing) { this.missingFactory = missing; @@ -351,13 +333,6 @@ public class RegistryBuilder return allowModifications; } - @Nullable - @Deprecated(forRemoval = true, since = "1.19.4") - public DummyFactory getDummyFactory() - { - return dummyFactory; - } - @Nullable public MissingFactory getMissingFactory() { diff --git a/src/main/java/net/minecraftforge/resource/ResourcePackLoader.java b/src/main/java/net/minecraftforge/resource/ResourcePackLoader.java index 437999e66b..128b75fdb4 100644 --- a/src/main/java/net/minecraftforge/resource/ResourcePackLoader.java +++ b/src/main/java/net/minecraftforge/resource/ResourcePackLoader.java @@ -53,13 +53,15 @@ public class ResourcePackLoader { @NotNull public static PathPackResources createPackForMod(IModFileInfo mf) { - return new PathPackResources(mf.getFile().getFileName(), false, mf.getFile().getFilePath()){ - final IModFile modFile = mf.getFile(); + return new PathPackResources(mf.getFile().getFileName(), true, mf.getFile().getFilePath()) + { + private final IModFile modFile = mf.getFile(); + @NotNull @Override protected Path resolve(@NotNull String... paths) { - return modFile.findResource(paths); + return this.modFile.findResource(paths); } }; } diff --git a/src/main/java/net/minecraftforge/server/command/ChunkGenWorker.java b/src/main/java/net/minecraftforge/server/command/ChunkGenWorker.java index d9f942d8b3..b0c2a350b7 100644 --- a/src/main/java/net/minecraftforge/server/command/ChunkGenWorker.java +++ b/src/main/java/net/minecraftforge/server/command/ChunkGenWorker.java @@ -107,7 +107,7 @@ public class ChunkGenWorker implements IWorker if (++lastNotification >= notificationFrequency || lastNotifcationTime < System.currentTimeMillis() - 60*1000) { - listener.sendSuccess(Component.translatable("commands.forge.gen.progress", total - queue.size(), total), true); + listener.sendSuccess(() -> Component.translatable("commands.forge.gen.progress", total - queue.size(), total), true); lastNotification = 0; lastNotifcationTime = System.currentTimeMillis(); } @@ -126,7 +126,7 @@ public class ChunkGenWorker implements IWorker if (queue.size() == 0) { - listener.sendSuccess(Component.translatable("commands.forge.gen.complete", genned, total, dim.dimension().location()), true); + listener.sendSuccess(() -> Component.translatable("commands.forge.gen.complete", genned, total, dim.dimension().location()), true); /* TODO: Readd if/when we introduce world unloading, or get Mojang to do it. if (keepingLoaded != null && !keepingLoaded) DimensionManager.keepLoaded(dim, false); diff --git a/src/main/java/net/minecraftforge/server/command/ConfigCommand.java b/src/main/java/net/minecraftforge/server/command/ConfigCommand.java index 048a250cb9..0000502db7 100644 --- a/src/main/java/net/minecraftforge/server/command/ConfigCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ConfigCommand.java @@ -43,13 +43,13 @@ public class ConfigCommand { final String configFileName = ConfigTracker.INSTANCE.getConfigFileName(modId, type); if (configFileName != null) { File f = new File(configFileName); - context.getSource().sendSuccess(Component.translatable("commands.config.getwithtype", + context.getSource().sendSuccess(() -> Component.translatable("commands.config.getwithtype", modId, type, Component.literal(f.getName()).withStyle(ChatFormatting.UNDERLINE). withStyle((style) -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_FILE, f.getAbsolutePath()))) ), true); } else { - context.getSource().sendSuccess(Component.translatable("commands.config.noconfig", modId, type), + context.getSource().sendSuccess(() -> Component.translatable("commands.config.noconfig", modId, type), true); } return 0; diff --git a/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java b/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java index b89f1d24e8..914cfccc2b 100644 --- a/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java +++ b/src/main/java/net/minecraftforge/server/command/DimensionsCommand.java @@ -29,7 +29,7 @@ class DimensionsCommand return Commands.literal("dimensions") .requires(cs->cs.hasPermission(0)) //permission .executes(ctx -> { - ctx.getSource().sendSuccess(Component.translatable("commands.forge.dimensions.list"), true); + ctx.getSource().sendSuccess(() -> Component.translatable("commands.forge.dimensions.list"), true); final Registry reg = ctx.getSource().registryAccess().registryOrThrow(Registries.DIMENSION_TYPE); Map> types = new HashMap<>(); @@ -38,7 +38,7 @@ class DimensionsCommand } types.keySet().stream().sorted().forEach(key -> { - ctx.getSource().sendSuccess(Component.literal(key + ": " + types.get(key).stream().map(ResourceLocation::toString).sorted().collect(Collectors.joining(", "))), false); + ctx.getSource().sendSuccess(() -> Component.literal(key + ": " + types.get(key).stream().map(ResourceLocation::toString).sorted().collect(Collectors.joining(", "))), false); }); return 0; }); diff --git a/src/main/java/net/minecraftforge/server/command/EntityCommand.java b/src/main/java/net/minecraftforge/server/command/EntityCommand.java index fc7f67ecfe..1a621e7832 100644 --- a/src/main/java/net/minecraftforge/server/command/EntityCommand.java +++ b/src/main/java/net/minecraftforge/server/command/EntityCommand.java @@ -89,7 +89,7 @@ class EntityCommand if (info == null) throw NO_ENTITIES.create(); - sender.sendSuccess(Component.translatable("commands.forge.entity.list.single.header", name, info.getLeft()), false); + sender.sendSuccess(() -> Component.translatable("commands.forge.entity.list.single.header", name, info.getLeft()), false); List> toSort = new ArrayList<>(); toSort.addAll(info.getRight().entrySet()); toSort.sort((a, b) -> { @@ -103,7 +103,7 @@ class EntityCommand for (Map.Entry e : toSort) { if (limit-- == 0) break; - sender.sendSuccess(Component.literal(" " + e.getValue() + ": " + e.getKey().x + ", " + e.getKey().z), false); + sender.sendSuccess(() -> Component.literal(" " + e.getValue() + ": " + e.getKey().x + ", " + e.getKey().z), false); } return toSort.size(); } @@ -129,8 +129,8 @@ class EntityCommand throw NO_ENTITIES.create(); int count = info.stream().mapToInt(Pair::getRight).sum(); - sender.sendSuccess(Component.translatable("commands.forge.entity.list.multiple.header", count), false); - info.forEach(e -> sender.sendSuccess(Component.literal(" " + e.getValue() + ": " + e.getKey()), false)); + sender.sendSuccess(() -> Component.translatable("commands.forge.entity.list.multiple.header", count), false); + info.forEach(e -> sender.sendSuccess(() -> Component.literal(" " + e.getValue() + ": " + e.getKey()), false)); return info.size(); } } diff --git a/src/main/java/net/minecraftforge/server/command/GenerateCommand.java b/src/main/java/net/minecraftforge/server/command/GenerateCommand.java index ef1dc581eb..d6a7f4052f 100644 --- a/src/main/java/net/minecraftforge/server/command/GenerateCommand.java +++ b/src/main/java/net/minecraftforge/server/command/GenerateCommand.java @@ -47,7 +47,7 @@ class GenerateCommand BlockPos chunkpos = new BlockPos(pos.getX() >> 4, 0, pos.getZ() >> 4); ChunkGenWorker worker = new ChunkGenWorker(source, chunkpos, count, dim, interval); - source.sendSuccess(worker.getStartMessage(source), true); + source.sendSuccess(() -> worker.getStartMessage(source), true); WorldWorkerManager.addWorker(worker); return 0; diff --git a/src/main/java/net/minecraftforge/server/command/ModListCommand.java b/src/main/java/net/minecraftforge/server/command/ModListCommand.java index 713ff07c4a..a6d4dc1f0d 100644 --- a/src/main/java/net/minecraftforge/server/command/ModListCommand.java +++ b/src/main/java/net/minecraftforge/server/command/ModListCommand.java @@ -20,7 +20,7 @@ class ModListCommand { return Commands.literal("mods") .requires(cs->cs.hasPermission(0)) //permission .executes(ctx -> { - ctx.getSource().sendSuccess(Component.translatable("commands.forge.mods.list", + ctx.getSource().sendSuccess(() -> Component.translatable("commands.forge.mods.list", ModList.get().applyForEachModFile(modFile -> // locator - filename : firstmod (version) - numberofmods\n String.format(Locale.ROOT, "%s %s : %s (%s) - %d", diff --git a/src/main/java/net/minecraftforge/server/command/TPSCommand.java b/src/main/java/net/minecraftforge/server/command/TPSCommand.java index 8a8d90080a..ddcf3efc63 100644 --- a/src/main/java/net/minecraftforge/server/command/TPSCommand.java +++ b/src/main/java/net/minecraftforge/server/command/TPSCommand.java @@ -36,7 +36,7 @@ class TPSCommand @SuppressWarnings("resource") double meanTickTime = mean(ctx.getSource().getServer().tickTimes) * 1.0E-6D; double meanTPS = Math.min(1000.0/meanTickTime, 20); - ctx.getSource().sendSuccess(Component.translatable("commands.forge.tps.summary.all", TIME_FORMATTER.format(meanTickTime), TIME_FORMATTER.format(meanTPS)), false); + ctx.getSource().sendSuccess(() -> Component.translatable("commands.forge.tps.summary.all", TIME_FORMATTER.format(meanTickTime), TIME_FORMATTER.format(meanTPS)), false); return 0; } @@ -53,7 +53,7 @@ class TPSCommand final Registry reg = cs.registryAccess().registryOrThrow(Registries.DIMENSION_TYPE); double worldTickTime = mean(times) * 1.0E-6D; double worldTPS = Math.min(1000.0 / worldTickTime, 20); - cs.sendSuccess(Component.translatable("commands.forge.tps.summary.named", dim.dimension().location().toString(), reg.getKey(dim.dimensionType()), TIME_FORMATTER.format(worldTickTime), TIME_FORMATTER.format(worldTPS)), false); + cs.sendSuccess(() -> Component.translatable("commands.forge.tps.summary.named", dim.dimension().location().toString(), reg.getKey(dim.dimensionType()), TIME_FORMATTER.format(worldTickTime), TIME_FORMATTER.format(worldTPS)), false); return 1; } diff --git a/src/main/java/net/minecraftforge/server/command/TagsCommand.java b/src/main/java/net/minecraftforge/server/command/TagsCommand.java index c11e24f415..63f6c096c5 100644 --- a/src/main/java/net/minecraftforge/server/command/TagsCommand.java +++ b/src/main/java/net/minecraftforge/server/command/TagsCommand.java @@ -115,7 +115,7 @@ class TagsCommand final long tagCount = registry.getTags().count(); - ctx.getSource().sendSuccess(createMessage( + ctx.getSource().sendSuccess(() -> createMessage( Component.translatable("commands.forge.tags.registry_key", Component.literal(registryKey.location().toString()).withStyle(ChatFormatting.GOLD)), "commands.forge.tags.tag_count", "commands.forge.tags.copy_tag_names", @@ -143,7 +143,7 @@ class TagsCommand final HolderSet.Named tag = registry.getTag(cast(tagKey)) .orElseThrow(() -> UNKNOWN_TAG.create(tagKey.location(), registryKey.location())); - ctx.getSource().sendSuccess(createMessage( + ctx.getSource().sendSuccess(() -> createMessage( Component.translatable("commands.forge.tags.tag_key", Component.literal(tagKey.registry().location().toString()).withStyle(ChatFormatting.GOLD), Component.literal(tagKey.location().toString()).withStyle(ChatFormatting.DARK_GREEN)), @@ -173,7 +173,7 @@ class TagsCommand final long containingTagsCount = elementHolder.tags().count(); - ctx.getSource().sendSuccess(createMessage( + ctx.getSource().sendSuccess(() -> createMessage( Component.translatable("commands.forge.tags.element", Component.literal(registryKey.location().toString()).withStyle(ChatFormatting.GOLD), Component.literal(elementLocation.toString()).withStyle(ChatFormatting.YELLOW)), diff --git a/src/main/java/net/minecraftforge/server/command/TrackCommand.java b/src/main/java/net/minecraftforge/server/command/TrackCommand.java index 15c02b6380..9f52c2ee32 100644 --- a/src/main/java/net/minecraftforge/server/command/TrackCommand.java +++ b/src/main/java/net/minecraftforge/server/command/TrackCommand.java @@ -51,7 +51,7 @@ class TrackCommand int duration = IntegerArgumentType.getInteger(ctx, "duration"); TimeTracker.BLOCK_ENTITY_UPDATE.reset(); TimeTracker.BLOCK_ENTITY_UPDATE.enable(duration); - ctx.getSource().sendSuccess(Component.translatable("commands.forge.tracking.be.enabled", duration), true); + ctx.getSource().sendSuccess(() -> Component.translatable("commands.forge.tracking.be.enabled", duration), true); return 0; }) ) @@ -62,7 +62,7 @@ class TrackCommand int duration = IntegerArgumentType.getInteger(ctx, "duration"); TimeTracker.ENTITY_UPDATE.reset(); TimeTracker.ENTITY_UPDATE.enable(duration); - ctx.getSource().sendSuccess(Component.translatable("commands.forge.tracking.entity.enabled", duration), true); + ctx.getSource().sendSuccess(() -> Component.translatable("commands.forge.tracking.entity.enabled", duration), true); return 0; }) ) @@ -79,14 +79,14 @@ class TrackCommand .then(Commands.literal("te") .executes(ctx -> { TimeTracker.BLOCK_ENTITY_UPDATE.reset(); - ctx.getSource().sendSuccess(Component.translatable("commands.forge.tracking.be.reset"), true); + ctx.getSource().sendSuccess(() -> Component.translatable("commands.forge.tracking.be.reset"), true); return 0; }) ) .then(Commands.literal("entity") .executes(ctx -> { TimeTracker.ENTITY_UPDATE.reset(); - ctx.getSource().sendSuccess(Component.translatable("commands.forge.tracking.entity.reset"), true); + ctx.getSource().sendSuccess(() -> Component.translatable("commands.forge.tracking.entity.reset"), true); return 0; }) ); @@ -116,14 +116,14 @@ class TrackCommand List> timingsList = getSortedTimings(tracker); if (timingsList.isEmpty()) { - source.sendSuccess(Component.translatable("commands.forge.tracking.no_data"), true); + source.sendSuccess(() -> Component.translatable("commands.forge.tracking.no_data"), true); } else { timingsList.stream() .filter(timings -> timings.getObject().get() != null) .limit(10) - .forEach(timings -> source.sendSuccess(toString.apply(timings), true)); + .forEach(timings -> source.sendSuccess(() -> toString.apply(timings), true)); } return 0; } @@ -143,7 +143,7 @@ class TrackCommand double averageTimings = data.getAverageTimings(); String tickTime = (averageTimings > 1000 ? TIME_FORMAT.format(averageTimings / 1000) : TIME_FORMAT.format(averageTimings)) + (averageTimings < 1000 ? "\u03bcs" : "ms"); - return Component.translatable("commands.forge.tracking.timing_entry", ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()), entity.level.dimension().location().toString(), pos.getX(), pos.getY(), pos.getZ(), tickTime); + return Component.translatable("commands.forge.tracking.timing_entry", ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()), entity.level().dimension().location().toString(), pos.getX(), pos.getY(), pos.getZ(), tickTime); }) ); } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 104c928f19..74560494e5 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -3,6 +3,7 @@ default net.minecraft.client.KeyMapping f_90817_ # isDown public net.minecraft.client.Minecraft f_90987_ # textureManager public net.minecraft.client.Minecraft m_91271_()V # createSearchTrees public-f net.minecraft.client.Options f_92059_ # keyMappings +public net.minecraft.client.Options$FieldAccess #group protected net.minecraft.client.gui.Gui * protected net.minecraft.client.gui.Gui f_168664_ # scopeScale protected net.minecraft.client.gui.Gui f_168665_ # SPYGLASS_SCOPE_LOCATION @@ -20,6 +21,7 @@ protected net.minecraft.client.gui.Gui f_193829_ # lastAutosaveIndicatorValue protected net.minecraft.client.gui.Gui f_193830_ # SAVING_TEXT protected net.minecraft.client.gui.Gui f_193831_ # AUTOSAVE_FADE_SPEED_FACTOR protected net.minecraft.client.gui.Gui f_238167_ # chatDisabledByPlayerShown +protected net.minecraft.client.gui.Gui f_279580_ # GUI_ICONS_LOCATION protected net.minecraft.client.gui.Gui f_92970_ # titleFadeInTime protected net.minecraft.client.gui.Gui f_92971_ # titleStayTime protected net.minecraft.client.gui.Gui f_92972_ # titleFadeOutTime @@ -52,22 +54,22 @@ protected net.minecraft.client.gui.Gui f_93000_ # titleTime protected net.minecraft.client.gui.Gui f_93001_ # title protected net.minecraft.client.gui.Gui f_93002_ # subtitle #endgroup -protected net.minecraft.client.gui.Gui m_168688_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/world/entity/player/Player;IIIIFIIIZ)V # renderHearts -public net.minecraft.client.gui.Gui m_264148_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/world/entity/Entity;)V # renderVignette -protected net.minecraft.client.gui.Gui m_264464_(Lcom/mojang/blaze3d/vertex/PoseStack;F)V # renderPortalOverlay -public net.minecraft.client.gui.Gui m_264541_(Lcom/mojang/blaze3d/vertex/PoseStack;F)V # renderSpyglassOverlay -protected net.minecraft.client.gui.Gui m_264571_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/resources/ResourceLocation;F)V # renderTextureOverlay -public net.minecraft.client.gui.Gui m_93009_(FLcom/mojang/blaze3d/vertex/PoseStack;)V # renderHotbar -public net.minecraft.client.gui.Gui m_93028_(Lcom/mojang/blaze3d/vertex/PoseStack;)V # renderEffects -public net.minecraft.client.gui.Gui m_93036_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/world/scores/Objective;)V # displayScoreboardSidebar -protected net.minecraft.client.gui.Gui m_93039_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/gui/Font;III)V # drawBackdrop -public net.minecraft.client.gui.Gui m_93080_(Lcom/mojang/blaze3d/vertex/PoseStack;)V # renderCrosshair +protected net.minecraft.client.gui.Gui m_168688_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/entity/player/Player;IIIIFIIIZ)V # renderHearts +public net.minecraft.client.gui.Gui m_280030_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/scores/Objective;)V # displayScoreboardSidebar +public net.minecraft.client.gui.Gui m_280130_(Lnet/minecraft/client/gui/GuiGraphics;)V # renderCrosshair +public net.minecraft.client.gui.Gui m_280154_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/entity/Entity;)V # renderVignette +protected net.minecraft.client.gui.Gui m_280155_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/resources/ResourceLocation;F)V # renderTextureOverlay +public net.minecraft.client.gui.Gui m_280278_(Lnet/minecraft/client/gui/GuiGraphics;F)V # renderSpyglassOverlay +protected net.minecraft.client.gui.Gui m_280379_(Lnet/minecraft/client/gui/GuiGraphics;F)V # renderPortalOverlay +public net.minecraft.client.gui.Gui m_280518_(FLnet/minecraft/client/gui/GuiGraphics;)V # renderHotbar +public net.minecraft.client.gui.Gui m_280523_(Lnet/minecraft/client/gui/GuiGraphics;)V # renderEffects +protected net.minecraft.client.gui.Gui m_93039_(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/gui/Font;III)V # drawBackdrop protected net.minecraft.client.gui.components.AbstractSelectionList$Entry f_93521_ # list +public net.minecraft.client.gui.components.AbstractSliderButton f_263683_ # SLIDER_LOCATION +protected net.minecraft.client.gui.components.AbstractSliderButton m_264270_()I # getHandleTextureY +protected net.minecraft.client.gui.components.AbstractSliderButton m_264355_()I # getTextureY protected net.minecraft.client.gui.components.DebugScreenOverlay f_94032_ # block protected net.minecraft.client.gui.components.DebugScreenOverlay f_94033_ # liquid -protected net.minecraft.client.gui.components.AbstractSliderButton m_264355_()I # getTextureY -protected net.minecraft.client.gui.components.AbstractSliderButton m_264270_()I # getHandleTextureY -public net.minecraft.client.gui.components.AbstractSliderButton f_263683_ # SLIDER_LOCATION public net.minecraft.client.gui.screens.MenuScreens m_96206_(Lnet/minecraft/world/inventory/MenuType;Lnet/minecraft/client/gui/screens/MenuScreens$ScreenConstructor;)V # register public net.minecraft.client.gui.screens.MenuScreens$ScreenConstructor public net.minecraft.client.gui.screens.Screen f_169369_ # renderables @@ -280,8 +282,8 @@ public net.minecraft.world.item.crafting.Ingredient$TagValue public net.minecraft.world.item.crafting.Ingredient$TagValue (Lnet/minecraft/tags/TagKey;)V # constructor public net.minecraft.world.item.crafting.Ingredient$Value public net.minecraft.world.level.GameRules m_46189_(Ljava/lang/String;Lnet/minecraft/world/level/GameRules$Category;Lnet/minecraft/world/level/GameRules$Type;)Lnet/minecraft/world/level/GameRules$Key; # register -public net.minecraft.world.level.GameRules$BooleanValue m_46252_(ZLjava/util/function/BiConsumer;)Lnet/minecraft/world/level/GameRules$Type; # create public net.minecraft.world.level.GameRules$BooleanValue m_46250_(Z)Lnet/minecraft/world/level/GameRules$Type; # create +public net.minecraft.world.level.GameRules$BooleanValue m_46252_(ZLjava/util/function/BiConsumer;)Lnet/minecraft/world/level/GameRules$Type; # create public net.minecraft.world.level.GameRules$IntegerValue m_46294_(ILjava/util/function/BiConsumer;)Lnet/minecraft/world/level/GameRules$Type; # create public net.minecraft.world.level.GameRules$IntegerValue m_46312_(I)Lnet/minecraft/world/level/GameRules$Type; # create public net.minecraft.world.level.Level f_46437_ # oRainLevel @@ -347,6 +349,7 @@ public net.minecraft.world.level.block.EndGatewayBlock (Lnet/minecraft/wor public net.minecraft.world.level.block.EndPortalBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor public net.minecraft.world.level.block.EndRodBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor public net.minecraft.world.level.block.EnderChestBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor +public net.minecraft.world.level.block.EquipableCarvedPumpkinBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor public net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor public net.minecraft.world.level.block.FarmBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor public net.minecraft.world.level.block.FletchingTableBlock (Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;)V # constructor @@ -416,9 +419,9 @@ public net.minecraft.world.level.block.FireBlock m_221166_(Lnet/minecraft/world/ public net.minecraft.world.level.block.entity.BlockEntityType$BlockEntitySupplier public net.minecraft.world.level.block.entity.HopperBlockEntity m_59395_(I)V # setCooldown public net.minecraft.world.level.block.entity.HopperBlockEntity m_59409_()Z # isOnCustomCooldown -public net.minecraft.world.level.block.state.properties.WoodType m_61844_(Lnet/minecraft/world/level/block/state/properties/WoodType;)Lnet/minecraft/world/level/block/state/properties/WoodType; # register public net.minecraft.world.level.block.state.properties.BlockSetType m_272115_(Lnet/minecraft/world/level/block/state/properties/BlockSetType;)Lnet/minecraft/world/level/block/state/properties/BlockSetType; # register -public net.minecraft.world.level.chunk.ChunkStatus (Ljava/lang/String;Lnet/minecraft/world/level/chunk/ChunkStatus;ILjava/util/EnumSet;Lnet/minecraft/world/level/chunk/ChunkStatus$ChunkType;Lnet/minecraft/world/level/chunk/ChunkStatus$GenerationTask;Lnet/minecraft/world/level/chunk/ChunkStatus$LoadingTask;)V # constructor +public net.minecraft.world.level.block.state.properties.WoodType m_61844_(Lnet/minecraft/world/level/block/state/properties/WoodType;)Lnet/minecraft/world/level/block/state/properties/WoodType; # register +public net.minecraft.world.level.chunk.ChunkStatus (Lnet/minecraft/world/level/chunk/ChunkStatus;IZLjava/util/EnumSet;Lnet/minecraft/world/level/chunk/ChunkStatus$ChunkType;Lnet/minecraft/world/level/chunk/ChunkStatus$GenerationTask;Lnet/minecraft/world/level/chunk/ChunkStatus$LoadingTask;)V # constructor protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer f_157994_ # barrierNoise protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer f_157996_ # lavaNoise protected net.minecraft.world.level.levelgen.Aquifer$NoiseBasedAquifer f_157998_ # aquiferCache diff --git a/src/main/resources/META-INF/coremods.json b/src/main/resources/META-INF/coremods.json index 0d4634501d..98eab2a142 100644 --- a/src/main/resources/META-INF/coremods.json +++ b/src/main/resources/META-INF/coremods.json @@ -2,6 +2,5 @@ "field_to_method": "coremods/field_to_method.js", "field_to_instanceof": "coremods/field_to_instanceof.js", "add_bouncer_method": "coremods/add_bouncer_method.js", - "intrinsic_tag_appender_binary_compat": "coremods/intrinsic_tag_appender_binary_compat.js", "method_redirector": "coremods/method_redirector.js" } diff --git a/src/main/resources/assets/forge/lang/en_us.json b/src/main/resources/assets/forge/lang/en_us.json index 6f2db3e4e1..9554d66910 100644 --- a/src/main/resources/assets/forge/lang/en_us.json +++ b/src/main/resources/assets/forge/lang/en_us.json @@ -212,6 +212,11 @@ "fluid_type.minecraft.milk": "Milk", "fluid_type.minecraft.flowing_milk": "Milk", + "forge.froge.warningScreen.title": "Forge snapshots notice", + "forge.froge.warningScreen.text": "Froge is not officially supported. Bugs and instability are expected.", + "forge.froge.supportWarning": "WARNING: Froge is not supported by Minecraft Forge", + "forge.gui.exit": "Exit", + "forge.experimentalsettings.tooltip": "This world uses experimental settings, which could stop working at any time.", "forge.selectWorld.backupWarning.experimental.additional" : "This message will not show again for this world.", diff --git a/src/main/resources/coremods/intrinsic_tag_appender_binary_compat.js b/src/main/resources/coremods/intrinsic_tag_appender_binary_compat.js deleted file mode 100644 index 9b3f3fd1e2..0000000000 --- a/src/main/resources/coremods/intrinsic_tag_appender_binary_compat.js +++ /dev/null @@ -1,65 +0,0 @@ -var Opcodes = Java.type('org.objectweb.asm.Opcodes') -var MethodNode = Java.type('org.objectweb.asm.tree.MethodNode') -var VarInsnNode = Java.type('org.objectweb.asm.tree.VarInsnNode') -var MethodInsnNode = Java.type('org.objectweb.asm.tree.MethodInsnNode') -var InsnNode = Java.type('org.objectweb.asm.tree.InsnNode') - -// TODO 1.20: Delete this whole coremod. We won't need to maintain binary compatibility then. -// This coremod exists purely because of Java limitations - 2 methods with the same parameters and name but different return types are not allowed. -// However, this restriction does not exist in the JVM. -// The two remove() methods had their return types narrowed to allow chaining calls. -// This coremod was made to maintain compatibility with mods compiled on old forge in the least invasive way. -// It adds runtime methods for the two methods in IForgeIntrinsicTagAppender that return TagsProvider.TagAppender. -// The ASM methods just delegate to the original methods. - -function initializeCoreMod() { - return { - 'intrinsic_tag_appender_binary_compat': { - 'target': { - 'type': 'CLASS', - 'name': 'net.minecraftforge.common.extensions.IForgeIntrinsicHolderTagAppender' - }, - 'transformer': function (classNode) { - var removeSingleNode = new MethodNode( - Opcodes.ACC_PUBLIC, - 'remove', - '(Ljava/lang/Object;)Lnet/minecraft/data/tags/TagsProvider$TagAppender;', - null, - null - ); - removeSingleNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); - removeSingleNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1)); - removeSingleNode.instructions.add(new MethodInsnNode( - Opcodes.INVOKEINTERFACE, - 'net/minecraftforge/common/extensions/IForgeIntrinsicHolderTagAppender', - 'remove', - '(Ljava/lang/Object;)Lnet/minecraft/data/tags/IntrinsicHolderTagsProvider$IntrinsicTagAppender;' - )); - removeSingleNode.instructions.add(new InsnNode(Opcodes.ARETURN)); - - var removeMultiNode = new MethodNode( - Opcodes.ACC_PUBLIC | Opcodes.ACC_VARARGS, - 'remove', - '(Ljava/lang/Object;[Ljava/lang/Object;)Lnet/minecraft/data/tags/TagsProvider$TagAppender;', - null, - null - ); - removeMultiNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); - removeMultiNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 1)); - removeMultiNode.instructions.add(new VarInsnNode(Opcodes.ALOAD, 2)); - removeMultiNode.instructions.add(new MethodInsnNode( - Opcodes.INVOKEINTERFACE, - 'net/minecraftforge/common/extensions/IForgeIntrinsicHolderTagAppender', - 'remove', - '(Ljava/lang/Object;[Ljava/lang/Object;)Lnet/minecraft/data/tags/IntrinsicHolderTagsProvider$IntrinsicTagAppender;' - )); - removeMultiNode.instructions.add(new InsnNode(Opcodes.ARETURN)); - - classNode.methods.add(removeSingleNode); - classNode.methods.add(removeMultiNode); - - return classNode; - } - } - } -} \ No newline at end of file diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index cc26321628..b423ef72a7 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -2,21 +2,19 @@ com/mojang/blaze3d/vertex/VertexConsumer.putBulkData(Lcom/mojang/blaze3d/vertex/ net/minecraft/advancements/Advancement$Builder.fromJson(Lcom/google/gson/JsonObject;Lnet/minecraft/advancements/critereon/DeserializationContext;Lnet/minecraftforge/common/crafting/conditions/ICondition$IContext;)Lnet/minecraft/advancements/Advancement$Builder;=|p_138381_,p_138382_,context net/minecraft/client/Options.processOptionsForge(Lnet/minecraft/client/Options$FieldAccess;)V=|p_168428_ net/minecraft/client/gui/screens/MenuScreens.getScreenFactory(Lnet/minecraft/world/inventory/MenuType;Lnet/minecraft/client/Minecraft;ILnet/minecraft/network/chat/Component;)Ljava/util/Optional;=|p_96202_,p_96203_,p_96204_,p_96205_ -net/minecraft/client/gui/screens/inventory/InventoryScreen.renderEntityInInventoryFollowsAngle(Lcom/mojang/blaze3d/vertex/PoseStack;IIIFFLnet/minecraft/world/entity/LivingEntity;)V=|p_275396_,p_275688_,p_275245_,p_275535_,angleXComponent,angleYComponent,p_275689_ -net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.renderRectangle(Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil$BlitPainter;Lorg/joml/Matrix4f;Lcom/mojang/blaze3d/vertex/BufferBuilder;IIIIIII)V=|p_262933_,p_263035_,p_263084_,p_262945_,p_262955_,p_263017_,p_262978_,p_262950_,p_262931_,colorTo -net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.renderTooltipBackground(Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil$BlitPainter;Lorg/joml/Matrix4f;Lcom/mojang/blaze3d/vertex/BufferBuilder;IIIIIIIII)V=|p_262929_,p_263052_,p_263082_,p_263046_,p_263101_,p_263024_,p_262926_,p_263038_,backgroundTop,backgroundBottom,borderTop,borderBottom +net/minecraft/client/gui/screens/inventory/InventoryScreen.renderEntityInInventoryFollowsAngle(Lnet/minecraft/client/gui/GuiGraphics;IIIFFLnet/minecraft/world/entity/LivingEntity;)V=|p_282802_,p_275688_,p_275245_,p_275535_,angleXComponent,angleYComponent,p_275689_ +net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.renderRectangle(Lnet/minecraft/client/gui/GuiGraphics;IIIIIII)V=|p_281392_,p_282294_,p_283353_,p_282640_,p_281964_,p_283211_,p_282349_,colorTo +net/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil.renderTooltipBackground(Lnet/minecraft/client/gui/GuiGraphics;IIIIIIIII)V=|p_282666_,p_281901_,p_281846_,p_281559_,p_283336_,p_283422_,backgroundTop,backgroundBottom,borderTop,borderBottom net/minecraft/client/gui/screens/worldselection/WorldOpenFlows.doLoadLevel(Lnet/minecraft/client/gui/screens/Screen;Ljava/lang/String;ZZZ)V=|p_233146_,p_233147_,p_233148_,p_233149_,confirmExperimentalWarning net/minecraft/client/renderer/ScreenEffectRenderer.getOverlayBlock(Lnet/minecraft/world/entity/player/Player;)Lorg/apache/commons/lang3/tuple/Pair;=|p_110717_ net/minecraft/client/renderer/ScreenEffectRenderer.renderFluid(Lnet/minecraft/client/Minecraft;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/resources/ResourceLocation;)V=|p_110726_,p_110727_,texture net/minecraft/client/renderer/ShaderInstance.(Lnet/minecraft/server/packs/resources/ResourceProvider;Lnet/minecraft/resources/ResourceLocation;Lcom/mojang/blaze3d/vertex/VertexFormat;)V=|p_173336_,shaderLocation,p_173338_ net/minecraft/client/renderer/block/BlockModelShaper.getTexture(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;=|p_110883_,level,pos net/minecraft/client/renderer/block/BlockRenderDispatcher.renderBatched(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/BlockAndTintGetter;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;ZLnet/minecraft/util/RandomSource;Lnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)V=|p_234356_,p_234357_,p_234358_,p_234359_,p_234360_,p_234361_,p_234362_,modelData,renderType -net/minecraft/client/renderer/block/BlockRenderDispatcher.renderBatched(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/BlockAndTintGetter;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;ZLnet/minecraft/util/RandomSource;Lnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;Z)V=|p_234356_,p_234357_,p_234358_,p_234359_,p_234360_,p_234361_,p_234362_,modelData,renderType,queryModelSpecificData net/minecraft/client/renderer/block/BlockRenderDispatcher.renderBreakingTexture(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/BlockAndTintGetter;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;Lnet/minecraftforge/client/model/data/ModelData;)V=|p_110919_,p_110920_,p_110921_,p_110922_,p_110923_,modelData net/minecraft/client/renderer/block/BlockRenderDispatcher.renderSingleBlock(Lnet/minecraft/world/level/block/state/BlockState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;IILnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)V=|p_110913_,p_110914_,p_110915_,p_110916_,p_110917_,modelData,renderType net/minecraft/client/renderer/block/ModelBlockRenderer.renderModel(Lcom/mojang/blaze3d/vertex/PoseStack$Pose;Lcom/mojang/blaze3d/vertex/VertexConsumer;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/client/resources/model/BakedModel;FFFIILnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)V=|p_111068_,p_111069_,p_111070_,p_111071_,p_111072_,p_111073_,p_111074_,p_111075_,p_111076_,modelData,renderType -net/minecraft/client/renderer/block/ModelBlockRenderer.tesselateBlock(Lnet/minecraft/world/level/BlockAndTintGetter;Lnet/minecraft/client/resources/model/BakedModel;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;ZLnet/minecraft/util/RandomSource;JILnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)V=|p_111048_,p_111049_,p_111050_,p_111051_,p_111052_,p_111053_,p_111054_,p_111055_,p_111056_,p_111057_,modelData,renderType -net/minecraft/client/renderer/block/ModelBlockRenderer.tesselateBlock(Lnet/minecraft/world/level/BlockAndTintGetter;Lnet/minecraft/client/resources/model/BakedModel;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;ZLnet/minecraft/util/RandomSource;JILnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;Z)V=|p_111048_,p_111049_,p_111050_,p_111051_,p_111052_,p_111053_,p_111054_,p_111055_,p_111056_,p_111057_,modelData,renderType,queryModelSpecificData +net/minecraft/client/renderer/block/ModelBlockRenderer.tesselateBlock(Lnet/minecraft/world/level/BlockAndTintGetter;Lnet/minecraft/client/resources/model/BakedModel;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;ZLnet/minecraft/util/RandomSource;JILnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)V=|p_234380_,p_234381_,p_234382_,p_234383_,p_234384_,p_234385_,p_234386_,p_234387_,p_234388_,p_234389_,modelData,renderType net/minecraft/client/renderer/block/ModelBlockRenderer.tesselateWithAO(Lnet/minecraft/world/level/BlockAndTintGetter;Lnet/minecraft/client/resources/model/BakedModel;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;ZLnet/minecraft/util/RandomSource;JILnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)V=|p_111079_,p_111080_,p_111081_,p_111082_,p_111083_,p_111084_,p_111085_,p_111086_,p_111087_,p_111088_,modelData,renderType net/minecraft/client/renderer/block/ModelBlockRenderer.tesselateWithoutAO(Lnet/minecraft/world/level/BlockAndTintGetter;Lnet/minecraft/client/resources/model/BakedModel;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/mojang/blaze3d/vertex/VertexConsumer;ZLnet/minecraft/util/RandomSource;JILnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/renderer/RenderType;)V=|p_111091_,p_111092_,p_111093_,p_111094_,p_111095_,p_111096_,p_111097_,p_111098_,p_111099_,p_111100_,modelData,renderType net/minecraft/client/renderer/block/model/BakedQuad.([IILnet/minecraft/core/Direction;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;ZZ)V=|p_111298_,p_111299_,p_111300_,p_111301_,p_111302_,hasAmbientOcclusion @@ -57,7 +55,7 @@ net/minecraft/data/tags/TagsProvider.(Lnet/minecraft/data/PackOutput;Lnet/ net/minecraft/data/tags/WorldPresetTagsProvider.(Lnet/minecraft/data/PackOutput;Ljava/util/concurrent/CompletableFuture;Ljava/lang/String;Lnet/minecraftforge/common/data/ExistingFileHelper;)V=|p_255701_,p_255974_,modId,existingFileHelper net/minecraft/gametest/framework/GameTestRegistry.register(Ljava/lang/reflect/Method;Ljava/util/Set;)V=|p_177504_,allowedNamespaces net/minecraft/network/FriendlyByteBuf.writeItemStack(Lnet/minecraft/world/item/ItemStack;Z)Lnet/minecraft/network/FriendlyByteBuf;=|p_130056_,limitedTag -net/minecraft/server/ServerAdvancementManager.(Lnet/minecraft/world/level/storage/loot/PredicateManager;Lnet/minecraftforge/common/crafting/conditions/ICondition$IContext;)V=|p_136027_,context +net/minecraft/server/ServerAdvancementManager.(Lnet/minecraft/world/level/storage/loot/LootDataManager;Lnet/minecraftforge/common/crafting/conditions/ICondition$IContext;)V=|p_279237_,context net/minecraft/server/level/DistanceManager.addRegionTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;Z)V=|p_140841_,p_140842_,p_140843_,p_140844_,forceTicks net/minecraft/server/level/DistanceManager.removeRegionTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;Z)V=|p_140850_,p_140851_,p_140852_,p_140853_,forceTicks net/minecraft/server/level/ServerChunkCache.addRegionTicket(Lnet/minecraft/server/level/TicketType;Lnet/minecraft/world/level/ChunkPos;ILjava/lang/Object;Z)V=|p_8388_,p_8389_,p_8390_,p_8391_,forceTicks @@ -67,6 +65,7 @@ net/minecraft/server/level/ServerPlayerGameMode.removeBlock(Lnet/minecraft/core/ net/minecraft/server/level/Ticket.(Lnet/minecraft/server/level/TicketType;ILjava/lang/Object;Z)V=|p_9425_,p_9426_,p_9427_,forceTicks net/minecraft/server/packs/metadata/pack/PackMetadataSection.(Lnet/minecraft/network/chat/Component;ILjava/util/Map;)V=|p_10371_,p_10372_,packTypeVersions net/minecraft/world/entity/Entity.changeDimension(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/world/entity/Entity;=|p_20118_,teleporter +net/minecraft/world/entity/Entity.playCombinationStepSounds(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/BlockPos;)V=|p_277472_,p_277630_,primaryPos,secondaryPos net/minecraft/world/entity/EntityType.(Lnet/minecraft/world/entity/EntityType$EntityFactory;Lnet/minecraft/world/entity/MobCategory;ZZZZLcom/google/common/collect/ImmutableSet;Lnet/minecraft/world/entity/EntityDimensions;IILnet/minecraft/world/flag/FeatureFlagSet;Ljava/util/function/Predicate;Ljava/util/function/ToIntFunction;Ljava/util/function/ToIntFunction;Ljava/util/function/BiFunction;)V=|p_251402_,p_251431_,p_251439_,p_251973_,p_252007_,p_250908_,p_250201_,p_251742_,p_250479_,p_249249_,p_250427_,velocityUpdateSupplier,trackingRangeSupplier,updateIntervalSupplier,customClientFactory net/minecraft/world/entity/item/ItemEntity.changeDimension(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/world/entity/Entity;=|p_32042_,teleporter net/minecraft/world/entity/npc/AbstractVillager.changeDimension(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/world/entity/Entity;=|p_35295_,teleporter @@ -96,4 +95,4 @@ net/minecraft/world/level/block/LiquidBlock.(Ljava/util/function/Supplier; net/minecraft/world/level/block/PoweredRailBlock.(Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;Z)V=|p_55218_,isPoweredRail net/minecraft/world/level/entity/PersistentEntitySectionManager.addEntityWithoutEvent(Lnet/minecraft/world/level/entity/EntityAccess;Z)Z=|p_157539_,p_157540_ net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.processEntityInfos(Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate;Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings;Ljava/util/List;)Ljava/util/List;=|template,p_215387_0_,p_215387_1_,p_215387_2_,p_215387_3_ -net/minecraft/world/level/storage/loot/LootPool.([Lnet/minecraft/world/level/storage/loot/entries/LootPoolEntryContainer;[Lnet/minecraft/world/level/storage/loot/predicates/LootItemCondition;[Lnet/minecraft/world/level/storage/loot/functions/LootItemFunction;Lnet/minecraft/world/level/storage/loot/providers/number/NumberProvider;Lnet/minecraft/world/level/storage/loot/providers/number/NumberProvider;Ljava/lang/String;)V=|p_165128_,p_165129_,p_165130_,p_165131_,p_165132_,name \ No newline at end of file +net/minecraft/world/level/storage/loot/LootContext.(Lnet/minecraft/world/level/storage/loot/LootParams;Lnet/minecraft/util/RandomSource;Lnet/minecraft/world/level/storage/loot/LootDataResolver;Lnet/minecraft/resources/ResourceLocation;)V=|p_287722_,p_287702_,p_287619_,queriedLootTableId \ No newline at end of file diff --git a/src/snapshots/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsMod.java b/src/snapshots/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsMod.java new file mode 100644 index 0000000000..5fd161a520 --- /dev/null +++ b/src/snapshots/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsMod.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.forge.snapshots; + +import com.mojang.logging.LogUtils; +import net.minecraft.CrashReport; +import net.minecraft.client.Options; +import org.slf4j.Logger; + +public class ForgeSnapshotsMod +{ + public static final String BRANDING_NAME = "Froge"; + public static final String BRANDING_ID = "froge"; + private static final Logger LOGGER = LogUtils.getLogger(); + static boolean seenSnapshotWarning = false; + + public static void processOptions(Options.FieldAccess fieldAccess) + { + seenSnapshotWarning = fieldAccess.process("seenSnapshotWarning", seenSnapshotWarning); + } + + public static void logStartupWarning() + { + LOGGER.warn("Froge is not officially supported. Bugs and instability are expected."); + } + + public static void addCrashReportHeader(StringBuilder builder, CrashReport crashReport) + { + builder.append("---- Please note that Minecraft Forge DOES NOT support Froge builds. Bugs and instability are expected. ----\n"); + } +} diff --git a/src/snapshots/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsModClient.java b/src/snapshots/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsModClient.java new file mode 100644 index 0000000000..e0d958fae2 --- /dev/null +++ b/src/snapshots/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsModClient.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.forge.snapshots; + +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.ConfirmScreen; +import net.minecraft.client.gui.screens.TitleScreen; +import net.minecraft.network.chat.CommonComponents; +import net.minecraft.network.chat.Component; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.client.event.ScreenEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.VersionChecker; +import net.minecraftforge.fml.common.Mod; + +@Mod.EventBusSubscriber(value = Dist.CLIENT) +public class ForgeSnapshotsModClient +{ + public static void renderMainMenuWarning(VersionChecker.Status status, TitleScreen gui, GuiGraphics guiGraphics, Font font, int width, int height, int alpha) + { + // Render a warning at the top of the screen + Component line = Component.translatable("forge.froge.supportWarning").withStyle(ChatFormatting.RED); + guiGraphics.drawCenteredString(font, line, width / 2, 4 + (font.lineHeight + 1) / 2, 0xFFFFFF | alpha); + } + + @SubscribeEvent + static void onScreenOpen(final ScreenEvent.Opening event) + { + if (ForgeSnapshotsMod.seenSnapshotWarning || !(event.getNewScreen() instanceof TitleScreen titleScreen)) + return; + + event.setNewScreen(new ConfirmScreen(confirmed -> { + if (confirmed) + { + ForgeSnapshotsMod.seenSnapshotWarning = true; + Minecraft.getInstance().options.save(); + Minecraft.getInstance().setScreen(titleScreen); + } + else + { + System.exit(0); + } + }, Component.translatable("forge.froge.warningScreen.title"), Component.translatable("forge.froge.warningScreen.text"), + CommonComponents.GUI_ACKNOWLEDGE, Component.translatable("forge.gui.exit"))); + } + + // @SubscribeEvent(priority = EventPriority.LOWEST) + // static void onGuiOverlayDebugText(final CustomizeGuiOverlayEvent.DebugText event) + // { + // if (Minecraft.getInstance().options.renderDebug) + // { + // event.getLeft().add(0, "Minecraft Froge"); + // event.getRight().add(0, "NOT SUPPORTED"); + // } + // } +} diff --git a/src/snapshots_disabled/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsMod.java b/src/snapshots_disabled/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsMod.java new file mode 100644 index 0000000000..a7d47104a2 --- /dev/null +++ b/src/snapshots_disabled/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsMod.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.forge.snapshots; + +import net.minecraft.CrashReport; +import net.minecraft.client.Options; + +public class ForgeSnapshotsMod +{ + public static final String BRANDING_NAME = "Forge"; + public static final String BRANDING_ID = "forge"; + + public static void processOptions(Options.FieldAccess fieldAccess) {} + + public static void logStartupWarning() {} + + public static void addCrashReportHeader(StringBuilder builder, CrashReport crashReport) {} +} diff --git a/src/snapshots_disabled/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsModClient.java b/src/snapshots_disabled/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsModClient.java new file mode 100644 index 0000000000..6e17c373f8 --- /dev/null +++ b/src/snapshots_disabled/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsModClient.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) Forge Development LLC and contributors + * SPDX-License-Identifier: LGPL-2.1-only + */ + +package net.minecraftforge.forge.snapshots; + +import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.TitleScreen; +import net.minecraft.network.chat.Component; +import net.minecraftforge.fml.VersionChecker; + +public class ForgeSnapshotsModClient +{ + public static void renderMainMenuWarning(VersionChecker.Status status, TitleScreen gui, GuiGraphics graphics, Font font, int width, int height, int alpha) + { + if (status == VersionChecker.Status.BETA || status == VersionChecker.Status.BETA_OUTDATED) + { + // Render a warning at the top of the screen + Component line = Component.translatable("forge.update.beta.1", ChatFormatting.RED, ChatFormatting.RESET).withStyle(ChatFormatting.RED); + graphics.drawCenteredString(font, line, width / 2, 4 + (0 * (font.lineHeight + 1)), 0xFFFFFF | alpha); + line = Component.translatable("forge.update.beta.2"); + graphics.drawCenteredString(font, line, width / 2, 4 + (1 * (font.lineHeight + 1)), 0xFFFFFF | alpha); + } + } +} diff --git a/src/test/java/net/minecraftforge/debug/CreativeModeTabTest.java b/src/test/java/net/minecraftforge/debug/CreativeModeTabTest.java index 3eac08a73c..f0ccef97d4 100644 --- a/src/test/java/net/minecraftforge/debug/CreativeModeTabTest.java +++ b/src/test/java/net/minecraftforge/debug/CreativeModeTabTest.java @@ -5,9 +5,9 @@ package net.minecraftforge.debug; -import java.util.List; - +import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.CreativeModeTab.TabVisibility; @@ -17,10 +17,11 @@ import net.minecraft.world.item.DyeItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Blocks; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraftforge.registries.RegisterEvent; @Mod(CreativeModeTabTest.MOD_ID) public class CreativeModeTabTest @@ -28,8 +29,8 @@ public class CreativeModeTabTest public static final String MOD_ID = "creative_mode_tab_test"; private static final boolean ENABLED = true; - private static CreativeModeTab LOGS; - private static CreativeModeTab STONE; + private static final ResourceKey LOGS = ResourceKey.create(Registries.CREATIVE_MODE_TAB, new ResourceLocation(MOD_ID, "logs")); + private static final ResourceKey STONE = ResourceKey.create(Registries.CREATIVE_MODE_TAB, new ResourceLocation(MOD_ID, "stone")); public CreativeModeTabTest() { @@ -42,49 +43,55 @@ public class CreativeModeTabTest modEventBus.addListener(CreativeModeTabTest::onCreativeModeTabBuildContents); } - private static void onCreativeModeTabRegister(CreativeModeTabEvent.Register event) + private static void onCreativeModeTabRegister(RegisterEvent event) { - LOGS = event.registerCreativeModeTab(new ResourceLocation(MOD_ID, "logs"), builder -> builder.icon(() -> new ItemStack(Blocks.ACACIA_LOG)) - .title(Component.literal("Logs")) - .withLabelColor(0x00FF00) - .displayItems((params, output) -> { - output.accept(new ItemStack(Blocks.ACACIA_LOG)); - output.accept(new ItemStack(Blocks.BIRCH_LOG)); - output.accept(new ItemStack(Blocks.DARK_OAK_LOG)); - output.accept(new ItemStack(Blocks.JUNGLE_LOG)); - output.accept(new ItemStack(Blocks.OAK_LOG)); - output.accept(new ItemStack(Blocks.SPRUCE_LOG)); - })); + event.register(Registries.CREATIVE_MODE_TAB, helper -> { + helper.register(LOGS, CreativeModeTab.builder().icon(() -> new ItemStack(Blocks.ACACIA_LOG)) + .title(Component.literal("Logs")) + .withLabelColor(0x00FF00) + .displayItems((params, output) -> { + output.accept(new ItemStack(Blocks.ACACIA_LOG)); + output.accept(new ItemStack(Blocks.BIRCH_LOG)); + output.accept(new ItemStack(Blocks.DARK_OAK_LOG)); + output.accept(new ItemStack(Blocks.JUNGLE_LOG)); + output.accept(new ItemStack(Blocks.OAK_LOG)); + output.accept(new ItemStack(Blocks.SPRUCE_LOG)); + }) + .build()); + helper.register(STONE, CreativeModeTab.builder().icon(() -> new ItemStack(Blocks.STONE)) + .title(Component.literal("Stone")) + .withLabelColor(0x0000FF) + .displayItems((params, output) -> { + output.accept(new ItemStack(Blocks.STONE)); + output.accept(new ItemStack(Blocks.GRANITE)); + output.accept(new ItemStack(Blocks.DIORITE)); + output.accept(new ItemStack(Blocks.ANDESITE)); + }) + .withTabsAfter(CreativeModeTabs.BUILDING_BLOCKS) + .build()); - STONE = event.registerCreativeModeTab(new ResourceLocation(MOD_ID, "stone"), List.of(CreativeModeTabs.BUILDING_BLOCKS), List.of(), builder -> builder.icon(() -> new ItemStack(Blocks.STONE)) - .title(Component.literal("Stone")) - .withLabelColor(0x0000FF) - .displayItems((params, output) -> { - output.accept(new ItemStack(Blocks.STONE)); - output.accept(new ItemStack(Blocks.GRANITE)); - output.accept(new ItemStack(Blocks.DIORITE)); - output.accept(new ItemStack(Blocks.ANDESITE)); - })); - - event.registerCreativeModeTab(new ResourceLocation(MOD_ID, "colors"), builder -> builder.title(Component.literal("Colors")) - .displayItems((params, output) -> - { - for (DyeColor color : DyeColor.values()) + helper.register(new ResourceLocation(MOD_ID, "colors"), CreativeModeTab.builder().title(Component.literal("Colors")) + .displayItems((params, output) -> { - output.accept(DyeItem.byColor(color)); - } - }) - .withTabFactory(CreativeModeColorTab::new) - ); + for (DyeColor color : DyeColor.values()) + { + output.accept(DyeItem.byColor(color)); + } + }) + .withTabFactory(CreativeModeColorTab::new) + .withTabsBefore(CreativeModeTabs.COLORED_BLOCKS) + .build() + ); + }); } private static ItemStack i(ItemLike item) { return new ItemStack(item); } - private static void onCreativeModeTabBuildContents(CreativeModeTabEvent.BuildContents event) + private static void onCreativeModeTabBuildContents(BuildCreativeModeTabContentsEvent event) { var entries = event.getEntries(); var vis = TabVisibility.PARENT_AND_SEARCH_TABS; - if (event.getTab() == LOGS) + if (event.getTabKey() == LOGS) { entries.putAfter(i(Blocks.ACACIA_LOG), i(Blocks.STRIPPED_ACACIA_LOG), vis); entries.putAfter(i(Blocks.BIRCH_LOG), i(Blocks.STRIPPED_BIRCH_LOG), vis); @@ -94,7 +101,7 @@ public class CreativeModeTabTest entries.putAfter(i(Blocks.SPRUCE_LOG), i(Blocks.STRIPPED_SPRUCE_LOG), vis); } - if (event.getTab() == STONE) + if (event.getTabKey() == STONE) { entries.putBefore(i(Blocks.STONE), i(Blocks.SMOOTH_STONE), vis); entries.putBefore(i(Blocks.GRANITE), i(Blocks.POLISHED_GRANITE), vis); diff --git a/src/test/java/net/minecraftforge/debug/CustomSoundTypeTest.java b/src/test/java/net/minecraftforge/debug/CustomSoundTypeTest.java index c7bc4ed5e5..b3187ea964 100644 --- a/src/test/java/net/minecraftforge/debug/CustomSoundTypeTest.java +++ b/src/test/java/net/minecraftforge/debug/CustomSoundTypeTest.java @@ -9,13 +9,13 @@ import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SoundType; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; import net.minecraftforge.common.util.ForgeSoundType; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.fml.common.Mod; @@ -37,7 +37,7 @@ public class CustomSoundTypeTest private static final SoundType TEST_SOUND_TYPE = new ForgeSoundType(1.0F, 1.0F, TEST_STEP_EVENT, TEST_STEP_EVENT, TEST_STEP_EVENT, TEST_STEP_EVENT, TEST_STEP_EVENT); private static final RegistryObject TEST_STEP_BLOCK = BLOCKS.register("test_block", - () -> new Block(BlockBehaviour.Properties.of(Material.WOOD).sound(TEST_SOUND_TYPE))); + () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).sound(TEST_SOUND_TYPE))); private static final RegistryObject TEST_STEP_BLOCK_ITEM = ITEMS.register("test_block", () -> new BlockItem(TEST_STEP_BLOCK.get(), new Item.Properties())); @@ -51,9 +51,9 @@ public class CustomSoundTypeTest modEventBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(TEST_STEP_BLOCK_ITEM); } } diff --git a/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java b/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java index ac4d9fc91f..c2c766070e 100644 --- a/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java +++ b/src/test/java/net/minecraftforge/debug/DataGeneratorTest.java @@ -460,8 +460,13 @@ public class DataGeneratorTest } final JsonObject actual; try { + List resourceStack = this.helper.getResourceStack(new ResourceLocation("sounds.json"), PackType.CLIENT_RESOURCES); + // Get the first resource in the stack + // This guarantees vanilla even when a forge sounds.json is present because getResourceStack reverses the list + // so that the lower priority resources are first (to allow overwriting data in later entries) + Resource vanillaSoundResource = resourceStack.get(0); actual = GSON.fromJson( - this.helper.getResource(new ResourceLocation("sounds.json"), PackType.CLIENT_RESOURCES).openAsReader(), + vanillaSoundResource.openAsReader(), JsonObject.class ); } catch (IOException e) { diff --git a/src/test/java/net/minecraftforge/debug/DeferredRegistryTest.java b/src/test/java/net/minecraftforge/debug/DeferredRegistryTest.java index 9dac398264..158313bccd 100644 --- a/src/test/java/net/minecraftforge/debug/DeferredRegistryTest.java +++ b/src/test/java/net/minecraftforge/debug/DeferredRegistryTest.java @@ -6,7 +6,6 @@ package net.minecraftforge.debug; import java.util.Set; -import java.util.function.Consumer; import java.util.function.Supplier; import net.minecraft.resources.ResourceLocation; @@ -14,25 +13,19 @@ import net.minecraft.tags.TagKey; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.crafting.RecipeType; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.event.server.ServerStartedEvent; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.minecraft.world.level.levelgen.structure.templatesystem.PosRuleTestType; -import net.minecraft.world.level.material.Material; -import net.minecraft.core.Holder; -import net.minecraft.core.Registry; -import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.level.material.MapColor; import net.minecraft.core.registries.Registries; import net.minecraft.data.DataGenerator; -import net.minecraft.data.worldgen.features.OreFeatures; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraftforge.client.model.generators.BlockStateProvider; -import net.minecraftforge.client.model.generators.ModelFile; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.fml.common.Mod; @@ -57,7 +50,7 @@ public class DeferredRegistryTest { // Vanilla Registry - filled directly after all RegistryEvent.Register events are fired private static final DeferredRegister> POS_RULE_TEST_TYPES = DeferredRegister.create(Registries.POS_RULE_TEST, MODID); - private static final RegistryObject BLOCK = BLOCKS.register("test", () -> new Block(Block.Properties.of(Material.STONE))); + private static final RegistryObject BLOCK = BLOCKS.register("test", () -> new Block(Block.Properties.of().mapColor(MapColor.STONE))); private static final RegistryObject ITEM = ITEMS .register("test", () -> new BlockItem(BLOCK.get(), new Item.Properties())); private static final RegistryObject CUSTOM = CUSTOMS.register("test", () -> new Custom(){}); // Should never be created as the registry doesn't exist - this should silently fail and remain empty @@ -84,9 +77,9 @@ public class DeferredRegistryTest { modBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(ITEM); } diff --git a/src/test/java/net/minecraftforge/debug/ManyMobEffectsTest.java b/src/test/java/net/minecraftforge/debug/ManyMobEffectsTest.java index faf73f8742..f3a4fe9aa5 100644 --- a/src/test/java/net/minecraftforge/debug/ManyMobEffectsTest.java +++ b/src/test/java/net/minecraftforge/debug/ManyMobEffectsTest.java @@ -5,7 +5,7 @@ package net.minecraftforge.debug; -import net.minecraft.core.NonNullList; +import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.effect.MobEffect; @@ -19,21 +19,19 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.SuspiciousStewItem; import net.minecraft.world.item.alchemy.PotionUtils; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.CreativeModeTabEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.util.ObfuscationReflectionHelper; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegisterEvent; import net.minecraftforge.registries.RegistryObject; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.List; -import java.util.function.Consumer; /** * Registers 255 mob effects that log every tick on the client. @@ -69,7 +67,7 @@ public class ManyMobEffectsTest @Override public void applyEffectTick(LivingEntity entity, int amplifier) { - if (entity.level.isClientSide) + if (entity.level().isClientSide) { LOGGER.info("Effect Tick for {} on the client", index); } @@ -91,22 +89,24 @@ public class ManyMobEffectsTest IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); MOB_EFFECTS.register(modBus); MinecraftForge.EVENT_BUS.addListener(ManyMobEffectsTest::mobInteract); - modBus.addListener((CreativeModeTabEvent.Register event) -> event.registerCreativeModeTab(new ResourceLocation(MODID, "many_mob_effects_test"), builder -> builder.withSearchBar() - .icon(() -> new ItemStack(Items.POTION)) - .displayItems((params, output) -> { - var stack = new ItemStack(Items.POTION); - PotionUtils.setCustomEffects(stack, List.of(new MobEffectInstance(LAST_EFFECT.get(), 1000))); - output.accept(stack); + modBus.addListener((final RegisterEvent event) -> event.register(Registries.CREATIVE_MODE_TAB, helper -> + helper.register(new ResourceLocation(MODID, "many_mob_effects_test"), CreativeModeTab.builder().withSearchBar() + .icon(() -> new ItemStack(Items.POTION)) + .displayItems((params, output) -> { + var stack = new ItemStack(Items.POTION); + PotionUtils.setCustomEffects(stack, List.of(new MobEffectInstance(LAST_EFFECT.get(), 1000))); + output.accept(stack); - stack = new ItemStack(Items.SUSPICIOUS_STEW); - SuspiciousStewItem.saveMobEffect(stack, LAST_EFFECT.get(), 1000); - output.accept(stack); - }))); + stack = new ItemStack(Items.SUSPICIOUS_STEW); + SuspiciousStewItem.saveMobEffect(stack, LAST_EFFECT.get(), 1000); + output.accept(stack); + }) + .build()))); } private static void mobInteract(PlayerInteractEvent.EntityInteract event) { - if (!event.getTarget().getLevel().isClientSide() && event.getTarget() instanceof MushroomCow cow) + if (!event.getTarget().level().isClientSide() && event.getTarget() instanceof MushroomCow cow) { var heldItem = event.getEntity().getItemInHand(event.getHand()); if (heldItem.is(Items.POTION)) diff --git a/src/test/java/net/minecraftforge/debug/PermissionTest.java b/src/test/java/net/minecraftforge/debug/PermissionTest.java index d4f5dfd803..1f31cc6fa7 100644 --- a/src/test/java/net/minecraftforge/debug/PermissionTest.java +++ b/src/test/java/net/minecraftforge/debug/PermissionTest.java @@ -56,10 +56,10 @@ public class PermissionTest event.getDispatcher().register(Commands.literal("permtest") .requires(src -> canUseCommand(src, boolPerm)) .executes(context -> { - context.getSource().sendSuccess(Component.literal("Blob"), false); - context.getSource().sendSuccess(Component.literal("String:" + PermissionAPI.getPermission((ServerPlayer) context.getSource().getEntity(), stringPerm)), false); - context.getSource().sendSuccess(Component.literal("Int: " + PermissionAPI.getPermission((ServerPlayer) context.getSource().getEntity(), intPerm)), false); - context.getSource().sendSuccess(PermissionAPI.getPermission((ServerPlayer) context.getSource().getEntity(), componentPerm), false); + context.getSource().sendSuccess(() -> Component.literal("Blob"), false); + context.getSource().sendSuccess(() -> Component.literal("String:" + PermissionAPI.getPermission((ServerPlayer) context.getSource().getEntity(), stringPerm)), false); + context.getSource().sendSuccess(() -> Component.literal("Int: " + PermissionAPI.getPermission((ServerPlayer) context.getSource().getEntity(), intPerm)), false); + context.getSource().sendSuccess(() -> PermissionAPI.getPermission((ServerPlayer) context.getSource().getEntity(), componentPerm), false); return 1; })); @@ -69,7 +69,7 @@ public class PermissionTest event.getDispatcher().register(Commands.literal("permtesterr") .requires(src -> canUseCommand(src, unregisteredPerm)) .executes(context -> { - context.getSource().sendSuccess(Component.literal("Blob"), false); + context.getSource().sendSuccess(() -> Component.literal("Blob"), false); return 1; })); } diff --git a/src/test/java/net/minecraftforge/debug/block/BlockEntityOnLoadTest.java b/src/test/java/net/minecraftforge/debug/block/BlockEntityOnLoadTest.java index 349fa239f8..88d0f676df 100644 --- a/src/test/java/net/minecraftforge/debug/block/BlockEntityOnLoadTest.java +++ b/src/test/java/net/minecraftforge/debug/block/BlockEntityOnLoadTest.java @@ -16,10 +16,9 @@ import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.entity.*; import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.level.material.MaterialColor; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.phys.BlockHitResult; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -41,7 +40,7 @@ public class BlockEntityOnLoadTest private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, "be_onload_test"); private static final DeferredRegister> BE_TYPES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, "be_onload_test"); - private static final RegistryObject TEST_BLOCK = BLOCKS.register("be_onload_testblock", () -> new TestBlock(Properties.of(Material.DECORATION, MaterialColor.SAND))); + private static final RegistryObject TEST_BLOCK = BLOCKS.register("be_onload_testblock", () -> new TestBlock(Properties.of().mapColor(MapColor.SAND))); private static final RegistryObject TEST_BLOCK_ITEM = ITEMS.register("be_onload_testblock", () -> new BlockItem(TEST_BLOCK.get(), new Item.Properties())); private static final RegistryObject> TEST_BE_TYPE = BE_TYPES.register("be_onload_testbe", () -> BlockEntityType.Builder.of(TestBlockEntity::new, TEST_BLOCK.get()).build(null)); @@ -57,9 +56,9 @@ public class BlockEntityOnLoadTest } } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) + if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) event.accept(TEST_BLOCK_ITEM); } diff --git a/src/test/java/net/minecraftforge/debug/block/CustomHeadTest.java b/src/test/java/net/minecraftforge/debug/block/CustomHeadTest.java index b6a4e86c88..0a75f0976f 100644 --- a/src/test/java/net/minecraftforge/debug/block/CustomHeadTest.java +++ b/src/test/java/net/minecraftforge/debug/block/CustomHeadTest.java @@ -20,11 +20,10 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.SkullBlockEntity; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.common.util.Lazy; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -48,8 +47,8 @@ public class CustomHeadTest private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); private static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MODID); - private static final RegistryObject BLAZE_HEAD = BLOCKS.register("blaze_head", () -> new CustomSkullBlock(SkullType.BLAZE, BlockBehaviour.Properties.of(Material.DECORATION).strength(1.0F))); - private static final RegistryObject BLAZE_HEAD_WALL = BLOCKS.register("blaze_wall_head", () -> new CustomWallSkullBlock(SkullType.BLAZE, BlockBehaviour.Properties.of(Material.DECORATION).strength(1.0F).lootFrom(BLAZE_HEAD))); + private static final RegistryObject BLAZE_HEAD = BLOCKS.register("blaze_head", () -> new CustomSkullBlock(SkullType.BLAZE, BlockBehaviour.Properties.of().strength(1.0F))); + private static final RegistryObject BLAZE_HEAD_WALL = BLOCKS.register("blaze_wall_head", () -> new CustomWallSkullBlock(SkullType.BLAZE, BlockBehaviour.Properties.of().strength(1.0F).lootFrom(BLAZE_HEAD))); private static final RegistryObject BLAZE_HEAD_ITEM = ITEMS.register("blaze_head", () -> new StandingAndWallBlockItem(BLAZE_HEAD.get(), BLAZE_HEAD_WALL.get(), new Item.Properties().rarity(Rarity.UNCOMMON), Direction.DOWN)); private static final RegistryObject> CUSTOM_SKULL = BLOCK_ENTITIES.register("custom_skull", () -> BlockEntityType.Builder.of(CustomSkullBlockEntity::new, BLAZE_HEAD.get(), BLAZE_HEAD_WALL.get()).build(null)); @@ -62,9 +61,9 @@ public class CustomHeadTest modBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) + if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) event.accept(BLAZE_HEAD_ITEM); } diff --git a/src/test/java/net/minecraftforge/debug/block/CustomPlantTypeTest.java b/src/test/java/net/minecraftforge/debug/block/CustomPlantTypeTest.java index de6dde975b..7bee0b73d3 100644 --- a/src/test/java/net/minecraftforge/debug/block/CustomPlantTypeTest.java +++ b/src/test/java/net/minecraftforge/debug/block/CustomPlantTypeTest.java @@ -9,7 +9,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.FlowerBlock; import net.minecraft.world.level.block.SoundType; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.effect.MobEffects; @@ -63,7 +63,7 @@ public class CustomPlantTypeTest { public CustomBlock() { - super(Properties.of(Material.STONE)); + super(Properties.of().mapColor(MapColor.STONE)); } @Override @@ -84,7 +84,7 @@ public class CustomPlantTypeTest public CustomPlantBlock() { - super(MobEffects.WEAKNESS, 9, Properties.of(Material.PLANT).noCollission().sound(SoundType.GRASS)); + super(MobEffects.WEAKNESS, 9, Properties.of().mapColor(MapColor.PLANT).noCollission().sound(SoundType.GRASS)); } @Override diff --git a/src/test/java/net/minecraftforge/debug/block/CustomRespawnTest.java b/src/test/java/net/minecraftforge/debug/block/CustomRespawnTest.java index 088086f4bf..6514d02320 100644 --- a/src/test/java/net/minecraftforge/debug/block/CustomRespawnTest.java +++ b/src/test/java/net/minecraftforge/debug/block/CustomRespawnTest.java @@ -19,7 +19,7 @@ import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.RespawnAnchorBlock; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; import net.minecraftforge.eventbus.api.IEventBus; @@ -39,7 +39,7 @@ public class CustomRespawnTest public static final String MODID = "custom_respawn_test"; private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); - public static final RegistryObject TEST_RESPAWN_BLOCK = BLOCKS.register("test_respawn_block", () -> new CustomRespawnBlock(Block.Properties.of(Material.WOOD))); + public static final RegistryObject TEST_RESPAWN_BLOCK = BLOCKS.register("test_respawn_block", () -> new CustomRespawnBlock(Block.Properties.of().mapColor(MapColor.WOOD))); private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); public static final RegistryObject TEST_RESPAWN_BLOCK_ITEM = ITEMS.register("test_respawn_block", () -> new BlockItem(TEST_RESPAWN_BLOCK.get(), (new Item.Properties()))); diff --git a/src/test/java/net/minecraftforge/debug/block/CustomSignsTest.java b/src/test/java/net/minecraftforge/debug/block/CustomSignsTest.java index 19d439eb9d..38525ad5eb 100644 --- a/src/test/java/net/minecraftforge/debug/block/CustomSignsTest.java +++ b/src/test/java/net/minecraftforge/debug/block/CustomSignsTest.java @@ -14,7 +14,6 @@ import net.minecraft.world.level.block.CeilingHangingSignBlock; import net.minecraft.world.level.block.WallHangingSignBlock; import net.minecraft.world.level.block.entity.HangingSignBlockEntity; import net.minecraft.world.level.block.state.properties.BlockSetType; -import net.minecraft.world.level.material.Material; import net.minecraft.client.renderer.Sheets; import net.minecraft.client.renderer.blockentity.SignRenderer; import net.minecraft.world.item.Item; @@ -23,7 +22,7 @@ import net.minecraft.world.level.block.entity.SignBlockEntity; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.fml.common.Mod; @@ -50,10 +49,10 @@ public class CustomSignsTest public static final WoodType TEST_WOOD_TYPE = WoodType.register(new WoodType(new ResourceLocation(MODID, "test").toString(), BlockSetType.ACACIA)); private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); - public static final RegistryObject TEST_STANDING_SIGN = BLOCKS.register("test_sign", () -> new CustomStandingSignBlock(Properties.of(Material.WOOD).noCollission().strength(1.0F).sound(SoundType.WOOD), CustomSignsTest.TEST_WOOD_TYPE)); - public static final RegistryObject TEST_WALL_SIGN = BLOCKS.register("test_wall_sign", () -> new CustomWallSignBlock(Properties.of(Material.WOOD).noCollission().strength(1.0F).sound(SoundType.WOOD), CustomSignsTest.TEST_WOOD_TYPE)); - public static final RegistryObject TEST_CEILING_HANGING_SIGN = BLOCKS.register("test_hanging_sign", () -> new CustomCeilingHangingSignBlock(Properties.of(Material.WOOD).noCollission().strength(1.0F).sound(SoundType.WOOD), CustomSignsTest.TEST_WOOD_TYPE)); - public static final RegistryObject TEST_WALL_HANGING_SIGN = BLOCKS.register("test_wall_hanging_sign", () -> new CustomWallHangingSignBlock(Properties.of(Material.WOOD).noCollission().strength(1.0F).sound(SoundType.WOOD), CustomSignsTest.TEST_WOOD_TYPE)); + public static final RegistryObject TEST_STANDING_SIGN = BLOCKS.register("test_sign", () -> new CustomStandingSignBlock(Properties.of().noCollission().strength(1.0F).sound(SoundType.WOOD), CustomSignsTest.TEST_WOOD_TYPE)); + public static final RegistryObject TEST_WALL_SIGN = BLOCKS.register("test_wall_sign", () -> new CustomWallSignBlock(Properties.of().noCollission().strength(1.0F).sound(SoundType.WOOD), CustomSignsTest.TEST_WOOD_TYPE)); + public static final RegistryObject TEST_CEILING_HANGING_SIGN = BLOCKS.register("test_hanging_sign", () -> new CustomCeilingHangingSignBlock(Properties.of().noCollission().strength(1.0F).sound(SoundType.WOOD), CustomSignsTest.TEST_WOOD_TYPE)); + public static final RegistryObject TEST_WALL_HANGING_SIGN = BLOCKS.register("test_wall_hanging_sign", () -> new CustomWallHangingSignBlock(Properties.of().noCollission().strength(1.0F).sound(SoundType.WOOD), CustomSignsTest.TEST_WOOD_TYPE)); private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); public static final RegistryObject TEST_SIGN = ITEMS.register("test_sign", () -> new SignItem((new Item.Properties()).stacksTo(16), TEST_STANDING_SIGN.get(), TEST_WALL_SIGN.get())); @@ -78,9 +77,9 @@ public class CustomSignsTest } } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) + if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) { event.accept(TEST_SIGN); event.accept(TEST_HANGING_SIGN); diff --git a/src/test/java/net/minecraftforge/debug/block/FullPotsAccessorDemo.java b/src/test/java/net/minecraftforge/debug/block/FullPotsAccessorDemo.java index f364001948..6ef9c5aaa5 100644 --- a/src/test/java/net/minecraftforge/debug/block/FullPotsAccessorDemo.java +++ b/src/test/java/net/minecraftforge/debug/block/FullPotsAccessorDemo.java @@ -31,7 +31,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -44,7 +44,7 @@ import net.minecraftforge.client.model.geometry.IGeometryBakingContext; import net.minecraftforge.client.model.geometry.IGeometryLoader; import net.minecraftforge.client.model.geometry.IUnbakedGeometry; import net.minecraftforge.common.util.ConcatenatedListView; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -91,9 +91,9 @@ public class FullPotsAccessorDemo } } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(DIORITE_POT_ITEM); } @@ -103,7 +103,7 @@ public class FullPotsAccessorDemo public DioriteFlowerPotBlock() { - super(Properties.of(Material.DECORATION).instabreak().noOcclusion()); + super(Properties.of().mapColor(MapColor.NONE).instabreak().noOcclusion()); } @Override diff --git a/src/test/java/net/minecraftforge/debug/block/OnTreeGrowBlockTest.java b/src/test/java/net/minecraftforge/debug/block/OnTreeGrowBlockTest.java index b87d4b48a7..ed3d5348af 100644 --- a/src/test/java/net/minecraftforge/debug/block/OnTreeGrowBlockTest.java +++ b/src/test/java/net/minecraftforge/debug/block/OnTreeGrowBlockTest.java @@ -17,8 +17,7 @@ import net.minecraft.world.level.block.SaplingBlock; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.level.material.MaterialColor; +import net.minecraft.world.level.material.MapColor; import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.extensions.IForgeBlockState; import net.minecraftforge.eventbus.api.IEventBus; @@ -45,7 +44,7 @@ public class OnTreeGrowBlockTest public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.Keys.BLOCKS, ID); public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.Keys.ITEMS, ID); - public static final RegistryObject TEST_GRASS_BLOCK = BLOCKS.register("test_grass_block", () -> new Block(BlockBehaviour.Properties.of(Material.GRASS, MaterialColor.COLOR_LIGHT_BLUE).destroyTime(1.5f)) + public static final RegistryObject TEST_GRASS_BLOCK = BLOCKS.register("test_grass_block", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_BLUE).destroyTime(1.5f)) { @Override public boolean canSustainPlant(BlockState state, BlockGetter world, BlockPos pos, Direction facing, IPlantable plantable) @@ -68,7 +67,7 @@ public class OnTreeGrowBlockTest } } }); - public static final RegistryObject TEST_DIRT = BLOCKS.register("test_dirt", () -> new Block(BlockBehaviour.Properties.of(Material.GRASS, MaterialColor.COLOR_LIGHT_BLUE).destroyTime(1.5f)) + public static final RegistryObject TEST_DIRT = BLOCKS.register("test_dirt", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_BLUE).destroyTime(1.5f)) { @Override public boolean canSustainPlant(BlockState state, BlockGetter world, BlockPos pos, Direction facing, IPlantable plantable) diff --git a/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java b/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java index 433c1c29fd..cbf3539d61 100644 --- a/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java +++ b/src/test/java/net/minecraftforge/debug/block/PistonEventTest.java @@ -21,11 +21,11 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.piston.PistonBaseBlock; import net.minecraft.world.level.block.piston.PistonStructureResolver; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraftforge.client.model.generators.BlockStateProvider; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.data.event.GatherDataEvent; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.event.level.PistonEvent; import net.minecraftforge.event.level.PistonEvent.PistonMoveType; import net.minecraftforge.eventbus.api.IEventBus; @@ -57,7 +57,7 @@ public class PistonEventTest private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); - private static final RegistryObject SHIFT_ON_MOVE = BLOCKS.register(blockName, () -> new Block(Block.Properties.of(Material.STONE))); + private static final RegistryObject SHIFT_ON_MOVE = BLOCKS.register(blockName, () -> new Block(Block.Properties.of().mapColor(MapColor.STONE))); private static final RegistryObject SHIFT_ON_MOVE_ITEM = ITEMS.register(blockName, () -> new BlockItem(SHIFT_ON_MOVE.get(), new Item.Properties())); public PistonEventTest() @@ -69,9 +69,9 @@ public class PistonEventTest modBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) + if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) event.accept(SHIFT_ON_MOVE_ITEM); } diff --git a/src/test/java/net/minecraftforge/debug/block/RedstoneSidedConnectivityTest.java b/src/test/java/net/minecraftforge/debug/block/RedstoneSidedConnectivityTest.java index e7e2ce7c65..6cf96dd607 100644 --- a/src/test/java/net/minecraftforge/debug/block/RedstoneSidedConnectivityTest.java +++ b/src/test/java/net/minecraftforge/debug/block/RedstoneSidedConnectivityTest.java @@ -15,14 +15,13 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.FurnaceBlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; import org.jetbrains.annotations.Nullable; @Mod(RedstoneSidedConnectivityTest.MODID) @@ -49,9 +48,9 @@ public class RedstoneSidedConnectivityTest modBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) + if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) event.accept(TEST_REDSTONE_BLOCKITEM); } @@ -62,7 +61,7 @@ public class RedstoneSidedConnectivityTest public EastRedstoneBlock() { - super(Properties.of(Material.METAL)); + super(Properties.of()); } @Override diff --git a/src/test/java/net/minecraftforge/debug/block/ScaffoldingTest.java b/src/test/java/net/minecraftforge/debug/block/ScaffoldingTest.java index 5923f8ba56..8fd224e428 100644 --- a/src/test/java/net/minecraftforge/debug/block/ScaffoldingTest.java +++ b/src/test/java/net/minecraftforge/debug/block/ScaffoldingTest.java @@ -10,8 +10,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.ScaffoldingBlock; import net.minecraft.world.level.block.SoundType; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.level.material.MaterialColor; +import net.minecraft.world.level.material.MapColor; import net.minecraft.data.DataGenerator; import net.minecraft.data.PackOutput; import net.minecraft.world.entity.LivingEntity; @@ -44,7 +43,7 @@ public class ScaffoldingTest static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); static final TagKey SCAFFOLDING = BlockTags.create(new ResourceLocation("forge", "scaffolding")); - static final RegistryObject SCAFFOLDING_METHOD_TEST = BLOCKS.register("scaffolding_method_test", () -> new ScaffoldingMethodTestBlock(Properties.of(Material.DECORATION, MaterialColor.SAND).noCollission().sound(SoundType.SCAFFOLDING).dynamicShape())); + static final RegistryObject SCAFFOLDING_METHOD_TEST = BLOCKS.register("scaffolding_method_test", () -> new ScaffoldingMethodTestBlock(Properties.of().mapColor(MapColor.SAND).noCollission().sound(SoundType.SCAFFOLDING).dynamicShape())); public ScaffoldingTest() { diff --git a/src/test/java/net/minecraftforge/debug/block/SlipperinessTest.java b/src/test/java/net/minecraftforge/debug/block/SlipperinessTest.java index b8f998e969..d06e83f9d7 100644 --- a/src/test/java/net/minecraftforge/debug/block/SlipperinessTest.java +++ b/src/test/java/net/minecraftforge/debug/block/SlipperinessTest.java @@ -5,20 +5,19 @@ package net.minecraftforge.debug.block; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; +import net.minecraft.core.BlockPos; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; -import net.minecraft.core.BlockPos; import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ObjectHolder; -import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.registries.RegisterEvent; @Mod(SlipperinessTest.MOD_ID) @@ -34,7 +33,7 @@ public class SlipperinessTest @SubscribeEvent public static void registerBlocks(RegisterEvent e) { - e.register(ForgeRegistries.Keys.BLOCKS, helper -> helper.register(BLOCK_ID, new Block(Block.Properties.of(Material.ICE_SOLID)) + e.register(ForgeRegistries.Keys.BLOCKS, helper -> helper.register(BLOCK_ID, new Block(Block.Properties.of()) { @Override public float getFriction(BlockState state, LevelReader level, BlockPos pos, Entity entity) diff --git a/src/test/java/net/minecraftforge/debug/block/StickyBlockTest.java b/src/test/java/net/minecraftforge/debug/block/StickyBlockTest.java index 10f11359d1..4d543abd80 100644 --- a/src/test/java/net/minecraftforge/debug/block/StickyBlockTest.java +++ b/src/test/java/net/minecraftforge/debug/block/StickyBlockTest.java @@ -8,7 +8,7 @@ package net.minecraftforge.debug.block; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraftforge.common.MinecraftForge; @@ -35,7 +35,7 @@ public class StickyBlockTest public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS.getRegistryName(), MODID); - public static final RegistryObject BLUE_BLOCK = BLOCKS.register(BLOCK_ID, () -> new Block(Block.Properties.of(Material.STONE)) + public static final RegistryObject BLUE_BLOCK = BLOCKS.register(BLOCK_ID, () -> new Block(Block.Properties.of().mapColor(MapColor.STONE)) { @Override public boolean isStickyBlock(BlockState state) @@ -44,7 +44,7 @@ public class StickyBlockTest } }); - public static final RegistryObject RED_BLOCK = BLOCKS.register(BLOCK_ID_2, () -> new Block(Block.Properties.of(Material.STONE)) + public static final RegistryObject RED_BLOCK = BLOCKS.register(BLOCK_ID_2, () -> new Block(Block.Properties.of().mapColor(MapColor.STONE)) { @Override public boolean isStickyBlock(BlockState state) diff --git a/src/test/java/net/minecraftforge/debug/block/ValidRailShapeTest.java b/src/test/java/net/minecraftforge/debug/block/ValidRailShapeTest.java index 3e01188ac1..7c93f21305 100644 --- a/src/test/java/net/minecraftforge/debug/block/ValidRailShapeTest.java +++ b/src/test/java/net/minecraftforge/debug/block/ValidRailShapeTest.java @@ -11,15 +11,22 @@ import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.LevelReader; -import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.BaseRailBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.*; -import net.minecraft.world.level.material.*; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.block.state.properties.RailShape; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.*; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; @Mod(ValidRailShapeTest.MOD_ID) public class ValidRailShapeTest @@ -49,7 +56,7 @@ public class ValidRailShapeTest protected RailSlopeBlock() { - super(true, Properties.of(Material.DECORATION).noCollission().strength(0.7F).sound(SoundType.METAL)); + super(true, Properties.of().noCollission().strength(0.7F).sound(SoundType.METAL)); } @Override diff --git a/src/test/java/net/minecraftforge/debug/chat/ClientCommandTest.java b/src/test/java/net/minecraftforge/debug/chat/ClientCommandTest.java index 0266952819..5d095e0215 100644 --- a/src/test/java/net/minecraftforge/debug/chat/ClientCommandTest.java +++ b/src/test/java/net/minecraftforge/debug/chat/ClientCommandTest.java @@ -50,60 +50,64 @@ public class ClientCommandTest .then(Commands.literal("server") .executes((context) -> { context.getSource().getServer(); - context.getSource().sendSuccess(Component.literal("Successfully called getServer should have errored"), false); + context.getSource().sendSuccess(() ->Component.literal("Successfully called getServer should have errored"), false); return 1; })) // Used for checking if attempting to get the server level on the client side errors .then(Commands.literal("level") .executes((context) -> { context.getSource().getLevel(); - context.getSource().sendSuccess(Component.literal("Successfully called getLevel should have errored"), false); + context.getSource().sendSuccess(() ->Component.literal("Successfully called getLevel should have errored"), false); return 1; })) // Used for checking if getting a known objective argument works on the client side .then(Commands.literal("get_objective") .then(Commands.argument("objective", ObjectiveArgument.objective()) .executes((context) -> { - context.getSource().sendSuccess(Component.literal("Regular: ") - .append(ObjectiveArgument.getObjective(context, "objective").getFormattedDisplayName()), false); + final Component msg = Component.literal("Regular: ") + .append(ObjectiveArgument.getObjective(context, "objective").getFormattedDisplayName()); + context.getSource().sendSuccess(() -> msg, false); return 1; }))) // Used for checking if getting a known advancement works on the client side .then(Commands.literal("get_advancement") .then(Commands.argument("advancement", ResourceLocationArgument.id()) .executes((context) -> { - context.getSource().sendSuccess(ResourceLocationArgument.getAdvancement(context, "advancement").getChatComponent(), - false); + final Component msg = ResourceLocationArgument.getAdvancement(context, "advancement").getChatComponent(); + context.getSource().sendSuccess(() -> msg, false); return 1; }))) // Used for checking if getting a known recipe works on the client side .then(Commands.literal("get_recipe") .then(Commands.argument("recipe", ResourceLocationArgument.id()) .executes((context) -> { + final Component msg = ResourceLocationArgument.getRecipe(context, "recipe").getResultItem(context.getSource().registryAccess()).getDisplayName(); context.getSource() - .sendSuccess(ResourceLocationArgument.getRecipe(context, "recipe").getResultItem(context.getSource().registryAccess()).getDisplayName(), false); + .sendSuccess(() -> msg, false); return 1; }))) // Used for checking if getting a team works on the client side .then(Commands.literal("get_team") .then(Commands.argument("team", TeamArgument.team()) .executes((context) -> { - context.getSource().sendSuccess(TeamArgument.getTeam(context, "team").getFormattedDisplayName(), false); + final Component msg = TeamArgument.getTeam(context, "team").getFormattedDisplayName(); + context.getSource().sendSuccess(() -> msg, false); return 1; }))) // Used for checking if a block position is valid works on the client side .then(Commands.literal("get_loaded_blockpos") .then(Commands.argument("blockpos", BlockPosArgument.blockPos()) .executes((context) -> { + final Component msg = Component.literal(BlockPosArgument.getLoadedBlockPos(context, "blockpos").toString()); context.getSource() - .sendSuccess(Component.literal(BlockPosArgument.getLoadedBlockPos(context, "blockpos").toString()), false); + .sendSuccess(() -> msg, false); return 1; }))) // Used for checking if a command can have a requirement .then(Commands.literal("requires") .requires((source) -> false) .executes((context) -> { - context.getSource().sendSuccess(Component.literal("Executed command"), false); + context.getSource().sendSuccess(() ->Component.literal("Executed command"), false); return 1; })) // Used for testing the screen after using commands @@ -114,7 +118,7 @@ public class ClientCommandTest LiteralArgumentBuilder fork = Commands.literal("clientcommandfork"); fork.fork(event.getDispatcher().getRoot(), (context) -> List.of(context.getSource(), context.getSource())) .executes((context) -> { - context.getSource().sendSuccess(Component.literal("Executing forked command"), false); + context.getSource().sendSuccess(() ->Component.literal("Executing forked command"), false); return 1; }); event.getDispatcher().register(fork); @@ -122,12 +126,12 @@ public class ClientCommandTest private int testCommand(CommandContext context) { - context.getSource().sendSuccess(Component.literal("Input: " + ResourceLocationArgument.getId(context, "block")), false); - context.getSource().sendSuccess(Component.literal("Teams: " + context.getSource().getAllTeams()), false); - context.getSource().sendSuccess(Component.literal("Players: " + context.getSource().getOnlinePlayerNames()), false); - context.getSource().sendSuccess(Component.literal("First recipe: " + context.getSource().getRecipeNames().findFirst().get()), false); - context.getSource().sendSuccess(Component.literal("Levels: " + context.getSource().levels()), false); - context.getSource().sendSuccess(Component.literal("Registry Access: " + context.getSource().registryAccess()), false); + context.getSource().sendSuccess(() ->Component.literal("Input: " + ResourceLocationArgument.getId(context, "block")), false); + context.getSource().sendSuccess(() ->Component.literal("Teams: " + context.getSource().getAllTeams()), false); + context.getSource().sendSuccess(() ->Component.literal("Players: " + context.getSource().getOnlinePlayerNames()), false); + context.getSource().sendSuccess(() ->Component.literal("First recipe: " + context.getSource().getRecipeNames().findFirst().get()), false); + context.getSource().sendSuccess(() ->Component.literal("Levels: " + context.getSource().levels()), false); + context.getSource().sendSuccess(() ->Component.literal("Registry Access: " + context.getSource().registryAccess()), false); return 0; } } diff --git a/src/test/java/net/minecraftforge/debug/client/AmbientOcclusionElementsTest.java b/src/test/java/net/minecraftforge/debug/client/AmbientOcclusionElementsTest.java index d6fa092407..a467cd63fe 100644 --- a/src/test/java/net/minecraftforge/debug/client/AmbientOcclusionElementsTest.java +++ b/src/test/java/net/minecraftforge/debug/client/AmbientOcclusionElementsTest.java @@ -10,8 +10,8 @@ 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.state.BlockBehaviour; -import net.minecraft.world.level.material.Material; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraft.world.level.material.MapColor; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -31,10 +31,10 @@ public class AmbientOcclusionElementsTest private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MOD_ID); private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MOD_ID); - public static final RegistryObject AO_BLOCK_SHADE = BLOCKS.register("ambient_occlusion_shade", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); - public static final RegistryObject AO_BLOCK_NO_SHADE = BLOCKS.register("ambient_occlusion_no_shade", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); - public static final RegistryObject NO_AO_BLOCK_SHADE = BLOCKS.register("no_ambient_occlusion_shade", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); - public static final RegistryObject NO_AO_BLOCK_NO_SHADE = BLOCKS.register("no_ambient_occlusion_no_shade", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); + public static final RegistryObject AO_BLOCK_SHADE = BLOCKS.register("ambient_occlusion_shade", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE))); + public static final RegistryObject AO_BLOCK_NO_SHADE = BLOCKS.register("ambient_occlusion_no_shade", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE))); + public static final RegistryObject NO_AO_BLOCK_SHADE = BLOCKS.register("no_ambient_occlusion_shade", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE))); + public static final RegistryObject NO_AO_BLOCK_NO_SHADE = BLOCKS.register("no_ambient_occlusion_no_shade", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE))); public static final RegistryObject AO_BLOCK_SHADE_ITEM = ITEMS.register("ambient_occlusion_shade", () -> new BlockItem(AO_BLOCK_SHADE.get(), new Item.Properties())); public static final RegistryObject AO_BLOCK_NO_SHADE_ITEM = ITEMS.register("ambient_occlusion_no_shade", () -> new BlockItem(AO_BLOCK_NO_SHADE.get(), new Item.Properties())); public static final RegistryObject NO_AO_BLOCK_SHADE_ITEM = ITEMS.register("no_ambient_occlusion_shade", () -> new BlockItem(NO_AO_BLOCK_SHADE.get(), new Item.Properties())); @@ -51,9 +51,9 @@ public class AmbientOcclusionElementsTest modEventBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) + if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) { event.accept(AO_BLOCK_SHADE_ITEM); event.accept(AO_BLOCK_NO_SHADE_ITEM); diff --git a/src/test/java/net/minecraftforge/debug/client/CustomArmorModelTest.java b/src/test/java/net/minecraftforge/debug/client/CustomArmorModelTest.java index 994008830a..0aa900c6d1 100644 --- a/src/test/java/net/minecraftforge/debug/client/CustomArmorModelTest.java +++ b/src/test/java/net/minecraftforge/debug/client/CustomArmorModelTest.java @@ -20,7 +20,7 @@ import net.minecraft.world.item.*; import net.minecraft.world.item.Item.Properties; import net.minecraftforge.client.extensions.common.IClientItemExtensions; import net.minecraftforge.common.util.Lazy; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -51,9 +51,9 @@ public class CustomArmorModelTest modBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) { event.accept(RED_LEGGINGS); event.accept(ENDERMAN_CHESTPLATE); diff --git a/src/test/java/net/minecraftforge/debug/client/CustomColorResolverTest.java b/src/test/java/net/minecraftforge/debug/client/CustomColorResolverTest.java index e9ba1be272..daf9010c64 100644 --- a/src/test/java/net/minecraftforge/debug/client/CustomColorResolverTest.java +++ b/src/test/java/net/minecraftforge/debug/client/CustomColorResolverTest.java @@ -12,7 +12,7 @@ import net.minecraft.world.level.ColorResolver; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; 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.client.event.RegisterColorHandlersEvent; import net.minecraftforge.eventbus.api.IEventBus; @@ -35,7 +35,7 @@ public class CustomColorResolverTest private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MOD_ID); private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MOD_ID); - private static final RegistryObject BLOCK = BLOCKS.register("test_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); + private static final RegistryObject BLOCK = BLOCKS.register("test_block", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE))); public CustomColorResolverTest() { diff --git a/src/test/java/net/minecraftforge/debug/client/CustomTooltipTest.java b/src/test/java/net/minecraftforge/debug/client/CustomTooltipTest.java index ec54122a8b..1b6c3cadef 100644 --- a/src/test/java/net/minecraftforge/debug/client/CustomTooltipTest.java +++ b/src/test/java/net/minecraftforge/debug/client/CustomTooltipTest.java @@ -5,58 +5,59 @@ package net.minecraftforge.debug.client; -import com.google.common.collect.ImmutableMap; -import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.datafixers.util.Either; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiComponent; -import net.minecraft.client.gui.font.FontManager; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; -import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.network.chat.Component; -import net.minecraft.server.packs.resources.ReloadableResourceManager; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.tooltip.TooltipComponent; -import net.minecraft.world.item.*; +import net.minecraft.world.item.CreativeModeTabs; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.RegisterClientTooltipComponentFactoriesEvent; import net.minecraftforge.client.event.RenderTooltipEvent; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.loading.FMLEnvironment; -import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; import org.jetbrains.annotations.Nullable; +import java.util.Arrays; import java.util.List; +import java.util.Map; import java.util.Optional; @Mod(CustomTooltipTest.ID) public class CustomTooltipTest { - static final boolean ENABLED = true; static final String ID = "custom_tooltip_test"; private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ID); - static final RegistryObject CUSTOM_ITEM = ITEMS.register( - "test_item", - () -> new CustomItemWithTooltip(new Item.Properties()) - ); + static final RegistryObject CUSTOM_ITEM = ITEMS.register("test_item", () -> new CustomItemWithTooltip(new Item.Properties())); public CustomTooltipTest() { - if (ENABLED) { + if (ENABLED) + { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); if (FMLEnvironment.dist.isClient()) { @@ -68,19 +69,16 @@ public class CustomTooltipTest } } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(CUSTOM_ITEM); } - static record CustomTooltip(int color) implements TooltipComponent - { - } + record CustomTooltip(int color) implements TooltipComponent {} record CustomClientTooltip(CustomTooltip tooltip) implements ClientTooltipComponent { - @Override public int getHeight() { @@ -94,9 +92,9 @@ public class CustomTooltipTest } @Override - public void renderImage(Font font, int x, int y, PoseStack poseStack, ItemRenderer itemRenderer_) + public void renderImage(Font font, int x, int y, GuiGraphics graphics) { - GuiComponent.fill(poseStack, x, y, x + 10, y+ 10, tooltip.color); + graphics.fill(x, y, x + 10, y + 10,tooltip.color); } } @@ -117,10 +115,10 @@ public class CustomTooltipTest @Override public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { -/* if (level.isClientSide) Update to 1.19.3: Disable screen tests since logic for tooltips on buttons has changed massively! + if (level.isClientSide) { DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> TooltipTestScreen::show); - }*/ + } return InteractionResultHolder.success(player.getItemInHand(hand)); } @@ -134,32 +132,15 @@ public class CustomTooltipTest private static class ClientModBusEventHandler { - - static FontManager customFontManager; - static Font customFont; - - @SubscribeEvent - public static void clientSetup(FMLClientSetupEvent event) - { - event.enqueueWork(() -> { - customFontManager = new FontManager(Minecraft.getInstance().textureManager); - customFont = customFontManager.createFont(); - ((ReloadableResourceManager) Minecraft.getInstance().getResourceManager()).registerReloadListener(customFontManager.getReloadListener()); - customFontManager.setRenames(ImmutableMap.of(Minecraft.DEFAULT_FONT, Minecraft.UNIFORM_FONT)); - }); - } - @SubscribeEvent public static void onRegisterClientTooltipComponentFactories(RegisterClientTooltipComponentFactoriesEvent event) { event.register(CustomTooltip.class, CustomClientTooltip::new); } - } private static class ClientEventHandler { - @SubscribeEvent public static void gatherTooltips(RenderTooltipEvent.GatherComponents event) { @@ -181,19 +162,15 @@ public class CustomTooltipTest event.setBackgroundStart(0xFF0000FF); event.setBackgroundEnd(0xFFFFFF00); event.setBorderStart(0xFFFF0000); - event.setBorderEnd(0xFFFF0011); + event.setBorderEnd(0xFF000011); } } - } -/* Disabled on update to 1.19.3: Tooltips have changed massively, and mojang now handles them differently - -static class TooltipTestScreen extends Screen + static class TooltipTestScreen extends Screen { - private ItemStack testStack = ItemStack.EMPTY; - private Font testFont = null; + private boolean testFont = false; protected TooltipTestScreen() { @@ -206,10 +183,11 @@ static class TooltipTestScreen extends Screen } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) + public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) { - super.render(poseStack, mouseX, mouseY, partialTicks); - this.font.draw(poseStack, "* must have Stack, # must have custom font", 0, 0, 0xFFFFFF); + this.renderBackground(graphics); + super.render(graphics, mouseX, mouseY, partialTicks); + graphics.drawString(font, "* must have Stack, # must have custom font", 0, 0, 0xFFFFFF); } @Override @@ -218,17 +196,15 @@ static class TooltipTestScreen extends Screen addRenderableWidget(Button.builder(Component.literal("Toggle Stack: EMPTY"), button -> { this.testStack = this.testStack.isEmpty() ? new ItemStack(Items.APPLE) : ItemStack.EMPTY; button.setMessage(Component.literal("Toggle Stack: " + (testStack.isEmpty() ? "EMPTY" : "Apple"))); - }).pos(10, 10).size(200,20).build()); - addRenderableWidget(Button.builder(Component.literal("Toggle Font: null"), button -> { - this.testFont = this.testFont == null ? ClientModBusEventHandler.customFont : null; - button.setMessage(Component.literal("Toggle Font: " + (testFont == null ? "null" : "customFont"))); - }).pos(220, 10).size(200,20).build()); - - + }).pos(10, 10).size(200, 20).build()); + addRenderableWidget(Button.builder(Component.literal("Toggle Font: Default"), button -> { + this.testFont = !this.testFont; + button.setMessage(Component.literal("Toggle Font: " + (this.testFont ? "Unicode" : "Default"))); + }).pos(220, 10).size(200, 20).build()); // * must have stack context // # must have custom font - List> tooltipTests = Arrays.asList( + List> tooltipTests = Arrays.asList( Map.entry(" 1 * ", this::test1), Map.entry(" 2 * ", this::test2), Map.entry(" 3 #", this::test3), @@ -248,7 +224,18 @@ static class TooltipTestScreen extends Screen int y = 50; for (var test : tooltipTests) { - addRenderableWidget(new Button(x, y, 100, 20, Component.literal(test.getKey()), button -> {}, test.getValue())); + addRenderableWidget(new Button.Builder(Component.literal(test.getKey()), button -> {}) + .bounds(x, y, 100, 20).build(b -> new Button(b) { + @Override + public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) + { + super.renderWidget(graphics, mouseX, mouseY, partialTick); + + boolean showTooltip = this.isHovered || this.isFocused() && Minecraft.getInstance().getLastInputType().isKeyboard(); + if (showTooltip) + test.getValue().render(graphics, mouseX, mouseY); + } + })); y+= 22; if (y >= height - 50) { @@ -258,81 +245,89 @@ static class TooltipTestScreen extends Screen } } - private void test1(Button button, PoseStack poseStack, int mouseX, int mouseY) + private Component getTestComponent(boolean testFont) { - renderTooltip(poseStack, this.testStack, mouseX, mouseY); + return Component.literal("test").withStyle(s -> s.withFont(testFont ? Minecraft.UNIFORM_FONT : Minecraft.DEFAULT_FONT)); + } + + private void test1(GuiGraphics graphics, int mouseX, int mouseY) + { + graphics.renderTooltip(this.font, this.testStack, mouseX, mouseY); } // renderTooltip with List and all combinations of ItemStack/Font - private void test2(Button button, PoseStack poseStack, int mouseX, int mouseY) + private void test2(GuiGraphics graphics, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(Component.literal("test")), Optional.empty(), mouseX, mouseY, this.testStack); + graphics.renderTooltip(this.font, List.of(this.getTestComponent(false)), Optional.empty(), mouseX, mouseY); } - private void test3(Button button, PoseStack poseStack, int mouseX, int mouseY) + private void test3(GuiGraphics graphics, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(Component.literal("test")), Optional.empty(), mouseX, mouseY, this.testFont); + graphics.renderTooltip(this.font, List.of(this.getTestComponent(this.testFont)), Optional.empty(), mouseX, mouseY); } - private void test4(Button button, PoseStack poseStack, int mouseX, int mouseY) + private void test4(GuiGraphics graphics, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(Component.literal("test")), Optional.empty(), mouseX, mouseY, this.testFont, this.testStack); + graphics.renderTooltip(this.font, List.of(this.getTestComponent(this.testFont)), Optional.empty(), mouseX, mouseY); } - private void test5(Button button, PoseStack poseStack, int mouseX, int mouseY) + private void test5(GuiGraphics graphics, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(Component.literal("test")), Optional.empty(), mouseX, mouseY); + graphics.renderTooltip(this.font, List.of(this.getTestComponent(false)), Optional.empty(), mouseX, mouseY); } // renderTooltip with just Component - private void test6(Button button, PoseStack poseStack, int mouseX, int mouseY) + private void test6(GuiGraphics graphics, int mouseX, int mouseY) { - renderTooltip(poseStack, Component.literal("test"), mouseX, mouseY); + graphics.renderTooltip(this.font, this.getTestComponent(false), mouseX, mouseY); } // renderComponentTooltip with all combinations of ItemStack/Font - private void test7(Button button, PoseStack poseStack, int mouseX, int mouseY) + private void test7(GuiGraphics graphics, int mouseX, int mouseY) { - renderComponentTooltip(poseStack, List.of(Component.literal("test")), mouseX, mouseY, this.testStack); + graphics.renderComponentTooltip(this.font, List.of(this.getTestComponent(false)), mouseX, mouseY); } - private void test8(Button button, PoseStack poseStack, int mouseX, int mouseY) + private void test8(GuiGraphics graphics, int mouseX, int mouseY) { - renderComponentTooltip(poseStack, List.of(Component.literal("test")), mouseX, mouseY, this.testFont); + graphics.renderComponentTooltip(this.font, List.of(this.getTestComponent(this.testFont)), mouseX, mouseY); } - private void test9(Button button, PoseStack poseStack, int mouseX, int mouseY) + private void test9(GuiGraphics graphics, int mouseX, int mouseY) { - renderComponentTooltip(poseStack, List.of(Component.literal("test")), mouseX, mouseY, this.testFont, this.testStack); + graphics.renderComponentTooltip(this.font, List.of(this.getTestComponent(this.testFont)), mouseX, mouseY); } - private void test10(Button button, PoseStack poseStack, int mouseX, int mouseY) + private void test10(GuiGraphics graphics, int mouseX, int mouseY) { - renderComponentTooltip(poseStack, List.of(Component.literal("test")), mouseX, mouseY); + graphics.renderComponentTooltip(this.font, List.of(this.getTestComponent(false)), mouseX, mouseY); } // renderTooltip with list of FormattedCharSequence - private void test11(Button button, PoseStack poseStack, int mouseX, int mouseY) + private void test11(GuiGraphics graphics, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(Component.literal("test").getVisualOrderText()), mouseX, mouseY); + graphics.renderTooltip(this.font, List.of(this.getTestComponent(false).getVisualOrderText()), mouseX, mouseY); } // renderTooltip with list of FormattedCharSequence and Font - private void test12(Button button, PoseStack poseStack, int mouseX, int mouseY) + private void test12(GuiGraphics graphics, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(Component.literal("test").getVisualOrderText()), mouseX, mouseY, this.testFont); + graphics.renderTooltip(this.font, List.of(this.getTestComponent(this.testFont).getVisualOrderText()), mouseX, mouseY); } // legacy ToolTip methods - private void test13(Button button, PoseStack poseStack, int mouseX, int mouseY) + private void test13(GuiGraphics graphics, int mouseX, int mouseY) { - renderTooltip(poseStack, List.of(Component.literal("test").getVisualOrderText()), mouseX, mouseY, this.testFont); + graphics.renderTooltip(this.font, List.of(this.getTestComponent(this.testFont).getVisualOrderText()), mouseX, mouseY); } - private void test14(Button button, PoseStack poseStack, int mouseX, int mouseY) + private void test14(GuiGraphics graphics, int mouseX, int mouseY) { - renderComponentTooltip(poseStack, List.of(Component.literal("test")), mouseX, mouseY, this.testFont, ItemStack.EMPTY); + graphics.renderComponentTooltip(this.font, List.of(this.getTestComponent(this.testFont)), mouseX, mouseY); } - }*/ + } + private interface TooltipTest { + void render(GuiGraphics graphics, int mouseX, int mouseY); + } } diff --git a/src/test/java/net/minecraftforge/debug/client/EmissiveElementsTest.java b/src/test/java/net/minecraftforge/debug/client/EmissiveElementsTest.java index 8944258e27..21bed12e57 100644 --- a/src/test/java/net/minecraftforge/debug/client/EmissiveElementsTest.java +++ b/src/test/java/net/minecraftforge/debug/client/EmissiveElementsTest.java @@ -10,8 +10,8 @@ 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.state.BlockBehaviour; -import net.minecraft.world.level.material.Material; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraft.world.level.material.MapColor; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -29,7 +29,7 @@ public class EmissiveElementsTest private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MOD_ID); private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MOD_ID); - public static final RegistryObject TEST_BLOCK = BLOCKS.register("emissive", () -> new Block(BlockBehaviour.Properties.of(Material.STONE))); + public static final RegistryObject TEST_BLOCK = BLOCKS.register("emissive", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.STONE))); public static final RegistryObject TEST_BLOCK_ITEM = ITEMS.register("emissive", () -> new BlockItem(TEST_BLOCK.get(), new Item.Properties())); public EmissiveElementsTest() @@ -40,9 +40,9 @@ public class EmissiveElementsTest modEventBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) + if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) event.accept(TEST_BLOCK_ITEM); } } diff --git a/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java b/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java index 904dd601d2..c7a65ae821 100644 --- a/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java +++ b/src/test/java/net/minecraftforge/debug/client/GuiLayeringTest.java @@ -8,6 +8,7 @@ package net.minecraftforge.debug.client; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; @@ -55,11 +56,11 @@ public class GuiLayeringTest } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) + public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) { - this.renderBackground(poseStack); - drawString(poseStack, this.font, this.title, this.width / 2, 15, 0xFFFFFF); - super.render(poseStack, mouseX, mouseY, partialTicks); + this.renderBackground(graphics); + graphics.drawString(this.font, this.title, this.width / 2, 15, 0xFFFFFF); + super.render(graphics, mouseX, mouseY, partialTicks); } @Override diff --git a/src/test/java/net/minecraftforge/debug/client/TestScreen.java b/src/test/java/net/minecraftforge/debug/client/TestScreen.java index d2dc6d3b25..124ec8a894 100644 --- a/src/test/java/net/minecraftforge/debug/client/TestScreen.java +++ b/src/test/java/net/minecraftforge/debug/client/TestScreen.java @@ -8,6 +8,7 @@ package net.minecraftforge.debug.client; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.brigadier.Command; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; @@ -25,8 +26,8 @@ public class TestScreen extends Screen } @Override - public void render(PoseStack PoseStack, int MouseX, int MouseY, float PartialTick) + public void render(GuiGraphics graphics, int MouseX, int MouseY, float PartialTick) { - renderBackground(PoseStack); + renderBackground(graphics); } } diff --git a/src/test/java/net/minecraftforge/debug/client/model/CompositeModelTest.java b/src/test/java/net/minecraftforge/debug/client/model/CompositeModelTest.java index 83c1e91f66..283a6c3733 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/CompositeModelTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/CompositeModelTest.java @@ -8,7 +8,7 @@ package net.minecraftforge.debug.client.model; import net.minecraft.world.item.*; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.context.BlockPlaceContext; @@ -19,7 +19,7 @@ import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.level.BlockGetter; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.fml.common.Mod; @@ -36,7 +36,7 @@ public class CompositeModelTest public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); public static RegistryObject composite_block = BLOCKS.register("composite_block", () -> - new Block(Block.Properties.of(Material.WOOD).strength(10)) { + new Block(Block.Properties.of().mapColor(MapColor.WOOD).strength(10)) { @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { @@ -88,9 +88,9 @@ public class CompositeModelTest modEventBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(composite_item); } } diff --git a/src/test/java/net/minecraftforge/debug/client/model/CustomItemDisplayContextTest.java b/src/test/java/net/minecraftforge/debug/client/model/CustomItemDisplayContextTest.java index 40e4cd0ff9..872812c274 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/CustomItemDisplayContextTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/CustomItemDisplayContextTest.java @@ -35,12 +35,11 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.material.Material; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.client.model.generators.*; import net.minecraftforge.common.data.ExistingFileHelper; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -116,7 +115,7 @@ public class CustomItemDisplayContextTest public static final DeferredRegister> BLOCK_ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MODID); public static final RegistryObject - ITEM_HANGER_BLOCK = BLOCKS.register("item_hanger", () -> new ItemHangerBlock(BlockBehaviour.Properties.of(Material.WOOL).noCollission().noOcclusion().noLootTable())); + ITEM_HANGER_BLOCK = BLOCKS.register("item_hanger", () -> new ItemHangerBlock(BlockBehaviour.Properties.of().noCollission().noOcclusion().noLootTable())); public static final RegistryObject> ITEM_HANGER_BE = BLOCK_ENTITY_TYPES.register("item_hanger", () -> BlockEntityType.Builder.of(ItemHangerBlockEntity::new, ITEM_HANGER_BLOCK.get()).build(null)); public static final RegistryObject @@ -132,9 +131,9 @@ public class CustomItemDisplayContextTest modBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(ITEM_HANGER_ITEM); } diff --git a/src/test/java/net/minecraftforge/debug/client/model/DynBucketModelTest.java b/src/test/java/net/minecraftforge/debug/client/model/DynBucketModelTest.java index a026535598..630fd46fc5 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/DynBucketModelTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/DynBucketModelTest.java @@ -7,7 +7,7 @@ package net.minecraftforge.debug.client.model; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.fml.common.Mod; @@ -35,9 +35,9 @@ public class DynBucketModelTest } } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) { event.accept(DRIP_BUCKET); event.accept(LAVA_OBSIDIAN); diff --git a/src/test/java/net/minecraftforge/debug/client/model/MegaModelTest.java b/src/test/java/net/minecraftforge/debug/client/model/MegaModelTest.java index 5a7e1fbde7..704fec1e11 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/MegaModelTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/MegaModelTest.java @@ -26,15 +26,16 @@ import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.phys.BlockHitResult; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ModelEvent; import net.minecraftforge.client.model.BakedModelWrapper; import net.minecraftforge.client.model.IQuadTransformer; +import net.minecraftforge.client.model.QuadTransformers; import net.minecraftforge.client.model.data.ModelData; import net.minecraftforge.client.model.data.ModelProperty; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -49,7 +50,6 @@ import org.joml.Vector3f; import java.util.List; import java.util.Set; -import java.util.function.Consumer; /** * Test mod that demos most Forge-provided model loaders in a single block + item, as well as in-JSON render states @@ -91,9 +91,9 @@ public class MegaModelTest modEventBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) + if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) event.accept(TEST_BLOCK_ITEM); } @@ -114,7 +114,7 @@ public class MegaModelTest { public TestBlock() { - super(Properties.of(Material.STONE)); + super(Properties.of().mapColor(MapColor.STONE)); } @Nullable @@ -178,7 +178,7 @@ public class MegaModelTest var quads = super.getQuads(state, side, rand, data, renderType); if (!data.has(TestData.PROPERTY)) return quads; - return IQuadTransformer.applying(data.get(TestData.PROPERTY).transform()).process(quads); + return QuadTransformers.applying(data.get(TestData.PROPERTY).transform()).process(quads); } } } diff --git a/src/test/java/net/minecraftforge/debug/client/model/MultiLayerModelTest.java b/src/test/java/net/minecraftforge/debug/client/model/MultiLayerModelTest.java index a28d1dafda..1a7415e229 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/MultiLayerModelTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/MultiLayerModelTest.java @@ -7,12 +7,12 @@ package net.minecraftforge.debug.client.model; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; @@ -32,7 +32,7 @@ public class MultiLayerModelTest private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); - private static final RegistryObject TEST_BLOCK = BLOCKS.register(blockName, () -> new Block(Block.Properties.of(Material.WOOD).noOcclusion())); + private static final RegistryObject TEST_BLOCK = BLOCKS.register(blockName, () -> new Block(Block.Properties.of().mapColor(MapColor.WOOD).noOcclusion())); private static final RegistryObject TEST_BLOCK_ITEM = ITEMS.register(blockName, () -> new BlockItem(TEST_BLOCK.get(), new Item.Properties())); public MultiLayerModelTest() @@ -47,9 +47,9 @@ public class MultiLayerModelTest modEventBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(TEST_BLOCK); } diff --git a/src/test/java/net/minecraftforge/debug/client/model/NewModelLoaderTest.java b/src/test/java/net/minecraftforge/debug/client/model/NewModelLoaderTest.java index 3e87fa24d7..f1bd5e461b 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/NewModelLoaderTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/NewModelLoaderTest.java @@ -12,7 +12,7 @@ import net.minecraft.data.PackOutput; import net.minecraft.world.item.*; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.data.DataGenerator; import net.minecraft.world.entity.Entity; @@ -39,7 +39,7 @@ import net.minecraftforge.client.model.generators.loaders.SeparateTransformsMode import net.minecraftforge.client.model.geometry.SimpleUnbakedGeometry; import net.minecraftforge.client.model.pipeline.QuadBakingVertexConsumer; import net.minecraftforge.common.data.ExistingFileHelper; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.fml.common.Mod; @@ -51,7 +51,6 @@ import net.minecraftforge.registries.ForgeRegistries; import java.util.Arrays; import java.util.function.Function; -import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.resources.model.ModelState; import net.minecraft.world.item.context.BlockPlaceContext; import org.jetbrains.annotations.Nullable; @@ -64,7 +63,7 @@ public class NewModelLoaderTest public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); public static RegistryObject obj_block = BLOCKS.register("obj_block", () -> - new Block(Block.Properties.of(Material.WOOD).strength(10)) { + new Block(Block.Properties.of().mapColor(MapColor.WOOD).strength(10)) { @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { @@ -130,9 +129,9 @@ public class NewModelLoaderTest modEventBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) { Arrays.asList( obj_item, diff --git a/src/test/java/net/minecraftforge/debug/client/model/TRSRTransformerTest.java b/src/test/java/net/minecraftforge/debug/client/model/TRSRTransformerTest.java index 177ee2dfa0..d86fd06a35 100644 --- a/src/test/java/net/minecraftforge/debug/client/model/TRSRTransformerTest.java +++ b/src/test/java/net/minecraftforge/debug/client/model/TRSRTransformerTest.java @@ -11,7 +11,7 @@ import net.minecraft.util.RandomSource; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.client.renderer.block.model.ItemOverrides; @@ -25,9 +25,10 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ModelEvent; import net.minecraftforge.client.model.IQuadTransformer; import net.minecraftforge.client.model.IDynamicBakedModel; +import net.minecraftforge.client.model.QuadTransformers; import net.minecraftforge.client.model.data.ModelData; import net.minecraftforge.common.util.TransformationHelper; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.registries.RegistryObject; @@ -45,7 +46,7 @@ public class TRSRTransformerTest { private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); - private static final RegistryObject TEST_BLOCK = BLOCKS.register("test", () -> new Block(Block.Properties.of(Material.STONE))); + private static final RegistryObject TEST_BLOCK = BLOCKS.register("test", () -> new Block(Block.Properties.of().mapColor(MapColor.STONE))); @SuppressWarnings("unused") private static final RegistryObject TEST_ITEM = ITEMS.register("test", () -> new BlockItem(TEST_BLOCK.get(), new Item.Properties())); @@ -57,9 +58,9 @@ public class TRSRTransformerTest { mod.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) + if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) event.accept(TEST_ITEM); } @@ -84,7 +85,7 @@ public class TRSRTransformerTest { Vector3f translation = new Vector3f(0, 0.33f, 0); Transformation trans = new Transformation(translation, rot, null, null).blockCenterToCorner(); - var transformer = IQuadTransformer.applying(trans); + var transformer = QuadTransformers.applying(trans); return transformer.process(base.getQuads(state, side, rand, data, renderType)); } diff --git a/src/test/java/net/minecraftforge/debug/client/rendering/CustomItemDecorationsTest.java b/src/test/java/net/minecraftforge/debug/client/rendering/CustomItemDecorationsTest.java index be0be08725..a013bb5fce 100644 --- a/src/test/java/net/minecraftforge/debug/client/rendering/CustomItemDecorationsTest.java +++ b/src/test/java/net/minecraftforge/debug/client/rendering/CustomItemDecorationsTest.java @@ -9,7 +9,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiComponent; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.util.Mth; import net.minecraft.world.item.ItemStack; @@ -42,7 +42,7 @@ public class CustomItemDecorationsTest private static class StackSizeDurabilityBar implements IItemDecorator { @Override - public boolean render(PoseStack poseStack, Font font, ItemStack stack, int xOffset, int yOffset) + public boolean render(GuiGraphics graphics, Font font, ItemStack stack, int xOffset, int yOffset) { RenderSystem.disableBlend(); float f = Math.max(0.0F, (float)stack.getCount() / stack.getMaxStackSize()); @@ -50,11 +50,11 @@ public class CustomItemDecorationsTest int j = Mth.hsvToRgb(f / 3.0F, 1f, 1f) | 0xFF000000; int x = xOffset + 2; int y = yOffset + 13; - poseStack.pushPose(); - poseStack.translate(0.0F, 0.0F, ItemRenderer.ITEM_COUNT_BLIT_OFFSET + 1F); - GuiComponent.fill(poseStack, x, y, x + 13, y + 2, 0xFF000000); - GuiComponent.fill(poseStack, x, y, x + i, y + 1, j); - poseStack.popPose(); + graphics.pose().pushPose(); + graphics.pose().translate(0.0F, 0.0F, ItemRenderer.ITEM_COUNT_BLIT_OFFSET + 1F); + graphics.fill(x, y, x + 13, y + 2, 0xFF000000); + graphics.fill(x, y, x + i, y + 1, j); + graphics.pose().popPose(); RenderSystem.enableBlend(); return true; } diff --git a/src/test/java/net/minecraftforge/debug/client/rendering/RenderableTest.java b/src/test/java/net/minecraftforge/debug/client/rendering/RenderableTest.java index 644b0a2d4c..b7e49f99d3 100644 --- a/src/test/java/net/minecraftforge/debug/client/rendering/RenderableTest.java +++ b/src/test/java/net/minecraftforge/debug/client/rendering/RenderableTest.java @@ -7,8 +7,6 @@ package net.minecraftforge.debug.client.rendering; import java.util.Map; -import com.mojang.math.Transformation; -import net.minecraftforge.common.util.TransformationHelper; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -29,7 +27,6 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.ForgeRenderTypes; import net.minecraftforge.client.event.ModelEvent; import net.minecraftforge.client.event.RegisterClientReloadListenersEvent; -import net.minecraftforge.client.event.RenderLevelLastEvent; import net.minecraftforge.client.event.RenderLevelStageEvent; import net.minecraftforge.client.event.RenderLevelStageEvent.Stage; import net.minecraftforge.client.model.geometry.StandaloneGeometryBakingContext; @@ -44,11 +41,10 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.loading.FMLEnvironment; import org.joml.Matrix4f; -import org.joml.Quaternionf; /** * This mod is testing the use of {@link RenderLevelStageEvent} and is a modifaction of a pre-existing test mod that used the old - * {@link RenderLevelLastEvent}. To restore the old behavior, set {@link #USE_LEVEL_RENDERER_STAGE} to false. + * RenderLevelLastEvent. To restore the old behavior, set {@link #USE_LEVEL_RENDERER_STAGE} to false. * * When you enter a world, there should be 6 sugar gliders rendering at (0, 120, 0) that test the various stages in {@link RenderLevelStageEvent}. * From left to right (with the sugar gliders facing you) they represent {@link Stage#AFTER_SKY}, {@link Stage#AFTER_SOLID_BLOCKS}, @@ -64,8 +60,6 @@ public class RenderableTest private static final Logger LOGGER = LogManager.getLogger(); public static final boolean ENABLED = false; // Renders at (0, 120, 0) - public static final boolean USE_LEVEL_RENDERER_STAGE = true; // True when using RenderLevelStageEvent. False when using RenderLevelLastEvent - public RenderableTest() { if (ENABLED) @@ -90,13 +84,8 @@ public class RenderableTest var forgeBus = MinecraftForge.EVENT_BUS; modBus.addListener(Client::registerModels); modBus.addListener(Client::registerReloadListeners); - if (USE_LEVEL_RENDERER_STAGE) - { - modBus.addListener(Client::registerStage); - forgeBus.addListener(Client::renderStage); - } - else - forgeBus.addListener(Client::renderLast); + modBus.addListener(Client::registerStage); + forgeBus.addListener(Client::renderStage); } private static void registerModels(ModelEvent.RegisterAdditional event) @@ -139,12 +128,6 @@ public class RenderableTest LOGGER.info("Registered RenderLevelStageEvent.Stage: {}", stage); } - public static void renderLast(RenderLevelLastEvent event) - { - Vec3 cam = Minecraft.getInstance().gameRenderer.getMainCamera().getPosition(); - render(Stage.AFTER_SKY, event.getPoseStack(), 0, event.getPartialTick(), cam.x, cam.y, cam.z, 0); - } - private static void renderStage(RenderLevelStageEvent event) { int xOffset = -1; diff --git a/src/test/java/net/minecraftforge/debug/client/rendering/ShaderFixTest.java b/src/test/java/net/minecraftforge/debug/client/rendering/ShaderFixTest.java deleted file mode 100644 index 1b592f5664..0000000000 --- a/src/test/java/net/minecraftforge/debug/client/rendering/ShaderFixTest.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.debug.client.rendering; - -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.EntityType; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.RegisterEntitySpectatorShadersEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; - -@Mod("shader_fix_test") -@Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD) -public class ShaderFixTest -{ - @SubscribeEvent - public static void onRegisterEntitySpectatorShaders(final RegisterEntitySpectatorShadersEvent event) - { - event.register(EntityType.PLAYER, new ResourceLocation("shaders/post/desaturate.json")); - } -} \ No newline at end of file diff --git a/src/test/java/net/minecraftforge/debug/command/EnumArgumentTest.java b/src/test/java/net/minecraftforge/debug/command/EnumArgumentTest.java index 34477b7593..5b566927c4 100644 --- a/src/test/java/net/minecraftforge/debug/command/EnumArgumentTest.java +++ b/src/test/java/net/minecraftforge/debug/command/EnumArgumentTest.java @@ -32,14 +32,14 @@ public class EnumArgumentTest event.getDispatcher().register(Commands.literal("enumargumenttest") .then(Commands.argument("string", StringArgumentType.string()) .executes(context -> { - context.getSource().sendSuccess(Component.literal("string: " + StringArgumentType.getString(context, "string")), false); + context.getSource().sendSuccess(() -> Component.literal("string: " + StringArgumentType.getString(context, "string")), false); return 1; })) .then(Commands.argument("enum", EnumArgument.enumArgument(ExampleEnum.class)) .executes(context -> { context.getSource() - .sendSuccess(Component.literal("enum: " + context.getArgument("enum", ExampleEnum.class)), false); + .sendSuccess(() -> Component.literal("enum: " + context.getArgument("enum", ExampleEnum.class)), false); return 1; }))); diff --git a/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java b/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java index b2be029e77..b03dbefa14 100644 --- a/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java +++ b/src/test/java/net/minecraftforge/debug/entity/GravityAttributeTest.java @@ -16,7 +16,7 @@ import net.minecraft.tags.BiomeTags; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.item.CreativeModeTabs; import net.minecraftforge.common.ForgeMod; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; @@ -105,7 +105,7 @@ public class GravityAttributeTest { AttributeInstance grav = liv.getAttribute(ForgeMod.ENTITY_GRAVITY.get()); - boolean inPlains = liv.level.getBiome(liv.blockPosition()).is(BiomeTags.IS_FOREST); + boolean inPlains = liv.level().getBiome(liv.blockPosition()).is(BiomeTags.IS_FOREST); if (inPlains && !grav.hasModifier(REDUCED_GRAVITY)) { logger.info("Granted low gravity to Entity: {}", liv); @@ -122,9 +122,9 @@ public class GravityAttributeTest } } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.TOOLS_AND_UTILITIES) + if (event.getTabKey() == CreativeModeTabs.TOOLS_AND_UTILITIES) event.accept(TEST_ITEM); } diff --git a/src/test/java/net/minecraftforge/debug/entity/living/LivingSetAttackTargetEventTest.java b/src/test/java/net/minecraftforge/debug/entity/living/LivingSetAttackTargetEventTest.java index aa49d4adc3..f7a3e12112 100644 --- a/src/test/java/net/minecraftforge/debug/entity/living/LivingSetAttackTargetEventTest.java +++ b/src/test/java/net/minecraftforge/debug/entity/living/LivingSetAttackTargetEventTest.java @@ -10,7 +10,6 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Items; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingChangeTargetEvent; -import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -26,16 +25,6 @@ public class LivingSetAttackTargetEventTest MinecraftForge.EVENT_BUS.register(this); } } - - @SubscribeEvent - public void onLivingSetAttackTarget(LivingSetAttackTargetEvent event) - { - // Make piglins die when they start attacking a player who is not holding a stick in their main hand. - if (event.getTarget() instanceof Player player && event.getEntity() instanceof AbstractPiglin piglin && player.getMainHandItem().getItem() != Items.STICK) - { - event.getEntity().kill(); - } - } @SubscribeEvent public void onLivingChangeTargetEvent(LivingChangeTargetEvent event) diff --git a/src/test/java/net/minecraftforge/debug/entity/player/ItemUseAnimationTest.java b/src/test/java/net/minecraftforge/debug/entity/player/ItemUseAnimationTest.java index 0a93edfb07..f3144cec95 100644 --- a/src/test/java/net/minecraftforge/debug/entity/player/ItemUseAnimationTest.java +++ b/src/test/java/net/minecraftforge/debug/entity/player/ItemUseAnimationTest.java @@ -14,7 +14,7 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.food.FoodProperties; import net.minecraft.world.item.*; import net.minecraftforge.client.extensions.common.IClientItemExtensions; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; @@ -46,9 +46,9 @@ public class ItemUseAnimationTest modBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.COMBAT) + if (event.getTabKey() == CreativeModeTabs.COMBAT) event.accept(THING); } diff --git a/src/test/java/net/minecraftforge/debug/entity/player/PlayerAttackKnockbackTest.java b/src/test/java/net/minecraftforge/debug/entity/player/PlayerAttackKnockbackTest.java index 773450a63c..5207947eb0 100644 --- a/src/test/java/net/minecraftforge/debug/entity/player/PlayerAttackKnockbackTest.java +++ b/src/test/java/net/minecraftforge/debug/entity/player/PlayerAttackKnockbackTest.java @@ -12,7 +12,7 @@ import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.item.*; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -48,9 +48,9 @@ public class PlayerAttackKnockbackTest { modEventBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.COMBAT) + if (event.getTabKey() == CreativeModeTabs.COMBAT) event.accept(KNOCKBACK_SWORD); } diff --git a/src/test/java/net/minecraftforge/debug/fluid/FluidTypeTest.java b/src/test/java/net/minecraftforge/debug/fluid/FluidTypeTest.java index 6ba1becde1..18cadbcf66 100644 --- a/src/test/java/net/minecraftforge/debug/fluid/FluidTypeTest.java +++ b/src/test/java/net/minecraftforge/debug/fluid/FluidTypeTest.java @@ -22,12 +22,11 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; -import net.minecraft.world.level.material.Material; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; import net.minecraftforge.client.event.RegisterColorHandlersEvent; import net.minecraftforge.common.ForgeMod; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fluids.FluidInteractionRegistry; import net.minecraftforge.fluids.FluidType; @@ -154,7 +153,7 @@ public class FluidTypeTest private static final RegistryObject TEST_FLUID_FLOWING = FLUIDS.register("test_fluid_flowing", () -> new ForgeFlowingFluid.Flowing(fluidProperties())); private static final RegistryObject TEST_FLUID_BLOCK = BLOCKS.register("test_fluid_block", () -> - new LiquidBlock(TEST_FLUID, BlockBehaviour.Properties.of(Material.WATER).noCollission().strength(100.0F).noLootTable())); + new LiquidBlock(TEST_FLUID, BlockBehaviour.Properties.of().noCollission().strength(100.0F).noLootTable())); private static final RegistryObject TEST_FLUID_BUCKET = ITEMS.register("test_fluid_bucket", () -> new BucketItem(TEST_FLUID, new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1))); @@ -179,9 +178,9 @@ public class FluidTypeTest } } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(TEST_FLUID_BUCKET); } diff --git a/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java b/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java index dd2dfedecc..fc2ce286c2 100644 --- a/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java +++ b/src/test/java/net/minecraftforge/debug/fluid/NewFluidTest.java @@ -6,7 +6,7 @@ package net.minecraftforge.debug.fluid; import net.minecraft.world.item.*; -import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.StateDefinition; @@ -14,7 +14,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.LevelAccessor; import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.fluids.DispenseFluidContainer; import net.minecraftforge.fluids.FluidType; import org.apache.commons.lang3.Validate; @@ -109,7 +109,7 @@ public class NewFluidTest ); public static RegistryObject test_fluid_block = BLOCKS.register("test_fluid_block", () -> - new LiquidBlock(test_fluid, Properties.of(Material.WATER).noCollission().strength(100.0F).noLootTable()) + new LiquidBlock(test_fluid, Properties.of().noCollission().strength(100.0F).noLootTable()) ); public static RegistryObject TEST_FLUID_BUCKET = ITEMS.register("test_fluid_bucket", () -> new BucketItem(test_fluid, new Item.Properties().craftRemainder(Items.BUCKET).stacksTo(1)) @@ -117,7 +117,7 @@ public class NewFluidTest // WARNING: this doesn't allow "any fluid", only the fluid from this test mod! public static RegistryObject fluidloggable_block = BLOCKS.register("fluidloggable_block", () -> - new FluidloggableBlock(Properties.of(Material.WOOD).noCollission().strength(100.0F).noLootTable()) + new FluidloggableBlock(Properties.of().mapColor(MapColor.WOOD).noCollission().strength(100.0F).noLootTable()) ); public static RegistryObject FLUID_LOGGABLE_BLOCK_ITEM = ITEMS.register("fluidloggable_block", () -> new BlockItem(fluidloggable_block.get(), new Item.Properties()) @@ -139,9 +139,9 @@ public class NewFluidTest } } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) { event.accept(FLUID_LOGGABLE_BLOCK_ITEM); event.accept(TEST_FLUID_BUCKET); diff --git a/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java b/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java index 5d10b19214..e9d4164170 100644 --- a/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java +++ b/src/test/java/net/minecraftforge/debug/gameplay/loot/GlobalLootModifiersTest.java @@ -12,6 +12,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList; import net.minecraft.advancements.critereon.EnchantmentPredicate; import net.minecraft.advancements.critereon.ItemPredicate; import net.minecraft.advancements.critereon.MinMaxBounds; +import net.minecraft.core.registries.Registries; import net.minecraft.util.ExtraCodecs; import net.minecraft.world.level.block.Blocks; import net.minecraft.data.DataGenerator; @@ -29,6 +30,8 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.SmeltingRecipe; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.LootTable; @@ -179,11 +182,10 @@ public class GlobalLootModifiersTest { if(ctxTool == null || EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, ctxTool) > 0) return generatedLoot; ItemStack fakeTool = ctxTool.copy(); fakeTool.enchant(Enchantments.SILK_TOUCH, 1); - LootContext.Builder builder = new LootContext.Builder(context); + LootParams.Builder builder = new LootParams.Builder(context.getLevel()); builder.withParameter(LootContextParams.TOOL, fakeTool); - LootContext ctx = builder.create(LootContextParamSets.BLOCK); - LootTable loottable = context.getLevel().getServer().getLootTables().get(context.getParamOrNull(LootContextParams.BLOCK_STATE).getBlock().getLootTable()); - return loottable.getRandomItems(ctx); + LootTable loottable = context.getLevel().getServer().getLootData().getLootTable(context.getParamOrNull(LootContextParams.BLOCK_STATE).getBlock().getLootTable()); + return loottable.getRandomItems(builder.create(LootContextParamSets.EMPTY)); // TODO - porting: we need an AT } @Override diff --git a/src/test/java/net/minecraftforge/debug/item/CustomElytraTest.java b/src/test/java/net/minecraftforge/debug/item/CustomElytraTest.java index 5099d89025..48b60dc122 100644 --- a/src/test/java/net/minecraftforge/debug/item/CustomElytraTest.java +++ b/src/test/java/net/minecraftforge/debug/item/CustomElytraTest.java @@ -20,7 +20,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.fml.common.Mod; @@ -49,9 +49,9 @@ public class CustomElytraTest modBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(TEST_ELYTRA); } @@ -94,7 +94,7 @@ public class CustomElytraTest @Override public boolean elytraFlightTick(ItemStack stack, LivingEntity entity, int flightTicks) { - if (!entity.level.isClientSide) + if (!entity.level().isClientSide) { //Adding 1 to flightTicks prevents damage on the very first tick. int nextFlightTick = flightTicks + 1; diff --git a/src/test/java/net/minecraftforge/debug/item/CustomMobBucketTest.java b/src/test/java/net/minecraftforge/debug/item/CustomMobBucketTest.java index e2bd0a980a..afa9aaaab9 100644 --- a/src/test/java/net/minecraftforge/debug/item/CustomMobBucketTest.java +++ b/src/test/java/net/minecraftforge/debug/item/CustomMobBucketTest.java @@ -11,7 +11,7 @@ import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; import net.minecraft.world.item.MobBucketItem; import net.minecraft.world.level.material.Fluids; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -43,9 +43,9 @@ public class CustomMobBucketTest } } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(COW_BUCKET); } } diff --git a/src/test/java/net/minecraftforge/debug/item/CustomShieldTest.java b/src/test/java/net/minecraftforge/debug/item/CustomShieldTest.java index a29d4e8c70..ecc2367595 100644 --- a/src/test/java/net/minecraftforge/debug/item/CustomShieldTest.java +++ b/src/test/java/net/minecraftforge/debug/item/CustomShieldTest.java @@ -12,15 +12,13 @@ import net.minecraft.world.item.*; import net.minecraft.world.level.Level; import net.minecraftforge.common.ToolAction; import net.minecraftforge.common.ToolActions; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.DeferredRegister; -import java.util.function.Consumer; - @Mod("custom_shield_test") public class CustomShieldTest { @@ -36,9 +34,9 @@ public class CustomShieldTest modBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.COMBAT) + if (event.getTabKey() == CreativeModeTabs.COMBAT) event.accept(CUSTOM_SHIELD_ITEM); } diff --git a/src/test/java/net/minecraftforge/debug/item/EnderMaskTest.java b/src/test/java/net/minecraftforge/debug/item/EnderMaskTest.java index 46e8f18f70..17e90977f1 100644 --- a/src/test/java/net/minecraftforge/debug/item/EnderMaskTest.java +++ b/src/test/java/net/minecraftforge/debug/item/EnderMaskTest.java @@ -7,9 +7,8 @@ package net.minecraftforge.debug.item; import net.minecraft.world.entity.monster.EnderMan; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.*; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.fml.common.Mod; @@ -41,9 +40,9 @@ public class EnderMaskTest modEventBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(ENDER_MASK); } } diff --git a/src/test/java/net/minecraftforge/debug/item/ForgeSpawnEggItemTest.java b/src/test/java/net/minecraftforge/debug/item/ForgeSpawnEggItemTest.java index bda11ae1e9..b565e3bc98 100644 --- a/src/test/java/net/minecraftforge/debug/item/ForgeSpawnEggItemTest.java +++ b/src/test/java/net/minecraftforge/debug/item/ForgeSpawnEggItemTest.java @@ -19,7 +19,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.ForgeSpawnEggItem; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.event.entity.EntityAttributeCreationEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -57,9 +57,9 @@ public class ForgeSpawnEggItemTest } } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(EGG); } diff --git a/src/test/java/net/minecraftforge/debug/item/HiddenTooltipPartsTest.java b/src/test/java/net/minecraftforge/debug/item/HiddenTooltipPartsTest.java index a35c8ab381..945282ee02 100644 --- a/src/test/java/net/minecraftforge/debug/item/HiddenTooltipPartsTest.java +++ b/src/test/java/net/minecraftforge/debug/item/HiddenTooltipPartsTest.java @@ -15,7 +15,7 @@ import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; @@ -40,9 +40,9 @@ public class HiddenTooltipPartsTest modBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(TEST_ITEM); } diff --git a/src/test/java/net/minecraftforge/debug/item/RangedMobsUseModdedWeaponsTest.java b/src/test/java/net/minecraftforge/debug/item/RangedMobsUseModdedWeaponsTest.java index 731332ec89..b39f6133e3 100644 --- a/src/test/java/net/minecraftforge/debug/item/RangedMobsUseModdedWeaponsTest.java +++ b/src/test/java/net/minecraftforge/debug/item/RangedMobsUseModdedWeaponsTest.java @@ -8,7 +8,7 @@ package net.minecraftforge.debug.item; import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.*; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; @@ -47,9 +47,9 @@ public class RangedMobsUseModdedWeaponsTest { } } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.COMBAT) + if (event.getTabKey() == CreativeModeTabs.COMBAT) { event.accept(MODDED_BOW); event.accept(MODDED_CROSSBOW); diff --git a/src/test/java/net/minecraftforge/debug/item/SnowBootsTest.java b/src/test/java/net/minecraftforge/debug/item/SnowBootsTest.java index 4712e323f9..db3470beb8 100644 --- a/src/test/java/net/minecraftforge/debug/item/SnowBootsTest.java +++ b/src/test/java/net/minecraftforge/debug/item/SnowBootsTest.java @@ -5,10 +5,9 @@ package net.minecraftforge.debug.item; -import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.*; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -39,9 +38,9 @@ public class SnowBootsTest modEventBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.COMBAT) + if (event.getTabKey() == CreativeModeTabs.COMBAT) event.accept(SNOW_BOOTS); } } diff --git a/src/test/java/net/minecraftforge/debug/item/StopUsingItemTest.java b/src/test/java/net/minecraftforge/debug/item/StopUsingItemTest.java index a5ec8c4638..be5bfa9332 100644 --- a/src/test/java/net/minecraftforge/debug/item/StopUsingItemTest.java +++ b/src/test/java/net/minecraftforge/debug/item/StopUsingItemTest.java @@ -18,7 +18,7 @@ import net.minecraft.world.level.gameevent.GameEvent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ComputeFovModifierEvent; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.event.VanillaGameEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -86,9 +86,9 @@ public class StopUsingItemTest } }); - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.COMBAT) + if (event.getTabKey() == CreativeModeTabs.COMBAT) { event.accept(BAD); event.accept(GOOD); @@ -125,14 +125,14 @@ public class StopUsingItemTest { player.startUsingItem(hand); player.getAbilities().mayfly = true; - if (player.level.isClientSide) + if (player.level().isClientSide) fovChange = 10f; return InteractionResultHolder.consume(player.getItemInHand(hand)); } public static void removeFov(LivingEntity living) { - if (living.level.isClientSide) + if (living.level().isClientSide) fovChange = 1f; if (living instanceof Player player) { diff --git a/src/test/java/net/minecraftforge/debug/item/TagBasedToolTypesTest.java b/src/test/java/net/minecraftforge/debug/item/TagBasedToolTypesTest.java index 8039de3cbc..8d025d93e8 100644 --- a/src/test/java/net/minecraftforge/debug/item/TagBasedToolTypesTest.java +++ b/src/test/java/net/minecraftforge/debug/item/TagBasedToolTypesTest.java @@ -19,18 +19,16 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.level.material.MaterialColor; +import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraftforge.client.model.generators.BlockStateProvider; import net.minecraftforge.client.model.generators.ItemModelProvider; -import net.minecraftforge.client.model.generators.ModelFile; import net.minecraftforge.client.model.generators.ModelFile.UncheckedModelFile; import net.minecraftforge.common.ForgeTier; import net.minecraftforge.common.TierSortingRegistry; import net.minecraftforge.common.data.BlockTagsProvider; import net.minecraftforge.common.data.ExistingFileHelper; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @@ -60,7 +58,7 @@ public class TagBasedToolTypesTest ); private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); - private static final RegistryObject STONE = BLOCKS.register("test_stone", () -> new Block(BlockBehaviour.Properties.of(Material.STONE, MaterialColor.DIRT).requiresCorrectToolForDrops().strength(1.5F, 6.0F))); + private static final RegistryObject STONE = BLOCKS.register("test_stone", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).requiresCorrectToolForDrops().strength(1.5F, 6.0F))); private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); @SuppressWarnings("unused") @@ -100,11 +98,11 @@ public class TagBasedToolTypesTest modEventBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.TOOLS_AND_UTILITIES) + if (event.getTabKey() == CreativeModeTabs.TOOLS_AND_UTILITIES) event.accept(TOOL); - if (event.getTab() == CreativeModeTabs.BUILDING_BLOCKS) + if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) event.accept(ORE_ITEM); } diff --git a/src/test/java/net/minecraftforge/debug/misc/ContainerTypeTest.java b/src/test/java/net/minecraftforge/debug/misc/ContainerTypeTest.java index cf1c177f99..4f741ed72f 100644 --- a/src/test/java/net/minecraftforge/debug/misc/ContainerTypeTest.java +++ b/src/test/java/net/minecraftforge/debug/misc/ContainerTypeTest.java @@ -6,6 +6,7 @@ package net.minecraftforge.debug.misc; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.world.level.block.Blocks; import net.minecraft.client.gui.screens.MenuScreens; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; @@ -78,9 +79,9 @@ public class ContainerTypeTest } @Override - protected void renderBg(PoseStack poseStack, float partialTick, int mouseX, int mouseY) + protected void renderBg(GuiGraphics graphics, float partialTick, int mouseX, int mouseY) { - drawString(poseStack, this.font, getMenu().text, mouseX, mouseY, -1); + graphics.drawString(this.font, getMenu().text, mouseX, mouseY, -1); } } diff --git a/src/test/java/net/minecraftforge/debug/misc/GameTestTest.java b/src/test/java/net/minecraftforge/debug/misc/GameTestTest.java index 0bc3dea2c0..2dd5d5caeb 100644 --- a/src/test/java/net/minecraftforge/debug/misc/GameTestTest.java +++ b/src/test/java/net/minecraftforge/debug/misc/GameTestTest.java @@ -21,14 +21,13 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockBehaviour.Properties; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.level.material.MaterialColor; +import net.minecraft.world.level.material.MapColor; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.energy.EnergyStorage; import net.minecraftforge.energy.IEnergyStorage; -import net.minecraftforge.event.CreativeModeTabEvent; +import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.event.RegisterGameTestsEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -42,7 +41,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; -import java.util.function.Consumer; @Mod(GameTestTest.MODID) public class GameTestTest @@ -53,7 +51,7 @@ public class GameTestTest private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); private static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MODID); private static final RegistryObject ENERGY_BLOCK = BLOCKS.register("energy_block", - () -> new EnergyBlock(Properties.of(Material.STONE, MaterialColor.STONE))); + () -> new EnergyBlock(Properties.of().mapColor(MapColor.STONE))); @SuppressWarnings("unused") private static final RegistryObject ENERGY_BLOCK_ITEM = ITEMS.register("energy_block", () -> new BlockItem(ENERGY_BLOCK.get(), new Item.Properties())); @@ -74,9 +72,9 @@ public class GameTestTest } } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(ENERGY_BLOCK_ITEM); } diff --git a/src/test/java/net/minecraftforge/debug/misc/GrindstoneEventTest.java b/src/test/java/net/minecraftforge/debug/misc/GrindstoneEventTest.java index efeb64146e..844c5bd07a 100644 --- a/src/test/java/net/minecraftforge/debug/misc/GrindstoneEventTest.java +++ b/src/test/java/net/minecraftforge/debug/misc/GrindstoneEventTest.java @@ -10,7 +10,6 @@ import net.minecraft.world.item.Items; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.GrindstoneEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.Bindings; import net.minecraftforge.fml.common.Mod; @Mod("grindstone_event_test") @@ -23,7 +22,7 @@ public class GrindstoneEventTest { } @SubscribeEvent - public void onGrindstonePlace(GrindstoneEvent.OnplaceItem event) + public void onGrindstonePlace(GrindstoneEvent.OnPlaceItem event) { // TODO 1.20: This will not work once IForgeItem#canGrindstoneRepair is changed to have items opt-in to being able to place // rather than the current opt-out (the hook will no longer fire after the change). Fix? diff --git a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestMenu.java b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestMenu.java index 702de70d99..a9543e2b06 100644 --- a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestMenu.java +++ b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestMenu.java @@ -18,6 +18,7 @@ import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.debug.recipe.recipebook.RecipeBookExtensionTest.RecipeBookTestContainer; +import java.util.List; import java.util.Optional; public class RecipeBookTestMenu extends RecipeBookMenu @@ -58,7 +59,8 @@ public class RecipeBookTestMenu extends RecipeBookMenu { this.checkTakeAchievements(stack); Container craftingContainer = RecipeBookTestMenu.this.container; - NonNullList remainders = player.level.getRecipeManager().getRemainingItemsFor(RecipeBookExtensionTest.RECIPE_BOOK_TEST_RECIPE_TYPE.get(), RecipeBookTestMenu.this.container, player.level); + NonNullList remainders = player.level() + .getRecipeManager().getRemainingItemsFor(RecipeBookExtensionTest.RECIPE_BOOK_TEST_RECIPE_TYPE.get(), RecipeBookTestMenu.this.container, player.level()); for (int i = 0; i < remainders.size(); ++i) { ItemStack toRemove = craftingContainer.getItem(i); @@ -73,7 +75,7 @@ public class RecipeBookTestMenu extends RecipeBookMenu { if (toRemove.isEmpty()) craftingContainer.setItem(i, toRemove); - else if (ItemStack.isSame(toRemove, toReplace) && ItemStack.tagMatches(toRemove, toReplace)) + else if (ItemStack.isSameItemSameTags(toRemove, toReplace)) { toReplace.grow(toRemove.getCount()); craftingContainer.setItem(i, toReplace); @@ -108,9 +110,9 @@ public class RecipeBookTestMenu extends RecipeBookMenu protected void checkTakeAchievements(ItemStack stack) { if (this.removeCount > 0) - stack.onCraftedBy(RecipeBookTestMenu.this.player.level, RecipeBookTestMenu.this.player, this.removeCount); + stack.onCraftedBy(RecipeBookTestMenu.this.player.level(), RecipeBookTestMenu.this.player, this.removeCount); if (this.container instanceof RecipeHolder recipeHolder) - recipeHolder.awardUsedRecipes(RecipeBookTestMenu.this.player); + recipeHolder.awardUsedRecipes(RecipeBookTestMenu.this.player, List.of()); this.removeCount = 0; } }; @@ -250,7 +252,7 @@ public class RecipeBookTestMenu extends RecipeBookMenu @Override public boolean recipeMatches(Recipe recipe) { - return recipe.matches(this.container, this.player.level); + return recipe.matches(this.container, this.player.level()); } @Override diff --git a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestRecipe.java b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestRecipe.java index facec3a79b..f4f5207d23 100644 --- a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestRecipe.java +++ b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestRecipe.java @@ -23,6 +23,7 @@ import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.crafting.ShapedRecipe; import net.minecraft.world.level.Level; +import net.minecraftforge.common.ForgeHooks; import java.util.*; import java.util.function.Function; @@ -149,7 +150,7 @@ public class RecipeBookTestRecipe implements Recipe !ingredient.isEmpty()) - .anyMatch(i -> i.getItems().length == 0); + .anyMatch(ForgeHooks::hasNoElements); } @Override diff --git a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestScreen.java b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestScreen.java index 50c0e17f21..6395ceb02b 100644 --- a/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestScreen.java +++ b/src/test/java/net/minecraftforge/debug/recipe/recipebook/RecipeBookTestScreen.java @@ -7,6 +7,7 @@ package net.minecraftforge.debug.recipe.recipebook; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.ImageButton; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.CraftingScreen; @@ -61,41 +62,40 @@ public class RecipeBookTestScreen extends AbstractContainerScreen BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); - private static final RegistryObject CHUNK_LOADER_BLOCK = BLOCKS.register("chunk_loader", () -> new ChunkLoaderBlock(Properties.of(Material.STONE))); + private static final RegistryObject CHUNK_LOADER_BLOCK = BLOCKS.register("chunk_loader", () -> new ChunkLoaderBlock(Properties.of().mapColor(MapColor.STONE))); private static final RegistryObject CHUNK_LOADER_ITEM = ITEMS.register("chunk_loader", () -> new BlockItem(CHUNK_LOADER_BLOCK.get(), new Item.Properties())); public ForgeChunkManagerTest() @@ -52,9 +52,9 @@ public class ForgeChunkManagerTest modEventBus.addListener(this::addCreative); } - private void addCreative(CreativeModeTabEvent.BuildContents event) + private void addCreative(BuildCreativeModeTabContentsEvent event) { - if (event.getTab() == CreativeModeTabs.INGREDIENTS) + if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) event.accept(CHUNK_LOADER_ITEM); } diff --git a/src/test/java/net/minecraftforge/debug/world/LoginPacketSplitTest.java b/src/test/java/net/minecraftforge/debug/world/LoginPacketSplitTest.java index 03f6d2c17e..a608c05d6f 100644 --- a/src/test/java/net/minecraftforge/debug/world/LoginPacketSplitTest.java +++ b/src/test/java/net/minecraftforge/debug/world/LoginPacketSplitTest.java @@ -19,6 +19,7 @@ import net.minecraft.commands.Commands; import net.minecraft.core.MappedRegistry; import net.minecraft.core.Registry; import net.minecraft.core.RegistryCodecs; +import net.minecraft.nbt.NbtOps; import net.minecraft.network.CompressionDecoder; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; @@ -104,7 +105,7 @@ public class LoginPacketSplitTest MinecraftForge.EVENT_BUS.addListener((final RegisterClientCommandsEvent event) -> event.getDispatcher().register(Commands.literal("big_data") .executes(context -> { - context.getSource().sendSuccess(Component.literal("Registry has " + context.getSource().registryAccess().registryOrThrow(BIG_DATA).holders().count() + " entries."), true); + context.getSource().sendSuccess(() -> Component.literal("Registry has " + context.getSource().registryAccess().registryOrThrow(BIG_DATA).holders().count() + " entries."), true); return Command.SINGLE_SUCCESS; }))); } diff --git a/src/test/java/net/minecraftforge/mdk/MdkDatagen.java b/src/test/java/net/minecraftforge/mdk/MdkDatagen.java index 5cfca7537c..1c90b08351 100644 --- a/src/test/java/net/minecraftforge/mdk/MdkDatagen.java +++ b/src/test/java/net/minecraftforge/mdk/MdkDatagen.java @@ -34,7 +34,7 @@ public class MdkDatagen var packOutput = gen.getPackOutput(); gen.addProvider(true, new PackMetadataGenerator(packOutput) .add(PackMetadataSection.TYPE, new PackMetadataSection( - Component.literal("examplemod resources"), + Component.literal("${mod_id} resources"), DetectedVersion.BUILT_IN.getPackVersion(PackType.CLIENT_RESOURCES), Arrays.stream(PackType.values()).collect(Collectors.toMap(Function.identity(), DetectedVersion.BUILT_IN::getPackVersion)) )) diff --git a/src/test/resources/META-INF/mods.toml b/src/test/resources/META-INF/mods.toml index 06f7bd98fd..472cd4ef4c 100644 --- a/src/test/resources/META-INF/mods.toml +++ b/src/test/resources/META-INF/mods.toml @@ -150,8 +150,6 @@ modId="item_modifier_test" [[mods]] modId="custom_signs_test" [[mods]] -modId="shader_fix_test" -[[mods]] modId="worldgen_registry_desync_test" [[mods]] modId="add_entity_attribute_test"